import { __rest } from '../../../_virtual/_tslib.js';
import React__default from 'react';
import AlertCircle from '../../../icons/AlertCircle.js';
import { getId } from '../../../utils/index.js';
import { CheckRadioInputGroupWrapper, CheckRadioGroupLabel, CheckRadioGroupWrapper, CheckRadioErrorArea, CheckRadioHintArea } from '../styles.js';
import { CheckboxInput } from './CheckboxInput.js';

function CheckboxGroup(_a) {
    var { value, options, onChange, name, groupLabel, orientation = 'row', id, hasError = false, errorText, disabled = false, assistText } = _a, props = __rest(_a, ["value", "options", "onChange", "name", "groupLabel", "orientation", "id", "hasError", "errorText", "disabled", "assistText"]);
    const appendTestId = getId(props['data-testid']);
    const appendTrackId = getId(props['data-trackid']);
    return (React__default.createElement(CheckRadioInputGroupWrapper, null,
        groupLabel && (React__default.createElement(CheckRadioGroupLabel, { "data-testid": appendTestId('group-label'), "data-trackid": appendTrackId('group-label') }, groupLabel)),
        options && (React__default.createElement(CheckRadioGroupWrapper, { orientation: orientation }, options.map((buttonProps) => (React__default.createElement(CheckboxInput, { key: buttonProps.value, label: buttonProps.label, value: buttonProps.value, id: buttonProps.id, name: name, hasError: hasError, disabled: disabled || buttonProps.disabled, onChange: onChange, "data-testid": appendTestId(buttonProps['data-testid']), "data-trackid": appendTrackId(buttonProps['data-trackid']), "aria-label": buttonProps.label, indeterminate: buttonProps.indeterminate, checked: buttonProps.checked }))))),
        hasError && errorText && (React__default.createElement(CheckRadioErrorArea, { "data-testid": appendTestId('error'), "data-trackid": appendTrackId('error') },
            React__default.createElement(AlertCircle, null),
            errorText)),
        assistText && !hasError && (React__default.createElement(CheckRadioHintArea, { "data-testid": appendTestId('assistText'), "data-trackid": appendTrackId('assistText') }, assistText))));
}

export { CheckboxGroup };
