UNPKG

@progress/kendo-react-grid

Version:

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

161 lines (160 loc) 4.82 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { AIPromptOutputInterface, outputViewDefaults, promptViewDefaults, AIPromptCardInterface } from '@progress/kendo-react-conversational-ui'; import { CustomComponent } from '@progress/kendo-react-common'; import { ButtonProps, SpeechToTextButtonProps } from '@progress/kendo-react-buttons'; import { TextAreaProps } from '@progress/kendo-react-inputs'; import * as React from 'react'; /** * Props for the `GridAIPrompt` component, which provides AI-powered prompt and output functionality in a grid toolbar. * * @example * ```tsx * <GridAIPrompt * promptValue="Summarize this data" * outputs={[{ text: "Summary...", ... }]} * streaming={true} * onPromptRequest={handlePrompt} * suggestionsList={["Summarize", "Explain", "Generate chart"]} * /> * ``` */ interface GridAIPromptProps { /** * List of AI-generated outputs to display. * * @example * outputs={[{ text: "AI output 1" }, { text: "AI output 2" }]} */ outputs?: AIPromptOutputInterface[]; /** * Enables the speech-to-text functionality for the input of the GridToolbarAIAssistant. * * @example * ```jsx * <GridToolbarAIAssistant enableSpeechToText={true} /> * ``` */ enableSpeechToText?: boolean | SpeechToTextButtonProps; /** * Indicates whether the prompt is currently streaming or processing. * * @example * streaming={true} */ streaming?: boolean; /** * Indicates whether the prompt is currently loading. * * @example * loading={true} */ loading?: boolean; /** * Configuration for the output card displaying AI results. * * @example * outputCard={{ title: "AI Result", content: "..." }} */ outputCard?: AIPromptCardInterface; /** * Current value of the prompt input field. * * @example * promptValue="Describe the selected rows" */ promptValue?: string; /** * Placeholder text for the prompt input field. * * @example * promptPlaceHolder="Type your question here..." */ promptPlaceHolder?: string; /** * Custom component to render the prompt input field. * * @example * promptInput={CustomTextArea} */ promptInput?: CustomComponent<TextAreaProps>; /** * Callback fired when the active view changes. * * @param viewName The name of the new active view. * @example * onActiveViewChange={(view) => setActiveView(view)} */ onActiveViewChange?: (viewName: string) => void; /** * Custom component to render the generate button. * * @example * generateButton={CustomGenerateButton} */ generateButton?: CustomComponent<ButtonProps>; /** * Name of the currently active view. * * @example * activeView="prompt" */ activeView?: string; /** * Array of toolbar items to display, can include prompt or output view defaults. * * @example * toolbarItems={[promptViewDefaults, outputViewDefaults]} */ toolbarItems?: Array<typeof promptViewDefaults | typeof outputViewDefaults>; /** * Callback fired when the user clicks the Copy button in the output card. * * @example * onCopy={() => copyToClipboard()} */ onCopy?: () => void; /** * Callback fired when the user rates the output. * * @example * onOutputRating={() => handleRating()} */ onOutputRating?: () => void; /** * Callback fired when the user submits a prompt request. * * @param prompt The prompt text submitted by the user. * @example * onPromptRequest={(prompt) => sendPrompt(prompt)} */ onPromptRequest?: (prompt: string) => void; /** * List of prompt suggestions to display to the user. * * @example * suggestionsList={["Summarize", "Explain", "Generate chart"]} */ suggestionsList?: string[]; /** * Callback fired when the user cancels the current operation. * * @example * onCancel={() => cancelPrompt()} */ onCancel?: () => void; /** * Callback fired when the user closes the current operation. * * @example * onClose={() => closePrompt()} */ onClose?: () => void; } declare const GridAIPrompt: (props: GridAIPromptProps) => React.JSX.Element; export { GridAIPrompt, GridAIPromptProps };