@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
67 lines (66 loc) • 1.69 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as t from "react";
function d({
selectedView: s,
searchHistorySettings: i,
semanticSearchHistorySettings: u,
aiAssistantHistorySettings: m
}) {
const [r, H] = t.useState([]), [e, y] = t.useState([]), [a, h] = t.useState([]), f = t.useCallback(
(A, c, n) => {
if (!n || !c.trim())
return;
const l = {
text: c,
timestamp: /* @__PURE__ */ new Date(),
format: n.timestampFormat
}, x = {
search: H,
semanticSearch: y,
aiAssistant: h
}[A];
x((o) => o.some((M) => M.text === c) ? o : [l, ...o].slice(0, n.size));
},
[]
), p = t.useMemo(() => {
switch (s) {
case "search":
return r;
case "semanticSearch":
return e;
case "aiAssistant":
return a;
default:
return [];
}
}, [s, r, e, a]), S = t.useMemo(() => {
switch (s) {
case "search":
return i;
case "semanticSearch":
return u;
case "aiAssistant":
return m;
default:
return null;
}
}, [s, i, u, m]);
return {
searchHistory: r,
semanticSearchHistory: e,
aiAssistantHistory: a,
currentHistory: p,
currentHistorySettings: S,
addToHistory: f
};
}
export {
d as useSmartBoxHistory
};