@progress/kendo-react-conversational-ui
Version:
React Chat component allows the user to participate in chat sessions with users or chat bots. KendoReact Conversational UI components
62 lines (61 loc) • 2.36 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import t from "react";
import { AIPromptContent as T } from "../AIPromptContent.mjs";
import { AIPromptFooter as b } from "../AIPromptFooter.mjs";
import { Button as S } from "@progress/kendo-react-buttons";
import { TextArea as w } from "@progress/kendo-react-inputs";
import { sparklesIcon as l } from "@progress/kendo-svg-icons";
import { useCustomComponent as a } from "@progress/kendo-react-common";
import { AIPromptViewRender as v } from "./AIPromptViewRender.mjs";
import { AIPromptExpander as R } from "../AIPromptExpander.mjs";
import { useAIPromptContext as V } from "../AIPromptContext.mjs";
const y = {
name: "prompt-view",
buttonText: "Ask AI",
buttonIcon: l
}, M = (c) => {
const u = "Generate", { promptInput: i = w, generateButton: d = S, promptValue: f, promptSuggestions: o } = c, [r, n] = t.useState(f || ""), [m] = V(), [A, p] = a(d), [P, s] = a(i), g = () => {
m.onPromptRequest && m.onPromptRequest.call(null, r), n("");
}, x = (e) => {
n(e);
}, I = (e) => {
n(e.target.value);
}, h = {
title: "Generate",
svgIcon: l
}, k = {
placeholder: "Ask or generate content with AI ...",
rows: 2
}, C = Object.keys(p).length > 0 ? p : h, E = Object.keys(s).length > 0 ? s : k;
return /* @__PURE__ */ t.createElement(v, { name: y.name }, /* @__PURE__ */ t.createElement(T, null, /* @__PURE__ */ t.createElement(P, { value: r, onChange: I, ...E }), o && o.length > 0 && /* @__PURE__ */ t.createElement(R, { title: "Prompt Suggestions" }, o.map((e) => /* @__PURE__ */ t.createElement(
"div",
{
key: e,
className: "k-prompt-suggestion",
onClick: () => x(e)
},
e
)))), /* @__PURE__ */ t.createElement(b, null, /* @__PURE__ */ t.createElement(
A,
{
themeColor: "primary",
fillMode: "solid",
"aria-hidden": "true",
rounded: "full",
size: "medium",
onClick: g,
...C
},
u
)));
};
export {
M as AIPromptView,
y as promptViewDefaults
};