UNPKG

@ray-js/components

Version:

Ray basic components

36 lines 1.2 kB
import "core-js/modules/esnext.iterator.constructor.js"; import "core-js/modules/esnext.iterator.map.js"; import * as React from 'react'; import { CheckboxGroup as RemaxCheckboxGroup } from '@ray-js/adapter'; import Checkbox from '../Checkbox'; import Label from '../Label'; const CheckboxGroup = props => { // @ts-ignore const { options, name, disabled, onChange, children } = props; return /*#__PURE__*/React.createElement(RemaxCheckboxGroup, { name: name, onChange: e => { !disabled && (onChange === null || onChange === void 0 ? void 0 : onChange(e)); } }, (() => children)() || (() => { if (!options || !Array.isArray(options)) return null; return options.map((item, index) => { var _item$checked; return /*#__PURE__*/React.createElement(Label, { key: index + '_' + item.value }, /*#__PURE__*/React.createElement(Checkbox, { 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 CheckboxGroup;