UNPKG

@agentlab/rjsf-antd

Version:

Ant Design theme, fields and widgets for react-jsonschema-form

16 lines 817 B
import React from 'react'; import { Radio } from 'antd'; const RadioWidget = ({ options, value, disabled, readonly, onChange }) => { // Generating a unique field name to identify this set of radio buttons const name = Math.random().toString(); const { enumOptions, enumDisabled } = options; const _onChange = (e) => { onChange(e.target.value); }; return (React.createElement(Radio.Group, { name: name, value: value, onChange: _onChange }, enumOptions.map((option, i) => { const itemDisabled = enumDisabled && enumDisabled.indexOf(option.value) !== -1; return (React.createElement(Radio, { value: option.value, key: i, disabled: disabled || itemDisabled || readonly }, `${option.label}`)); }))); }; export default RadioWidget; //# sourceMappingURL=RadioWidget.js.map