mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
7bc219422e
* Update Babel and ESLint and fix all related errors * Update babel-jest
43 lines
771 B
JavaScript
43 lines
771 B
JavaScript
// @flow
|
|
import * as React from 'react';
|
|
import autobind from 'autobind-decorator';
|
|
|
|
type Props = {
|
|
indeterminate: boolean,
|
|
checked: boolean,
|
|
};
|
|
|
|
@autobind
|
|
class IndeterminateCheckbox extends React.PureComponent<Props> {
|
|
input: ?HTMLInputElement;
|
|
|
|
_setRef(n: ?HTMLInputElement) {
|
|
this.input = n;
|
|
}
|
|
|
|
_update() {
|
|
if (this.input) {
|
|
this.input.indeterminate = this.props.indeterminate;
|
|
}
|
|
}
|
|
|
|
componentDidMount() {
|
|
this._update();
|
|
}
|
|
|
|
componentDidUpdate() {
|
|
this._update();
|
|
}
|
|
|
|
render() {
|
|
const {
|
|
indeterminate, // eslint-disable-line no-unused-vars
|
|
...otherProps
|
|
} = this.props;
|
|
|
|
return <input ref={this._setRef} type="checkbox" {...(otherProps: Object)} />;
|
|
}
|
|
}
|
|
|
|
export default IndeterminateCheckbox;
|