import React from 'react';
import PropTypes from 'prop-types';

const propTypes = {
	value: PropTypes.any,
	children: PropTypes.node,
	className: PropTypes.string,
	onChange: PropTypes.func,
	onFocus: PropTypes.func,
	onBlur: PropTypes.func,
	enabled: PropTypes.bool,
};

const defaultProps = {
	className: '',
	enabled: true,
};

export default class FormSlot extends React.Component {
	constructor(props) {
		super(props);

		this.state = {
			hasFocus: false,
		};

		this.focus = null;
		this.blur = null;
		this.prepareChild = (children, restProps) => {
			if (!this.focus) {
				this.focus = () => {
					children.props.onFocus ? children.props.onFocus() : null;
					this.setState({hasFocus: true});
				};
				this.blur = () => {
					children.props.onBlur ? children.props.onBlur() : null;
					this.setState({hasFocus: false});
				};
			}

			return React.cloneElement(children, Object.assign({}, restProps, {onFocus: this.focus, onBlur: this.blur}));
		};
	}

	render() {
		const classNames = ['mdo-formslot'];

		const {
			children,
			className,
			enabled,
			label,
			...restProps
		} = this.props;

		const {
			hasFocus
		} = this.state;

		if (!enabled) {
			classNames.push('mdo-disabled');
		}

		if(hasFocus){
			classNames.push('mdo-focused');
		}

		if(restProps.value === undefined || restProps.value === null){
			classNames.push('mdo-empty');
		}

		if (className) {
			classNames.push(className);
		}

		const preparedChild = this.prepareChild(children, restProps);

		return (
			<div className={classNames.join(' ')}>
				<label>
					<span>{label}</span>
					{preparedChild}
				</label>
			</div>
		);
	}
}

FormSlot.propTypes = propTypes;
FormSlot.defaultProps = defaultProps;

@@ -1215,16 +1215,17 @@
 %09%7D%0A%0A%09%09if
+ 
 (hasFocu
@@ -1226,16 +1226,17 @@
 asFocus)
+ 
 %7B%0A%09%09%09cla
@@ -1273,16 +1273,17 @@
 %09%7D%0A%0A%09%09if
+ 
 (restPro
@@ -1291,17 +1291,17 @@
 s.value 
-=
+!
 == undef
@@ -1309,10 +1309,10 @@
 ned 
-%7C%7C
+&&
  res
@@ -1328,17 +1328,44 @@
 lue 
-=
+!
 == null
-)
+ && restProps.value !== '') 
 %7B%0A%09%09
@@ -1390,13 +1390,14 @@
 mdo-
-empty
+filled
 ');%0A

Change class output to positive label