UNPKG

@handie/squirtle

Version:

Widgets for Handie-React

13 lines (12 loc) 1.16 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { getControl } from 'handie-react'; import { EnumFieldStructuralWidget } from 'handie-react/dist/widgets/class'; export default class RadioEditEnumFieldWidget extends EnumFieldStructuralWidget { render() { const RadioGroup = getControl('RadioGroup'); const Radio = getControl('Radio'); const Tooltip = getControl('Tooltip'); const Icon = getControl('Icon'); return RadioGroup ? (_jsx(RadioGroup, Object.assign({ value: this.props.value, disabled: this.state.disabled, onChange: value => this.onChange(value) }, { children: this.state.options.map(opt => Radio ? (_jsx(Radio, Object.assign({ value: opt.value, disabled: opt.disabled }, { children: opt.hint ? (_jsxs(_Fragment, { children: [opt.label, Tooltip ? (_jsx(Tooltip, Object.assign({ content: opt.hint }, { children: Icon ? (_jsx(Icon, { refs: this.config.hintIcon || this.getCommonBehavior('field.hintIcon') }, void 0)) : null }), void 0)) : null] }, void 0)) : (opt.label) }), `Option${opt.value}OfRadioEditEnumFieldWidget`)) : null) }), void 0)) : null; } }