@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
38 lines (37 loc) • 1.19 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 a from "react";
import { Keys as u, classNames as i } from "@progress/kendo-react-common";
const m = (c) => {
const { item: e, onActionExecute: l, selected: s } = c, o = a.useRef(null);
a.useEffect(() => {
s && o.current && o.current.focus();
}, [s]);
const n = a.useCallback(
(t) => {
(t.keyCode === u.enter || t.key === " ") && (t.preventDefault(), l(e, t));
},
[l, e]
), r = a.useCallback(() => i("k-suggestion k-suggestion-primary", { "k-selected": s }, { "k-focus": s }), [s]);
return /* @__PURE__ */ a.createElement(
"span",
{
role: "button",
className: r(),
onClick: (t) => l(e, t),
ref: o,
onKeyDown: n,
tabIndex: 0,
"aria-label": e.title || e.value
},
e.title || e.value
);
};
export {
m as default
};