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

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