remove no longer required div wrapper around ValidatedDualRange (#70188)

* remove no longer required div wrapper around ValidatedDualRange

* tslint
This commit is contained in:
Nathan Reese 2020-06-29 09:37:16 -06:00 committed by GitHub
parent 848c239bff
commit 3347c8b9df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
import { i18n } from '@kbn/i18n'; import { i18n } from '@kbn/i18n';
import React, { Component, createRef } from 'react'; import React, { Component } from 'react';
import { EuiFormRow, EuiDualRange } from '@elastic/eui'; import { EuiFormRow, EuiDualRange } from '@elastic/eui';
import { EuiFormRowDisplayKeys } from '@elastic/eui/src/components/form/form_row/form_row'; import { EuiFormRowDisplayKeys } from '@elastic/eui/src/components/form/form_row/form_row';
import { EuiDualRangeProps } from '@elastic/eui/src/components/form/range/dual_range'; import { EuiDualRangeProps } from '@elastic/eui/src/components/form/range/dual_range';
@ -72,18 +72,6 @@ export class ValidatedDualRange extends Component<Props> {
return null; return null;
} }
// Can remove after eui#3412 is resolved
componentDidMount() {
if (this.trackRef.current) {
const track = this.trackRef.current.querySelector('.euiRangeTrack');
if (track) {
track.setAttribute('aria-hidden', 'true');
}
}
}
trackRef = createRef<HTMLDivElement>();
// @ts-ignore state populated by getDerivedStateFromProps // @ts-ignore state populated by getDerivedStateFromProps
state: State = {}; state: State = {};
@ -119,34 +107,32 @@ export class ValidatedDualRange extends Component<Props> {
} = this.props; } = this.props;
return ( return (
<div ref={this.trackRef}> <EuiFormRow
<EuiFormRow compressed={compressed}
fullWidth={fullWidth}
isInvalid={!this.state.isValid}
error={this.state.errorMessage ? [this.state.errorMessage] : []}
label={label}
display={formRowDisplay}
>
<EuiDualRange
compressed={compressed} compressed={compressed}
fullWidth={fullWidth} fullWidth={fullWidth}
isInvalid={!this.state.isValid} value={this.state.value}
error={this.state.errorMessage ? [this.state.errorMessage] : []} onChange={this._onChange}
label={label} minInputProps={{
display={formRowDisplay} 'aria-label': i18n.translate('kibana-react.dualRangeControl.minInputAriaLabel', {
> defaultMessage: 'Range minimum',
<EuiDualRange }),
compressed={compressed} }}
fullWidth={fullWidth} maxInputProps={{
value={this.state.value} 'aria-label': i18n.translate('kibana-react.dualRangeControl.maxInputAriaLabel', {
onChange={this._onChange} defaultMessage: 'Range maximum',
minInputProps={{ }),
'aria-label': i18n.translate('kibana-react.dualRangeControl.minInputAriaLabel', { }}
defaultMessage: 'Range minimum', {...rest}
}), />
}} </EuiFormRow>
maxInputProps={{
'aria-label': i18n.translate('kibana-react.dualRangeControl.maxInputAriaLabel', {
defaultMessage: 'Range maximum',
}),
}}
{...rest}
/>
</EuiFormRow>
</div>
); );
} }
} }