@copilotkit/react-ui 0.22.0 → 0.36.0-mme-pre.1

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 (165) hide show
  1. package/.turbo/turbo-build.log +211 -178
  2. package/CHANGELOG.md +24 -0
  3. package/dist/chunk-4MKP23AD.mjs +97 -0
  4. package/dist/chunk-4MKP23AD.mjs.map +1 -0
  5. package/dist/{chunk-T3WYKWNC.mjs → chunk-6XLZXLM5.mjs} +6 -6
  6. package/dist/chunk-6XLZXLM5.mjs.map +1 -0
  7. package/dist/{chunk-73EBDGYK.mjs → chunk-7FES2IQA.mjs} +5 -5
  8. package/dist/chunk-7FES2IQA.mjs.map +1 -0
  9. package/dist/chunk-ANO23V2M.mjs +135 -0
  10. package/dist/chunk-ANO23V2M.mjs.map +1 -0
  11. package/dist/chunk-BL65ZC6L.mjs +83 -0
  12. package/dist/chunk-BL65ZC6L.mjs.map +1 -0
  13. package/dist/{chunk-YEHO5VMA.mjs → chunk-CE7PJAAO.mjs} +2 -2
  14. package/dist/{chunk-7YXG7D47.mjs → chunk-FZC7X5PK.mjs} +57 -2
  15. package/dist/chunk-FZC7X5PK.mjs.map +1 -0
  16. package/dist/chunk-LTCJCXCP.mjs +29 -0
  17. package/dist/chunk-LTCJCXCP.mjs.map +1 -0
  18. package/dist/chunk-MRFF7GSQ.mjs +1 -0
  19. package/dist/{chunk-7JYUCW7H.mjs → chunk-PAQWLSA4.mjs} +2 -2
  20. package/dist/{chunk-YTIGBBTC.mjs → chunk-RT2XG2T7.mjs} +2 -2
  21. package/dist/chunk-RT2XG2T7.mjs.map +1 -0
  22. package/dist/chunk-T26KLXLH.mjs +1 -0
  23. package/dist/{chunk-6U3O2JZP.mjs → chunk-T3JTSIHT.mjs} +32 -39
  24. package/dist/chunk-T3JTSIHT.mjs.map +1 -0
  25. package/dist/{chunk-MBYUBR3F.mjs → chunk-UPTB2MVO.mjs} +2 -2
  26. package/dist/chunk-VUZA5AFH.mjs +73 -0
  27. package/dist/chunk-VUZA5AFH.mjs.map +1 -0
  28. package/dist/{chunk-YAORLSQ3.mjs → chunk-XRODMID5.mjs} +6 -6
  29. package/dist/chunk-XRODMID5.mjs.map +1 -0
  30. package/dist/{chunk-WDHLWSSU.mjs → chunk-YQ3D5IQV.mjs} +2 -2
  31. package/dist/{chunk-WM6BS77F.mjs → chunk-YQFVRDNC.mjs} +2 -2
  32. package/dist/{chunk-WM6BS77F.mjs.map → chunk-YQFVRDNC.mjs.map} +1 -1
  33. package/dist/chunk-ZO3GLN23.mjs +137 -0
  34. package/dist/chunk-ZO3GLN23.mjs.map +1 -0
  35. package/dist/components/chat/Button.js.map +1 -1
  36. package/dist/components/chat/Button.mjs +3 -3
  37. package/dist/components/chat/Chat.d.ts +66 -46
  38. package/dist/components/chat/Chat.js +433 -278
  39. package/dist/components/chat/Chat.js.map +1 -1
  40. package/dist/components/chat/Chat.mjs +15 -14
  41. package/dist/components/chat/ChatContext.d.ts +16 -16
  42. package/dist/components/chat/ChatContext.js +43 -27
  43. package/dist/components/chat/ChatContext.js.map +1 -1
  44. package/dist/components/chat/ChatContext.mjs +2 -2
  45. package/dist/components/chat/CodeBlock.js.map +1 -1
  46. package/dist/components/chat/CodeBlock.mjs +2 -2
  47. package/dist/components/chat/Header.js.map +1 -1
  48. package/dist/components/chat/Header.mjs +3 -3
  49. package/dist/components/chat/Icons.d.ts +7 -5
  50. package/dist/components/chat/Icons.js +57 -0
  51. package/dist/components/chat/Icons.js.map +1 -1
  52. package/dist/components/chat/Icons.mjs +5 -1
  53. package/dist/components/chat/Input.d.ts +1 -1
  54. package/dist/components/chat/Input.js +148 -11
  55. package/dist/components/chat/Input.js.map +1 -1
  56. package/dist/components/chat/Input.mjs +5 -4
  57. package/dist/components/chat/Markdown.js.map +1 -1
  58. package/dist/components/chat/Markdown.mjs +3 -3
  59. package/dist/components/chat/Messages.d.ts +1 -1
  60. package/dist/components/chat/Messages.js +2 -2
  61. package/dist/components/chat/Messages.js.map +1 -1
  62. package/dist/components/chat/Messages.mjs +5 -5
  63. package/dist/components/chat/Modal.d.ts +50 -0
  64. package/dist/components/chat/Modal.js +1584 -0
  65. package/dist/components/chat/Modal.js.map +1 -0
  66. package/dist/components/chat/Modal.mjs +23 -0
  67. package/dist/components/chat/Modal.mjs.map +1 -0
  68. package/dist/components/chat/Popup.d.ts +56 -4
  69. package/dist/components/chat/Popup.js +428 -78
  70. package/dist/components/chat/Popup.js.map +1 -1
  71. package/dist/components/chat/Popup.mjs +15 -12
  72. package/dist/components/chat/Response.js.map +1 -1
  73. package/dist/components/chat/Response.mjs +3 -3
  74. package/dist/components/chat/Sidebar.d.ts +7 -8
  75. package/dist/components/chat/Sidebar.js +430 -80
  76. package/dist/components/chat/Sidebar.js.map +1 -1
  77. package/dist/components/chat/Sidebar.mjs +15 -12
  78. package/dist/components/chat/Suggestion.d.ts +13 -0
  79. package/dist/components/chat/Suggestion.js +172 -0
  80. package/dist/components/chat/Suggestion.js.map +1 -0
  81. package/dist/components/chat/Suggestion.mjs +11 -0
  82. package/dist/components/chat/Suggestion.mjs.map +1 -0
  83. package/dist/components/chat/Textarea.d.ts +4 -4
  84. package/dist/components/chat/Textarea.js +1 -1
  85. package/dist/components/chat/Textarea.js.map +1 -1
  86. package/dist/components/chat/Textarea.mjs +1 -1
  87. package/dist/components/chat/index.d.ts +4 -2
  88. package/dist/components/chat/index.js +436 -84
  89. package/dist/components/chat/index.js.map +1 -1
  90. package/dist/components/chat/index.mjs +22 -16
  91. package/dist/components/chat/props.d.ts +10 -3
  92. package/dist/components/chat/props.js.map +1 -1
  93. package/dist/components/index.d.ts +4 -2
  94. package/dist/components/index.js +436 -84
  95. package/dist/components/index.js.map +1 -1
  96. package/dist/components/index.mjs +22 -16
  97. package/dist/hooks/index.d.ts +1 -2
  98. package/dist/hooks/index.js +36 -0
  99. package/dist/hooks/index.js.map +1 -1
  100. package/dist/hooks/index.mjs +8 -1
  101. package/dist/hooks/use-copilot-chat-suggestions.d.ts +87 -0
  102. package/dist/hooks/use-copilot-chat-suggestions.js +53 -0
  103. package/dist/hooks/use-copilot-chat-suggestions.js.map +1 -0
  104. package/dist/hooks/use-copilot-chat-suggestions.mjs +8 -0
  105. package/dist/hooks/use-copilot-chat-suggestions.mjs.map +1 -0
  106. package/dist/hooks/use-push-to-talk.d.ts +19 -0
  107. package/dist/hooks/use-push-to-talk.js +177 -0
  108. package/dist/hooks/use-push-to-talk.js.map +1 -0
  109. package/dist/hooks/use-push-to-talk.mjs +12 -0
  110. package/dist/hooks/use-push-to-talk.mjs.map +1 -0
  111. package/dist/index.css +101 -13
  112. package/dist/index.css.map +1 -1
  113. package/dist/index.d.ts +5 -2
  114. package/dist/index.js +465 -86
  115. package/dist/index.js.map +1 -1
  116. package/dist/index.mjs +29 -19
  117. package/dist/types/suggestions.d.ts +8 -0
  118. package/dist/types/suggestions.js +19 -0
  119. package/dist/types/suggestions.js.map +1 -0
  120. package/dist/types/suggestions.mjs +1 -0
  121. package/dist/types/suggestions.mjs.map +1 -0
  122. package/package.json +6 -6
  123. package/src/components/chat/Button.tsx +1 -2
  124. package/src/components/chat/Chat.tsx +163 -104
  125. package/src/components/chat/ChatContext.tsx +36 -38
  126. package/src/components/chat/Icons.tsx +44 -0
  127. package/src/components/chat/Input.tsx +38 -7
  128. package/src/components/chat/Messages.tsx +3 -3
  129. package/src/components/chat/Modal.tsx +115 -0
  130. package/src/components/chat/Popup.tsx +53 -7
  131. package/src/components/chat/Sidebar.tsx +62 -9
  132. package/src/components/chat/Suggestion.tsx +109 -0
  133. package/src/components/chat/Textarea.tsx +1 -1
  134. package/src/components/chat/index.tsx +1 -0
  135. package/src/components/chat/props.ts +10 -2
  136. package/src/css/input.css +18 -8
  137. package/src/css/messages.css +7 -1
  138. package/src/css/panel.css +38 -0
  139. package/src/css/response.css +1 -4
  140. package/src/css/suggestions.css +35 -0
  141. package/src/css/window.css +3 -1
  142. package/src/hooks/index.ts +1 -1
  143. package/src/hooks/use-copilot-chat-suggestions.tsx +117 -0
  144. package/src/hooks/use-push-to-talk.tsx +162 -0
  145. package/src/styles.css +2 -0
  146. package/src/types/suggestions.ts +6 -0
  147. package/typedoc.json +4 -0
  148. package/dist/chunk-6U3O2JZP.mjs.map +0 -1
  149. package/dist/chunk-73EBDGYK.mjs.map +0 -1
  150. package/dist/chunk-7LMXXGJT.mjs +0 -75
  151. package/dist/chunk-7LMXXGJT.mjs.map +0 -1
  152. package/dist/chunk-7YXG7D47.mjs.map +0 -1
  153. package/dist/chunk-H4VKQGVU.mjs +0 -1
  154. package/dist/chunk-KE3N45ZY.mjs +0 -63
  155. package/dist/chunk-KE3N45ZY.mjs.map +0 -1
  156. package/dist/chunk-T3WYKWNC.mjs.map +0 -1
  157. package/dist/chunk-UGQQ4WEQ.mjs +0 -1
  158. package/dist/chunk-YAORLSQ3.mjs.map +0 -1
  159. package/dist/chunk-YTIGBBTC.mjs.map +0 -1
  160. /package/dist/{chunk-YEHO5VMA.mjs.map → chunk-CE7PJAAO.mjs.map} +0 -0
  161. /package/dist/{chunk-H4VKQGVU.mjs.map → chunk-MRFF7GSQ.mjs.map} +0 -0
  162. /package/dist/{chunk-7JYUCW7H.mjs.map → chunk-PAQWLSA4.mjs.map} +0 -0
  163. /package/dist/{chunk-UGQQ4WEQ.mjs.map → chunk-T26KLXLH.mjs.map} +0 -0
  164. /package/dist/{chunk-MBYUBR3F.mjs.map → chunk-UPTB2MVO.mjs.map} +0 -0
  165. /package/dist/{chunk-WDHLWSSU.mjs.map → chunk-YQ3D5IQV.mjs.map} +0 -0
@@ -1,8 +1,55 @@
1
- import React from 'react';
2
1
  import { CopilotChatIcons, CopilotChatLabels } from './ChatContext.js';
2
+ import React__default from 'react';
3
3
  import { SystemMessageFunction } from '@copilotkit/react-core';
4
- import { WindowProps, ButtonProps, HeaderProps, MessagesProps, InputProps, ResponseButtonProps } from './props.js';
5
- import '@copilotkit/shared';
4
+ import { CopilotChatSuggestion } from '../../types/suggestions.js';
5
+ import { Message } from '@copilotkit/shared';
6
+ import { MessagesProps, InputProps, ResponseButtonProps } from './props.js';
7
+
8
+ /**
9
+ * An embeddable chat panel for CopilotKit.
10
+ *
11
+ * <img src="/images/CopilotChat/CopilotChat.gif" width="500" />
12
+ *
13
+ * A chatbot panel component for the CopilotKit framework. The component allows for a high degree
14
+ * of customization through various props and custom CSS.
15
+ *
16
+ * <RequestExample>
17
+ * ```jsx CopilotChat Example
18
+ * import { CopilotChat } from "@copilotkit/react-ui";
19
+ *
20
+ * <CopilotChat
21
+ * labels={{
22
+ * title: "Your Assistant",
23
+ * initial: "Hi! 👋 How can I assist you today?",
24
+ * }}
25
+ * />
26
+ * ```
27
+ * </RequestExample>
28
+ *
29
+ * ## Custom CSS
30
+ *
31
+ * You can customize the colors of the panel by overriding the CSS variables
32
+ * defined in the [default styles](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-ui/src/css/colors.css).
33
+ *
34
+ * For example, to set the primary color to purple:
35
+ *
36
+ * ```jsx
37
+ * <div style={{ "--copilot-kit-primary-color": "#7D5BA6" }}>
38
+ * <CopilotPopup />
39
+ * </div>
40
+ * ```
41
+ *
42
+ * To further customize the panel, you can override the CSS classes defined
43
+ * [here](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-ui/src/css/).
44
+ *
45
+ * For example:
46
+ *
47
+ * ```css
48
+ * .copilotKitButton {
49
+ * border-radius: 0;
50
+ * }
51
+ * ```
52
+ */
6
53
 
7
54
  /**
8
55
  * Props for CopilotChat component.
@@ -17,25 +64,6 @@ interface CopilotChatProps {
17
64
  * user's needs or the application's requirements.
18
65
  */
19
66
  instructions?: string;
20
- /**
21
- * Whether the chat window should be open by default.
22
- * @default false
23
- */
24
- defaultOpen?: boolean;
25
- /**
26
- * If the chat window should close when the user clicks outside of it.
27
- * @default true
28
- */
29
- clickOutsideToClose?: boolean;
30
- /**
31
- * If the chat window should close when the user hits the Escape key.
32
- * @default true
33
- */
34
- hitEscapeToClose?: boolean;
35
- /**
36
- * A callback that gets called when the chat window opens or closes.
37
- */
38
- onSetOpen?: (open: boolean) => void;
39
67
  /**
40
68
  * A callback that gets called when the in progress state changes.
41
69
  */
@@ -44,12 +72,6 @@ interface CopilotChatProps {
44
72
  * A callback that gets called when a new message it submitted.
45
73
  */
46
74
  onSubmitMessage?: (message: string) => void;
47
- /**
48
- * The shortcut key to open the chat window.
49
- * Uses Command-<shortcut> on a Mac and Ctrl-<shortcut> on Windows.
50
- * @default "e"
51
- */
52
- shortcut?: string;
53
75
  /**
54
76
  * Icons can be used to set custom icons for the chat window.
55
77
  */
@@ -70,30 +92,18 @@ interface CopilotChatProps {
70
92
  * @default true
71
93
  */
72
94
  showResponseButton?: boolean;
73
- /**
74
- * A custom Window component to use instead of the default.
75
- */
76
- Window?: React.ComponentType<WindowProps>;
77
- /**
78
- * A custom Button component to use instead of the default.
79
- */
80
- Button?: React.ComponentType<ButtonProps>;
81
- /**
82
- * A custom Header component to use instead of the default.
83
- */
84
- Header?: React.ComponentType<HeaderProps>;
85
95
  /**
86
96
  * A custom Messages component to use instead of the default.
87
97
  */
88
- Messages?: React.ComponentType<MessagesProps>;
98
+ Messages?: React__default.ComponentType<MessagesProps>;
89
99
  /**
90
100
  * A custom Input component to use instead of the default.
91
101
  */
92
- Input?: React.ComponentType<InputProps>;
102
+ Input?: React__default.ComponentType<InputProps>;
93
103
  /**
94
104
  * A custom ResponseButton component to use instead of the default.
95
105
  */
96
- ResponseButton?: React.ComponentType<ResponseButtonProps>;
106
+ ResponseButton?: React__default.ComponentType<ResponseButtonProps>;
97
107
  /**
98
108
  * A class name to apply to the root element.
99
109
  */
@@ -101,8 +111,18 @@ interface CopilotChatProps {
101
111
  /**
102
112
  * Children to render.
103
113
  */
104
- children?: React.ReactNode;
114
+ children?: React__default.ReactNode;
105
115
  }
106
- declare const CopilotChat: ({ instructions, defaultOpen, clickOutsideToClose, hitEscapeToClose, onSetOpen, onSubmitMessage, shortcut, icons, labels, makeSystemMessage, showResponseButton, onInProgress, Window, Button, Header, Messages, Input, ResponseButton, className, children, }: CopilotChatProps) => JSX.Element;
116
+ declare function CopilotChat({ instructions, onSubmitMessage, icons, labels, makeSystemMessage, showResponseButton, onInProgress, Messages, Input, ResponseButton, className, }: CopilotChatProps): JSX.Element;
117
+ declare const useCopilotChatLogic: (instructions?: string, makeSystemMessage?: SystemMessageFunction, onInProgress?: ((isLoading: boolean) => void) | undefined, onSubmitMessage?: ((messageContent: string) => void) | undefined) => {
118
+ visibleMessages: Message[];
119
+ isLoading: boolean;
120
+ currentSuggestions: CopilotChatSuggestion[];
121
+ sendMessage: (messageContent: string) => Promise<Message>;
122
+ stop: () => void;
123
+ reload: () => Promise<void>;
124
+ input: string;
125
+ setInput: React__default.Dispatch<React__default.SetStateAction<string>>;
126
+ };
107
127
 
108
- export { CopilotChat, CopilotChatProps };
128
+ export { CopilotChat, CopilotChatProps, useCopilotChatLogic };