import { clsx } from 'clsx';
import Body from '../body/Body.mjs';
import { jsx, jsxs } from 'react/jsx-runtime';
import CheckboxButton from '../checkboxButton/CheckboxButton.mjs';
import { Typography } from '../common/propsValues/typography.mjs';

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

export { Checkbox as default };
//# sourceMappingURL=Checkbox.mjs.map
