@copilotkit/react-ui 1.61.0 → 1.61.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/src/index.tsx +0 -1
- package/tsdown.config.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,8 @@ let remark_math = require("remark-math");
|
|
|
43
43
|
remark_math = __toESM(remark_math);
|
|
44
44
|
let rehype_raw = require("rehype-raw");
|
|
45
45
|
rehype_raw = __toESM(rehype_raw);
|
|
46
|
+
let rehype_sanitize = require("rehype-sanitize");
|
|
47
|
+
rehype_sanitize = __toESM(rehype_sanitize);
|
|
46
48
|
let _copilotkit_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
47
49
|
|
|
48
50
|
//#region src/components/chat/Icons.tsx
|
|
@@ -1408,7 +1410,11 @@ const Markdown = ({ content, components, remarkPlugins, rehypePlugins, ...rest }
|
|
|
1408
1410
|
[remark_math.default, { singleDollarTextMath: false }],
|
|
1409
1411
|
...remarkPlugins ?? []
|
|
1410
1412
|
], [remarkPlugins]);
|
|
1411
|
-
const mergedRehypePlugins = (0, react.useMemo)(() => [
|
|
1413
|
+
const mergedRehypePlugins = (0, react.useMemo)(() => [
|
|
1414
|
+
rehype_raw.default,
|
|
1415
|
+
...rehypePlugins ?? [],
|
|
1416
|
+
rehype_sanitize.default
|
|
1417
|
+
], [rehypePlugins]);
|
|
1412
1418
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1413
1419
|
className: "copilotKitMarkdown",
|
|
1414
1420
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedReactMarkdown, {
|
|
@@ -1800,7 +1806,7 @@ function useScrollToBottom(messages) {
|
|
|
1800
1806
|
|
|
1801
1807
|
//#endregion
|
|
1802
1808
|
//#region src/components/chat/Textarea.tsx
|
|
1803
|
-
const AutoResizingTextarea = (0, react.forwardRef)(({ maxRows = 1, placeholder, value, onChange, onKeyDown, onCompositionStart, onCompositionEnd, autoFocus }, ref) => {
|
|
1809
|
+
const AutoResizingTextarea = (0, react.forwardRef)(({ maxRows = 1, placeholder, value, onChange, onKeyDown, onCompositionStart, onCompositionEnd, autoFocus, "data-testid": dataTestId }, ref) => {
|
|
1804
1810
|
const internalTextareaRef = (0, react.useRef)(null);
|
|
1805
1811
|
const [maxHeight, setMaxHeight] = (0, react.useState)(0);
|
|
1806
1812
|
(0, react.useImperativeHandle)(ref, () => internalTextareaRef.current);
|
|
@@ -1825,6 +1831,7 @@ const AutoResizingTextarea = (0, react.forwardRef)(({ maxRows = 1, placeholder,
|
|
|
1825
1831
|
}, [value, maxHeight]);
|
|
1826
1832
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
|
|
1827
1833
|
ref: internalTextareaRef,
|
|
1834
|
+
"data-testid": dataTestId,
|
|
1828
1835
|
value,
|
|
1829
1836
|
onChange,
|
|
1830
1837
|
onKeyDown,
|
|
@@ -2031,6 +2038,7 @@ const Input = ({ inProgress, onSend, chatReady = false, onStop, onUpload, hideSt
|
|
|
2031
2038
|
autoFocus: false,
|
|
2032
2039
|
maxRows: MAX_NEWLINES,
|
|
2033
2040
|
value: text,
|
|
2041
|
+
"data-testid": "copilot-chat-textarea",
|
|
2034
2042
|
onChange: (event) => setText(event.target.value),
|
|
2035
2043
|
onCompositionStart: () => setIsComposing(true),
|
|
2036
2044
|
onCompositionEnd: () => setIsComposing(false),
|
|
@@ -2058,6 +2066,7 @@ const Input = ({ inProgress, onSend, chatReady = false, onStop, onUpload, hideSt
|
|
|
2058
2066
|
disabled: sendDisabled,
|
|
2059
2067
|
onClick: isInProgress && !hideStopButton ? onStop : send,
|
|
2060
2068
|
"data-copilotkit-in-progress": inProgress,
|
|
2069
|
+
"data-testid": "copilot-send-button",
|
|
2061
2070
|
"data-test-id": inProgress ? "copilot-chat-request-in-progress" : "copilot-chat-ready",
|
|
2062
2071
|
className: "copilotKitInputControlButton",
|
|
2063
2072
|
"aria-label": buttonAlt,
|