@grafana/alerting
Version:
Grafana Alerting Library – Build vertical integrations on top of the industry-leading alerting solution
23 lines (22 loc) • 706 B
TypeScript
import { type ComponentProps } from 'react';
import { type Combobox } from '@grafana/ui';
interface ClearableProps<T> {
isClearable: true;
onChange: (option: T | null) => void;
}
interface NotClearableProps<T> {
isClearable?: false;
onChange: (option: T) => void;
}
type ComboboxClearableProps<T> = NotClearableProps<T> | ClearableProps<T>;
type AutoSizeConditionals = {
width: 'auto';
minWidth: number;
maxWidth?: number;
} | {
width?: number;
minWidth?: never;
maxWidth?: never;
};
export type CustomComboBoxProps<T> = Omit<ComponentProps<typeof Combobox<string>>, 'options' | 'loading' | 'onChange'> & ComboboxClearableProps<T> & AutoSizeConditionals;
export {};