'use strict';

var clsx = require('clsx');
var Body = require('../body/Body.js');
var jsxRuntime = require('react/jsx-runtime');
var CheckboxButton = require('../checkboxButton/CheckboxButton.js');
var typography = require('../common/propsValues/typography.js');

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
