text: import React from 'react';
  import APRadio from '../APRadio/APRadio';
  import ErrorField from '../ErrorField/ErrorField';
  import FreeText from '../FreeText/FreeText';
  import { getBEMClasses } from 'helpers/cssClassesHelper';
  import './RadioGroup.css';
  
  const bemClasses = getBEMClasses(['radio-group']);
  
  const RadioGroup = ({
    options,
    validate,
    showErrorMessage,
    name,
    ...props
  }) => (
    <>
      {options.map(({ label, value, valueAsFreeText }) => {
        const id = `${name}-${value}`;
        return (
          <div
            className={bemClasses('container')}
            key={`RadioGroup-${name}-${value}`}
          >
            <APRadio id={id} label={label} name={name} value={value} {...props} />
            {valueAsFreeText && (
              <FreeText
                id={id}
                name={name}
                value={value}
                validate={validate}
                customClass={bemClasses('freetext')}
                {...props}
              />
            )}
          </div>
        );
      })}
      <ErrorField
        name={name}
        validate={validate}
        showErrorMessage={showErrorMessage}
      />
    </>
  );
  
  export default RadioGroup;
  