import InputField from 'sentry/components/deprecatedforms/inputField'; import Tooltip from 'sentry/components/tooltip'; import {IconQuestion} from 'sentry/icons'; import {defined} from 'sentry/utils'; type Props = InputField['props']; type State = InputField['state'] & { value: boolean; }; export default class BooleanField extends InputField { coerceValue(initialValue: string | number) { const value = super.coerceValue(initialValue); return value ? true : false; } onChange = (e: React.ChangeEvent) => { const value = e.target.checked; this.setValue(value); }; getField() { return ( ); } render() { const {error} = this.state; let className = this.getClassName(); if (error) { className += ' has-error'; } return (
{defined(this.props.help) &&

{this.props.help}

} {error &&

{error}

}
); } getClassName() { return 'control-group checkbox'; } getType() { return 'checkbox'; } }