UNPKG

@progress/kendo-react-grid

Version:

React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package

10 lines (9 loc) 2.77 kB
/** * @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"; "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),h=require("@progress/kendo-react-intl"),x=require("@progress/kendo-svg-icons"),a=require("../../../messages/index.js");function D(o){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:()=>o[s]})}}return r.default=o,Object.freeze(r)}const l=D(S);function M({selectedView:o,searchModeEnabled:r,semanticSearchModeEnabled:s,promptSuggestions:i,currentHistory:p,currentHistorySettings:e}){const t=h.useLocalization(),u=h.useInternationalization(),g=t.toLanguageString(a.smartBoxSuggestedPrompts,a.messages[a.smartBoxSuggestedPrompts]),n=o==="aiAssistant"?t.toLanguageString(a.smartBoxPreviouslyAsked,a.messages[a.smartBoxPreviouslyAsked]):t.toLanguageString(a.smartBoxPreviouslySearched,a.messages[a.smartBoxPreviouslySearched]),f=l.useMemo(()=>r&&s?[{text:t.toLanguageString(a.smartBoxSearchModeText,a.messages[a.smartBoxSearchModeText]),description:t.toLanguageString(a.smartBoxSearchModeDescription,a.messages[a.smartBoxSearchModeDescription]),selected:o==="search",mode:"search"},{text:t.toLanguageString(a.smartBoxSemanticSearchModeText,a.messages[a.smartBoxSemanticSearchModeText]),description:t.toLanguageString(a.smartBoxSemanticSearchModeDescription,a.messages[a.smartBoxSemanticSearchModeDescription]),selected:o==="semanticSearch",mode:"semanticSearch"}]:[],[r,s,o,t]),B=l.useMemo(()=>{const m=[];return i.forEach((c,d)=>{m.push({id:`suggestion-${d}`,text:c,group:g,groupSvgIcon:x.lightbulbOutlineIcon,isHistoryItem:!1})}),p.forEach((c,d)=>{m.push({id:`history-${d}`,text:c.text,description:u.formatDate(c.timestamp,(e==null?void 0:e.timestampFormat)||"HH:mm"),group:n,groupSvgIcon:x.clockArrowRotateIcon,isHistoryItem:!0,timestamp:c.timestamp})}),m},[i,p,g,n,u,e==null?void 0:e.timestampFormat]),L=l.useMemo(()=>p.map((m,c)=>({id:`history-${c}`,text:m.text,description:u.formatDate(m.timestamp,(e==null?void 0:e.timestampFormat)||"HH:mm"),group:n,groupSvgIcon:x.clockArrowRotateIcon,isHistoryItem:!0,timestamp:m.timestamp})),[p,n,u,e==null?void 0:e.timestampFormat]);return{searchListData:f,aiAssistantListData:B,searchHistoryListData:L,suggestedPromptsLabel:g,historyLabel:n}}exports.useSmartBoxListData=M;