import type { IconButtonProps, TextFieldProps } from '@mui/material' import type { ReactNode } from 'react' import type { EchartWidgetData } from '../../echart/types' import type { BaseWidgetState } from '../../stores/types' /** * Filter function type for custom search filtering logic. * Receives the original data and search text, returns filtered data. * Can be synchronous or asynchronous to support remote filtering. */ export type SearcherFilterFn = ( data: EchartWidgetData, searchText: string, ) => Promise | EchartWidgetData /** * Searcher-specific state properties. */ export interface SearcherStateProps { /** Whether search is currently enabled */ isSearchEnabled?: boolean /** Current search text */ searchText?: string } /** * Widget state extension for searcher functionality. * Extends the base widget state with search-specific properties. */ export type SearcherState = BaseWidgetState export interface SearcherToggleProps { /** Widget ID to store search enabled state */ id: string /** Initial search enabled state. Defaults to false */ defaultEnabled?: boolean /** Custom labels for the action */ labels?: { /** Tooltip when search is disabled (button will enable search) */ enable?: string /** Tooltip when search is enabled (button will disable search) */ disable?: string /** Accessibility label */ ariaLabel?: string } /** Props passed to the IconButton component */ IconButtonProps?: IconButtonProps /** Custom icon to display */ Icon?: ReactNode } export interface SearcherProps { /** Widget ID to update filtered data in the widget store */ id: string /** Custom filter function. Defaults to case-insensitive search across all string fields */ filterFn?: SearcherFilterFn /** Execution order in the tool pipeline. Lower values execute first. Defaults to 10. */ order?: number /** Custom labels for the searcher input */ labels?: { /** Placeholder text for the input */ placeholder?: string /** Accessibility label for clear button */ clearAriaLabel?: string } /** Props passed to the TextField component */ TextFieldProps?: Omit /** Custom icon for clear button */ ClearIcon?: ReactNode /** Debounce delay in milliseconds for search input. Defaults to 300ms */ debounceDelay?: number }