sws-frontend
Version:
sws frontend project
38 lines • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
require("./multistatecheckbox.scss");
exports.default = function (p) {
var onChange = p.onChange, children = p.children, className = p.className, disabled = p.disabled, value = p.value;
var states = [
{
icon: 'check_box_outline_blank',
style: {
color: 'var(--theme-gray)'
}
}, {
icon: 'check_box',
style: {
color: 'var(--theme-brand-success)'
}
}, {
icon: 'check_box',
style: {
color: 'var(--theme-brand-primary)'
}
}, {
icon: 'indeterminate_check_box',
style: {
color: 'var(--theme-brand-primary)'
}
}
];
return (React.createElement("div", { className: "field form-group multistate-checkbox" + " " + (className && className), onClick: function (e) {
var val = (value || 0) + 1;
((val + 1) == (p.states || states).length) && (val = 0);
return onChange(val);
} },
React.createElement("i", { style: (p.states || states)[value || 0].style, className: "material-icons state-" + (value || 0) }, (p.states || states)[value || 0].icon),
children && React.createElement("span", { className: "children" }, children)));
};
//# sourceMappingURL=multistatecheckbox.js.map