@agentiffai/design 0.1.0 → 0.1.2

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.
Files changed (61) hide show
  1. package/dist/{Window-CgGFIYHS.d.cts → Window-CukhSS8T.d.cts} +3 -1
  2. package/dist/{Window-B6e_UfLV.d.ts → Window-CukhSS8T.d.ts} +3 -1
  3. package/dist/{chunk-MNXQDDWP.js → chunk-6NGVSBJZ.js} +71 -10
  4. package/dist/chunk-6NGVSBJZ.js.map +1 -0
  5. package/dist/{chunk-CNVJ5UF2.js → chunk-H5TKEGIC.js} +28 -5
  6. package/dist/chunk-H5TKEGIC.js.map +1 -0
  7. package/dist/{chunk-P4Q3MHIY.cjs → chunk-OPWUJP7J.cjs} +28 -5
  8. package/dist/chunk-OPWUJP7J.cjs.map +1 -0
  9. package/dist/{chunk-KNSPBTTJ.cjs → chunk-ULL2LDN3.cjs} +71 -10
  10. package/dist/chunk-ULL2LDN3.cjs.map +1 -0
  11. package/dist/copilotkit/index.cjs +122 -118
  12. package/dist/copilotkit/index.cjs.map +1 -1
  13. package/dist/copilotkit/index.d.cts +53 -56
  14. package/dist/copilotkit/index.d.ts +53 -56
  15. package/dist/copilotkit/index.js +98 -94
  16. package/dist/copilotkit/index.js.map +1 -1
  17. package/dist/index.cjs +31 -31
  18. package/dist/index.d.cts +3 -3
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +2 -2
  21. package/dist/layout/index.cjs +11 -11
  22. package/dist/layout/index.d.cts +16 -4
  23. package/dist/layout/index.d.ts +16 -4
  24. package/dist/layout/index.js +1 -1
  25. package/package.json +8 -7
  26. package/CHANGELOG.md +0 -35
  27. package/LICENSE +0 -21
  28. package/assets/layout/main-pane-section.png +0 -0
  29. package/assets/layout/nav-complete.png +0 -0
  30. package/assets/layout/nav-horizontal-section.png +0 -0
  31. package/assets/layout/nav-vertical-section.png +0 -0
  32. package/assets/layout/pane-section-dropdowns.png +0 -0
  33. package/assets/layout/pane-section-header.png +0 -0
  34. package/dist/chunk-CNVJ5UF2.js.map +0 -1
  35. package/dist/chunk-KNSPBTTJ.cjs.map +0 -1
  36. package/dist/chunk-MNXQDDWP.js.map +0 -1
  37. package/dist/chunk-P4Q3MHIY.cjs.map +0 -1
  38. package/dist/index.d-DYU1eVeb.d.cts +0 -252
  39. package/dist/index.d-DYU1eVeb.d.ts +0 -252
  40. package/public/assets/bg-set/brand-logos/Google.svg +0 -1
  41. package/public/assets/bg-set/brand-logos/Google2.svg +0 -1
  42. package/public/assets/bg-set/brand-logos/Microsoft.svg +0 -1
  43. package/public/assets/bg-set/brand-logos/Microsoft2.svg +0 -1
  44. package/public/assets/bg-set/brand-logos/Slack.svg +0 -1
  45. package/public/assets/bg-set/brand-logos/Slack2.svg +0 -1
  46. package/public/assets/bg-set/brand-logos/YouTube.svg +0 -1
  47. package/public/assets/bg-set/brand-logos/YouTube2.svg +0 -1
  48. package/public/assets/bg-set/pattern/Size=lg, Type=Waves Rays2.svg +0 -1
  49. package/public/assets/bg-set/pattern/Size=md, Type=Waves Rays2.svg +0 -1
  50. package/public/assets/bg-set/pattern/Size=sm, Type=Waves Rays2.svg +0 -1
  51. package/public/assets/bg-set/pattern/Size=xl, Type=Waves Rays2.svg +0 -1
  52. package/public/assets/bg-set/pattern/Size=xs, Type=Waves Rays2.svg +0 -1
  53. package/public/assets/icon-set/Icon-add-circle-fill.svg +0 -1
  54. package/public/assets/icon-set/Icon-calendar-fill.svg +0 -1
  55. package/public/assets/icon-set/Icon-chat-1-fill.svg +0 -1
  56. package/public/assets/icon-set/Icon-download-2-fill.svg +0 -1
  57. package/public/assets/icon-set/Icon-home-fill.svg +0 -1
  58. package/public/assets/icon-set/Icon-mic-fill.svg +0 -1
  59. package/public/assets/icon-set/Icon-settings-3-fill.svg +0 -1
  60. package/public/assets/icon-set/Icon-settings-fill.svg +0 -1
  61. package/public/assets/icon-set/Icon-settings-line.svg +0 -1
@@ -1,9 +1,9 @@
1
- import { AssistantThinking, AssistantMessage, ChatInput, UserMessage, Header, Window, Messages } from '../chunk-CNVJ5UF2.js';
2
- export { Actions, AgentState, AssistantMessage, Button, FileAttachment, Footer, Header, Input, Messages, MessagesList, MessagesListContainer, MessagesListContent, Response, Suggestions, UserMessage2 as UserMessage, Window } from '../chunk-CNVJ5UF2.js';
1
+ import { AssistantThinking, AssistantMessage, UserMessage, ChatInput, Header, Window, Messages } from '../chunk-H5TKEGIC.js';
2
+ export { Actions, AgentState, AssistantMessage, Button, FileAttachment, Footer, Header, Input, Messages, MessagesList, MessagesListContainer, MessagesListContent, Response, Suggestions, UserMessage2 as UserMessage, Window } from '../chunk-H5TKEGIC.js';
3
+ import { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';
4
+ import styled, { createGlobalStyle } from 'styled-components';
3
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
6
  import { useState } from 'react';
5
- import styled, { createGlobalStyle } from 'styled-components';
6
- import { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';
7
7
 
8
8
  var AssistantMessageAdapter = ({
9
9
  message,
@@ -38,6 +38,29 @@ var AssistantMessageAdapter = ({
38
38
  );
39
39
  };
40
40
  AssistantMessageAdapter.displayName = "AssistantMessageAdapter";
41
+ var UserMessageWrapper = styled.div`
42
+ display: flex;
43
+ justify-content: flex-end;
44
+ width: 100%;
45
+ padding: 8px 0;
46
+ `;
47
+ var UserMessageAdapter = ({
48
+ message,
49
+ ImageRenderer
50
+ }) => {
51
+ if (message?.image) {
52
+ return /* @__PURE__ */ jsx(
53
+ ImageRenderer,
54
+ {
55
+ image: message.image,
56
+ content: message.content
57
+ }
58
+ );
59
+ }
60
+ const content = message?.content || "";
61
+ return /* @__PURE__ */ jsx(UserMessageWrapper, { children: /* @__PURE__ */ jsx(UserMessage, { children: content }) });
62
+ };
63
+ UserMessageAdapter.displayName = "UserMessageAdapter";
41
64
  var InputAdapter = ({
42
65
  inProgress,
43
66
  onSend,
@@ -72,23 +95,6 @@ var InputAdapter = ({
72
95
  );
73
96
  };
74
97
  InputAdapter.displayName = "InputAdapter";
75
- var UserMessageWrapper = styled.div`
76
- display: flex;
77
- justify-content: flex-end;
78
- width: 100%;
79
- padding: 8px 0;
80
- `;
81
- var UserMessageAdapter = ({
82
- message,
83
- ImageRenderer
84
- }) => {
85
- if (message?.image) {
86
- return /* @__PURE__ */ jsx(ImageRenderer, { image: message.image, content: message.content });
87
- }
88
- const content = message?.content || "";
89
- return /* @__PURE__ */ jsx(UserMessageWrapper, { children: /* @__PURE__ */ jsx(UserMessage, { children: content }) });
90
- };
91
- UserMessageAdapter.displayName = "UserMessageAdapter";
92
98
  var GlobalSidebarStyles = createGlobalStyle`
93
99
  /* Override CopilotKit's default positioning - start off-screen */
94
100
  .copilotKitSidebar {
@@ -105,6 +111,7 @@ var GlobalSidebarStyles = createGlobalStyle`
105
111
 
106
112
  /* Mobile-first: Full viewport sidebar */
107
113
  .copilotKitSidebar .copilotKitWindow {
114
+ /* Override CopilotKit defaults for mobile */
108
115
  position: fixed !important;
109
116
  top: 0 !important;
110
117
  right: 0 !important;
@@ -118,12 +125,14 @@ var GlobalSidebarStyles = createGlobalStyle`
118
125
  border-radius: 0 !important;
119
126
  z-index: 1001 !important;
120
127
 
128
+ /* Hidden by default - translateX(100%) moves it off-screen to the right */
121
129
  transform: translateX(100%) !important;
122
130
  visibility: hidden !important;
123
131
  pointer-events: none !important;
124
132
  opacity: 0 !important;
125
133
  display: none !important;
126
134
 
135
+ /* Smooth slide transition */
127
136
  transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
128
137
  }
129
138
 
@@ -166,36 +175,6 @@ var GlobalSidebarStyles = createGlobalStyle`
166
175
  display: flex !important;
167
176
  }
168
177
  }
169
-
170
- /* Override CopilotKit's default message styles with our custom components */
171
- .copilotKitSidebar {
172
- /* Reset all default CopilotKit message styling */
173
- [class*="copilotKitMessage"],
174
- [class*="Message-module"] {
175
- all: unset !important;
176
- display: contents !important;
177
- }
178
-
179
- /* Ensure our custom UserMessage gradient pill shows through */
180
- button[role="presentation"] {
181
- all: revert !important;
182
- display: inline-flex !important;
183
- }
184
-
185
- /* Reset input styles to allow our custom ChatInput */
186
- [class*="Input-module"],
187
- [class*="copilotKitInput"] {
188
- all: unset !important;
189
- display: contents !important;
190
- }
191
-
192
- /* Reset header styles */
193
- [class*="Header-module"],
194
- [class*="copilotKitHeader"] {
195
- all: unset !important;
196
- display: contents !important;
197
- }
198
- }
199
178
  `;
200
179
  var StyledChatButton = styled.button`
201
180
  position: fixed;
@@ -229,20 +208,14 @@ var StyledChatButton = styled.button`
229
208
  fill: white;
230
209
  }
231
210
  `;
232
- var CustomCopilotSidebar = ({
211
+ function CustomCopilotSidebar({
233
212
  children,
234
- instructions = "You are a helpful AI assistant.",
235
- labels,
236
- icons,
237
213
  defaultOpen = false,
238
- clickOutsideToClose = true,
239
- hitEscapeToClose = true,
240
- shortcut = "/",
241
214
  onSetOpen,
242
- className,
243
- ...props
244
- }) => {
245
- const HeaderAdapter = (_props) => {
215
+ instructions,
216
+ className
217
+ }) {
218
+ const HeaderAdapterWithClose = (_props) => {
246
219
  const { setOpen } = useChatContext();
247
220
  const handleClose = () => {
248
221
  setOpen(false);
@@ -250,17 +223,17 @@ var CustomCopilotSidebar = ({
250
223
  };
251
224
  return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
252
225
  };
253
- const WindowAdapter = (props2) => {
254
- return /* @__PURE__ */ jsx(Window, { children: props2.children });
226
+ const WindowAdapterLocal = (props) => {
227
+ return /* @__PURE__ */ jsx(Window, { children: props.children });
255
228
  };
256
- const MessagesAdapter = (props2) => {
257
- return /* @__PURE__ */ jsx(Messages, { children: props2.messages.map((message, index) => /* @__PURE__ */ jsx(
258
- props2.RenderMessage,
229
+ const MessagesAdapter = (props) => {
230
+ return /* @__PURE__ */ jsx(Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsx(
231
+ props.RenderMessage,
259
232
  {
260
233
  message,
261
- inProgress: props2.inProgress,
234
+ inProgress: props.inProgress,
262
235
  index,
263
- isCurrentMessage: index === props2.messages.length - 1
236
+ isCurrentMessage: index === props.messages.length - 1
264
237
  },
265
238
  message.id || `message-${index}`
266
239
  )) });
@@ -305,29 +278,25 @@ var CustomCopilotSidebar = ({
305
278
  AssistantMessage: AssistantMessageAdapter,
306
279
  UserMessage: UserMessageAdapter,
307
280
  Input: InputAdapter,
308
- Header: HeaderAdapter,
309
- Window: WindowAdapter,
281
+ Header: HeaderAdapterWithClose,
282
+ Window: WindowAdapterLocal,
310
283
  Messages: MessagesAdapter,
311
284
  Button: CustomButton,
312
285
  instructions,
313
286
  labels: {
314
287
  title: "AI Assistant",
315
- initial: "Hi! How can I help you today?",
316
- ...labels
288
+ initial: "Hi! How can I help you today?"
317
289
  },
318
- icons,
319
290
  defaultOpen,
320
- clickOutsideToClose,
321
- hitEscapeToClose,
322
- shortcut,
291
+ clickOutsideToClose: true,
292
+ hitEscapeToClose: true,
323
293
  onSetOpen,
324
294
  className,
325
- ...props,
326
295
  children
327
296
  }
328
297
  )
329
298
  ] });
330
- };
299
+ }
331
300
  CustomCopilotSidebar.displayName = "CustomCopilotSidebar";
332
301
  var GlobalSidebarStyles2 = createGlobalStyle`
333
302
  /* Override CopilotKit's default positioning - start off-screen */
@@ -345,7 +314,6 @@ var GlobalSidebarStyles2 = createGlobalStyle`
345
314
 
346
315
  /* Mobile-first: Full viewport sidebar */
347
316
  .copilotKitSidebar .copilotKitWindow {
348
- /* Override CopilotKit defaults for mobile */
349
317
  position: fixed !important;
350
318
  top: 0 !important;
351
319
  right: 0 !important;
@@ -359,14 +327,12 @@ var GlobalSidebarStyles2 = createGlobalStyle`
359
327
  border-radius: 0 !important;
360
328
  z-index: 1001 !important;
361
329
 
362
- /* Hidden by default - translateX(100%) moves it off-screen to the right */
363
330
  transform: translateX(100%) !important;
364
331
  visibility: hidden !important;
365
332
  pointer-events: none !important;
366
333
  opacity: 0 !important;
367
334
  display: none !important;
368
335
 
369
- /* Smooth slide transition */
370
336
  transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;
371
337
  }
372
338
 
@@ -409,6 +375,36 @@ var GlobalSidebarStyles2 = createGlobalStyle`
409
375
  display: flex !important;
410
376
  }
411
377
  }
378
+
379
+ /* Override CopilotKit's default message styles with our custom components */
380
+ .copilotKitSidebar {
381
+ /* Reset all default CopilotKit message styling */
382
+ [class*="copilotKitMessage"],
383
+ [class*="Message-module"] {
384
+ all: unset !important;
385
+ display: contents !important;
386
+ }
387
+
388
+ /* Ensure our custom UserMessage gradient pill shows through */
389
+ button[role="presentation"] {
390
+ all: revert !important;
391
+ display: inline-flex !important;
392
+ }
393
+
394
+ /* Reset input styles to allow our custom ChatInput */
395
+ [class*="Input-module"],
396
+ [class*="copilotKitInput"] {
397
+ all: unset !important;
398
+ display: contents !important;
399
+ }
400
+
401
+ /* Reset header styles */
402
+ [class*="Header-module"],
403
+ [class*="copilotKitHeader"] {
404
+ all: unset !important;
405
+ display: contents !important;
406
+ }
407
+ }
412
408
  `;
413
409
  var StyledChatButton2 = styled.button`
414
410
  position: fixed;
@@ -442,14 +438,19 @@ var StyledChatButton2 = styled.button`
442
438
  fill: white;
443
439
  }
444
440
  `;
445
- function CustomCopilotSidebar2({
441
+ var CustomCopilotSidebar2 = ({
446
442
  children,
443
+ instructions = "You are a helpful AI assistant.",
444
+ labels,
445
+ icons,
447
446
  defaultOpen = false,
447
+ clickOutsideToClose = true,
448
+ hitEscapeToClose = true,
449
+ shortcut = "/",
448
450
  onSetOpen,
449
- instructions,
450
451
  className
451
- }) {
452
- const HeaderAdapterWithClose = (_props) => {
452
+ }) => {
453
+ const HeaderAdapter = (_props) => {
453
454
  const { setOpen } = useChatContext();
454
455
  const handleClose = () => {
455
456
  setOpen(false);
@@ -457,7 +458,7 @@ function CustomCopilotSidebar2({
457
458
  };
458
459
  return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
459
460
  };
460
- const WindowAdapterLocal = (props) => {
461
+ const WindowAdapter = (props) => {
461
462
  return /* @__PURE__ */ jsx(Window, { children: props.children });
462
463
  };
463
464
  const MessagesAdapter = (props) => {
@@ -512,27 +513,30 @@ function CustomCopilotSidebar2({
512
513
  AssistantMessage: AssistantMessageAdapter,
513
514
  UserMessage: UserMessageAdapter,
514
515
  Input: InputAdapter,
515
- Header: HeaderAdapterWithClose,
516
- Window: WindowAdapterLocal,
516
+ Header: HeaderAdapter,
517
+ Window: WindowAdapter,
517
518
  Messages: MessagesAdapter,
518
519
  Button: CustomButton,
519
520
  instructions,
520
521
  labels: {
521
522
  title: "AI Assistant",
522
- initial: "Hi! How can I help you today?"
523
+ initial: "Hi! How can I help you today?",
524
+ ...labels
523
525
  },
526
+ icons,
524
527
  defaultOpen,
525
- clickOutsideToClose: true,
526
- hitEscapeToClose: true,
528
+ clickOutsideToClose,
529
+ hitEscapeToClose,
530
+ shortcut,
527
531
  onSetOpen,
528
532
  className,
529
533
  children
530
534
  }
531
535
  )
532
536
  ] });
533
- }
537
+ };
534
538
  CustomCopilotSidebar2.displayName = "CustomCopilotSidebar";
535
539
 
536
- export { AssistantMessageAdapter, CustomCopilotSidebar2 as CustomCopilotSidebar, InputAdapter, CustomCopilotSidebar as IntegratedSidebar, UserMessageAdapter };
540
+ export { AssistantMessageAdapter, CustomCopilotSidebar, InputAdapter, CustomCopilotSidebar2 as IntegratedSidebar, UserMessageAdapter };
537
541
  //# sourceMappingURL=index.js.map
538
542
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/copilotkit/adapters/AssistantMessageAdapter.tsx","../../src/components/copilotkit/adapters/InputAdapter.tsx","../../src/components/copilotkit/adapters/UserMessageAdapter.tsx","../../src/components/copilotkit/CopilotSidebarIntegration.tsx","../../src/components/copilotkit/CustomCopilotSidebar/CustomCopilotSidebar.tsx"],"names":["jsx","styled","props","GlobalSidebarStyles","createGlobalSt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AA;AAAA,YACR,IAAA,EAAK,cAAA;AAAA,YACL,KAAA,EAAM,4BAAA;AAAA,YACN,IAAA,EAAK,KAAA;AAAA,YACL,YAAA,EAAW,WAAA;AAAA,YAEX,QAAA,EAAA;AAAA,8BAAAR,GAAAA,CAAC,WAAM,QAAA,EAAA,MAAA,EAAI,CAAA;AAAA,8BACXA,GAAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,yFAAA,EAA0F;AAAA;AAAA;AAAA;AACpG;AAAA,KACF;AAAA,EAEJ,CAAA;AAEA,EAAA,uBACEQ,IAAAA,CAAAC,QAAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAAT,GAAAA,CAACG,sBAAA,EAAoB,CAAA;AAAA,oBACrBH,GAAAA;AAAA,MAACU,cAAAA;AAAA,MAAA;AAAA,QAEC,gBAAA,EAAkB,uBAAA;AAAA,QAClB,WAAA,EAAa,kBAAA;AAAA,QACb,KAAA,EAAO,YAAA;AAAA,QACP,MAAA,EAAQ,sBAAA;AAAA,QACR,MAAA,EAAQ,kBAAA;AAAA,QACR,QAAA,EAAU,eAAA;AAAA,QACV,MAAA,EAAQ,YAAA;AAAA,QAER,YAAA;AAAA,QACA,MAAA,EAAQ;AAAA,UACN,KAAA,EAAO,cAAA;AAAA,UACP,OAAA,EAAS;AAAA,SACX;AAAA,QAEA,WAAA;AAAA,QACA,mBAAA,EAAqB,IAAA;AAAA,QACrB,gBAAA,EAAkB,IAAA;AAAA,QAClB,SAAA;AAAA,QAEA,SAAA;AAAA,QAEC;AAAA;AAAA;AACH,GAAA,EACF,CAAA;AAEJ;AAEAJ,qBAAAA,CAAqB,WAAA,GAAc,sBAAA","file":"index.js","sourcesContent":["/**\n * Adapter component that bridges custom AssistantMessage with CopilotKit's expected interface\n *\n * This adapter:\n * 1. Converts CopilotKit's AssistantMessageProps to our custom component props\n * 2. Handles loading states by showing AssistantThinking component\n * 3. Extracts message content and renders with our styled component\n */\n\nimport type { AssistantMessageProps as CopilotAssistantMessageProps } from '@copilotkit/react-ui';\nimport type React from 'react';\nimport { AssistantThinking } from '../../AssistantThinking/AssistantThinking';\nimport { AssistantMessage } from '../Messages/AssistantMessage';\n\n/**\n * Adapter that converts CopilotKit's AssistantMessageProps to our custom component\n */\nexport const AssistantMessageAdapter: React.FC<CopilotAssistantMessageProps> = ({\n message,\n isLoading,\n isGenerating,\n // These are available but not used in our current implementation:\n // isCurrentMessage,\n // onRegenerate,\n // onCopy,\n // onThumbsUp,\n // onThumbsDown,\n // markdownTagRenderers,\n // ImageRenderer,\n}) => {\n // Show thinking state when loading (before content arrives)\n if (isLoading) {\n return <AssistantThinking message=\"Thinking...\" />;\n }\n\n // Show thinking state when generating (content is streaming)\n if (isGenerating && !message?.content) {\n return <AssistantThinking message=\"Generating response...\" />;\n }\n\n // Extract content from the message\n const content = message?.content || '';\n\n // Parse attachments if present in the message\n // Note: generativeUI is a function in CopilotKit's AIMessage, not an array\n // For now, we don't extract attachments from the message\n // TODO: Implement proper attachment extraction when CopilotKit supports it\n const attachments: any[] = [];\n\n return (\n <AssistantMessage\n content={content}\n avatarInitials=\"AI\"\n isLoading={isGenerating} // Show loading dots while generating\n attachments={attachments}\n enableMarkdown={true}\n />\n );\n};\n\nAssistantMessageAdapter.displayName = 'AssistantMessageAdapter';\n","/**\n * Adapter component that bridges custom Input with CopilotKit's expected interface\n *\n * This adapter:\n * 1. Converts CopilotKit's InputProps to our custom component props\n * 2. Handles the onSend callback to work with CopilotKit's message system\n * 3. Manages input state and submission\n */\n\nimport type { InputProps as CopilotInputProps } from '@copilotkit/react-ui';\nimport type React from 'react';\nimport { useState } from 'react';\nimport { ChatInput } from '../../ChatInput/ChatInput';\n\n/**\n * Adapter that converts CopilotKit's InputProps to our custom component\n */\nexport const InputAdapter: React.FC<CopilotInputProps> = ({\n inProgress,\n onSend,\n isVisible = true,\n}) => {\n const [value, setValue] = useState('');\n\n const handleSubmit = async (message: string) => {\n if (!message.trim() || inProgress) return;\n\n // Call CopilotKit's onSend which returns a Promise<Message>\n await onSend(message);\n setValue(''); // Clear input after sending\n };\n\n // TODO: Add support for stop button and file upload if needed\n\n return (\n <ChatInput\n value={value}\n onChange={setValue}\n onSubmit={handleSubmit}\n placeholder=\"Ask, write or search for anything...\"\n isDisabled={inProgress}\n autoFocus={isVisible}\n aria-label=\"Chat message input\"\n suggestions={[\n { text: 'Create in-depth analysis' },\n { text: 'Identify actionable tasks' },\n { text: 'Summarize key points' },\n ]}\n onSuggestionSelect={(suggestion) => {\n setValue(suggestion);\n handleSubmit(suggestion);\n }}\n />\n );\n};\n\nInputAdapter.displayName = 'InputAdapter';\n","/**\n * Adapter component that bridges custom UserMessage with CopilotKit's expected interface\n *\n * This adapter:\n * 1. Converts CopilotKit's UserMessageProps to our custom component props\n * 2. Extracts message content from CopilotKit's message object\n * 3. Handles image messages appropriately\n */\n\nimport type { UserMessageProps as CopilotUserMessageProps } from '@copilotkit/react-ui';\nimport type React from 'react';\nimport styled from 'styled-components';\nimport { UserMessage } from '../../UserMessage/UserMessage';\n\n// Wrapper to align user messages to the right\nconst UserMessageWrapper = styled.div`\n display: flex;\n justify-content: flex-end;\n width: 100%;\n padding: 8px 0;\n`;\n\n/**\n * Adapter that converts CopilotKit's UserMessageProps to our custom component\n */\nexport const UserMessageAdapter: React.FC<CopilotUserMessageProps> = ({\n message,\n ImageRenderer,\n}) => {\n // Handle image messages\n if (message?.image) {\n return <ImageRenderer image={message.image} content={message.content} />;\n }\n\n // Extract text content\n const content = message?.content || '';\n\n // Our UserMessage is a button-like component with React ARIA\n // In the chat context, it's not interactive, so we don't provide onPress\n return (\n <UserMessageWrapper>\n <UserMessage>{content}</UserMessage>\n </UserMessageWrapper>\n );\n};\n\nUserMessageAdapter.displayName = 'UserMessageAdapter';\n","/**\n * Complete CopilotSidebar Integration Example\n *\n * This file demonstrates how to integrate custom-designed components\n * (AssistantMessage, UserMessage, AssistantThinking, Input) with CopilotKit's\n * CopilotSidebar component using adapter components.\n *\n * Usage:\n * ```tsx\n * import { CopilotKit } from \"@copilotkit/react-core\";\n * import { CustomCopilotSidebar } from \"./CopilotSidebarIntegration\";\n *\n * function App() {\n * return (\n * <CopilotKit runtimeUrl=\"/api/copilotkit\">\n * <CustomCopilotSidebar>\n * <YourApp />\n * </CustomCopilotSidebar>\n * </CopilotKit>\n * );\n * }\n * ```\n */\n\nimport type {\n ButtonProps as CopilotButtonProps,\n HeaderProps as CopilotHeaderProps,\n MessagesProps as CopilotMessagesProps,\n WindowProps as CopilotWindowProps,\n} from '@copilotkit/react-ui';\nimport { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';\nimport type React from 'react';\nimport styled, { createGlobalStyle } from 'styled-components';\nimport { AssistantMessageAdapter, InputAdapter, UserMessageAdapter } from './adapters';\nimport { Header } from './Header/Header';\nimport { Messages } from './Messages/Messages';\nimport { Window } from './Window/Window';\n\n// Global styles to ensure sidebar starts hidden and button visibility\nconst GlobalSidebarStyles = createGlobalStyle`\n /* Override CopilotKit's default positioning - start off-screen */\n .copilotKitSidebar {\n position: fixed !important;\n right: -100vw !important;\n bottom: 0 !important;\n transition: right 0.3s ease !important;\n }\n\n /* Move sidebar container into view when expanded */\n .copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {\n right: 0 !important;\n }\n\n /* Mobile-first: Full viewport sidebar */\n .copilotKitSidebar .copilotKitWindow {\n position: fixed !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n margin: 0 !important;\n border-radius: 0 !important;\n z-index: 1001 !important;\n\n transform: translateX(100%) !important;\n visibility: hidden !important;\n pointer-events: none !important;\n opacity: 0 !important;\n display: none !important;\n\n transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;\n }\n\n /* When window has .open class (CopilotKit's native class), show it */\n .copilotKitSidebar .copilotKitWindow.open {\n display: flex !important;\n transform: translateX(0) !important;\n visibility: visible !important;\n pointer-events: auto !important;\n opacity: 1 !important;\n }\n\n /* Desktop: Sidebar panel on the right (640px = CopilotKit's breakpoint) */\n @media (min-width: 640px) {\n .copilotKitSidebar .copilotKitWindow {\n inset: auto !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 28rem !important;\n height: 100vh !important;\n max-width: 28rem !important;\n max-height: 100vh !important;\n }\n }\n\n /* Hide button when sidebar is open */\n .copilotKitSidebarContentWrapper.sidebarExpanded {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: none !important;\n }\n }\n\n /* Show button when sidebar is closed */\n .copilotKitSidebarContentWrapper:not(.sidebarExpanded) {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: flex !important;\n }\n }\n\n /* Override CopilotKit's default message styles with our custom components */\n .copilotKitSidebar {\n /* Reset all default CopilotKit message styling */\n [class*=\"copilotKitMessage\"],\n [class*=\"Message-module\"] {\n all: unset !important;\n display: contents !important;\n }\n\n /* Ensure our custom UserMessage gradient pill shows through */\n button[role=\"presentation\"] {\n all: revert !important;\n display: inline-flex !important;\n }\n\n /* Reset input styles to allow our custom ChatInput */\n [class*=\"Input-module\"],\n [class*=\"copilotKitInput\"] {\n all: unset !important;\n display: contents !important;\n }\n\n /* Reset header styles */\n [class*=\"Header-module\"],\n [class*=\"copilotKitHeader\"] {\n all: unset !important;\n display: contents !important;\n }\n }\n`;\n\n// Styled button positioned in the bottom-right corner\nconst StyledChatButton = styled.button`\n position: fixed;\n bottom: 8px;\n right: 8px;\n width: 36px;\n height: 36px;\n border-radius: 18px;\n border: none;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 1000;\n transition: all 0.2s ease;\n\n &:hover {\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);\n }\n\n &:active {\n transform: scale(0.95);\n }\n\n svg {\n width: 20px;\n height: 20px;\n fill: white;\n }\n`;\n\nexport interface CustomCopilotSidebarProps {\n /**\n * Children to render alongside the sidebar\n */\n children?: React.ReactNode;\n /**\n * Instructions for the AI assistant\n */\n instructions?: string;\n /**\n * Custom labels for the sidebar\n */\n labels?: {\n title?: string;\n initial?: string;\n };\n /**\n * Custom icons\n */\n icons?: Record<string, React.ReactNode>;\n /**\n * Whether the sidebar starts open\n */\n defaultOpen?: boolean;\n /**\n * Allow closing by clicking outside\n */\n clickOutsideToClose?: boolean;\n /**\n * Allow closing with Escape key\n */\n hitEscapeToClose?: boolean;\n /**\n * Keyboard shortcut to open\n */\n shortcut?: string;\n /**\n * Callback when open state changes\n */\n onSetOpen?: (open: boolean) => void;\n /**\n * CSS class name\n */\n className?: string;\n}\n\n/**\n * CopilotSidebar with custom-designed components\n *\n * This component wraps CopilotKit's CopilotSidebar and injects our\n * custom components via adapter components.\n *\n * Features:\n * - Custom AssistantMessage with avatar and loading states\n * - AssistantThinking component shown during loading\n * - Custom UserMessage with gradient pill design\n * - Custom Input with React ARIA accessibility\n * - Styled chat button with gradient\n */\nexport const CustomCopilotSidebar: React.FC<CustomCopilotSidebarProps> = ({\n children,\n instructions = 'You are a helpful AI assistant.',\n labels,\n icons,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n shortcut = '/',\n onSetOpen,\n className,\n ...props\n}) => {\n // Header adapter with close handler\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const HeaderAdapter = (_props: CopilotHeaderProps) => {\n const { setOpen } = useChatContext();\n\n const handleClose = () => {\n setOpen(false);\n onSetOpen?.(false);\n };\n\n return (\n <Header title=\"AI Assistant\" subtitle=\"How can I help you today?\" onClose={handleClose} />\n );\n };\n\n // Window adapter - wraps our custom Window component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const WindowAdapter = (props: CopilotWindowProps) => {\n return <Window>{props.children}</Window>;\n };\n\n // Messages adapter - wraps our custom Messages component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const MessagesAdapter = (props: CopilotMessagesProps) => {\n return (\n <Messages>\n {props.messages.map((message, index) => (\n <props.RenderMessage\n key={message.id || `message-${index}`}\n message={message}\n inProgress={props.inProgress}\n index={index}\n isCurrentMessage={index === props.messages.length - 1}\n />\n ))}\n </Messages>\n );\n };\n\n // Custom Button component that uses CopilotKit's ChatContext\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const CustomButton = (_props: CopilotButtonProps) => {\n const { open, setOpen } = useChatContext();\n\n const handleClick = () => {\n const newOpenState = !open;\n setOpen(newOpenState);\n onSetOpen?.(newOpenState);\n };\n\n return (\n <StyledChatButton\n onClick={handleClick}\n aria-label={open ? 'Close chat' : 'Open chat'}\n type=\"button\"\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label=\"Chat icon\"\n >\n <title>Chat</title>\n <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\" />\n </svg>\n </StyledChatButton>\n );\n };\n\n return (\n <>\n <GlobalSidebarStyles />\n <CopilotSidebar\n // Pass through custom components via adapters\n AssistantMessage={AssistantMessageAdapter}\n UserMessage={UserMessageAdapter}\n Input={InputAdapter}\n Header={HeaderAdapter}\n Window={WindowAdapter}\n Messages={MessagesAdapter}\n Button={CustomButton}\n // Configuration\n instructions={instructions}\n labels={{\n title: 'AI Assistant',\n initial: 'Hi! How can I help you today?',\n ...labels,\n }}\n icons={icons}\n // Behavior\n defaultOpen={defaultOpen}\n clickOutsideToClose={clickOutsideToClose}\n hitEscapeToClose={hitEscapeToClose}\n shortcut={shortcut}\n onSetOpen={onSetOpen}\n // Styling\n className={className}\n // Other props\n {...props}\n >\n {children}\n </CopilotSidebar>\n </>\n );\n};\n\nCustomCopilotSidebar.displayName = 'CustomCopilotSidebar';\n","import type {\n ButtonProps as CopilotButtonProps,\n HeaderProps as CopilotHeaderProps,\n MessagesProps as CopilotMessagesProps,\n WindowProps as CopilotWindowProps,\n} from '@copilotkit/react-ui';\nimport { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';\nimport type { ReactNode } from 'react';\nimport styled, { createGlobalStyle } from 'styled-components';\nimport { AssistantMessageAdapter, InputAdapter, UserMessageAdapter } from '../adapters';\nimport { Header } from '../Header/Header';\nimport { Messages } from '../Messages/Messages';\nimport { Window } from '../Window/Window';\n\n// Global styles to ensure sidebar starts hidden and button visibility\nconst GlobalSidebarStyles = createGlobalStyle`\n /* Override CopilotKit's default positioning - start off-screen */\n .copilotKitSidebar {\n position: fixed !important;\n right: -100vw !important;\n bottom: 0 !important;\n transition: right 0.3s ease !important;\n }\n\n /* Move sidebar container into view when expanded */\n .copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {\n right: 0 !important;\n }\n\n /* Mobile-first: Full viewport sidebar */\n .copilotKitSidebar .copilotKitWindow {\n /* Override CopilotKit defaults for mobile */\n position: fixed !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n margin: 0 !important;\n border-radius: 0 !important;\n z-index: 1001 !important;\n\n /* Hidden by default - translateX(100%) moves it off-screen to the right */\n transform: translateX(100%) !important;\n visibility: hidden !important;\n pointer-events: none !important;\n opacity: 0 !important;\n display: none !important;\n\n /* Smooth slide transition */\n transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;\n }\n\n /* When window has .open class (CopilotKit's native class), show it */\n .copilotKitSidebar .copilotKitWindow.open {\n display: flex !important;\n transform: translateX(0) !important;\n visibility: visible !important;\n pointer-events: auto !important;\n opacity: 1 !important;\n }\n\n /* Desktop: Sidebar panel on the right (640px = CopilotKit's breakpoint) */\n @media (min-width: 640px) {\n .copilotKitSidebar .copilotKitWindow {\n inset: auto !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 28rem !important;\n height: 100vh !important;\n max-width: 28rem !important;\n max-height: 100vh !important;\n }\n }\n\n /* Hide button when sidebar is open */\n .copilotKitSidebarContentWrapper.sidebarExpanded {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: none !important;\n }\n }\n\n /* Show button when sidebar is closed */\n .copilotKitSidebarContentWrapper:not(.sidebarExpanded) {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: flex !important;\n }\n }\n`;\n\n// Styled button positioned in the bottom-right corner\nconst StyledChatButton = styled.button`\n position: fixed;\n bottom: 8px;\n right: 8px;\n width: 36px;\n height: 36px;\n border-radius: 18px;\n border: none;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 1000;\n transition: all 0.2s ease;\n\n &:hover {\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);\n }\n\n &:active {\n transform: scale(0.95);\n }\n\n svg {\n width: 20px;\n height: 20px;\n fill: white;\n }\n`;\n\nexport interface CustomCopilotSidebarProps {\n children: ReactNode;\n defaultOpen?: boolean;\n onSetOpen?: (open: boolean) => void;\n instructions?: string;\n className?: string;\n}\n\n/**\n * CustomCopilotSidebar - A CopilotSidebar wrapper using our custom components\n *\n * This component wraps CopilotKit's CopilotSidebar and provides our custom\n * design system components for a consistent look and feel.\n *\n * @example\n * ```tsx\n * <CustomCopilotSidebar defaultOpen={false} onSetOpen={(open) => console.log(open)}>\n * <YourApp />\n * </CustomCopilotSidebar>\n * ```\n */\nexport function CustomCopilotSidebar({\n children,\n defaultOpen = false,\n onSetOpen,\n instructions,\n className,\n}: CustomCopilotSidebarProps) {\n // Header adapter with close handler\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const HeaderAdapterWithClose = (_props: CopilotHeaderProps) => {\n const { setOpen } = useChatContext();\n\n const handleClose = () => {\n setOpen(false);\n onSetOpen?.(false);\n };\n\n return (\n <Header title=\"AI Assistant\" subtitle=\"How can I help you today?\" onClose={handleClose} />\n );\n };\n\n // Window adapter - wraps our custom Window component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const WindowAdapterLocal = (props: CopilotWindowProps) => {\n return <Window>{props.children}</Window>;\n };\n\n // Messages adapter - wraps our custom Messages component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const MessagesAdapter = (props: CopilotMessagesProps) => {\n return (\n <Messages>\n {props.messages.map((message, index) => (\n <props.RenderMessage\n key={message.id || `message-${index}`}\n message={message}\n inProgress={props.inProgress}\n index={index}\n isCurrentMessage={index === props.messages.length - 1}\n />\n ))}\n </Messages>\n );\n };\n\n // Custom Button component that uses CopilotKit's ChatContext\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const CustomButton = (_props: CopilotButtonProps) => {\n const { open, setOpen } = useChatContext();\n\n const handleClick = () => {\n const newOpenState = !open;\n setOpen(newOpenState);\n onSetOpen?.(newOpenState);\n };\n\n return (\n <StyledChatButton\n onClick={handleClick}\n aria-label={open ? 'Close chat' : 'Open chat'}\n type=\"button\"\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label=\"Chat icon\"\n >\n <title>Chat</title>\n <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\" />\n </svg>\n </StyledChatButton>\n );\n };\n\n return (\n <>\n <GlobalSidebarStyles />\n <CopilotSidebar\n // Pass through custom components via adapters\n AssistantMessage={AssistantMessageAdapter}\n UserMessage={UserMessageAdapter}\n Input={InputAdapter}\n Header={HeaderAdapterWithClose}\n Window={WindowAdapterLocal}\n Messages={MessagesAdapter}\n Button={CustomButton}\n // Configuration\n instructions={instructions}\n labels={{\n title: 'AI Assistant',\n initial: 'Hi! How can I help you today?',\n }}\n // Behavior\n defaultOpen={defaultOpen}\n clickOutsideToClose={true}\n hitEscapeToClose={true}\n onSetOpen={onSetOpen}\n // Styling\n className={className}\n >\n {children}\n </CopilotSidebar>\n </>\n );\n}\n\nCustomCopilotSidebar.displayName = 'CustomCopilotSidebar';\n"]}
1
+ {"version":3,"sources":["../../src/components/copilotkit/adapters/AssistantMessageAdapter.tsx","../../src/components/copilotkit/adapters/UserMessageAdapter.tsx","../../src/components/copilotkit/adapters/InputAdapter.tsx","../../src/components/copilotkit/CustomCopilotSidebar/CustomCopilotSidebar.tsx","../../src/components/copilotkit/CopilotSidebarIntegration.tsx"],"names":["jsx","styled","GlobalSidebarStyles","createGlobalStyle","StyledChatButton","CustomCopilotSidebar","useChatContext","jsxs","Fragment","CopilotSidebar"],"mappings":";;;;;;;AAiBO,IAAM,0BAAkE,CAAC;AAAA,EAC9E,OAAA;AAAA,EACA,SAAA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASF,CAAA,KAAM;AAEJ,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,uBAAO,GAAA,CAAC,iBAAA,EAAA,EAAkB,OAAA,EAAQ,aAAA,EAAc,CAAA;AAAA,EAClD;AAGA,EAAA,IAAI,YAAA,IAAgB,CAAC,OAAA,EAAS,OAAA,EAAS;AACrC,IAAA,uBAAO,GAAA,CAAC,iBAAA,EAAA,EAAkB,OAAA,EAAQ,wBAAA,EAAyB,CAAA;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A,EAAa,kBAAA;AAAA,QACb,KAAA,EAAO,YAAA;AAAA,QACP,MAAA,EAAQ,aAAA;AAAA,QACR,MAAA,EAAQ,aAAA;AAAA,QACR,QAAA,EAAU,eAAA;AAAA,QACV,MAAA,EAAQ,YAAA;AAAA,QAGR,YAAA;AAAA,QACA,MAAA,EAAQ;AAAA,UACN,KAAA,EAAO,cAAA;AAAA,UACP,OAAA,EAAS,+BAAA;AAAA,UACT,GAAG;AAAA,SACL;AAAA,QACA,KAAA;AAAA,QAGA,WAAA;AAAA,QACA,mBAAA;AAAA,QACA,gBAAA;AAAA,QACA,QAAA;AAAA,QACA,SAAA;AAAA,QAGA,SAAA;AAAA,QAEC;AAAA;AAAA;AACH,GAAA,EACF,CAAA;AAEJ;AAEAJ,qBAAAA,CAAqB,WAAA,GAAc,sBAAA","file":"index.js","sourcesContent":["/**\n * Adapter component that bridges custom AssistantMessage with CopilotKit's expected interface\n *\n * This adapter:\n * 1. Converts CopilotKit's AssistantMessageProps to our custom component props\n * 2. Handles loading states by showing AssistantThinking component\n * 3. Extracts message content and renders with our styled component\n */\n\nimport type React from 'react';\nimport type { AssistantMessageProps as CopilotAssistantMessageProps } from '@copilotkit/react-ui';\nimport { AssistantMessage } from '../Messages/AssistantMessage';\nimport { AssistantThinking } from '../../AssistantThinking/AssistantThinking';\n\n/**\n * Adapter that converts CopilotKit's AssistantMessageProps to our custom component\n */\nexport const AssistantMessageAdapter: React.FC<CopilotAssistantMessageProps> = ({\n message,\n isLoading,\n isGenerating,\n // These are available but not used in our current implementation:\n // isCurrentMessage,\n // onRegenerate,\n // onCopy,\n // onThumbsUp,\n // onThumbsDown,\n // markdownTagRenderers,\n // ImageRenderer,\n}) => {\n // Show thinking state when loading (before content arrives)\n if (isLoading) {\n return <AssistantThinking message=\"Thinking...\" />;\n }\n\n // Show thinking state when generating (content is streaming)\n if (isGenerating && !message?.content) {\n return <AssistantThinking message=\"Generating response...\" />;\n }\n\n // Extract content from the message\n const content = message?.content || '';\n\n // Parse attachments if present in the message\n // TODO: Implement attachments parsing from CopilotKit message data\n const attachments: any[] = [];\n\n return (\n <AssistantMessage\n content={content}\n avatarInitials=\"AI\"\n isLoading={isGenerating} // Show loading dots while generating\n attachments={attachments}\n enableMarkdown={true}\n />\n );\n};\n\nAssistantMessageAdapter.displayName = 'AssistantMessageAdapter';\n","/**\n * Adapter component that bridges custom UserMessage with CopilotKit's expected interface\n *\n * This adapter:\n * 1. Converts CopilotKit's UserMessageProps to our custom component props\n * 2. Extracts message content from CopilotKit's message object\n * 3. Handles image messages appropriately\n */\n\nimport type React from 'react';\nimport type { UserMessageProps as CopilotUserMessageProps } from '@copilotkit/react-ui';\nimport styled from 'styled-components';\nimport { UserMessage } from '../../UserMessage/UserMessage';\n\n// Wrapper to align user messages to the right\nconst UserMessageWrapper = styled.div`\n display: flex;\n justify-content: flex-end;\n width: 100%;\n padding: 8px 0;\n`;\n\n/**\n * Adapter that converts CopilotKit's UserMessageProps to our custom component\n */\nexport const UserMessageAdapter: React.FC<CopilotUserMessageProps> = ({\n message,\n ImageRenderer,\n}) => {\n // Handle image messages\n if (message?.image) {\n return (\n <ImageRenderer\n image={message.image}\n content={message.content}\n />\n );\n }\n\n // Extract text content\n const content = message?.content || '';\n\n // Our UserMessage is a button-like component with React ARIA\n // In the chat context, it's not interactive, so we don't provide onPress\n return (\n <UserMessageWrapper>\n <UserMessage>\n {content}\n </UserMessage>\n </UserMessageWrapper>\n );\n};\n\nUserMessageAdapter.displayName = 'UserMessageAdapter';\n","/**\n * Adapter component that bridges custom Input with CopilotKit's expected interface\n *\n * This adapter:\n * 1. Converts CopilotKit's InputProps to our custom component props\n * 2. Handles the onSend callback to work with CopilotKit's message system\n * 3. Manages input state and submission\n */\n\nimport { useState } from 'react';\nimport type React from 'react';\nimport type { InputProps as CopilotInputProps } from '@copilotkit/react-ui';\nimport { ChatInput } from '../../ChatInput/ChatInput';\n\n/**\n * Adapter that converts CopilotKit's InputProps to our custom component\n */\nexport const InputAdapter: React.FC<CopilotInputProps> = ({\n inProgress,\n onSend,\n isVisible = true,\n}) => {\n const [value, setValue] = useState('');\n\n const handleSubmit = async (message: string) => {\n if (!message.trim() || inProgress) return;\n\n // Call CopilotKit's onSend which returns a Promise<Message>\n await onSend(message);\n setValue(''); // Clear input after sending\n };\n\n // TODO: Add support for stop button and file upload if needed\n\n return (\n <ChatInput\n value={value}\n onChange={setValue}\n onSubmit={handleSubmit}\n placeholder=\"Ask, write or search for anything...\"\n isDisabled={inProgress}\n autoFocus={isVisible}\n aria-label=\"Chat message input\"\n suggestions={[\n { text: 'Create in-depth analysis' },\n { text: 'Identify actionable tasks' },\n { text: 'Summarize key points' },\n ]}\n onSuggestionSelect={(suggestion) => {\n setValue(suggestion);\n handleSubmit(suggestion);\n }}\n />\n );\n};\n\nInputAdapter.displayName = 'InputAdapter';\n","import type {\n ButtonProps as CopilotButtonProps,\n HeaderProps as CopilotHeaderProps,\n MessagesProps as CopilotMessagesProps,\n WindowProps as CopilotWindowProps,\n} from '@copilotkit/react-ui';\nimport { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';\nimport type { ReactNode } from 'react';\nimport styled, { createGlobalStyle } from 'styled-components';\nimport {\n AssistantMessageAdapter,\n UserMessageAdapter,\n InputAdapter,\n} from '../adapters';\nimport { Header } from '../Header/Header';\nimport { Messages } from '../Messages/Messages';\nimport { Window } from '../Window/Window';\n\n// Global styles to ensure sidebar starts hidden and button visibility\nconst GlobalSidebarStyles = createGlobalStyle`\n /* Override CopilotKit's default positioning - start off-screen */\n .copilotKitSidebar {\n position: fixed !important;\n right: -100vw !important;\n bottom: 0 !important;\n transition: right 0.3s ease !important;\n }\n\n /* Move sidebar container into view when expanded */\n .copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {\n right: 0 !important;\n }\n\n /* Mobile-first: Full viewport sidebar */\n .copilotKitSidebar .copilotKitWindow {\n /* Override CopilotKit defaults for mobile */\n position: fixed !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n margin: 0 !important;\n border-radius: 0 !important;\n z-index: 1001 !important;\n\n /* Hidden by default - translateX(100%) moves it off-screen to the right */\n transform: translateX(100%) !important;\n visibility: hidden !important;\n pointer-events: none !important;\n opacity: 0 !important;\n display: none !important;\n\n /* Smooth slide transition */\n transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;\n }\n\n /* When window has .open class (CopilotKit's native class), show it */\n .copilotKitSidebar .copilotKitWindow.open {\n display: flex !important;\n transform: translateX(0) !important;\n visibility: visible !important;\n pointer-events: auto !important;\n opacity: 1 !important;\n }\n\n /* Desktop: Sidebar panel on the right (640px = CopilotKit's breakpoint) */\n @media (min-width: 640px) {\n .copilotKitSidebar .copilotKitWindow {\n inset: auto !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 28rem !important;\n height: 100vh !important;\n max-width: 28rem !important;\n max-height: 100vh !important;\n }\n }\n\n /* Hide button when sidebar is open */\n .copilotKitSidebarContentWrapper.sidebarExpanded {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: none !important;\n }\n }\n\n /* Show button when sidebar is closed */\n .copilotKitSidebarContentWrapper:not(.sidebarExpanded) {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: flex !important;\n }\n }\n`;\n\n// Styled button positioned in the bottom-right corner\nconst StyledChatButton = styled.button`\n position: fixed;\n bottom: 8px;\n right: 8px;\n width: 36px;\n height: 36px;\n border-radius: 18px;\n border: none;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 1000;\n transition: all 0.2s ease;\n\n &:hover {\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);\n }\n\n &:active {\n transform: scale(0.95);\n }\n\n svg {\n width: 20px;\n height: 20px;\n fill: white;\n }\n`;\n\nexport interface CustomCopilotSidebarProps {\n children: ReactNode;\n defaultOpen?: boolean;\n onSetOpen?: (open: boolean) => void;\n instructions?: string;\n className?: string;\n}\n\n/**\n * CustomCopilotSidebar - A CopilotSidebar wrapper using our custom components\n *\n * This component wraps CopilotKit's CopilotSidebar and provides our custom\n * design system components for a consistent look and feel.\n *\n * @example\n * ```tsx\n * <CustomCopilotSidebar defaultOpen={false} onSetOpen={(open) => console.log(open)}>\n * <YourApp />\n * </CustomCopilotSidebar>\n * ```\n */\nexport function CustomCopilotSidebar({\n children,\n defaultOpen = false,\n onSetOpen,\n instructions,\n className,\n}: CustomCopilotSidebarProps) {\n // Header adapter with close handler\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const HeaderAdapterWithClose = (_props: CopilotHeaderProps) => {\n const { setOpen } = useChatContext();\n\n const handleClose = () => {\n setOpen(false);\n onSetOpen?.(false);\n };\n\n return (\n <Header title=\"AI Assistant\" subtitle=\"How can I help you today?\" onClose={handleClose} />\n );\n };\n\n // Window adapter - wraps our custom Window component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const WindowAdapterLocal = (props: CopilotWindowProps) => {\n return <Window>{props.children}</Window>;\n };\n\n // Messages adapter - wraps our custom Messages component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const MessagesAdapter = (props: CopilotMessagesProps) => {\n return (\n <Messages>\n {props.messages.map((message, index) => (\n <props.RenderMessage\n key={message.id || `message-${index}`}\n message={message}\n inProgress={props.inProgress}\n index={index}\n isCurrentMessage={index === props.messages.length - 1}\n />\n ))}\n </Messages>\n );\n };\n\n // Custom Button component that uses CopilotKit's ChatContext\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const CustomButton = (_props: CopilotButtonProps) => {\n const { open, setOpen } = useChatContext();\n\n const handleClick = () => {\n const newOpenState = !open;\n setOpen(newOpenState);\n onSetOpen?.(newOpenState);\n };\n\n return (\n <StyledChatButton\n onClick={handleClick}\n aria-label={open ? 'Close chat' : 'Open chat'}\n type=\"button\"\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label=\"Chat icon\"\n >\n <title>Chat</title>\n <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\" />\n </svg>\n </StyledChatButton>\n );\n };\n\n return (\n <>\n <GlobalSidebarStyles />\n <CopilotSidebar\n // Pass through custom components via adapters\n AssistantMessage={AssistantMessageAdapter}\n UserMessage={UserMessageAdapter}\n Input={InputAdapter}\n Header={HeaderAdapterWithClose}\n Window={WindowAdapterLocal}\n Messages={MessagesAdapter}\n Button={CustomButton}\n\n // Configuration\n instructions={instructions}\n labels={{\n title: 'AI Assistant',\n initial: 'Hi! How can I help you today?',\n }}\n\n // Behavior\n defaultOpen={defaultOpen}\n clickOutsideToClose={true}\n hitEscapeToClose={true}\n onSetOpen={onSetOpen}\n\n // Styling\n className={className}\n >\n {children}\n </CopilotSidebar>\n </>\n );\n}\n\nCustomCopilotSidebar.displayName = 'CustomCopilotSidebar';\n","/**\n * Complete CopilotSidebar Integration Example\n *\n * This file demonstrates how to integrate custom-designed components\n * (AssistantMessage, UserMessage, AssistantThinking, Input) with CopilotKit's\n * CopilotSidebar component using adapter components.\n *\n * Usage:\n * ```tsx\n * import { CopilotKit } from \"@copilotkit/react-core\";\n * import { CustomCopilotSidebar } from \"./CopilotSidebarIntegration\";\n *\n * function App() {\n * return (\n * <CopilotKit runtimeUrl=\"/api/copilotkit\">\n * <CustomCopilotSidebar>\n * <YourApp />\n * </CustomCopilotSidebar>\n * </CopilotKit>\n * );\n * }\n * ```\n */\n\nimport type React from 'react';\nimport { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';\nimport type {\n ButtonProps as CopilotButtonProps,\n HeaderProps as CopilotHeaderProps,\n WindowProps as CopilotWindowProps,\n MessagesProps as CopilotMessagesProps,\n} from '@copilotkit/react-ui';\nimport styled, { createGlobalStyle } from 'styled-components';\nimport {\n AssistantMessageAdapter,\n UserMessageAdapter,\n InputAdapter,\n} from './adapters';\nimport { Header } from './Header/Header';\nimport { Window } from './Window/Window';\nimport { Messages } from './Messages/Messages';\n\n// Global styles to ensure sidebar starts hidden and button visibility\nconst GlobalSidebarStyles = createGlobalStyle`\n /* Override CopilotKit's default positioning - start off-screen */\n .copilotKitSidebar {\n position: fixed !important;\n right: -100vw !important;\n bottom: 0 !important;\n transition: right 0.3s ease !important;\n }\n\n /* Move sidebar container into view when expanded */\n .copilotKitSidebarContentWrapper.sidebarExpanded .copilotKitSidebar {\n right: 0 !important;\n }\n\n /* Mobile-first: Full viewport sidebar */\n .copilotKitSidebar .copilotKitWindow {\n position: fixed !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n margin: 0 !important;\n border-radius: 0 !important;\n z-index: 1001 !important;\n\n transform: translateX(100%) !important;\n visibility: hidden !important;\n pointer-events: none !important;\n opacity: 0 !important;\n display: none !important;\n\n transition: transform 0.3s ease, visibility 0.3s ease, opacity 0.3s ease !important;\n }\n\n /* When window has .open class (CopilotKit's native class), show it */\n .copilotKitSidebar .copilotKitWindow.open {\n display: flex !important;\n transform: translateX(0) !important;\n visibility: visible !important;\n pointer-events: auto !important;\n opacity: 1 !important;\n }\n\n /* Desktop: Sidebar panel on the right (640px = CopilotKit's breakpoint) */\n @media (min-width: 640px) {\n .copilotKitSidebar .copilotKitWindow {\n inset: auto !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: auto !important;\n width: 28rem !important;\n height: 100vh !important;\n max-width: 28rem !important;\n max-height: 100vh !important;\n }\n }\n\n /* Hide button when sidebar is open */\n .copilotKitSidebarContentWrapper.sidebarExpanded {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: none !important;\n }\n }\n\n /* Show button when sidebar is closed */\n .copilotKitSidebarContentWrapper:not(.sidebarExpanded) {\n button[aria-label=\"Open chat\"],\n button[aria-label=\"Close chat\"] {\n display: flex !important;\n }\n }\n\n /* Override CopilotKit's default message styles with our custom components */\n .copilotKitSidebar {\n /* Reset all default CopilotKit message styling */\n [class*=\"copilotKitMessage\"],\n [class*=\"Message-module\"] {\n all: unset !important;\n display: contents !important;\n }\n\n /* Ensure our custom UserMessage gradient pill shows through */\n button[role=\"presentation\"] {\n all: revert !important;\n display: inline-flex !important;\n }\n\n /* Reset input styles to allow our custom ChatInput */\n [class*=\"Input-module\"],\n [class*=\"copilotKitInput\"] {\n all: unset !important;\n display: contents !important;\n }\n\n /* Reset header styles */\n [class*=\"Header-module\"],\n [class*=\"copilotKitHeader\"] {\n all: unset !important;\n display: contents !important;\n }\n }\n`;\n\n// Styled button positioned in the bottom-right corner\nconst StyledChatButton = styled.button`\n position: fixed;\n bottom: 8px;\n right: 8px;\n width: 36px;\n height: 36px;\n border-radius: 18px;\n border: none;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 1000;\n transition: all 0.2s ease;\n\n &:hover {\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);\n }\n\n &:active {\n transform: scale(0.95);\n }\n\n svg {\n width: 20px;\n height: 20px;\n fill: white;\n }\n`;\n\nexport interface CustomCopilotSidebarProps {\n /**\n * Children to render alongside the sidebar\n */\n children?: React.ReactNode;\n /**\n * Instructions for the AI assistant\n */\n instructions?: string;\n /**\n * Custom labels for the UI\n */\n labels?: Record<string, string>;\n /**\n * Custom icons for the UI\n */\n icons?: Record<string, React.ReactNode>;\n /**\n * Whether the sidebar should be open by default\n */\n defaultOpen?: boolean;\n /**\n * Whether clicking outside should close the sidebar\n */\n clickOutsideToClose?: boolean;\n /**\n * Whether hitting escape should close the sidebar\n */\n hitEscapeToClose?: boolean;\n /**\n * Keyboard shortcut to open the sidebar\n */\n shortcut?: string;\n /**\n * Callback when the sidebar open state changes\n */\n onSetOpen?: (open: boolean) => void;\n /**\n * Additional CSS class name\n */\n className?: string;\n}\n\n/**\n * CopilotSidebar with custom-designed components\n *\n * This component wraps CopilotKit's CopilotSidebar and injects our\n * custom components via adapter components.\n *\n * Features:\n * - Custom AssistantMessage with avatar and loading states\n * - AssistantThinking component shown during loading\n * - Custom UserMessage with gradient pill design\n * - Custom Input with React ARIA accessibility\n * - Styled chat button with gradient\n */\nexport const CustomCopilotSidebar: React.FC<CustomCopilotSidebarProps> = ({\n children,\n instructions = \"You are a helpful AI assistant.\",\n labels,\n icons,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n shortcut = '/',\n onSetOpen,\n className,\n}) => {\n // Header adapter with close handler\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const HeaderAdapter = (_props: CopilotHeaderProps) => {\n const { setOpen } = useChatContext();\n\n const handleClose = () => {\n setOpen(false);\n onSetOpen?.(false);\n };\n\n return (\n <Header title=\"AI Assistant\" subtitle=\"How can I help you today?\" onClose={handleClose} />\n );\n };\n\n // Window adapter - wraps our custom Window component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const WindowAdapter = (props: CopilotWindowProps) => {\n return <Window>{props.children}</Window>;\n };\n\n // Messages adapter - wraps our custom Messages component\n // biome-ignore lint/correctness/noNestedComponentDefinitions: Simple adapter component\n const MessagesAdapter = (props: CopilotMessagesProps) => {\n return (\n <Messages>\n {props.messages.map((message, index) => (\n <props.RenderMessage\n key={message.id || `message-${index}`}\n message={message}\n inProgress={props.inProgress}\n index={index}\n isCurrentMessage={index === props.messages.length - 1}\n />\n ))}\n </Messages>\n );\n };\n\n // Custom Button component that uses CopilotKit's ChatContext\n // biome-ignore lint/correctness/noNestedComponentDefinitions: This component must be defined here to access CopilotKit's ChatContext and the onSetOpen prop\n const CustomButton = (_props: CopilotButtonProps) => {\n const { open, setOpen } = useChatContext();\n\n const handleClick = () => {\n const newOpenState = !open;\n setOpen(newOpenState);\n onSetOpen?.(newOpenState);\n };\n\n return (\n <StyledChatButton\n onClick={handleClick}\n aria-label={open ? 'Close chat' : 'Open chat'}\n type=\"button\"\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label=\"Chat icon\"\n >\n <title>Chat</title>\n <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\" />\n </svg>\n </StyledChatButton>\n );\n };\n\n return (\n <>\n <GlobalSidebarStyles />\n <CopilotSidebar\n // Pass through custom components via adapters\n AssistantMessage={AssistantMessageAdapter}\n UserMessage={UserMessageAdapter}\n Input={InputAdapter}\n Header={HeaderAdapter}\n Window={WindowAdapter}\n Messages={MessagesAdapter}\n Button={CustomButton}\n\n // Configuration\n instructions={instructions}\n labels={{\n title: \"AI Assistant\",\n initial: \"Hi! How can I help you today?\",\n ...labels,\n }}\n icons={icons}\n\n // Behavior\n defaultOpen={defaultOpen}\n clickOutsideToClose={clickOutsideToClose}\n hitEscapeToClose={hitEscapeToClose}\n shortcut={shortcut}\n onSetOpen={onSetOpen}\n\n // Styling\n className={className}\n >\n {children}\n </CopilotSidebar>\n </>\n );\n};\n\nCustomCopilotSidebar.displayName = 'CustomCopilotSidebar';\n"]}