UNPKG

@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

55 lines (54 loc) 1.85 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import e from "react"; import { PromptHeader as E } from "./AIPromptHeader.mjs"; import { promptViewDefaults as I, outputViewDefaults as x } from "./views/constants.mjs"; import { AIPromptContext as L } from "./AIPromptContext.mjs"; import { validatePackage as M, getLicenseMessage as N, classNames as b, WatermarkOverlay as y } from "@progress/kendo-react-common"; import { packageMetadata as s } from "../package-metadata.mjs"; const O = (c) => { const m = !M(s, { component: "AIPrompt" }), n = N(s), { activeView: a, toolbarItems: i, children: l, onActiveViewChange: o, onPromptRequest: p, onCommandExecute: d, style: g, dir: u, className: v, streaming: f, loading: w, onCancel: P, suggestionsView: t, ...V } = c, h = i || [I, x], [S, k] = e.useState({ activeView: a }), r = { ...S, activeView: a, streaming: f, loading: w, suggestionsView: t != null ? t : "classic", onCancel: P, onActiveViewChange: o, onPromptRequest: p, onCommandExecute: d }, A = (C) => { k(C); }; return /* @__PURE__ */ e.createElement(L.Provider, { value: [r, A] }, /* @__PURE__ */ e.createElement("div", { className: b("k-prompt", v), style: g, dir: u, ...V }, /* @__PURE__ */ e.createElement( E, { activeView: r.activeView, toolbarItems: h, activeViewChange: o } ), l, m && /* @__PURE__ */ e.createElement(y, { message: n }))); }; export { O as AIPrompt };