@copilotkit/react-ui
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
81 lines (76 loc) • 2.91 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/components/chat/Suggestions.tsx
var Suggestions_exports = {};
__export(Suggestions_exports, {
Suggestions: () => Suggestions
});
module.exports = __toCommonJS(Suggestions_exports);
// src/components/chat/Suggestion.tsx
var import_react_core = require("@copilotkit/react-core");
// src/components/chat/Icons.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var SmallSpinnerIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "copilotKitSpinner", style: { width: "13px", height: "13px" } });
// src/components/chat/Suggestion.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
function Suggestion({ title, onClick, partial, className }) {
if (!title)
return null;
const { isLoading } = (0, import_react_core.useCopilotChatInternal)();
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
"button",
{
disabled: partial || isLoading,
onClick: (e) => {
e.preventDefault();
onClick();
},
className: className || (partial ? "suggestion loading" : "suggestion"),
"data-test-id": "suggestion",
children: partial ? SmallSpinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: title })
}
);
}
// src/components/chat/Suggestions.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
function Suggestions({
suggestions,
onSuggestionClick,
isLoading
}) {
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "suggestions", children: suggestions.map((suggestion, index) => {
var _a, _b;
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
Suggestion,
{
title: suggestion.title,
message: suggestion.message,
partial: (_b = (_a = suggestion.isLoading) != null ? _a : suggestion.partial) != null ? _b : isLoading,
className: suggestion.className,
onClick: () => onSuggestionClick(suggestion.message)
},
index
);
}) });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Suggestions
});
//# sourceMappingURL=Suggestions.js.map