mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
42e198bf75
* Gruvbox theme * Added Storybook for all components that don't fail in browser
43 lines
761 B
JavaScript
43 lines
761 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} />;
|
|
}
|
|
}
|
|
|
|
export default IndeterminateCheckbox;
|