@copilotkit/react-ui 1.60.2 → 1.61.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.
- package/dist/index.cjs +11 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +14 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -6
- package/src/components/chat/Input.tsx +3 -1
- package/src/components/chat/Markdown.tsx +6 -3
- package/src/components/chat/Markdown.xss.test.ts +170 -0
- package/src/components/chat/Textarea.tsx +3 -0
- package/src/components/chat/input.testids.test.ts +47 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
(function(global, factory) {
|
|
4
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react/jsx-runtime'), require('@copilotkit/react-core'), require('@copilotkit/shared'), require('@headlessui/react'), require('react-markdown'), require('react-syntax-highlighter'), require('remark-gfm'), require('remark-math'), require('rehype-raw'), require('@copilotkit/runtime-client-gql')) :
|
|
5
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react/jsx-runtime', '@copilotkit/react-core', '@copilotkit/shared', '@headlessui/react', 'react-markdown', 'react-syntax-highlighter', 'remark-gfm', 'remark-math', 'rehype-raw', '@copilotkit/runtime-client-gql'], factory) :
|
|
6
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitReactUI = {}), global.React,global.ReactJsxRuntime,global.CopilotKitReactCore,global.CopilotKitShared,global.HeadlessUIReact,global.ReactMarkdown,global.ReactSyntaxHighlighter,global.remarkGfm,global.remarkMath,global.rehypeRaw,global.CopilotKitRuntimeClientGQL));
|
|
7
|
-
})(this, function(exports, react, react_jsx_runtime, _copilotkit_react_core, _copilotkit_shared, _headlessui_react, react_markdown, react_syntax_highlighter, remark_gfm, remark_math, rehype_raw, _copilotkit_runtime_client_gql) {
|
|
4
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react/jsx-runtime'), require('@copilotkit/react-core'), require('@copilotkit/shared'), require('@headlessui/react'), require('react-markdown'), require('react-syntax-highlighter'), require('remark-gfm'), require('remark-math'), require('rehype-raw'), require('rehype-sanitize'), require('@copilotkit/runtime-client-gql')) :
|
|
5
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react/jsx-runtime', '@copilotkit/react-core', '@copilotkit/shared', '@headlessui/react', 'react-markdown', 'react-syntax-highlighter', 'remark-gfm', 'remark-math', 'rehype-raw', 'rehype-sanitize', '@copilotkit/runtime-client-gql'], factory) :
|
|
6
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitReactUI = {}), global.React,global.ReactJsxRuntime,global.CopilotKitReactCore,global.CopilotKitShared,global.HeadlessUIReact,global.ReactMarkdown,global.ReactSyntaxHighlighter,global.remarkGfm,global.remarkMath,global.rehypeRaw,global.rehype_sanitize,global.CopilotKitRuntimeClientGQL));
|
|
7
|
+
})(this, function(exports, react, react_jsx_runtime, _copilotkit_react_core, _copilotkit_shared, _headlessui_react, react_markdown, react_syntax_highlighter, remark_gfm, remark_math, rehype_raw, rehype_sanitize, _copilotkit_runtime_client_gql) {
|
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
10
|
var __create = Object.create;
|
|
@@ -38,6 +38,7 @@ react_markdown = __toESM(react_markdown);
|
|
|
38
38
|
remark_gfm = __toESM(remark_gfm);
|
|
39
39
|
remark_math = __toESM(remark_math);
|
|
40
40
|
rehype_raw = __toESM(rehype_raw);
|
|
41
|
+
rehype_sanitize = __toESM(rehype_sanitize);
|
|
41
42
|
|
|
42
43
|
//#region src/components/chat/Icons.tsx
|
|
43
44
|
const OpenIcon = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
@@ -1406,7 +1407,11 @@ rehype_raw = __toESM(rehype_raw);
|
|
|
1406
1407
|
[remark_math.default, { singleDollarTextMath: false }],
|
|
1407
1408
|
...remarkPlugins !== null && remarkPlugins !== void 0 ? remarkPlugins : []
|
|
1408
1409
|
], [remarkPlugins]);
|
|
1409
|
-
const mergedRehypePlugins = (0, react.useMemo)(() => [
|
|
1410
|
+
const mergedRehypePlugins = (0, react.useMemo)(() => [
|
|
1411
|
+
rehype_raw.default,
|
|
1412
|
+
...rehypePlugins !== null && rehypePlugins !== void 0 ? rehypePlugins : [],
|
|
1413
|
+
rehype_sanitize.default
|
|
1414
|
+
], [rehypePlugins]);
|
|
1410
1415
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1411
1416
|
className: "copilotKitMarkdown",
|
|
1412
1417
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedReactMarkdown, {
|
|
@@ -1803,7 +1808,7 @@ rehype_raw = __toESM(rehype_raw);
|
|
|
1803
1808
|
|
|
1804
1809
|
//#endregion
|
|
1805
1810
|
//#region src/components/chat/Textarea.tsx
|
|
1806
|
-
const AutoResizingTextarea = (0, react.forwardRef)(({ maxRows = 1, placeholder, value, onChange, onKeyDown, onCompositionStart, onCompositionEnd, autoFocus }, ref) => {
|
|
1811
|
+
const AutoResizingTextarea = (0, react.forwardRef)(({ maxRows = 1, placeholder, value, onChange, onKeyDown, onCompositionStart, onCompositionEnd, autoFocus, "data-testid": dataTestId }, ref) => {
|
|
1807
1812
|
const internalTextareaRef = (0, react.useRef)(null);
|
|
1808
1813
|
const [maxHeight, setMaxHeight] = (0, react.useState)(0);
|
|
1809
1814
|
(0, react.useImperativeHandle)(ref, () => internalTextareaRef.current);
|
|
@@ -1828,6 +1833,7 @@ rehype_raw = __toESM(rehype_raw);
|
|
|
1828
1833
|
}, [value, maxHeight]);
|
|
1829
1834
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
1830
1835
|
ref: internalTextareaRef,
|
|
1836
|
+
"data-testid": dataTestId,
|
|
1831
1837
|
value,
|
|
1832
1838
|
onChange,
|
|
1833
1839
|
onKeyDown,
|
|
@@ -2037,6 +2043,7 @@ rehype_raw = __toESM(rehype_raw);
|
|
|
2037
2043
|
autoFocus: false,
|
|
2038
2044
|
maxRows: MAX_NEWLINES,
|
|
2039
2045
|
value: text,
|
|
2046
|
+
"data-testid": "copilot-chat-textarea",
|
|
2040
2047
|
onChange: (event) => setText(event.target.value),
|
|
2041
2048
|
onCompositionStart: () => setIsComposing(true),
|
|
2042
2049
|
onCompositionEnd: () => setIsComposing(false),
|
|
@@ -2064,6 +2071,7 @@ rehype_raw = __toESM(rehype_raw);
|
|
|
2064
2071
|
disabled: sendDisabled,
|
|
2065
2072
|
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
2066
2073
|
"data-copilotkit-in-progress": inProgress,
|
|
2074
|
+
"data-testid": "copilot-send-button",
|
|
2067
2075
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
2068
2076
|
className: "copilotKitInputControlButton",
|
|
2069
2077
|
"aria-label": buttonAlt,
|