@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
59 lines (58 loc) • 1.86 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 g from "react";
import { zoomSparkleIcon as t, searchIcon as N, sparklesIcon as i } from "@progress/kendo-svg-icons";
function z({
searchMode: n,
semanticSearchMode: u,
aiAssistantMode: C,
selectedView: f,
lastSearchMode: b,
setSelectedViewState: l,
setInputValue: k
}) {
const p = g.useMemo(() => {
const I = (n == null ? void 0 : n.enabled) || (u == null ? void 0 : u.enabled), B = C == null ? void 0 : C.enabled;
if (!I || !B)
return [];
const v = f === "semanticSearch" || f === "aiAssistant" && b === "semanticSearch";
return [
{
value: "search",
text: "Search",
svgIcon: v ? t : N,
iconClassName: v ? "k-accent-icon" : void 0
},
{
value: "aiAssistant",
text: "AI Assistant",
svgIcon: i,
iconClassName: "k-accent-icon"
}
];
}, [n, u, C, f, b]), x = g.useCallback(() => {
if (f === "search" || f === "semanticSearch")
return "search";
if (f === "aiAssistant")
return "aiAssistant";
}, [f]), A = g.useCallback(
(I) => {
I === "search" ? b && (b === "search" ? n != null && n.enabled : u != null && u.enabled) ? l(b) : n != null && n.enabled ? l("search") : u != null && u.enabled && l("semanticSearch") : I === "aiAssistant" && l("aiAssistant"), k("");
},
[n, u, b, l, k]
);
return {
items: p,
value: x(),
onChange: A
};
}
export {
z as useSmartBoxSegmentedControl
};