@agentiffai/design 0.1.2 → 0.1.4

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,10 +1,792 @@
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';
1
+ import { useButton } from '@react-aria/button';
2
+ import { useRef, useState, useEffect } from 'react';
3
+ import styled4, { css, keyframes, createGlobalStyle } from 'styled-components';
5
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
- import { useState } from 'react';
5
+ import { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';
6
+ import { useTextField } from '@react-aria/textfield';
7
+
8
+ // src/components/copilotkit/Button/Button.tsx
9
+ var variantStyles = {
10
+ primary: css`
11
+ background-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
12
+ color: white;
13
+ border: none;
14
+
15
+ &:hover:not(:disabled) {
16
+ opacity: 0.9;
17
+ transform: translateY(-1px);
18
+ }
19
+
20
+ &:active:not(:disabled) {
21
+ opacity: 0.8;
22
+ transform: translateY(0);
23
+ }
24
+
25
+ &:focus-visible {
26
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
27
+ outline-offset: 2px;
28
+ }
29
+ `,
30
+ secondary: css`
31
+ background-color: transparent;
32
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
33
+ border: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
34
+
35
+ &:hover:not(:disabled) {
36
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
37
+ border-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
38
+ }
39
+
40
+ &:active:not(:disabled) {
41
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
42
+ }
43
+
44
+ &:focus-visible {
45
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
46
+ outline-offset: 2px;
47
+ }
48
+ `,
49
+ icon: css`
50
+ background-color: transparent;
51
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
52
+ border: none;
53
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
54
+ min-width: auto;
55
+
56
+ &:hover:not(:disabled) {
57
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
58
+ opacity: 0.8;
59
+ }
60
+
61
+ &:active:not(:disabled) {
62
+ opacity: 0.6;
63
+ }
64
+
65
+ &:focus-visible {
66
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
67
+ outline-offset: 2px;
68
+ }
69
+ `
70
+ };
71
+ var sizeStyles = {
72
+ small: css`
73
+ padding: ${({ theme }) => theme?.spacing?.xs ?? "4px"} ${({ theme }) => theme?.spacing?.sm ?? "8px"};
74
+ font-size: 0.875rem;
75
+ min-width: 60px;
76
+ height: 28px;
77
+ `,
78
+ medium: css`
79
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
80
+ font-size: 1rem;
81
+ min-width: 80px;
82
+ height: 36px;
83
+ `,
84
+ large: css`
85
+ padding: ${({ theme }) => theme?.spacing?.md ?? "16px"} ${({ theme }) => theme?.spacing?.lg ?? "24px"};
86
+ font-size: 1.125rem;
87
+ min-width: 100px;
88
+ height: 44px;
89
+ `
90
+ };
91
+ var StyledButton = styled4.button`
92
+ /* Base styles */
93
+ display: inline-flex;
94
+ align-items: center;
95
+ justify-content: center;
96
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
97
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
98
+ font-weight: 500;
99
+ border-radius: ${({ theme }) => theme?.radii?.md ?? "8px"};
100
+ cursor: pointer;
101
+ transition: all 0.2s ease-in-out;
102
+ white-space: nowrap;
103
+ user-select: none;
104
+
105
+ /* Variant styles */
106
+ ${({ $variant }) => variantStyles[$variant]}
107
+
108
+ /* Size styles */
109
+ ${({ $size, $variant }) => $variant !== "icon" && sizeStyles[$size]}
110
+
111
+ /* Icon variant size overrides */
112
+ ${({ $variant, $size }) => $variant === "icon" && css`
113
+ width: ${$size === "small" ? "28px" : $size === "large" ? "44px" : "36px"};
114
+ height: ${$size === "small" ? "28px" : $size === "large" ? "44px" : "36px"};
115
+ border-radius: ${({ theme }) => theme?.radii?.sm ?? "4px"};
116
+ `}
117
+
118
+ /* Pressed state */
119
+ ${({ $isPressed }) => $isPressed && css`
120
+ transform: scale(0.98);
121
+ `}
122
+
123
+ /* Loading state */
124
+ ${({ $isLoading }) => $isLoading && css`
125
+ cursor: wait;
126
+ opacity: 0.7;
127
+ `}
128
+
129
+ /* Disabled state */
130
+ &:disabled {
131
+ cursor: not-allowed;
132
+ opacity: 0.5;
133
+ transform: none;
134
+ }
135
+
136
+ /* Remove default focus outline, using focus-visible instead */
137
+ &:focus {
138
+ outline: none;
139
+ }
140
+ `;
141
+ function Button({
142
+ variant = "primary",
143
+ size = "medium",
144
+ children,
145
+ className,
146
+ disabled = false,
147
+ isLoading = false,
148
+ ...ariaProps
149
+ }) {
150
+ const ref = useRef(null);
151
+ const { buttonProps, isPressed } = useButton(
152
+ {
153
+ ...ariaProps,
154
+ isDisabled: disabled || isLoading
155
+ },
156
+ ref
157
+ );
158
+ return /* @__PURE__ */ jsx(
159
+ StyledButton,
160
+ {
161
+ ...buttonProps,
162
+ ref,
163
+ className,
164
+ $variant: variant,
165
+ $size: size,
166
+ $isPressed: isPressed,
167
+ $isLoading: isLoading,
168
+ disabled: disabled || isLoading,
169
+ children: isLoading ? /* @__PURE__ */ jsx("span", { "aria-live": "polite", "aria-busy": "true", children: "Loading..." }) : children
170
+ }
171
+ );
172
+ }
173
+ Button.displayName = "Button";
174
+ var ActionsContainer = styled4.div`
175
+ display: flex;
176
+ gap: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
177
+ align-items: center;
178
+
179
+ ${({ $layout }) => $layout === "horizontal" ? css`
180
+ flex-direction: row;
181
+ flex-wrap: wrap;
182
+ ` : css`
183
+ flex-direction: column;
184
+ align-items: stretch;
185
+
186
+ button {
187
+ width: 100%;
188
+ }
189
+ `}
190
+ `;
191
+ function Actions({ actions, layout = "horizontal", className }) {
192
+ return /* @__PURE__ */ jsx(ActionsContainer, { $layout: layout, className, children: actions.map((action) => /* @__PURE__ */ jsxs(
193
+ Button,
194
+ {
195
+ variant: action.variant || "secondary",
196
+ onPress: action.onClick,
197
+ isDisabled: action.disabled,
198
+ "aria-label": action.label,
199
+ children: [
200
+ action.icon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: action.icon }),
201
+ action.variant !== "icon" && action.label
202
+ ]
203
+ },
204
+ action.id
205
+ )) });
206
+ }
207
+ Actions.displayName = "Actions";
208
+ var dotPulse = keyframes`
209
+ 0%, 100% {
210
+ opacity: 0.3;
211
+ transform: scale(0.8);
212
+ }
213
+ 50% {
214
+ opacity: 1;
215
+ transform: scale(1);
216
+ }
217
+ `;
218
+ var fadeIn = keyframes`
219
+ from {
220
+ opacity: 0;
221
+ }
222
+ to {
223
+ opacity: 1;
224
+ }
225
+ `;
226
+ var blink = keyframes`
227
+ 0%, 49% {
228
+ opacity: 1;
229
+ }
230
+ 50%, 100% {
231
+ opacity: 0;
232
+ }
233
+ `;
234
+ var ResponseContainer = styled4.div`
235
+ display: inline-flex;
236
+ align-items: center;
237
+ gap: 12px;
238
+ padding: 12px 16px;
239
+ background-color: #2c2c2e;
240
+ border-radius: 16px;
241
+ box-shadow: none;
242
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
243
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
244
+ max-width: fit-content;
245
+ margin: 0 auto;
246
+ `;
247
+ var LoadingDots = styled4.div`
248
+ display: flex;
249
+ align-items: center;
250
+ gap: 4px;
251
+ padding: 0 4px;
252
+ `;
253
+ var Dot = styled4.span`
254
+ width: 6px;
255
+ height: 6px;
256
+ border-radius: 50%;
257
+ background-color: #8e8e93;
258
+ animation: ${dotPulse} 1.4s ease-in-out infinite;
259
+ animation-delay: ${(props) => props.delay}s;
260
+ `;
261
+ var TypingIndicator = styled4.div`
262
+ display: flex;
263
+ align-items: center;
264
+ gap: 4px;
265
+ padding: 0 4px;
266
+
267
+ ${Dot} {
268
+ width: 6px;
269
+ height: 6px;
270
+ background-color: #8e8e93;
271
+ animation: ${dotPulse} 1.4s ease-in-out infinite;
272
+ }
273
+ `;
274
+ var Message = styled4.span`
275
+ font-size: 14px;
276
+ color: #e5e5e7;
277
+ font-weight: 400;
278
+ line-height: 1.5;
279
+ white-space: nowrap;
280
+ `;
281
+ var StreamingText = styled4.div`
282
+ font-size: 14px;
283
+ line-height: 1.5;
284
+ color: #e5e5e7;
285
+ animation: ${fadeIn} 0.3s ease-in;
286
+ position: relative;
287
+ font-weight: 400;
288
+ white-space: nowrap;
289
+
290
+ /* Blinking cursor effect */
291
+ &::after {
292
+ content: '|';
293
+ margin-left: 0.125rem;
294
+ animation: ${blink} 1s infinite;
295
+ color: #8e8e93;
296
+ font-weight: 400;
297
+ }
298
+ `;
299
+ var Response = ({
300
+ isLoading = false,
301
+ isTyping = false,
302
+ isStreaming = false,
303
+ streamingContent = "",
304
+ message = "Thinking...",
305
+ className
306
+ }) => {
307
+ if (isLoading) {
308
+ return /* @__PURE__ */ jsxs(ResponseContainer, { className, "data-testid": "response-loading", children: [
309
+ /* @__PURE__ */ jsxs(LoadingDots, { "aria-hidden": "true", children: [
310
+ /* @__PURE__ */ jsx(Dot, { delay: 0 }),
311
+ /* @__PURE__ */ jsx(Dot, { delay: 0.15 }),
312
+ /* @__PURE__ */ jsx(Dot, { delay: 0.3 })
313
+ ] }),
314
+ /* @__PURE__ */ jsx(Message, { children: message })
315
+ ] });
316
+ }
317
+ if (isTyping) {
318
+ return /* @__PURE__ */ jsxs(ResponseContainer, { className, "data-testid": "response-typing", children: [
319
+ /* @__PURE__ */ jsxs(TypingIndicator, { "aria-hidden": "true", children: [
320
+ /* @__PURE__ */ jsx(Dot, { delay: 0 }),
321
+ /* @__PURE__ */ jsx(Dot, { delay: 0.15 }),
322
+ /* @__PURE__ */ jsx(Dot, { delay: 0.3 })
323
+ ] }),
324
+ /* @__PURE__ */ jsx(Message, { children: message })
325
+ ] });
326
+ }
327
+ if (isStreaming && streamingContent) {
328
+ return /* @__PURE__ */ jsx(ResponseContainer, { className, "data-testid": "response-streaming", children: /* @__PURE__ */ jsx(StreamingText, { children: streamingContent }) });
329
+ }
330
+ return null;
331
+ };
332
+ var dotPulse2 = keyframes`
333
+ 0%, 100% {
334
+ opacity: 0.3;
335
+ transform: scale(0.8);
336
+ }
337
+ 50% {
338
+ opacity: 1;
339
+ transform: scale(1);
340
+ }
341
+ `;
342
+ var shake = keyframes`
343
+ 0%, 100% {
344
+ transform: translateX(0);
345
+ }
346
+ 25% {
347
+ transform: translateX(-5px);
348
+ }
349
+ 75% {
350
+ transform: translateX(5px);
351
+ }
352
+ `;
353
+ var AgentStateContainer = styled4.div`
354
+ display: inline-flex;
355
+ flex-direction: column;
356
+ align-items: center;
357
+ gap: 12px;
358
+ padding: 12px 16px;
359
+ background-color: ${(props) => props.isError ? "#3a1f1f" : "#2c2c2e"};
360
+ border-radius: 16px;
361
+ border: ${(props) => props.isError ? "1px solid #7f1d1d" : "none"};
362
+ box-shadow: none;
363
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
364
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
365
+ max-width: fit-content;
366
+ margin: 0 auto;
367
+ `;
368
+ var StateContent = styled4.div`
369
+ display: flex;
370
+ flex-direction: column;
371
+ gap: 8px;
372
+ align-items: center;
373
+ width: 100%;
374
+ `;
375
+ var IdleIndicator = styled4.div`
376
+ width: 6px;
377
+ height: 6px;
378
+ background-color: #8e8e93;
379
+ border-radius: 50%;
380
+ animation: ${dotPulse2} 2s infinite ease-in-out;
381
+ `;
382
+ var ErrorIndicator = styled4.div`
383
+ width: 6px;
384
+ height: 6px;
385
+ background-color: #ff6b6b;
386
+ border-radius: 50%;
387
+ animation: ${shake} 0.5s ease-in-out;
388
+ `;
389
+ var StateLabel = styled4.span`
390
+ font-size: 14px;
391
+ font-weight: 400;
392
+ color: #e5e5e7;
393
+ line-height: 1.5;
394
+ white-space: nowrap;
395
+ `;
396
+ styled4.p`
397
+ font-size: 14px;
398
+ color: #8e8e93;
399
+ line-height: 1.5;
400
+ margin: 0;
401
+ text-align: center;
402
+ white-space: nowrap;
403
+ `;
404
+ var ProgressBar = styled4.div`
405
+ width: 100%;
406
+ height: 4px;
407
+ background-color: #3a3a3c;
408
+ border-radius: 2px;
409
+ overflow: hidden;
410
+ margin-top: 4px;
411
+ `;
412
+ var ProgressBarFill = styled4.div`
413
+ height: 100%;
414
+ width: ${(props) => Math.min(Math.max(props.progress, 0), 100)}%;
415
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
416
+ border-radius: 2px;
417
+ transition: width 0.3s ease-in-out;
418
+ `;
419
+ var AgentState = ({ state, message, progress, className }) => {
420
+ if (state === "idle") {
421
+ return /* @__PURE__ */ jsx(AgentStateContainer, { className, "data-testid": "agent-state-idle", children: /* @__PURE__ */ jsxs(StateContent, { children: [
422
+ /* @__PURE__ */ jsx(IdleIndicator, {}),
423
+ /* @__PURE__ */ jsx(StateLabel, { children: message || "Agent is idle" }),
424
+ progress !== void 0 && /* @__PURE__ */ jsx(ProgressBar, { children: /* @__PURE__ */ jsx(ProgressBarFill, { progress }) })
425
+ ] }) });
426
+ }
427
+ if (state === "error") {
428
+ return /* @__PURE__ */ jsx(AgentStateContainer, { className, "data-testid": "agent-state-error", isError: true, children: /* @__PURE__ */ jsxs(StateContent, { children: [
429
+ /* @__PURE__ */ jsx(ErrorIndicator, {}),
430
+ /* @__PURE__ */ jsx(StateLabel, { children: message || "Error occurred" })
431
+ ] }) });
432
+ }
433
+ if (state === "thinking") {
434
+ return /* @__PURE__ */ jsx(
435
+ Response,
436
+ {
437
+ isLoading: true,
438
+ message: message || "Agent is thinking...",
439
+ className
440
+ }
441
+ );
442
+ }
443
+ if (state === "responding") {
444
+ return /* @__PURE__ */ jsx(
445
+ Response,
446
+ {
447
+ isTyping: true,
448
+ message: message || "Agent is responding...",
449
+ className
450
+ }
451
+ );
452
+ }
453
+ return null;
454
+ };
455
+ var MessageContainer = styled4.div`
456
+ display: flex;
457
+ gap: 12px;
458
+ align-items: flex-start;
459
+ padding: 8px 0;
460
+ max-width: 100%;
461
+ `;
462
+ var AvatarContainer = styled4.div`
463
+ flex-shrink: 0;
464
+ `;
465
+ var Avatar = styled4.img`
466
+ width: 32px;
467
+ height: 32px;
468
+ border-radius: 50%;
469
+ object-fit: cover;
470
+ background-color: #e5e7eb;
471
+ `;
472
+ var AvatarInitials = styled4.div`
473
+ width: 32px;
474
+ height: 32px;
475
+ border-radius: 50%;
476
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
477
+ color: white;
478
+ display: flex;
479
+ align-items: center;
480
+ justify-content: center;
481
+ font-size: 12px;
482
+ font-weight: 600;
483
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
484
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
485
+
486
+ svg {
487
+ width: 18px;
488
+ height: 18px;
489
+ }
490
+ `;
491
+ var ContentContainer = styled4.div`
492
+ flex: 1;
493
+ min-width: 0;
494
+ `;
495
+ var MessageContent = styled4.div`
496
+ background-color: #2c2c2e;
497
+ padding: 12px 16px;
498
+ border-radius: 16px;
499
+ border-top-left-radius: 4px;
500
+ color: #e5e5e7;
501
+ font-size: 14px;
502
+ line-height: 1.5;
503
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
504
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
505
+ word-wrap: break-word;
506
+ white-space: pre-wrap;
507
+ `;
508
+ var LoadingDots2 = styled4.div`
509
+ display: flex;
510
+ gap: 6px;
511
+ padding: 12px 16px;
512
+ background-color: #2c2c2e;
513
+ border-radius: 16px;
514
+ border-top-left-radius: 4px;
515
+ width: fit-content;
516
+ `;
517
+ var bounce = keyframes`
518
+ 0%, 60%, 100% {
519
+ transform: translateY(0);
520
+ }
521
+ 30% {
522
+ transform: translateY(-8px);
523
+ }
524
+ `;
525
+ var LoadingDot = styled4.div`
526
+ width: 8px;
527
+ height: 8px;
528
+ border-radius: 50%;
529
+ background-color: #8e8e93;
530
+ animation: ${bounce} 1.4s ease-in-out infinite;
531
+ animation-delay: ${(props) => props.delay}s;
532
+ `;
533
+ var FileAttachmentContainer = styled4.div`
534
+ display: flex;
535
+ align-items: center;
536
+ gap: 8px;
537
+ padding: 12px;
538
+ background-color: #3a3a3c;
539
+ border: 1px solid #48484a;
540
+ border-radius: 8px;
541
+ max-width: 320px;
542
+ cursor: ${(props) => props.$isInteractive ? "pointer" : "default"};
543
+ transition: border-color 0.15s ease;
544
+
545
+ /* Remove default button styles when used as button */
546
+ ${(props) => props.$isInteractive && `
547
+ font: inherit;
548
+ color: inherit;
549
+ text-align: left;
550
+ appearance: none;
551
+ -webkit-appearance: none;
7
552
 
553
+ &:hover {
554
+ border-color: #5a5a5c;
555
+ background-color: #48484a;
556
+ }
557
+
558
+ &:focus-visible {
559
+ outline: 2px solid #5B9FFF;
560
+ outline-offset: 2px;
561
+ border-color: #5B9FFF;
562
+ }
563
+
564
+ &:active {
565
+ border-color: #6a6a6c;
566
+ }
567
+ `}
568
+ `;
569
+ var FileIconContainer = styled4.div`
570
+ flex-shrink: 0;
571
+ width: 32px;
572
+ height: 32px;
573
+ display: flex;
574
+ align-items: center;
575
+ justify-content: center;
576
+ font-size: 24px;
577
+ line-height: 1;
578
+ `;
579
+ var FileInfo = styled4.div`
580
+ flex: 1;
581
+ min-width: 0;
582
+ display: flex;
583
+ flex-direction: column;
584
+ gap: 2px;
585
+ `;
586
+ var FileTitle = styled4.div`
587
+ font-size: 14px;
588
+ font-weight: 500;
589
+ color: #e5e5e7;
590
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
591
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
592
+ line-height: 1.4;
593
+ overflow: hidden;
594
+ text-overflow: ellipsis;
595
+ white-space: nowrap;
596
+ `;
597
+ var FileMetadata = styled4.div`
598
+ display: flex;
599
+ align-items: center;
600
+ gap: 4px;
601
+ font-size: 12px;
602
+ color: #8e8e93;
603
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
604
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
605
+ line-height: 1.4;
606
+ overflow: hidden;
607
+ `;
608
+ var FileSubtitle = styled4.span`
609
+ color: #8e8e93;
610
+ white-space: nowrap;
611
+ overflow: hidden;
612
+ text-overflow: ellipsis;
613
+
614
+ &:last-child {
615
+ flex-shrink: 0;
616
+ }
617
+ `;
618
+ var FileAttachment = ({
619
+ title,
620
+ subtitle,
621
+ size,
622
+ icon = "\u{1F4C4}",
623
+ onClick,
624
+ onPress,
625
+ className,
626
+ ...ariaProps
627
+ }) => {
628
+ const ref = useRef(null);
629
+ const isInteractive = !!(onClick || onPress);
630
+ const handlePress = (e) => {
631
+ if (onClick) onClick();
632
+ if (onPress) onPress(e);
633
+ };
634
+ const { buttonProps } = useButton(
635
+ {
636
+ ...ariaProps,
637
+ onPress: isInteractive ? handlePress : void 0,
638
+ isDisabled: !isInteractive
639
+ },
640
+ ref
641
+ );
642
+ return /* @__PURE__ */ jsxs(
643
+ FileAttachmentContainer,
644
+ {
645
+ ...isInteractive ? buttonProps : {},
646
+ ref: isInteractive ? ref : void 0,
647
+ className,
648
+ $isInteractive: isInteractive,
649
+ as: isInteractive ? "button" : "div",
650
+ children: [
651
+ /* @__PURE__ */ jsx(FileIconContainer, { children: icon }),
652
+ /* @__PURE__ */ jsxs(FileInfo, { children: [
653
+ /* @__PURE__ */ jsx(FileTitle, { children: title }),
654
+ /* @__PURE__ */ jsxs(FileMetadata, { children: [
655
+ subtitle && /* @__PURE__ */ jsx(FileSubtitle, { children: subtitle }),
656
+ size && subtitle && /* @__PURE__ */ jsx(FileSubtitle, { "aria-hidden": "true", children: " \u2022 " }),
657
+ size && /* @__PURE__ */ jsx(FileSubtitle, { children: size })
658
+ ] })
659
+ ] })
660
+ ]
661
+ }
662
+ );
663
+ };
664
+ var AttachmentsContainer = styled4.div`
665
+ display: flex;
666
+ flex-direction: column;
667
+ gap: 8px;
668
+ margin-top: 12px;
669
+ `;
670
+ var AssistantMessage = ({
671
+ content = "",
672
+ avatarUrl,
673
+ avatarInitials: _avatarInitials = "AI",
674
+ isLoading = false,
675
+ className,
676
+ attachments = [],
677
+ enableMarkdown: _enableMarkdown = false
678
+ }) => {
679
+ const renderContent = () => {
680
+ if (isLoading) {
681
+ return /* @__PURE__ */ jsxs(LoadingDots2, { children: [
682
+ /* @__PURE__ */ jsx(LoadingDot, { delay: 0 }),
683
+ /* @__PURE__ */ jsx(LoadingDot, { delay: 0.2 }),
684
+ /* @__PURE__ */ jsx(LoadingDot, { delay: 0.4 })
685
+ ] });
686
+ }
687
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
688
+ content && /* @__PURE__ */ jsx(MessageContent, { children: content }),
689
+ attachments.length > 0 && /* @__PURE__ */ jsx(AttachmentsContainer, { children: attachments.map((attachment, index) => /* @__PURE__ */ jsx(FileAttachment, { ...attachment }, `${attachment.title}-${index}`)) })
690
+ ] });
691
+ };
692
+ return /* @__PURE__ */ jsxs(MessageContainer, { className, children: [
693
+ /* @__PURE__ */ jsx(AvatarContainer, { children: avatarUrl ? /* @__PURE__ */ jsx(Avatar, { src: avatarUrl, alt: "Assistant avatar" }) : /* @__PURE__ */ jsx(AvatarInitials, { children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M17 13a4 4 0 0 1 0 8c-2.142 0-4-1.79-4-4h-2a4 4 0 1 1-.535-2h3.07A4 4 0 0 1 17 13M2 12v-2h2V7a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v3h2v2z" }) }) }) }),
694
+ /* @__PURE__ */ jsx(ContentContainer, { children: renderContent() })
695
+ ] });
696
+ };
697
+ var dotPulse3 = keyframes`
698
+ 0%, 100% {
699
+ opacity: 0.3;
700
+ transform: scale(0.8);
701
+ }
702
+ 50% {
703
+ opacity: 1;
704
+ transform: scale(1);
705
+ }
706
+ `;
707
+ var Container = styled4.div`
708
+ display: inline-flex;
709
+ align-items: center;
710
+ gap: 12px;
711
+ padding: 12px 16px;
712
+ background-color: #2c2c2e;
713
+ border-radius: 16px;
714
+ box-shadow: none;
715
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
716
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
717
+ max-width: fit-content;
718
+ margin: 0 auto;
719
+ `;
720
+ var Avatar2 = styled4.div`
721
+ width: 40px;
722
+ height: 40px;
723
+ border-radius: 50%;
724
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
725
+ display: flex;
726
+ align-items: center;
727
+ justify-content: center;
728
+ flex-shrink: 0;
729
+ box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
730
+ `;
731
+ var HeadphonesIcon = styled4.svg`
732
+ width: 20px;
733
+ height: 20px;
734
+ color: #FFFFFF;
735
+ `;
736
+ var Content = styled4.div`
737
+ display: flex;
738
+ align-items: center;
739
+ gap: 8px;
740
+ `;
741
+ var LoadingDots3 = styled4.div`
742
+ display: flex;
743
+ align-items: center;
744
+ gap: 4px;
745
+ padding: 0 4px;
746
+ `;
747
+ var Dot2 = styled4.span`
748
+ width: 6px;
749
+ height: 6px;
750
+ border-radius: 50%;
751
+ background-color: #8e8e93;
752
+ animation: ${dotPulse3} 1.4s ease-in-out infinite;
753
+ `;
754
+ var Message2 = styled4.span`
755
+ font-size: 14px;
756
+ color: #e5e5e7;
757
+ font-weight: 400;
758
+ line-height: 1.5;
759
+ white-space: nowrap;
760
+ `;
761
+ function AssistantThinking({
762
+ message = "Analyzing data, please wait...",
763
+ className,
764
+ ariaLabel = "Assistant is thinking"
765
+ }) {
766
+ const containerRef = useRef(null);
767
+ return /* @__PURE__ */ jsxs(
768
+ Container,
769
+ {
770
+ ref: containerRef,
771
+ className,
772
+ role: "status",
773
+ "aria-live": "polite",
774
+ "aria-label": ariaLabel,
775
+ children: [
776
+ /* @__PURE__ */ jsx(Avatar2, { "aria-hidden": "true", children: /* @__PURE__ */ jsx(HeadphonesIcon, { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M17 13a4 4 0 0 1 0 8c-2.142 0-4-1.79-4-4h-2a4 4 0 1 1-.535-2h3.07A4 4 0 0 1 17 13M2 12v-2h2V7a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v3h2v2z" }) }) }),
777
+ /* @__PURE__ */ jsxs(Content, { children: [
778
+ /* @__PURE__ */ jsxs(LoadingDots3, { "aria-hidden": "true", children: [
779
+ /* @__PURE__ */ jsx(Dot2, { style: { animationDelay: "0ms" } }),
780
+ /* @__PURE__ */ jsx(Dot2, { style: { animationDelay: "150ms" } }),
781
+ /* @__PURE__ */ jsx(Dot2, { style: { animationDelay: "300ms" } })
782
+ ] }),
783
+ /* @__PURE__ */ jsx(Message2, { children: message })
784
+ ] })
785
+ ]
786
+ }
787
+ );
788
+ }
789
+ AssistantThinking.displayName = "AssistantThinking";
8
790
  var AssistantMessageAdapter = ({
9
791
  message,
10
792
  isLoading,
@@ -38,7 +820,164 @@ var AssistantMessageAdapter = ({
38
820
  );
39
821
  };
40
822
  AssistantMessageAdapter.displayName = "AssistantMessageAdapter";
41
- var UserMessageWrapper = styled.div`
823
+ var StyledUserMessage = styled4.button`
824
+ /* Base styles */
825
+ display: inline-flex;
826
+ align-items: center;
827
+ justify-content: center;
828
+ padding: 12px 20px;
829
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
830
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
831
+ font-size: 14px;
832
+ font-weight: 400;
833
+ line-height: 1.4;
834
+ color: #ffffff;
835
+ border: none;
836
+ cursor: default;
837
+ user-select: none;
838
+ white-space: pre-wrap;
839
+ word-wrap: break-word;
840
+ position: relative;
841
+ text-align: left;
842
+
843
+ /* Pill shape - fully rounded ends */
844
+ border-radius: 999px;
845
+
846
+ /* Purple to blue gradient (left to right) */
847
+ background: linear-gradient(90deg, #8B5CF6 0%, #5B8DEF 100%);
848
+
849
+ /* Subtle shadow and glow effect */
850
+ box-shadow:
851
+ 0 2px 8px rgba(91, 141, 239, 0.25),
852
+ 0 1px 3px rgba(139, 92, 246, 0.15);
853
+
854
+ /* Smooth transitions */
855
+ transition: all 0.2s ease-in-out;
856
+
857
+ /* Speech bubble tail */
858
+ &::after {
859
+ content: '';
860
+ position: absolute;
861
+ bottom: -4px;
862
+ right: -6px;
863
+ width: 18px;
864
+ height: 18px;
865
+ background: #5B8DEF;
866
+ transform: rotate(45deg);
867
+ border-radius: 0 0 16px 0;
868
+ box-shadow:
869
+ 2px 2px 4px rgba(91, 141, 239, 0.15);
870
+ transition: all 0.2s ease-in-out;
871
+ }
872
+
873
+ /* Hover state - only for button elements */
874
+ &[role="button"]:hover:not(:disabled) {
875
+ transform: translateY(-1px);
876
+ cursor: pointer;
877
+ box-shadow:
878
+ 0 4px 12px rgba(91, 141, 239, 0.35),
879
+ 0 2px 6px rgba(139, 92, 246, 0.25);
880
+
881
+ &::after {
882
+ box-shadow:
883
+ 3px 3px 6px rgba(91, 141, 239, 0.2);
884
+ }
885
+ }
886
+
887
+ /* Active/Pressed state - only for button elements */
888
+ &[role="button"]:active:not(:disabled) {
889
+ transform: translateY(0);
890
+ box-shadow:
891
+ 0 1px 4px rgba(91, 141, 239, 0.2),
892
+ 0 1px 2px rgba(139, 92, 246, 0.1);
893
+
894
+ &::after {
895
+ box-shadow:
896
+ 1px 1px 2px rgba(91, 141, 239, 0.1);
897
+ }
898
+ }
899
+
900
+ ${({ $isPressed }) => $isPressed && css`
901
+ transform: translateY(0) scale(0.98);
902
+ box-shadow:
903
+ 0 1px 4px rgba(91, 141, 239, 0.2),
904
+ 0 1px 2px rgba(139, 92, 246, 0.1);
905
+
906
+ &::after {
907
+ box-shadow:
908
+ 1px 1px 2px rgba(91, 141, 239, 0.1);
909
+ }
910
+ `}
911
+
912
+ /* Focus state for accessibility */
913
+ &:focus {
914
+ outline: none;
915
+ }
916
+
917
+ &:focus-visible {
918
+ outline: 2px solid #5B8DEF;
919
+ outline-offset: 3px;
920
+ box-shadow:
921
+ 0 4px 12px rgba(91, 141, 239, 0.35),
922
+ 0 2px 6px rgba(139, 92, 246, 0.25),
923
+ 0 0 0 3px rgba(91, 141, 239, 0.1);
924
+ }
925
+
926
+ /* Disabled state */
927
+ &:disabled {
928
+ cursor: not-allowed;
929
+ opacity: 0.5;
930
+ transform: none;
931
+ box-shadow: none;
932
+
933
+ &::after {
934
+ opacity: 0.5;
935
+ box-shadow: none;
936
+ }
937
+ }
938
+ `;
939
+ function UserMessage({
940
+ children,
941
+ className,
942
+ isPressed = false,
943
+ onPress,
944
+ ...ariaProps
945
+ }) {
946
+ const ref = useRef(null);
947
+ if (!onPress) {
948
+ return /* @__PURE__ */ jsx(
949
+ StyledUserMessage,
950
+ {
951
+ as: "div",
952
+ className,
953
+ $isPressed: isPressed,
954
+ role: "presentation",
955
+ children
956
+ }
957
+ );
958
+ }
959
+ const { buttonProps, isPressed: ariaPressedState } = useButton(
960
+ {
961
+ ...ariaProps,
962
+ onPress
963
+ },
964
+ ref
965
+ );
966
+ return /* @__PURE__ */ jsx(
967
+ StyledUserMessage,
968
+ {
969
+ ...buttonProps,
970
+ ref,
971
+ className,
972
+ $isPressed: isPressed || ariaPressedState,
973
+ role: "button",
974
+ tabIndex: 0,
975
+ children
976
+ }
977
+ );
978
+ }
979
+ UserMessage.displayName = "UserMessage";
980
+ var UserMessageWrapper = styled4.div`
42
981
  display: flex;
43
982
  justify-content: flex-end;
44
983
  width: 100%;
@@ -52,15 +991,292 @@ var UserMessageAdapter = ({
52
991
  return /* @__PURE__ */ jsx(
53
992
  ImageRenderer,
54
993
  {
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 }) });
994
+ image: message.image,
995
+ content: message.content
996
+ }
997
+ );
998
+ }
999
+ const content = message?.content || "";
1000
+ return /* @__PURE__ */ jsx(UserMessageWrapper, { children: /* @__PURE__ */ jsx(UserMessage, { children: content }) });
1001
+ };
1002
+ UserMessageAdapter.displayName = "UserMessageAdapter";
1003
+ var ChatInputContainer = styled4.div`
1004
+ display: flex;
1005
+ flex-direction: column;
1006
+ width: 100%;
1007
+ padding: 8px;
1008
+ background: transparent;
1009
+ border-radius: 0;
1010
+ box-shadow: none;
1011
+ box-sizing: border-box;
1012
+
1013
+ @media (min-width: 640px) {
1014
+ padding: 12px;
1015
+ }
1016
+ `;
1017
+ var SuggestionsWrapper = styled4.div`
1018
+ display: flex;
1019
+ flex-direction: row;
1020
+ flex-wrap: wrap;
1021
+ gap: 8px;
1022
+ margin-bottom: 12px;
1023
+ width: 100%;
1024
+ box-sizing: border-box;
1025
+ `;
1026
+ var SuggestionButton = styled4.button`
1027
+ padding: 8px 16px;
1028
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1029
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1030
+ font-size: 13px;
1031
+ font-weight: 400;
1032
+ text-align: center;
1033
+ border: 1px solid #3a3a3c;
1034
+ border-radius: 20px;
1035
+ cursor: pointer;
1036
+ transition: all 0.15s ease;
1037
+ white-space: nowrap;
1038
+
1039
+ /* Dark theme colors */
1040
+ background-color: #2c2c2e;
1041
+ color: #e5e5e7;
1042
+
1043
+ /* Hover state */
1044
+ &:hover:not(:disabled) {
1045
+ background-color: #3a3a3c;
1046
+ border-color: #48484a;
1047
+ }
1048
+
1049
+ /* Active state */
1050
+ &:active:not(:disabled) {
1051
+ background-color: #48484a;
1052
+ }
1053
+
1054
+ /* Focus state */
1055
+ &:focus-visible {
1056
+ outline: 2px solid #5B9FFF;
1057
+ outline-offset: 2px;
1058
+ }
1059
+
1060
+ /* Disabled state */
1061
+ &:disabled {
1062
+ cursor: not-allowed;
1063
+ opacity: 0.4;
1064
+ }
1065
+ `;
1066
+ var InputWrapper = styled4.div`
1067
+ display: flex;
1068
+ align-items: center;
1069
+ gap: 10px;
1070
+ padding: 10px 14px;
1071
+ background-color: #2c2c2e;
1072
+ border: 1px solid #3a3a3c;
1073
+ border-radius: 12px;
1074
+ transition: all 0.2s ease;
1075
+ width: 100%;
1076
+ box-sizing: border-box;
1077
+
1078
+ &:focus-within {
1079
+ border-color: #5B9FFF;
1080
+ background-color: #323234;
1081
+ }
1082
+ `;
1083
+ var InputField = styled4.input`
1084
+ flex: 1;
1085
+ border: none;
1086
+ outline: none;
1087
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1088
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1089
+ font-size: 14px;
1090
+ color: #e5e5e7;
1091
+ background: transparent;
1092
+
1093
+ &::placeholder {
1094
+ color: #6e6e73;
1095
+ }
1096
+
1097
+ &:disabled {
1098
+ color: #6e6e73;
1099
+ cursor: not-allowed;
1100
+ }
1101
+ `;
1102
+ var SubmitButton = styled4.button`
1103
+ display: flex;
1104
+ align-items: center;
1105
+ justify-content: center;
1106
+ width: 32px;
1107
+ height: 32px;
1108
+ padding: 0;
1109
+ border: none;
1110
+ border-radius: 50%;
1111
+ background-color: ${(props) => props.disabled ? "#3a3a3c" : "#5B9FFF"};
1112
+ color: ${(props) => props.disabled ? "#6e6e73" : "#ffffff"};
1113
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
1114
+ transition: all 0.2s ease;
1115
+ flex-shrink: 0;
1116
+
1117
+ &:hover:not(:disabled) {
1118
+ background-color: #4A8FEF;
1119
+ transform: scale(1.05);
1120
+ }
1121
+
1122
+ &:active:not(:disabled) {
1123
+ transform: scale(0.98);
1124
+ }
1125
+
1126
+ &:focus-visible {
1127
+ outline: 2px solid #5B9FFF;
1128
+ outline-offset: 2px;
1129
+ }
1130
+
1131
+ svg {
1132
+ width: 18px;
1133
+ height: 18px;
1134
+ }
1135
+ `;
1136
+ var ChatInput = ({
1137
+ suggestions = [],
1138
+ onSuggestionSelect,
1139
+ value = "",
1140
+ onChange,
1141
+ onSubmit,
1142
+ placeholder = "Ask, write or search for anything...",
1143
+ isDisabled = false,
1144
+ isReadOnly = false,
1145
+ autoFocus = false,
1146
+ className,
1147
+ "aria-label": ariaLabel = "Chat message input",
1148
+ ...ariaProps
1149
+ }) => {
1150
+ const [internalValue, setInternalValue] = useState(value);
1151
+ const inputRef = useRef(null);
1152
+ const currentValue = value !== void 0 ? value : internalValue;
1153
+ const setValue = onChange || setInternalValue;
1154
+ const { inputProps } = useTextField(
1155
+ {
1156
+ ...ariaProps,
1157
+ "aria-label": ariaLabel,
1158
+ value: currentValue,
1159
+ onChange: (newValue) => {
1160
+ setValue(newValue);
1161
+ },
1162
+ isDisabled,
1163
+ isReadOnly
1164
+ },
1165
+ inputRef
1166
+ );
1167
+ const handleKeyDown = (e) => {
1168
+ if (e.key === "Enter") {
1169
+ e.preventDefault();
1170
+ handleSubmit();
1171
+ }
1172
+ };
1173
+ const handleSubmit = () => {
1174
+ if (currentValue.trim() && onSubmit && !isDisabled && !isReadOnly) {
1175
+ onSubmit(currentValue.trim());
1176
+ setValue("");
1177
+ inputRef.current?.focus();
1178
+ }
1179
+ };
1180
+ const handleSuggestionClick = (suggestionText) => {
1181
+ if (onSuggestionSelect && !isDisabled && !isReadOnly) {
1182
+ onSuggestionSelect(suggestionText);
1183
+ setValue(suggestionText);
1184
+ inputRef.current?.focus();
1185
+ }
1186
+ };
1187
+ const canSubmit = currentValue.trim().length > 0 && !isDisabled && !isReadOnly;
1188
+ return /* @__PURE__ */ jsxs(ChatInputContainer, { className, children: [
1189
+ suggestions.length > 0 && /* @__PURE__ */ jsx(SuggestionsWrapper, { role: "list", "aria-label": "Suggested prompts", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsx(
1190
+ SuggestionButtonComponent,
1191
+ {
1192
+ suggestion,
1193
+ onSelect: handleSuggestionClick,
1194
+ isDisabled: isDisabled || isReadOnly
1195
+ },
1196
+ `${suggestion.text}-${index}`
1197
+ )) }),
1198
+ /* @__PURE__ */ jsxs(InputWrapper, { children: [
1199
+ /* @__PURE__ */ jsx(
1200
+ InputField,
1201
+ {
1202
+ ...inputProps,
1203
+ ref: inputRef,
1204
+ type: "text",
1205
+ placeholder,
1206
+ onKeyDown: handleKeyDown,
1207
+ autoFocus,
1208
+ disabled: isDisabled,
1209
+ readOnly: isReadOnly
1210
+ }
1211
+ ),
1212
+ /* @__PURE__ */ jsx(
1213
+ SubmitButtonComponent,
1214
+ {
1215
+ onPress: handleSubmit,
1216
+ isDisabled: !canSubmit,
1217
+ ariaLabel: "Send message"
1218
+ }
1219
+ )
1220
+ ] })
1221
+ ] });
62
1222
  };
63
- UserMessageAdapter.displayName = "UserMessageAdapter";
1223
+ var SuggestionButtonComponent = ({
1224
+ suggestion,
1225
+ onSelect,
1226
+ isDisabled = false
1227
+ }) => {
1228
+ const ref = useRef(null);
1229
+ const { buttonProps } = useButton(
1230
+ {
1231
+ onPress: () => onSelect(suggestion.text),
1232
+ isDisabled,
1233
+ "aria-label": `Select suggestion: ${suggestion.text}`
1234
+ },
1235
+ ref
1236
+ );
1237
+ return /* @__PURE__ */ jsx(SuggestionButton, { ...buttonProps, ref, role: "listitem", children: suggestion.text });
1238
+ };
1239
+ var SubmitButtonComponent = ({
1240
+ onPress,
1241
+ isDisabled = false,
1242
+ ariaLabel = "Send message"
1243
+ }) => {
1244
+ const ref = useRef(null);
1245
+ const { buttonProps } = useButton(
1246
+ {
1247
+ onPress,
1248
+ isDisabled,
1249
+ "aria-label": ariaLabel
1250
+ },
1251
+ ref
1252
+ );
1253
+ return /* @__PURE__ */ jsx(SubmitButton, { ...buttonProps, ref, disabled: isDisabled, title: ariaLabel, children: /* @__PURE__ */ jsxs(
1254
+ "svg",
1255
+ {
1256
+ width: "20",
1257
+ height: "20",
1258
+ viewBox: "0 0 20 20",
1259
+ fill: "none",
1260
+ xmlns: "http://www.w3.org/2000/svg",
1261
+ role: "img",
1262
+ "aria-hidden": "true",
1263
+ children: [
1264
+ /* @__PURE__ */ jsx("title", { children: "Arrow Right Icon" }),
1265
+ /* @__PURE__ */ jsx(
1266
+ "path",
1267
+ {
1268
+ d: "M4 10H16M16 10L10 4M16 10L10 16",
1269
+ stroke: "currentColor",
1270
+ strokeWidth: "2",
1271
+ strokeLinecap: "round",
1272
+ strokeLinejoin: "round"
1273
+ }
1274
+ )
1275
+ ]
1276
+ }
1277
+ ) });
1278
+ };
1279
+ ChatInput.displayName = "ChatInput";
64
1280
  var InputAdapter = ({
65
1281
  inProgress,
66
1282
  onSend,
@@ -95,6 +1311,277 @@ var InputAdapter = ({
95
1311
  );
96
1312
  };
97
1313
  InputAdapter.displayName = "InputAdapter";
1314
+ var HeaderContainer = styled4.header`
1315
+ display: flex;
1316
+ align-items: center;
1317
+ justify-content: space-between;
1318
+ padding: 8px;
1319
+ background-color: #2c2c2e;
1320
+ border-bottom: 1px solid #3a3a3c;
1321
+ min-height: 60px;
1322
+ box-sizing: border-box;
1323
+
1324
+ @media (min-width: 640px) {
1325
+ padding: 12px;
1326
+ }
1327
+ `;
1328
+ var HeaderContent = styled4.div`
1329
+ display: flex;
1330
+ flex-direction: column;
1331
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1332
+ flex: 1;
1333
+ min-width: 0;
1334
+ `;
1335
+ var HeaderTitle = styled4.h1`
1336
+ margin: 0;
1337
+ font-size: 1rem;
1338
+ font-weight: 600;
1339
+ color: #e5e5e7;
1340
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1341
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1342
+ line-height: 1.5;
1343
+ overflow: hidden;
1344
+ text-overflow: ellipsis;
1345
+ white-space: nowrap;
1346
+ `;
1347
+ var HeaderSubtitle = styled4.p`
1348
+ margin: 0;
1349
+ font-size: 0.875rem;
1350
+ color: #8e8e93;
1351
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1352
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1353
+ line-height: 1.4;
1354
+ overflow: hidden;
1355
+ text-overflow: ellipsis;
1356
+ white-space: nowrap;
1357
+ `;
1358
+ var HeaderActions = styled4.div`
1359
+ display: flex;
1360
+ align-items: center;
1361
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1362
+ margin-left: ${({ theme }) => theme?.spacing?.md ?? "16px"};
1363
+ `;
1364
+ var ActionButton = styled4.button`
1365
+ display: inline-flex;
1366
+ align-items: center;
1367
+ justify-content: center;
1368
+ width: 32px;
1369
+ height: 32px;
1370
+ padding: 0;
1371
+ background-color: transparent;
1372
+ border: none;
1373
+ border-radius: 6px;
1374
+ color: #e5e5e7;
1375
+ cursor: pointer;
1376
+ transition: all 150ms ease;
1377
+
1378
+ &:hover:not(:disabled) {
1379
+ background-color: #3a3a3c;
1380
+ }
1381
+
1382
+ &:active:not(:disabled) {
1383
+ transform: scale(0.95);
1384
+ background-color: #48484a;
1385
+ }
1386
+
1387
+ &:focus-visible {
1388
+ outline: 2px solid #5B9FFF;
1389
+ outline-offset: 2px;
1390
+ }
1391
+
1392
+ &:disabled {
1393
+ cursor: not-allowed;
1394
+ opacity: 0.3;
1395
+ }
1396
+
1397
+ svg {
1398
+ width: 16px;
1399
+ height: 16px;
1400
+ display: block;
1401
+ }
1402
+ `;
1403
+ var Header = ({
1404
+ title,
1405
+ subtitle,
1406
+ onClose,
1407
+ onMinimize,
1408
+ className
1409
+ }) => {
1410
+ const minimizeRef = useRef(null);
1411
+ const closeRef = useRef(null);
1412
+ const { buttonProps: minimizeProps } = useButton(
1413
+ {
1414
+ onPress: onMinimize,
1415
+ "aria-label": "Minimize",
1416
+ isDisabled: !onMinimize
1417
+ },
1418
+ minimizeRef
1419
+ );
1420
+ const { buttonProps: closeProps } = useButton(
1421
+ {
1422
+ onPress: onClose,
1423
+ "aria-label": "Close",
1424
+ isDisabled: !onClose
1425
+ },
1426
+ closeRef
1427
+ );
1428
+ return /* @__PURE__ */ jsxs(HeaderContainer, { className, children: [
1429
+ /* @__PURE__ */ jsxs(HeaderContent, { children: [
1430
+ /* @__PURE__ */ jsx(HeaderTitle, { children: title }),
1431
+ subtitle && /* @__PURE__ */ jsx(HeaderSubtitle, { children: subtitle })
1432
+ ] }),
1433
+ /* @__PURE__ */ jsxs(HeaderActions, { children: [
1434
+ onMinimize && /* @__PURE__ */ jsx(ActionButton, { ref: minimizeRef, ...minimizeProps, "data-action": "minimize", children: /* @__PURE__ */ jsxs(
1435
+ "svg",
1436
+ {
1437
+ width: "16",
1438
+ height: "16",
1439
+ viewBox: "0 0 16 16",
1440
+ fill: "none",
1441
+ xmlns: "http://www.w3.org/2000/svg",
1442
+ "aria-hidden": "true",
1443
+ children: [
1444
+ /* @__PURE__ */ jsx("title", { children: "Minimize" }),
1445
+ /* @__PURE__ */ jsx("line", { x1: "3", y1: "8", x2: "13", y2: "8", stroke: "currentColor", strokeWidth: "2" })
1446
+ ]
1447
+ }
1448
+ ) }),
1449
+ onClose && /* @__PURE__ */ jsx(ActionButton, { ref: closeRef, ...closeProps, "data-action": "close", children: /* @__PURE__ */ jsxs(
1450
+ "svg",
1451
+ {
1452
+ width: "16",
1453
+ height: "16",
1454
+ viewBox: "0 0 16 16",
1455
+ fill: "none",
1456
+ xmlns: "http://www.w3.org/2000/svg",
1457
+ "aria-hidden": "true",
1458
+ children: [
1459
+ /* @__PURE__ */ jsx("title", { children: "Close" }),
1460
+ /* @__PURE__ */ jsx("line", { x1: "4", y1: "4", x2: "12", y2: "12", stroke: "currentColor", strokeWidth: "2" }),
1461
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "4", x2: "4", y2: "12", stroke: "currentColor", strokeWidth: "2" })
1462
+ ]
1463
+ }
1464
+ ) })
1465
+ ] })
1466
+ ] });
1467
+ };
1468
+ Header.displayName = "Header";
1469
+ var MessagesContainer = styled4.div`
1470
+ display: flex;
1471
+ flex-direction: column;
1472
+ flex: 1;
1473
+ overflow: hidden;
1474
+ background-color: #1c1c1e;
1475
+ padding: 8px;
1476
+ gap: 12px;
1477
+ box-sizing: border-box;
1478
+
1479
+ /* Ensure proper scrolling behavior for child components */
1480
+ position: relative;
1481
+ min-height: 0;
1482
+
1483
+ /* Desktop padding */
1484
+ @media (min-width: 640px) {
1485
+ padding: 12px;
1486
+ }
1487
+ `;
1488
+ var Messages = ({
1489
+ children,
1490
+ className,
1491
+ ariaLabel = "Messages"
1492
+ }) => {
1493
+ return /* @__PURE__ */ jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
1494
+ };
1495
+ Messages.displayName = "Messages";
1496
+ var WindowContainer = styled4.div`
1497
+ display: flex;
1498
+ flex-direction: column;
1499
+ background-color: #1c1c1e;
1500
+ border-radius: 0;
1501
+ box-shadow: none;
1502
+ overflow: hidden;
1503
+ transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
1504
+ position: relative;
1505
+
1506
+ /* Default dimensions */
1507
+ width: ${({ $width }) => $width};
1508
+ height: ${({ $height }) => $height};
1509
+
1510
+ /* Fullscreen state */
1511
+ ${({ $isFullscreen }) => $isFullscreen && css`
1512
+ width: 100vw;
1513
+ height: 100vh;
1514
+ border-radius: 0;
1515
+ box-shadow: none;
1516
+ position: fixed;
1517
+ top: 0;
1518
+ left: 0;
1519
+ z-index: 1000;
1520
+ `}
1521
+
1522
+ /* Minimized state */
1523
+ ${({ $isMinimized }) => $isMinimized && css`
1524
+ height: 60px;
1525
+ width: 300px;
1526
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
1527
+ cursor: pointer;
1528
+
1529
+ /* Hide all content except header when minimized */
1530
+ > *:not(:first-child) {
1531
+ display: none;
1532
+ }
1533
+
1534
+ /* Keep header visible but adjust styling */
1535
+ > *:first-child {
1536
+ border-bottom: none;
1537
+ }
1538
+ `}
1539
+
1540
+ /* Responsive behavior for smaller screens */
1541
+ @media (max-width: 768px) {
1542
+ ${({ $isFullscreen, $isMinimized }) => !$isFullscreen && !$isMinimized && css`
1543
+ width: 100vw;
1544
+ height: 100vh;
1545
+ border-radius: 0;
1546
+ max-width: 100%;
1547
+ max-height: 100%;
1548
+ `}
1549
+ }
1550
+
1551
+ /* Focus states for accessibility */
1552
+ &:focus-visible {
1553
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1554
+ outline-offset: 2px;
1555
+ }
1556
+
1557
+ /* Ensure proper stacking context */
1558
+ z-index: ${({ $isFullscreen }) => $isFullscreen ? 1e3 : 100};
1559
+ `;
1560
+ var Window = ({
1561
+ isMinimized = false,
1562
+ isFullscreen = false,
1563
+ width = "400px",
1564
+ height = "600px",
1565
+ children,
1566
+ className,
1567
+ ariaLabel = "Chat window"
1568
+ }) => {
1569
+ return /* @__PURE__ */ jsx(
1570
+ WindowContainer,
1571
+ {
1572
+ className,
1573
+ $isMinimized: isMinimized,
1574
+ $isFullscreen: isFullscreen,
1575
+ $width: width,
1576
+ $height: height,
1577
+ role: "dialog",
1578
+ "aria-label": ariaLabel,
1579
+ "aria-modal": "false",
1580
+ children
1581
+ }
1582
+ );
1583
+ };
1584
+ Window.displayName = "Window";
98
1585
  var GlobalSidebarStyles = createGlobalStyle`
99
1586
  /* Override CopilotKit's default positioning - start off-screen */
100
1587
  .copilotKitSidebar {
@@ -176,7 +1663,7 @@ var GlobalSidebarStyles = createGlobalStyle`
176
1663
  }
177
1664
  }
178
1665
  `;
179
- var StyledChatButton = styled.button`
1666
+ var StyledChatButton = styled4.button`
180
1667
  position: fixed;
181
1668
  bottom: 8px;
182
1669
  right: 8px;
@@ -298,6 +1785,601 @@ function CustomCopilotSidebar({
298
1785
  ] });
299
1786
  }
300
1787
  CustomCopilotSidebar.displayName = "CustomCopilotSidebar";
1788
+ var FooterContainer = styled4.footer`
1789
+ display: flex;
1790
+ align-items: center;
1791
+ justify-content: center;
1792
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
1793
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
1794
+ border-top: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
1795
+ min-height: 44px;
1796
+ `;
1797
+ var FooterContent = styled4.div`
1798
+ display: flex;
1799
+ align-items: center;
1800
+ justify-content: space-between;
1801
+ gap: ${({ theme }) => theme?.spacing?.md ?? "16px"};
1802
+ width: 100%;
1803
+ max-width: 100%;
1804
+ font-size: 0.75rem;
1805
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
1806
+ opacity: 0.6;
1807
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
1808
+ line-height: 1.4;
1809
+ `;
1810
+ var FooterBranding = styled4.div`
1811
+ display: flex;
1812
+ align-items: center;
1813
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1814
+ flex-shrink: 0;
1815
+ `;
1816
+ var FooterStatus = styled4.div`
1817
+ display: flex;
1818
+ align-items: center;
1819
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1820
+ overflow: hidden;
1821
+ text-overflow: ellipsis;
1822
+ white-space: nowrap;
1823
+ font-size: 0.75rem;
1824
+ opacity: 0.8;
1825
+ `;
1826
+ var FooterLink = styled4.a`
1827
+ color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1828
+ text-decoration: none;
1829
+ transition: opacity 150ms ease;
1830
+ cursor: pointer;
1831
+
1832
+ &:hover {
1833
+ opacity: 0.8;
1834
+ text-decoration: underline;
1835
+ }
1836
+
1837
+ &:focus-visible {
1838
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1839
+ outline-offset: 2px;
1840
+ border-radius: ${({ theme }) => theme?.radii?.sm ?? "4px"};
1841
+ }
1842
+ `;
1843
+ var Footer = ({
1844
+ branding,
1845
+ status,
1846
+ brandingUrl,
1847
+ onBrandingClick,
1848
+ className
1849
+ }) => {
1850
+ if (!branding && !status) {
1851
+ return null;
1852
+ }
1853
+ const handleBrandingClick = (e) => {
1854
+ if (onBrandingClick) {
1855
+ e.preventDefault();
1856
+ onBrandingClick();
1857
+ }
1858
+ };
1859
+ return /* @__PURE__ */ jsx(FooterContainer, { className, children: /* @__PURE__ */ jsxs(FooterContent, { children: [
1860
+ branding && /* @__PURE__ */ jsx(FooterBranding, { children: brandingUrl ? /* @__PURE__ */ jsx(
1861
+ FooterLink,
1862
+ {
1863
+ href: brandingUrl,
1864
+ onClick: handleBrandingClick,
1865
+ target: "_blank",
1866
+ rel: "noopener noreferrer",
1867
+ children: branding
1868
+ }
1869
+ ) : branding }),
1870
+ status && /* @__PURE__ */ jsx(FooterStatus, { children: status })
1871
+ ] }) });
1872
+ };
1873
+ Footer.displayName = "Footer";
1874
+ var InputContainer = styled4.div`
1875
+ display: flex;
1876
+ flex-direction: column;
1877
+ width: 100%;
1878
+ position: relative;
1879
+ `;
1880
+ var InputWrapper2 = styled4.div`
1881
+ display: flex;
1882
+ align-items: flex-end;
1883
+ gap: 8px;
1884
+ padding: 12px;
1885
+ background-color: #ffffff;
1886
+ border: 1px solid #e5e7eb;
1887
+ border-radius: 12px;
1888
+ transition: all 0.2s ease;
1889
+
1890
+ &:focus-within {
1891
+ border-color: #3b82f6;
1892
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
1893
+ }
1894
+
1895
+ &:hover:not(:focus-within) {
1896
+ border-color: #d1d5db;
1897
+ }
1898
+ `;
1899
+ var TextArea = styled4.textarea`
1900
+ flex: 1;
1901
+ min-height: 24px;
1902
+ max-height: ${(props) => `${(props.$maxRows || 5) * 24}px`};
1903
+ padding: 0;
1904
+ border: none;
1905
+ outline: none;
1906
+ resize: none;
1907
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1908
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1909
+ font-size: 14px;
1910
+ line-height: 24px;
1911
+ color: #111827;
1912
+ background: transparent;
1913
+ overflow-y: auto;
1914
+
1915
+ &::placeholder {
1916
+ color: #9ca3af;
1917
+ }
1918
+
1919
+ &:disabled {
1920
+ color: #9ca3af;
1921
+ cursor: not-allowed;
1922
+ }
1923
+
1924
+ &:read-only {
1925
+ cursor: default;
1926
+ }
1927
+
1928
+ /* Custom scrollbar */
1929
+ &::-webkit-scrollbar {
1930
+ width: 6px;
1931
+ }
1932
+
1933
+ &::-webkit-scrollbar-track {
1934
+ background: transparent;
1935
+ }
1936
+
1937
+ &::-webkit-scrollbar-thumb {
1938
+ background: #d1d5db;
1939
+ border-radius: 3px;
1940
+ }
1941
+
1942
+ &::-webkit-scrollbar-thumb:hover {
1943
+ background: #9ca3af;
1944
+ }
1945
+ `;
1946
+ var SendButton = styled4.button`
1947
+ display: flex;
1948
+ align-items: center;
1949
+ justify-content: center;
1950
+ width: 36px;
1951
+ height: 36px;
1952
+ padding: 0;
1953
+ border: none;
1954
+ border-radius: 8px;
1955
+ background-color: ${(props) => props.disabled ? "#e5e7eb" : "#3b82f6"};
1956
+ color: ${(props) => props.disabled ? "#9ca3af" : "#ffffff"};
1957
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
1958
+ transition: all 0.2s ease;
1959
+ flex-shrink: 0;
1960
+
1961
+ &:hover:not(:disabled) {
1962
+ background-color: #2563eb;
1963
+ transform: translateY(-1px);
1964
+ }
1965
+
1966
+ &:active:not(:disabled) {
1967
+ transform: translateY(0);
1968
+ }
1969
+
1970
+ &:focus-visible {
1971
+ outline: 2px solid #3b82f6;
1972
+ outline-offset: 2px;
1973
+ }
1974
+
1975
+ svg {
1976
+ width: 20px;
1977
+ height: 20px;
1978
+ }
1979
+ `;
1980
+ var Input = ({
1981
+ value = "",
1982
+ onChange,
1983
+ onSubmit,
1984
+ placeholder = "Type a message...",
1985
+ isDisabled = false,
1986
+ isReadOnly = false,
1987
+ maxRows = 5,
1988
+ autoFocus = false,
1989
+ className,
1990
+ "aria-label": ariaLabel = "Message input",
1991
+ ...ariaProps
1992
+ }) => {
1993
+ const textareaRef = useRef(null);
1994
+ const { inputProps } = useTextField(
1995
+ {
1996
+ ...ariaProps,
1997
+ "aria-label": ariaLabel,
1998
+ value,
1999
+ onChange: (newValue) => {
2000
+ onChange?.(newValue);
2001
+ },
2002
+ isDisabled,
2003
+ isReadOnly,
2004
+ inputElementType: "textarea"
2005
+ },
2006
+ textareaRef
2007
+ );
2008
+ const handleKeyDown = (e) => {
2009
+ if (e.key === "Enter" && !e.shiftKey) {
2010
+ e.preventDefault();
2011
+ if (value.trim() && onSubmit && !isDisabled && !isReadOnly) {
2012
+ onSubmit(value.trim());
2013
+ onChange?.("");
2014
+ }
2015
+ }
2016
+ };
2017
+ const handleSend = () => {
2018
+ if (value.trim() && onSubmit && !isDisabled && !isReadOnly) {
2019
+ onSubmit(value.trim());
2020
+ onChange?.("");
2021
+ textareaRef.current?.focus();
2022
+ }
2023
+ };
2024
+ const canSend = value.trim().length > 0 && !isDisabled && !isReadOnly;
2025
+ return /* @__PURE__ */ jsx(InputContainer, { className, children: /* @__PURE__ */ jsxs(InputWrapper2, { children: [
2026
+ /* @__PURE__ */ jsx(
2027
+ TextArea,
2028
+ {
2029
+ ...inputProps,
2030
+ ref: textareaRef,
2031
+ placeholder,
2032
+ onKeyDown: handleKeyDown,
2033
+ $maxRows: maxRows,
2034
+ autoFocus,
2035
+ disabled: isDisabled,
2036
+ readOnly: isReadOnly
2037
+ }
2038
+ ),
2039
+ /* @__PURE__ */ jsx(
2040
+ SendButton,
2041
+ {
2042
+ type: "button",
2043
+ onClick: handleSend,
2044
+ disabled: !canSend,
2045
+ "aria-label": "Send message",
2046
+ title: "Send message (Enter)",
2047
+ children: /* @__PURE__ */ jsxs(
2048
+ "svg",
2049
+ {
2050
+ width: "20",
2051
+ height: "20",
2052
+ viewBox: "0 0 20 20",
2053
+ fill: "none",
2054
+ xmlns: "http://www.w3.org/2000/svg",
2055
+ role: "img",
2056
+ "aria-hidden": "true",
2057
+ children: [
2058
+ /* @__PURE__ */ jsx("title", { children: "Send Icon" }),
2059
+ /* @__PURE__ */ jsx(
2060
+ "path",
2061
+ {
2062
+ d: "M2.5 10L17.5 3.75L11.25 18.75L10 12.5L2.5 10Z",
2063
+ stroke: "currentColor",
2064
+ strokeWidth: "2",
2065
+ strokeLinecap: "round",
2066
+ strokeLinejoin: "round"
2067
+ }
2068
+ )
2069
+ ]
2070
+ }
2071
+ )
2072
+ }
2073
+ )
2074
+ ] }) });
2075
+ };
2076
+ var MessagesListContainer = styled4.div`
2077
+ display: flex;
2078
+ flex-direction: column;
2079
+ width: 100%;
2080
+ max-height: ${(props) => props.$maxHeight};
2081
+ overflow-y: auto;
2082
+ overflow-x: hidden;
2083
+ position: relative;
2084
+ background: #ffffff;
2085
+ border: 1px solid #e5e7eb;
2086
+ border-radius: 8px;
2087
+ scroll-behavior: smooth;
2088
+
2089
+ /* Custom scrollbar styling */
2090
+ &::-webkit-scrollbar {
2091
+ width: 8px;
2092
+ }
2093
+
2094
+ &::-webkit-scrollbar-track {
2095
+ background: #f1f5f9;
2096
+ border-radius: 4px;
2097
+ }
2098
+
2099
+ &::-webkit-scrollbar-thumb {
2100
+ background: #cbd5e1;
2101
+ border-radius: 4px;
2102
+ transition: background 0.2s ease;
2103
+ }
2104
+
2105
+ &::-webkit-scrollbar-thumb:hover {
2106
+ background: #94a3b8;
2107
+ }
2108
+
2109
+ /* Firefox scrollbar styling */
2110
+ scrollbar-width: thin;
2111
+ scrollbar-color: #cbd5e1 #f1f5f9;
2112
+
2113
+ /* Ensure proper rendering on mobile */
2114
+ -webkit-overflow-scrolling: touch;
2115
+ `;
2116
+ var MessagesListContent = styled4.div`
2117
+ display: flex;
2118
+ flex-direction: column;
2119
+ gap: 12px;
2120
+ padding: 16px;
2121
+ min-height: min-content;
2122
+
2123
+ /* Message styling */
2124
+ .message {
2125
+ display: flex;
2126
+ flex-direction: column;
2127
+ gap: 4px;
2128
+ padding: 12px 16px;
2129
+ border-radius: 8px;
2130
+ max-width: 85%;
2131
+ word-wrap: break-word;
2132
+ animation: messageSlideIn 0.2s ease-out;
2133
+ }
2134
+
2135
+ @keyframes messageSlideIn {
2136
+ from {
2137
+ opacity: 0;
2138
+ transform: translateY(8px);
2139
+ }
2140
+ to {
2141
+ opacity: 1;
2142
+ transform: translateY(0);
2143
+ }
2144
+ }
2145
+
2146
+ /* Role-specific message styling */
2147
+ .message--user {
2148
+ align-self: flex-end;
2149
+ background: #3b82f6;
2150
+ color: #ffffff;
2151
+ border-bottom-right-radius: 4px;
2152
+ }
2153
+
2154
+ .message--assistant {
2155
+ align-self: flex-start;
2156
+ background: #f1f5f9;
2157
+ color: #1e293b;
2158
+ border-bottom-left-radius: 4px;
2159
+ }
2160
+
2161
+ .message--system {
2162
+ align-self: center;
2163
+ background: #fef3c7;
2164
+ color: #92400e;
2165
+ font-size: 0.875rem;
2166
+ font-style: italic;
2167
+ max-width: 100%;
2168
+ text-align: center;
2169
+ }
2170
+ `;
2171
+ var MessagesList = ({
2172
+ messages,
2173
+ autoScroll = true,
2174
+ className,
2175
+ renderMessage,
2176
+ onScrollTop,
2177
+ maxHeight = "600px"
2178
+ }) => {
2179
+ const containerRef = useRef(null);
2180
+ const contentRef = useRef(null);
2181
+ const isUserScrollingRef = useRef(false);
2182
+ const scrollTimeoutRef = useRef(null);
2183
+ useEffect(() => {
2184
+ if (autoScroll && !isUserScrollingRef.current && containerRef.current) {
2185
+ const container = containerRef.current;
2186
+ container.scrollTop = container.scrollHeight;
2187
+ }
2188
+ }, [messages.length, autoScroll]);
2189
+ const handleScroll = () => {
2190
+ if (!containerRef.current) return;
2191
+ const container = containerRef.current;
2192
+ const isAtBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 10;
2193
+ isUserScrollingRef.current = !isAtBottom;
2194
+ if (scrollTimeoutRef.current) {
2195
+ clearTimeout(scrollTimeoutRef.current);
2196
+ }
2197
+ scrollTimeoutRef.current = setTimeout(() => {
2198
+ isUserScrollingRef.current = false;
2199
+ }, 1e3);
2200
+ if (container.scrollTop === 0 && onScrollTop) {
2201
+ onScrollTop();
2202
+ }
2203
+ };
2204
+ useEffect(() => {
2205
+ return () => {
2206
+ if (scrollTimeoutRef.current) {
2207
+ clearTimeout(scrollTimeoutRef.current);
2208
+ }
2209
+ };
2210
+ }, []);
2211
+ const defaultRenderMessage = (message) => /* @__PURE__ */ jsx(
2212
+ "div",
2213
+ {
2214
+ className: `message message--${message.role}`,
2215
+ "data-message-id": message.id,
2216
+ "data-role": message.role,
2217
+ children: message.content
2218
+ },
2219
+ message.id
2220
+ );
2221
+ return /* @__PURE__ */ jsx(
2222
+ MessagesListContainer,
2223
+ {
2224
+ ref: containerRef,
2225
+ onScroll: handleScroll,
2226
+ className,
2227
+ $maxHeight: maxHeight,
2228
+ children: /* @__PURE__ */ jsx(MessagesListContent, { ref: contentRef, children: messages.map(renderMessage || defaultRenderMessage) })
2229
+ }
2230
+ );
2231
+ };
2232
+ var StyledUserMessage2 = styled4.div`
2233
+ display: flex;
2234
+ justify-content: flex-end;
2235
+ align-items: flex-start;
2236
+ margin: 8px 0;
2237
+ padding: 0 16px;
2238
+ width: 100%;
2239
+ `;
2240
+ var MessageBubble = styled4.div`
2241
+ display: flex;
2242
+ flex-direction: column;
2243
+ max-width: 70%;
2244
+ padding: 12px 16px;
2245
+ border-radius: 18px 18px 4px 18px;
2246
+
2247
+ /* User message colors - distinct from assistant messages */
2248
+ background-color: #007AFF;
2249
+ color: #FFFFFF;
2250
+
2251
+ /* Box shadow for depth */
2252
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
2253
+
2254
+ /* Smooth transitions */
2255
+ transition: all 0.2s ease-in-out;
2256
+
2257
+ &:hover {
2258
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
2259
+ }
2260
+
2261
+ /* Username styling */
2262
+ strong {
2263
+ font-size: 12px;
2264
+ font-weight: 600;
2265
+ margin-bottom: 4px;
2266
+ opacity: 0.9;
2267
+ }
2268
+ `;
2269
+ var MessageContent2 = styled4.p`
2270
+ margin: 0;
2271
+ font-size: 14px;
2272
+ line-height: 1.5;
2273
+ word-wrap: break-word;
2274
+ white-space: pre-wrap;
2275
+ `;
2276
+ var MessageTime = styled4.time`
2277
+ font-size: 11px;
2278
+ opacity: 0.7;
2279
+ margin-top: 4px;
2280
+ text-align: right;
2281
+ `;
2282
+ var UserMessage2 = ({
2283
+ content,
2284
+ timestamp,
2285
+ className,
2286
+ avatarUrl,
2287
+ username
2288
+ }) => {
2289
+ return /* @__PURE__ */ jsxs(StyledUserMessage2, { className, children: [
2290
+ /* @__PURE__ */ jsxs(MessageBubble, { children: [
2291
+ username && /* @__PURE__ */ jsx("strong", { children: username }),
2292
+ /* @__PURE__ */ jsx(MessageContent2, { children: content }),
2293
+ timestamp && /* @__PURE__ */ jsx(MessageTime, { children: timestamp })
2294
+ ] }),
2295
+ avatarUrl && /* @__PURE__ */ jsx(
2296
+ "img",
2297
+ {
2298
+ src: avatarUrl,
2299
+ alt: username || "User",
2300
+ style: { width: "32px", height: "32px", borderRadius: "50%", marginLeft: "8px" }
2301
+ }
2302
+ )
2303
+ ] });
2304
+ };
2305
+ var SuggestionsContainer = styled4.div`
2306
+ display: flex;
2307
+ flex-wrap: wrap;
2308
+ gap: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
2309
+ padding: ${({ theme }) => theme?.spacing?.md ?? "16px"} 0;
2310
+ `;
2311
+ var StyledSuggestion = styled4.button`
2312
+ /* Base styles */
2313
+ display: inline-flex;
2314
+ align-items: center;
2315
+ justify-content: center;
2316
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
2317
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
2318
+ font-size: 0.875rem;
2319
+ font-weight: 500;
2320
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
2321
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
2322
+ border: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
2323
+ border-radius: ${({ theme }) => theme?.radii?.lg ?? "12px"};
2324
+ cursor: pointer;
2325
+ transition: all 0.2s ease-in-out;
2326
+ white-space: nowrap;
2327
+ user-select: none;
2328
+
2329
+ /* Hover state */
2330
+ &:hover:not(:disabled) {
2331
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
2332
+ border-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
2333
+ transform: translateY(-1px);
2334
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
2335
+ }
2336
+
2337
+ /* Active/Pressed state */
2338
+ &:active:not(:disabled) {
2339
+ transform: translateY(0);
2340
+ box-shadow: none;
2341
+ }
2342
+
2343
+ ${({ $isPressed }) => $isPressed && css`
2344
+ transform: scale(0.98);
2345
+ `}
2346
+
2347
+ /* Focus state */
2348
+ &:focus-visible {
2349
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
2350
+ outline-offset: 2px;
2351
+ }
2352
+
2353
+ /* Remove default focus outline */
2354
+ &:focus {
2355
+ outline: none;
2356
+ }
2357
+
2358
+ /* Disabled state */
2359
+ &:disabled {
2360
+ cursor: not-allowed;
2361
+ opacity: 0.5;
2362
+ transform: none;
2363
+ }
2364
+ `;
2365
+ function Suggestions({ suggestions, onSelect, className }) {
2366
+ if (suggestions.length === 0) {
2367
+ return null;
2368
+ }
2369
+ return /* @__PURE__ */ jsx(SuggestionsContainer, { className, role: "list", "aria-label": "Suggested prompts", children: suggestions.map((suggestion) => /* @__PURE__ */ jsx(SuggestionChip, { suggestion, onSelect }, suggestion)) });
2370
+ }
2371
+ function SuggestionChip({ suggestion, onSelect }) {
2372
+ const ref = useRef(null);
2373
+ const { buttonProps, isPressed } = useButton(
2374
+ {
2375
+ onPress: () => onSelect(suggestion),
2376
+ "aria-label": `Select suggestion: ${suggestion}`
2377
+ },
2378
+ ref
2379
+ );
2380
+ return /* @__PURE__ */ jsx(StyledSuggestion, { ...buttonProps, ref, $isPressed: isPressed, role: "listitem", children: suggestion });
2381
+ }
2382
+ Suggestions.displayName = "Suggestions";
301
2383
  var GlobalSidebarStyles2 = createGlobalStyle`
302
2384
  /* Override CopilotKit's default positioning - start off-screen */
303
2385
  .copilotKitSidebar {
@@ -406,7 +2488,7 @@ var GlobalSidebarStyles2 = createGlobalStyle`
406
2488
  }
407
2489
  }
408
2490
  `;
409
- var StyledChatButton2 = styled.button`
2491
+ var StyledChatButton2 = styled4.button`
410
2492
  position: fixed;
411
2493
  bottom: 8px;
412
2494
  right: 8px;
@@ -537,6 +2619,6 @@ var CustomCopilotSidebar2 = ({
537
2619
  };
538
2620
  CustomCopilotSidebar2.displayName = "CustomCopilotSidebar";
539
2621
 
540
- export { AssistantMessageAdapter, CustomCopilotSidebar, InputAdapter, CustomCopilotSidebar2 as IntegratedSidebar, UserMessageAdapter };
2622
+ export { Actions, AgentState, AssistantMessage, AssistantMessageAdapter, Button, CustomCopilotSidebar, FileAttachment, Footer, Header, Input, InputAdapter, CustomCopilotSidebar2 as IntegratedSidebar, Messages, MessagesList, MessagesListContainer, MessagesListContent, Response, Suggestions, UserMessage2 as UserMessage, UserMessageAdapter, Window };
541
2623
  //# sourceMappingURL=index.js.map
542
2624
  //# sourceMappingURL=index.js.map