/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { SpeechToTextButtonProps } from '@progress/kendo-react-buttons'; import { SVGIcon } from '@progress/kendo-svg-icons'; import { GridAIRequestConfig, GridAIResponse, GridAIHttpClient, GridAIRequestData } from '../hooks/useGridAIRequest.js'; import { CustomComponent } from '@progress/kendo-react-common'; import { AIPromptOutputInterface } from '@progress/kendo-react-conversational-ui'; import { GridAIPromptProps } from './ai-tool/GridAIPrompt.js'; import * as React from 'react'; /** * Represents the handle interface for the GridToolbarAIAssistant component. */ export interface GridToolbarAIAssistantHandle { /** * Shows the AI assistant prompt interface. */ show: () => void; /** * Hides the AI assistant prompt interface. */ hide: () => void; } /** * Represents the request data structure for the GridToolbarAIAssistant component. */ export type GridToolbarAIAssistantRequestData = GridAIRequestData; /** * Represents the props interface for the GridToolbarAIAssistant component. * This component provides AI-powered functionality for grid operations through natural language prompts. * Users can request sorting, filtering, grouping, and highlighting through conversational input. * * @example * ```tsx * * * console.log('AI processed:', response)} * /> * * * ``` */ export interface GridToolbarAIAssistantProps { /** * Defines the URL to which the request will be sent. * * @example * ```jsx * * ``` */ requestUrl?: string; /** * Enables the speech-to-text functionality for the input of the GridToolbarAIAssistant. * * @example * ```jsx * * ``` */ enableSpeechToText?: boolean | SpeechToTextButtonProps; /** * Defines the placeholder text for the AI prompt input. * * @example * ```jsx * * ``` */ promptPlaceHolder?: string; /** * Defines the list of suggestions for the AI prompt. * * @example * ```jsx * * ``` */ suggestionsList?: string[]; /** * Defines if the AI prompt is in streaming mode. * * @example * ```jsx * * ``` */ streaming?: boolean; /** * Defines if the AI prompt is in loading mode. * * @example * ```jsx * * ``` */ loading?: boolean; /** * Defines the outputs of the AI prompt. * * @example * ```jsx * * ``` */ outputs?: AIPromptOutputInterface[]; /** * Defines the options for the HTTP request. * Accepts both the new `GridAIRequestConfig` and the legacy `AxiosRequestConfig`. * * @remarks * `GridAIRequestConfig` is the recommended type — it has no external dependency. * `AxiosRequestConfig` continues to work for backward compatibility. * * @example * ```jsx * * ``` */ requestOptions?: GridAIRequestConfig; /** * Called before the request is sent. * * @example * ```jsx * console.log(request)} /> * ``` */ onPromptRequest?: (request: GridToolbarAIAssistantRequestData, isRetry?: boolean) => void; /** * Called when the response is received. * * @remarks * The response object provides `data`, `status`, and `statusText` — * the same properties available on both `GridAIResponse` and `AxiosResponse`. * Use `GridAIResponse` as the recommended type annotation. * * @example * ```jsx * console.log(response)} /> * ``` */ onResponseSuccess?: (response: GridAIResponse, promptMessage?: string, isRetry?: boolean) => void; /** * Called when the response returns an error. * * @example * ```jsx * console.error(error)} /> * ``` */ onResponseError?: (error: any) => void; /** * Defines the user role for the request. Defaults to 'user'. * * @example * ```jsx * * ``` * * @remarks * This property is related to accessibility. */ role?: string; /** * Customizes the AI prompt component. * * @example * ```jsx * * ``` */ gridAIPrompt?: CustomComponent; /** * Defines the icon rendered in the GridToolbarAIAssistant tool ([see example](https://www.telerik.com/kendo-react-ui/components/common/icon)). * * @example * ```jsx * * ``` */ icon?: string; /** * Defines the SVG icon rendered in the GridToolbarAIAssistant tool ([see example](https://www.telerik.com/kendo-react-ui/components/common/svgicon)). * * @example * ```jsx * import { gearIcon } from '@progress/kendo-svg-icons'; * * * ``` */ svgIcon?: SVGIcon; /** * Specifies if the popup will be displayed. * * @example * ```jsx * * ``` */ show?: boolean; /** * The method that will be called to close the column menu. * * @example * ```jsx * console.log('close menu');} /> * ``` */ onCloseWindow?: () => void; /** * Optional custom HTTP client for the AI assistant. * When not provided, the component uses the built-in fetch-based transport. * * @example * ```tsx * import axios from 'axios'; * import { createAxiosAIClient } from '@progress/kendo-react-grid'; * * * ``` */ httpClient?: GridAIHttpClient; } declare const GridToolbarAIAssistant: React.ForwardRefExoticComponent>; export { GridToolbarAIAssistant };