import React from 'react'; import { Checkbox } from 'formsy-react-components'; import { registerComponent } from 'meteor/vulcan:core'; import without from 'lodash/without'; // note: treat checkbox group the same as a nested component, using `path` const CheckboxGroupComponent = ({ refFunction, label, path, value, updateCurrentValues, inputProperties }) => (
{inputProperties.options.map((option, i) => ( { const newValue = isChecked ? [...value, option.value] : without(value, option.value); updateCurrentValues({ [path]: newValue }); }} /> ))}
); registerComponent('FormComponentCheckboxGroup', CheckboxGroupComponent);