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

40 lines (39 loc) 1.63 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 t from "react"; import { stopSmIcon as f } from "@progress/kendo-svg-icons"; import { FloatingActionButton as d } from "@progress/kendo-react-buttons"; import { aIPromptCancel as i, messages as g } from "../messages/index.mjs"; import { useLocalization as w } from "@progress/kendo-react-intl"; import { useAIPromptContext as k } from "./AIPromptContext.mjs"; import { outputViewDefaults as C } from "./views/constants.mjs"; const I = t.forwardRef((m, r) => { const { children: c, streaming: s, onCancel: o } = m, n = w().toLanguageString(i, g[i]), [l] = k(), p = l.activeView === C.name, e = s && p, u = t.useCallback( (a) => { a.key === "Escape" && e && o && (a.preventDefault(), o()); }, [e, o] ); return /* @__PURE__ */ t.createElement("div", { className: "k-prompt-content", ref: r, onKeyDown: u }, e && /* @__PURE__ */ t.createElement( d, { onClick: o, svgIcon: f, icon: "stop-sm", size: "medium", positionMode: "absolute", className: "k-prompt-stop-fab k-generating", "aria-label": n, title: n } ), /* @__PURE__ */ t.createElement("div", { className: "k-prompt-view" }, c)); }); I.displayName = "KendoReactAIPromptContent"; export { I as AIPromptContent };