/**
* Common part of Checkbox & Radio
*/
import { useSlots } from '../utils';
import Icon from '../icon';
import findParent from './find-parent';
export default (parent, bem) => ({
mixins: [findParent],
props: {
name: null,
value: null,
disabled: Boolean,
checkedColor: String,
labelPosition: String,
labelDisabled: Boolean,
shape: {
type: String,
default: 'round'
}
},
created() {
this.findParent(parent);
},
computed: {
isDisabled() {
return (this.parent && this.parent.disabled) || this.disabled;
},
iconStyle() {
const { checkedColor } = this;
if (checkedColor && this.checked && !this.isDisabled) {
return {
borderColor: checkedColor,
backgroundColor: checkedColor
};
}
}
},
render(h) {
const { checked } = this;
const slots = useSlots(this);
const CheckIcon = slots('icon', { checked }) || (