UNPKG

@ray-js/components

Version:

Ray basic components

34 lines 1.06 kB
import "core-js/modules/esnext.iterator.constructor.js"; import "core-js/modules/esnext.iterator.map.js"; import * as React from 'react'; import { RadioGroup as RemaxRadioGroup } from '@ray-core/wechat'; import Radio from '../Radio'; import Label from '../Label'; const RadioGroup = props => { const { options, name, disabled, onChange = () => {}, children } = props; return /*#__PURE__*/React.createElement(RemaxRadioGroup, { name: name, onChange: e => { !disabled && onChange(e); } }, (() => children)() || (() => { return options.map((item, index) => { var _item$checked; return /*#__PURE__*/React.createElement(Label, { key: index + '_' + item.value }, /*#__PURE__*/React.createElement(Radio, { value: item.value, checked: (_item$checked = item.checked) !== null && _item$checked !== void 0 ? _item$checked : false, disabled: disabled || item.disabled || false, color: item.color }), item.label); }); })()); }; export default RadioGroup;