@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
31 lines (30 loc) • 1.76 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 * as t from "react";
import { classNames as f } from "@progress/kendo-react-common";
const p = (s) => {
const { item: e, template: c, tabbable: l, onClick: r, selected: a } = s, n = t.useRef(null);
t.useEffect(() => {
a && n.current && n.current.focus();
}, [a]);
const i = t.useCallback(() => {
if (l !== void 0)
return l ? 0 : -1;
}, [l]), u = t.useCallback(() => f({ "k-selected": a }, { "k-focus": a }), [a]), o = t.useCallback(() => e.title ? /* @__PURE__ */ t.createElement("h5", { className: "k-card-title" }, e.title) : null, [e.title]), m = t.useCallback(() => e.subtitle ? /* @__PURE__ */ t.createElement("h6", { className: "k-card-subtitle" }, e.subtitle) : null, [e.subtitle]), d = t.useCallback(() => e.contentType.indexOf("image/") === 0 ? /* @__PURE__ */ t.createElement(
"img",
{
src: e.content,
alt: e.title || "Attachment",
style: { maxHeight: "200px", height: "auto", maxWidth: "200px", width: "auto" }
}
) : e.content, [e.contentType, e.content, e.title]), b = c;
return /* @__PURE__ */ t.createElement("div", { className: u(), tabIndex: i(), onClick: r, ref: n }, c ? /* @__PURE__ */ t.createElement(b, { item: e }) : /* @__PURE__ */ t.createElement("div", { className: "k-card" }, /* @__PURE__ */ t.createElement("div", { className: "k-card-body" }, o(), m(), d())));
};
export {
p as default
};