@copilotkit/react-ui 1.10.0-next.4 → 1.10.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/{chunk-WYEGK6BP.mjs → chunk-BXX6RM44.mjs} +2 -2
- package/dist/chunk-BXX6RM44.mjs.map +1 -0
- package/dist/chunk-BY42E5VF.mjs +203 -0
- package/dist/chunk-BY42E5VF.mjs.map +1 -0
- package/dist/{chunk-P6O2MZGT.mjs → chunk-K344MVUT.mjs} +58 -5
- package/dist/chunk-K344MVUT.mjs.map +1 -0
- package/dist/{chunk-2TABXABK.mjs → chunk-MYWIJSW6.mjs} +2 -2
- package/dist/chunk-MYWIJSW6.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +10 -5
- package/dist/components/chat/Chat.js +54 -7
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +1 -1
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +157 -52
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +2 -2
- package/dist/components/chat/Popup.js +157 -52
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +3 -3
- package/dist/components/chat/Sidebar.js +157 -52
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +3 -3
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/chat/index.js +157 -52
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +4 -4
- package/dist/components/chat/props.d.ts +39 -1
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +157 -52
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +161 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/package.json +4 -4
- package/src/components/chat/Chat.tsx +98 -4
- package/src/components/chat/Modal.tsx +107 -41
- package/src/components/chat/Popup.tsx +20 -0
- package/src/components/chat/Sidebar.tsx +22 -0
- package/src/components/chat/props.ts +46 -0
- package/dist/chunk-2TABXABK.mjs.map +0 -1
- package/dist/chunk-P6O2MZGT.mjs.map +0 -1
- package/dist/chunk-QKDRZ7WA.mjs +0 -144
- package/dist/chunk-QKDRZ7WA.mjs.map +0 -1
- package/dist/chunk-WYEGK6BP.mjs.map +0 -1
package/dist/chunk-QKDRZ7WA.mjs
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Window
|
|
3
|
-
} from "./chunk-C3GSYRC3.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Header
|
|
6
|
-
} from "./chunk-GDSZGYCE.mjs";
|
|
7
|
-
import {
|
|
8
|
-
Button
|
|
9
|
-
} from "./chunk-UFN2VWSR.mjs";
|
|
10
|
-
import {
|
|
11
|
-
CopilotChat
|
|
12
|
-
} from "./chunk-P6O2MZGT.mjs";
|
|
13
|
-
import {
|
|
14
|
-
AssistantMessage
|
|
15
|
-
} from "./chunk-GCKKSSBU.mjs";
|
|
16
|
-
import {
|
|
17
|
-
UserMessage
|
|
18
|
-
} from "./chunk-VVL6JFCJ.mjs";
|
|
19
|
-
import {
|
|
20
|
-
Input
|
|
21
|
-
} from "./chunk-DTRPPNSA.mjs";
|
|
22
|
-
import {
|
|
23
|
-
Messages
|
|
24
|
-
} from "./chunk-U5ATIGWH.mjs";
|
|
25
|
-
import {
|
|
26
|
-
ChatContextProvider
|
|
27
|
-
} from "./chunk-IEMQ2SQW.mjs";
|
|
28
|
-
import {
|
|
29
|
-
__objRest,
|
|
30
|
-
__spreadProps,
|
|
31
|
-
__spreadValues
|
|
32
|
-
} from "./chunk-MRXNTQOX.mjs";
|
|
33
|
-
|
|
34
|
-
// src/components/chat/Modal.tsx
|
|
35
|
-
import React, { useMemo } from "react";
|
|
36
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
-
var CopilotModal = (_a) => {
|
|
38
|
-
var _b = _a, {
|
|
39
|
-
instructions,
|
|
40
|
-
defaultOpen = false,
|
|
41
|
-
clickOutsideToClose = true,
|
|
42
|
-
hitEscapeToClose = true,
|
|
43
|
-
onSetOpen,
|
|
44
|
-
onSubmitMessage,
|
|
45
|
-
onStopGeneration,
|
|
46
|
-
onReloadMessages,
|
|
47
|
-
shortcut = "/",
|
|
48
|
-
icons,
|
|
49
|
-
labels,
|
|
50
|
-
makeSystemMessage,
|
|
51
|
-
onInProgress,
|
|
52
|
-
Window: Window2 = Window,
|
|
53
|
-
Button: Button2 = Button,
|
|
54
|
-
Header: Header2 = Header,
|
|
55
|
-
Messages: Messages2 = Messages,
|
|
56
|
-
Input: Input2 = Input,
|
|
57
|
-
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
58
|
-
UserMessage: UserMessage2 = UserMessage,
|
|
59
|
-
onThumbsUp,
|
|
60
|
-
onThumbsDown,
|
|
61
|
-
onCopy,
|
|
62
|
-
onRegenerate,
|
|
63
|
-
markdownTagRenderers,
|
|
64
|
-
className,
|
|
65
|
-
children
|
|
66
|
-
} = _b, props = __objRest(_b, [
|
|
67
|
-
"instructions",
|
|
68
|
-
"defaultOpen",
|
|
69
|
-
"clickOutsideToClose",
|
|
70
|
-
"hitEscapeToClose",
|
|
71
|
-
"onSetOpen",
|
|
72
|
-
"onSubmitMessage",
|
|
73
|
-
"onStopGeneration",
|
|
74
|
-
"onReloadMessages",
|
|
75
|
-
"shortcut",
|
|
76
|
-
"icons",
|
|
77
|
-
"labels",
|
|
78
|
-
"makeSystemMessage",
|
|
79
|
-
"onInProgress",
|
|
80
|
-
"Window",
|
|
81
|
-
"Button",
|
|
82
|
-
"Header",
|
|
83
|
-
"Messages",
|
|
84
|
-
"Input",
|
|
85
|
-
"AssistantMessage",
|
|
86
|
-
"UserMessage",
|
|
87
|
-
"onThumbsUp",
|
|
88
|
-
"onThumbsDown",
|
|
89
|
-
"onCopy",
|
|
90
|
-
"onRegenerate",
|
|
91
|
-
"markdownTagRenderers",
|
|
92
|
-
"className",
|
|
93
|
-
"children"
|
|
94
|
-
]);
|
|
95
|
-
const [openState, setOpenState] = React.useState(defaultOpen);
|
|
96
|
-
const setOpen = (open) => {
|
|
97
|
-
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
98
|
-
setOpenState(open);
|
|
99
|
-
};
|
|
100
|
-
const memoizedHeader = useMemo(() => /* @__PURE__ */ jsx(Header2, {}), [Header2]);
|
|
101
|
-
const memoizedChildren = useMemo(() => children, [children]);
|
|
102
|
-
return /* @__PURE__ */ jsxs(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
103
|
-
memoizedChildren,
|
|
104
|
-
/* @__PURE__ */ jsxs("div", { className, children: [
|
|
105
|
-
/* @__PURE__ */ jsx(Button2, {}),
|
|
106
|
-
/* @__PURE__ */ jsxs(
|
|
107
|
-
Window2,
|
|
108
|
-
{
|
|
109
|
-
clickOutsideToClose,
|
|
110
|
-
shortcut,
|
|
111
|
-
hitEscapeToClose,
|
|
112
|
-
children: [
|
|
113
|
-
memoizedHeader,
|
|
114
|
-
/* @__PURE__ */ jsx(
|
|
115
|
-
CopilotChat,
|
|
116
|
-
__spreadProps(__spreadValues({}, props), {
|
|
117
|
-
instructions,
|
|
118
|
-
onSubmitMessage,
|
|
119
|
-
onStopGeneration,
|
|
120
|
-
onReloadMessages,
|
|
121
|
-
makeSystemMessage,
|
|
122
|
-
onInProgress,
|
|
123
|
-
Messages: Messages2,
|
|
124
|
-
Input: Input2,
|
|
125
|
-
AssistantMessage: AssistantMessage2,
|
|
126
|
-
UserMessage: UserMessage2,
|
|
127
|
-
onThumbsUp,
|
|
128
|
-
onThumbsDown,
|
|
129
|
-
onCopy,
|
|
130
|
-
onRegenerate,
|
|
131
|
-
markdownTagRenderers
|
|
132
|
-
})
|
|
133
|
-
)
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
] })
|
|
138
|
-
] });
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export {
|
|
142
|
-
CopilotModal
|
|
143
|
-
};
|
|
144
|
-
//# sourceMappingURL=chunk-QKDRZ7WA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat/Modal.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { ButtonProps, HeaderProps, WindowProps } from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\nimport { AssistantMessage as DefaultAssistantMessage } from \"./messages/AssistantMessage\";\nimport { UserMessage as DefaultUserMessage } from \"./messages/UserMessage\";\n\nexport interface CopilotModalProps extends CopilotChatProps {\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * The shortcut key to open the chat window.\n * Uses Command-[shortcut] on a Mac and Ctrl-[shortcut] on Windows.\n * @default '/'\n */\n shortcut?: string;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n}\n\nexport const CopilotModal = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n onSubmitMessage,\n onStopGeneration,\n onReloadMessages,\n shortcut = \"/\",\n icons,\n labels,\n makeSystemMessage,\n onInProgress,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n AssistantMessage = DefaultAssistantMessage,\n UserMessage = DefaultUserMessage,\n onThumbsUp,\n onThumbsDown,\n onCopy,\n onRegenerate,\n markdownTagRenderers,\n className,\n children,\n ...props\n}: CopilotModalProps) => {\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n const memoizedHeader = useMemo(() => <Header />, [Header]);\n const memoizedChildren = useMemo(() => children, [children]);\n\n return (\n <ChatContextProvider icons={icons} labels={labels} open={openState} setOpen={setOpen}>\n {memoizedChildren}\n <div className={className}>\n <Button></Button>\n <Window\n clickOutsideToClose={clickOutsideToClose}\n shortcut={shortcut}\n hitEscapeToClose={hitEscapeToClose}\n >\n {memoizedHeader}\n <CopilotChat\n {...props}\n instructions={instructions}\n onSubmitMessage={onSubmitMessage}\n onStopGeneration={onStopGeneration}\n onReloadMessages={onReloadMessages}\n makeSystemMessage={makeSystemMessage}\n onInProgress={onInProgress}\n Messages={Messages}\n Input={Input}\n AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\n onThumbsUp={onThumbsUp}\n onThumbsDown={onThumbsDown}\n onCopy={onCopy}\n onRegenerate={onRegenerate}\n markdownTagRenderers={markdownTagRenderers}\n />\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,eAAe;AAgGQ,cAQ/B,YAR+B;AArChC,IAAM,eAAe,CAAC,OA6BJ;AA7BI,eAC3B;AAAA;AAAA,IACA,cAAc;AAAA,IACd,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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,gBACA;AAAA,gBACA,UAAUG;AAAA,gBACV,OAAOC;AAAA,gBACP,kBAAkBC;AAAA,gBAClB,aAAaC;AAAA,gBACb;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA;AAAA,YACF;AAAA;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Window","Button","Header","Messages","Input","AssistantMessage","UserMessage"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat/Popup.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"https://cdn.copilotkit.ai/docs/copilotkit/images/CopilotPopup.gif\" width=\"500\" />\n *\n * A chatbot popup component for the CopilotKit framework. The component allows for a high degree\n * of customization through various props and custom CSS.\n *\n * See [CopilotSidebar](/reference/components/chat/CopilotSidebar) for a sidebar version of this component.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n * ## Usage\n *\n * ```tsx\n * import { CopilotPopup } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotPopup\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * />\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx title=\"YourRootComponent.tsx\"\n * ...\n * import \"@copilotkit/react-ui/styles.css\"; // [!code highlight]\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.\n */\n\nimport { CopilotModal, CopilotModalProps } from \"./Modal\";\n\nexport function CopilotPopup(props: CopilotModalProps) {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotModal {...props}>{props.children}</CopilotModal>;\n}\n"],"mappings":";;;;;;;;;AAuDS;AALF,SAAS,aAAa,OAA0B;AACrD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,+CAAiB,QAAjB,EAAyB,gBAAM,WAAS;AAClD;","names":[]}
|