import CX from "classnames";
import React from "react";
import PropTypes from "prop-types";

/**
 * A simple checkbox component based on the application icon font.
 *
 * @param props
 * @returns {*}
 * @constructor
 */
export const Checkbox = (props) => {

    let name;

    if (props.checked) {
        name = "checked";
    } else if (props.partial) {
        name = "partial";
    } else {
        name = "unchecked";
    }

    let className = CX("pointer", {
        "pull-right": props.pullRight,
        "labelled-checkbox": props.label
    });

    if (props.className) {
        className += ` ${props.className}`;
    }

    return (
        <span className={className} onClick={props.onClick} style={props.style}>
            <i className={`i-checkbox-${name}`} /> {props.label ? <span>{props.label}</span> : null}
        </span>
    );
};

Checkbox.propTypes = {
    label: PropTypes.node,
    checked: PropTypes.bool,
    partial: PropTypes.bool,
    onClick: PropTypes.func,
    pending: PropTypes.bool,
    style: PropTypes.object,
    className: PropTypes.string,
    pullRight: PropTypes.bool
};

Checkbox.defaultProps = {
    checked: false,
    partial: false,
    pullRight: false
};

@@ -537,16 +537,54 @@
 ps.label
+,%0A        %22text-muted%22: props.disabled
 %0A    %7D);
@@ -659,24 +659,169 @@
 e%7D%60;%0A    %7D%0A%0A
+    let style = %7Bcursor: props.disabled ? %22not-allowed%22 : %22pointer%22%7D;%0A%0A    if (props.style) %7B%0A        style = %7B...style, ...props.style%7D;%0A    %7D%0A%0A
     return (
@@ -866,16 +866,40 @@
 nClick=%7B
+props.disabled ? null : 
 props.on
@@ -912,22 +912,16 @@
  style=%7B
-props.
 style%7D%3E%0A
@@ -1075,35 +1075,8 @@
 = %7B%0A
-    label: PropTypes.node,%0A
     
@@ -1108,31 +1108,92 @@
     
-partial: PropTypes.bool
+className: PropTypes.string,%0A    disabled: PropTypes.bool,%0A    label: PropTypes.node
 ,%0A  
@@ -1228,14 +1228,14 @@
    p
-ending
+artial
 : Pr
@@ -1252,21 +1252,23 @@
 ol,%0A    
-style
+pending
 : PropTy
@@ -1275,62 +1275,54 @@
 pes.
-object,%0A    className: PropTypes.string,%0A    pullRight
+bool,%0A    pullRight: PropTypes.bool,%0A    style
 : Pr
@@ -1329,20 +1329,22 @@
 opTypes.
-bool
+object
 %0A%7D;%0A%0AChe

Make Checkbox component disableable