import { FormEvent, ReactElement, useCallback } from 'react'; import { TextBoxVariableModel } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { Trans, t } from '@grafana/i18n'; import { VariableLegend } from '../../dashboard-scene/settings/variables/components/VariableLegend'; import { VariableTextField } from '../../dashboard-scene/settings/variables/components/VariableTextField'; import { VariableEditorProps } from '../editor/types'; export interface Props extends VariableEditorProps {} export function TextBoxVariableEditor({ onPropChange, variable: { query } }: Props): ReactElement { const updateVariable = useCallback( (event: FormEvent, updateOptions: boolean) => { event.preventDefault(); onPropChange({ propName: 'originalQuery', propValue: event.currentTarget.value, updateOptions: false }); onPropChange({ propName: 'query', propValue: event.currentTarget.value, updateOptions }); }, [onPropChange] ); const onChange = useCallback((e: FormEvent) => updateVariable(e, false), [updateVariable]); const onBlur = useCallback((e: FormEvent) => updateVariable(e, true), [updateVariable]); return ( <> Text options ); }