UNPKG

@progress/kendo-react-grid

Version:

React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package

107 lines (106 loc) 3.18 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 * as e from "react"; import { promptViewDefaults as l, AIPrompt as R, outputViewDefaults as g, AIPromptView as D, AIPromptOutputView as q } from "@progress/kendo-react-conversational-ui"; import { Button as L } from "@progress/kendo-react-buttons"; import { TextArea as O } from "@progress/kendo-react-inputs"; import { tableWizardIcon as B } from "@progress/kendo-svg-icons"; import { toolbarAIApply as a, messages as d } from "../../messages/index.mjs"; import { useLocalization as H } from "@progress/kendo-react-intl"; const T = (i) => { const { responseContent: o } = i, r = o.split(` `); return /* @__PURE__ */ e.createElement("div", { className: "k-card-body" }, r.map((n, s) => /* @__PURE__ */ e.createElement("div", { key: n.trim() + s, className: "k-card-text" }, n))); }, J = (i) => { const { activeView: o, onActiveViewChange: r, toolbarItems: n, outputs: s, promptValue: f, promptInput: w, generateButton: y, onCopy: A, onOutputRating: h, onPromptRequest: u, suggestionsList: x, outputCard: C, promptPlaceHolder: I, streaming: V, loading: b, onCancel: v, onClose: p, enableSpeechToText: E } = i, m = H(), [S, c] = e.useState(l.name), P = (t, K) => { t && (u && u(t), c(g.name)); }, k = (t) => { r && r(t), c(t); }, z = (t) => { t.key === "Escape" && p && p(); }; return e.useEffect(() => { const t = document.querySelector(".k-prompt-view .k-textarea textarea"); t && t.focus(); }, []), /* @__PURE__ */ e.createElement( R, { style: { maxHeight: "100%" }, activeView: o != null ? o : S, onActiveViewChange: k, onPromptRequest: P, toolbarItems: n || [l, g], streaming: V, loading: b, suggestionsView: "modern", onCancel: v, onKeyDown: z }, /* @__PURE__ */ e.createElement( D, { promptSuggestions: x, promptValue: f, promptInput: w || /* @__PURE__ */ e.createElement( O, { flow: "vertical", resizable: "none", autoSize: !0, textareaStyle: { maxHeight: "110px" }, placeholder: I, rows: 2 } ), generateButton: y || /* @__PURE__ */ e.createElement( L, { svgIcon: B, icon: "table-wizard", type: "button", title: m.toLanguageString(a, d[a]) }, m.toLanguageString(a, d[a]) ), enableSpeechToText: E } ), /* @__PURE__ */ e.createElement( q, { outputs: s, showOutputRating: !0, onCopy: A, onOutputRating: h, outputCard: C || { body: T } } ) ); }; export { J as GridAIPrompt };