import { __rest } from '../../_virtual/_tslib.js';
import React__default from 'react';
import Check from '../../icons/Check.js';
import { Wrapper, ToggleLabel, ToggleWrapper, ToggleInput, ToggleSlider } from './styles.js';
import { getId } from '../../utils/index.js';

function Toggle(_a) {
    var { checked, disabled, id, onChange, value, label, name } = _a, props = __rest(_a, ["checked", "disabled", "id", "onChange", "value", "label", "name"]);
    const handleInputChange = (event) => onChange(event);
    const appendTestId = getId(props['data-testid']);
    const appendTrackId = getId(props['data-testid']);
    return (React__default.createElement(Wrapper, { htmlFor: id || label, "data-testid": appendTestId('wrapper'), "data-trackid": appendTrackId('wrapper') },
        label && (React__default.createElement(ToggleLabel, { disabled: disabled, "aria-label": label, "data-testid": appendTestId('label') }, label)),
        React__default.createElement(ToggleWrapper, null,
            React__default.createElement(ToggleInput, { id: id ? id : label, name: name, value: value, checked: checked, "aria-checked": props['aria-checked'], disabled: disabled, type: "checkbox", role: "checkbox", onChange: handleInputChange, "data-testid": appendTestId('input'), "data-trackid": appendTrackId('input') }),
            React__default.createElement(ToggleSlider, null,
                React__default.createElement(Check, null)))));
}

export { Toggle };
