import React , { useCallback } from 'react' ; import { EuiSpacer } from '@elastic/eui' ; import { VisEditorOptionsProps } from 'src/plugins/visualizations/public' ; import { GaugeVisParams } from '../../../gauge' ; import { RangesPanel } from './ranges_panel' ; import { StylePanel } from './style_panel' ; import { LabelsPanel } from './labels_panel' ; export type GaugeOptionsInternalProps = VisEditorOptionsProps < GaugeVisParams > & { setGaugeValue : < T extends keyof GaugeVisParams [ 'gauge' ] > ( paramName : T , value : GaugeVisParams [ 'gauge' ] [ T ] ) => void ; } ; function GaugeOptions ( props ) { const { stateParams , setValue } = props ; const setGaugeValue = useCallback ( ( paramName , value ) => setValue ( 'gauge' , { ... stateParams . gauge , [ paramName ] : value , } ) , [ setValue , stateParams . gauge ] ) ; return ( < > < StylePanel { ... props } setGaugeValue = { setGaugeValue } / > < EuiSpacer size = "s" / > < RangesPanel { ... props } setGaugeValue = { setGaugeValue } / > < EuiSpacer size = "s" / > < LabelsPanel { ... props } setGaugeValue = { setGaugeValue } / > < />); } export { GaugeOptions as default } ;