@grafana/ui
Version:
Grafana Components Library
27 lines (26 loc) • 1.15 kB
TypeScript
import { type FieldReducerInfo } from '@grafana/data';
import { type ComboboxProps } from '../Combobox/Combobox';
import { type MultiComboboxProps } from '../Combobox/MultiCombobox';
/** Props managed by StatsPicker — forwarded combobox props must not replace these. */
type ComboboxManagedProps = 'value' | 'options' | 'onChange' | 'isClearable' | 'width' | 'minWidth' | 'maxWidth';
/** Forwarded props (managed keys + layout are applied after the spread). */
type MultiSpread = Omit<MultiComboboxProps<string>, ComboboxManagedProps>;
type SingleSpread = Omit<ComboboxProps<string>, ComboboxManagedProps>;
interface BaseProps {
stats: string[];
onChange: (stats: string[]) => void;
defaultStat?: string;
width?: number | 'auto';
minWidth?: number;
maxWidth?: number;
filterOptions?: (ext: FieldReducerInfo) => boolean;
}
type MultiProps = MultiSpread & {
allowMultiple: true;
};
type SingleProps = SingleSpread & {
allowMultiple?: false;
};
export type StatsPickerProps = BaseProps & (MultiProps | SingleProps);
export declare const StatsPicker: import("react").NamedExoticComponent<StatsPickerProps>;
export {};