<commit_before>import React from 'react';
import { CheckboxGroup } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

const CheckboxGroupComponent = ({refFunction, inputProperties}) => 
  <CheckboxGroup {...inputProperties} ref={refFunction} />;

registerComponent('FormComponentCheckboxGroup', CheckboxGroupComponent);<commit_msg>Give CheckboxGroup its own custom event handler (fix #1998)<commit_after>import React from 'react';
import { Checkbox } from 'formsy-react-components';
import { registerComponent } from 'meteor/vulcan:core';

// note: treat checkbox group the same as a nested component, using `path`
const CheckboxGroupComponent = ({ refFunction, path, value, updateCurrentValues, inputProperties }) =>
  inputProperties.options.map((option, i) => (
    <Checkbox
      key={i}
      {...inputProperties}
      label={option.label}
      value={value.includes(option.value)}
      ref={refFunction}
      onChange={(name, isChecked) => {
        // give each individual checkbox its own path
        const checkboxPath = `${path}.${i}`;
        if (isChecked) {
          updateCurrentValues({ [checkboxPath]: option.value });
        } else {
          updateCurrentValues({ [checkboxPath]: null });
        }
      }}
    />
  ));

registerComponent('FormComponentCheckboxGroup', CheckboxGroupComponent);
{'fraction_non_alphanumeric': 0.1287711552612215, 'fraction_numerical': 0.0029433406916850625, 'mean_word_length': 4.093632958801498, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4333363', 'n_tokens_mistral': 371, 'n_tokens_neox': 362, 'n_words': 90}