@handie/squirtle
Version:
Widgets for Handie-React
13 lines (12 loc) • 933 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { getControl } from 'handie-react';
import { BooleanFieldStructuralWidget } from 'handie-react/dist/widgets/class';
export default class RadioEditBooleanFieldWidget extends BooleanFieldStructuralWidget {
render() {
const Radio = getControl('Radio');
const RadioGroup = getControl('RadioGroup');
const positiveOption = Radio ? (_jsx(Radio, Object.assign({ value: true }, { children: this.positiveLabel }), void 0)) : null;
const negativeOption = Radio ? (_jsx(Radio, Object.assign({ value: false }, { children: this.negativeLabel }), void 0)) : null;
return RadioGroup ? (_jsx(RadioGroup, Object.assign({ value: this.props.value, disabled: this.state.disabled, onChange: value => this.onChange(value) }, { children: this.negativeFirst ? [negativeOption, positiveOption] : [positiveOption, negativeOption] }), void 0)) : null;
}
}