'use strict';

var clsx = require('clsx');
var Body = require('../body/Body.js');
var CheckboxButton = require('../checkboxButton/CheckboxButton.js');
require('../common/theme.js');
require('../common/direction.js');
require('../common/propsValues/control.js');
require('../common/propsValues/breakpoint.js');
require('../common/propsValues/size.js');
var typography = require('../common/propsValues/typography.js');
require('../common/propsValues/width.js');
require('../common/propsValues/type.js');
require('../common/propsValues/dateMode.js');
require('../common/propsValues/monthFormat.js');
require('../common/propsValues/position.js');
require('../common/propsValues/layouts.js');
require('../common/propsValues/status.js');
require('../common/propsValues/sentiment.js');
require('../common/propsValues/profileType.js');
require('../common/propsValues/variant.js');
require('../common/propsValues/scroll.js');
require('../common/propsValues/markdownNodeType.js');
require('../common/fileType.js');
require('@transferwise/icons');
require('react');
require('react-intl');
require('../common/closeButton/CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');

function Checkbox({
  id,
  checked,
  required,
  disabled,
  readOnly,
  label,
  className,
  secondary,
  onChange,
  onFocus,
  onBlur
}) {
  const classList = clsx.clsx('np-checkbox', {
    checkbox: true,
    'checkbox-lg': secondary,
    'checkbox-disabled': disabled
  }, className);
  const innerDisabled = disabled || readOnly;
  return /*#__PURE__*/jsxRuntime.jsx("div", {
    id: id,
    className: classList,
    children: /*#__PURE__*/jsxRuntime.jsxs("label", {
      className: clsx.clsx({
        disabled
      }),
      children: [/*#__PURE__*/jsxRuntime.jsx(CheckboxButton, {
        className: "p-r-2",
        checked: checked,
        disabled: innerDisabled,
        required: !innerDisabled && required,
        onFocus: onFocus,
        onChange: () => onChange(!checked),
        onBlur: onBlur
      }), /*#__PURE__*/jsxRuntime.jsxs(Body, {
        as: "span",
        className: "np-checkbox__text",
        type: secondary ? typography.Typography.BODY_LARGE_BOLD : typography.Typography.BODY_LARGE,
        children: [/*#__PURE__*/jsxRuntime.jsx("span", {
          className: required ? 'has-required' : undefined,
          children: label
        }), secondary && /*#__PURE__*/jsxRuntime.jsx(Body, {
          as: "span",
          children: secondary
        })]
      })]
    })
  });
}

module.exports = Checkbox;
//# sourceMappingURL=Checkbox.js.map
