2015-10-19 03:38:25 +03:00
|
|
|
import React from 'react';
|
2016-05-22 20:08:47 +03:00
|
|
|
import classnames from 'classnames';
|
|
|
|
import { themr } from 'react-css-themr';
|
2015-10-19 03:38:25 +03:00
|
|
|
import Checkbox from '../checkbox';
|
2015-11-23 00:28:24 +03:00
|
|
|
import ListItemContent from './ListItemContent';
|
2015-10-19 03:38:25 +03:00
|
|
|
|
2016-05-22 20:08:47 +03:00
|
|
|
const ListCheckbox = ({ caption, checked, className, disabled, legend, name, onBlur, onChange, onFocus, theme }) => {
|
|
|
|
const _className = classnames(theme.item, theme.checkboxItem, {
|
|
|
|
[theme.disabled]: disabled
|
|
|
|
}, className);
|
2015-10-19 03:38:25 +03:00
|
|
|
|
2015-10-20 08:40:51 +03:00
|
|
|
return (
|
2016-05-22 20:08:47 +03:00
|
|
|
<li className={_className}>
|
2015-10-20 08:40:51 +03:00
|
|
|
<Checkbox
|
2016-05-22 20:08:47 +03:00
|
|
|
checked={checked}
|
|
|
|
className={theme.checkbox}
|
|
|
|
disabled={disabled}
|
|
|
|
label={<ListItemContent caption={caption} legend={legend} />}
|
|
|
|
name={name}
|
|
|
|
onBlur={onBlur}
|
|
|
|
onChange={onChange}
|
|
|
|
onFocus={onFocus}
|
2015-10-20 08:40:51 +03:00
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
};
|
2015-10-19 03:38:25 +03:00
|
|
|
|
2015-10-20 08:40:51 +03:00
|
|
|
ListCheckbox.propTypes = {
|
|
|
|
caption: React.PropTypes.string.isRequired,
|
|
|
|
checked: React.PropTypes.bool,
|
|
|
|
className: React.PropTypes.string,
|
|
|
|
disabled: React.PropTypes.bool,
|
|
|
|
legend: React.PropTypes.string,
|
|
|
|
name: React.PropTypes.string,
|
|
|
|
onBlur: React.PropTypes.func,
|
|
|
|
onChange: React.PropTypes.func,
|
2016-05-22 20:08:47 +03:00
|
|
|
onFocus: React.PropTypes.func,
|
|
|
|
theme: React.PropTypes.shape({
|
|
|
|
checkbox: React.PropTypes.string.isRequired,
|
|
|
|
checkboxItem: React.PropTypes.string.isRequired,
|
|
|
|
disabled: React.PropTypes.string.isRequired,
|
|
|
|
item: React.PropTypes.string.isRequired
|
|
|
|
})
|
2015-10-20 08:40:51 +03:00
|
|
|
};
|
2015-10-19 03:38:25 +03:00
|
|
|
|
2015-10-20 08:40:51 +03:00
|
|
|
ListCheckbox.defaultProps = {
|
2015-11-01 12:48:12 +03:00
|
|
|
checked: false,
|
2015-10-20 08:40:51 +03:00
|
|
|
disabled: false
|
|
|
|
};
|
2015-10-19 03:38:25 +03:00
|
|
|
|
2016-05-22 20:08:47 +03:00
|
|
|
export default themr('ToolboxList')(ListCheckbox);
|