var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
// import { Input } from "@alifd/next";
import ConfigProvider from '../config-provider';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import cls from 'classnames';
import { Input as NextInput } from '@alifd/next';
import { getTheme } from '../utils/getTheme';
import { omitProps } from '../utils/object';
class TextArea extends Component {
    render() {
        const _a = this.props, { prefix = 'next-', className } = _a, otherProps = __rest(_a, ["prefix", "className"]);
        const theme = getTheme(this.context, this.props);
        return (React.createElement(NextInput.TextArea, Object.assign({}, otherProps, { prefix: prefix, className: cls(className, {
                [`${prefix}white`]: theme === 'white',
                [`${prefix}grey`]: theme === 'grey',
            }) })));
    }
}
// contextTypes
TextArea.contextTypes = {
    theme: PropTypes.string,
};
class Password extends Component {
    render() {
        const _a = this.props, { prefix = 'next-', size = 'medium', className } = _a, otherProps = __rest(_a, ["prefix", "size", "className"]);
        const theme = getTheme(this.context, this.props);
        if (size === 'xs') {
            return (React.createElement(NextInput.Password, Object.assign({}, omitProps(otherProps, ['size']), { prefix: prefix, className: cls(className, {
                    [`${prefix}grey`]: theme === 'grey',
                    [`${prefix}xs`]: size === 'xs',
                    [`${prefix}white`]: theme === 'white',
                }) })));
        }
        return (React.createElement(NextInput.Password, Object.assign({}, otherProps, { prefix: prefix, size: size, className: cls(className, {
                [`${prefix}grey`]: theme === 'grey',
                [`${prefix}white`]: theme === 'white',
            }) })));
    }
}
// contextTypes
Password.contextTypes = {
    theme: PropTypes.string,
};
class Group extends Component {
    render() {
        const _a = this.props, { prefix = 'next-', className } = _a, otherProps = __rest(_a, ["prefix", "className"]);
        const theme = getTheme(this.context, this.props);
        return (React.createElement(NextInput.Group, Object.assign({}, otherProps, { prefix: prefix, className: cls(className, {
                [`${prefix}grey`]: theme === 'grey',
                [`${prefix}white`]: theme === 'white',
            }) })));
    }
}
// contextTypes
Group.contextTypes = {
    theme: PropTypes.string,
};
class Input extends Component {
    render() {
        const _a = this.props, { prefix = 'next-', className, size = 'medium' } = _a, otherProps = __rest(_a, ["prefix", "className", "size"]);
        const theme = getTheme(this.context, this.props);
        if (size === 'xs') {
            return (React.createElement(NextInput, Object.assign({}, omitProps(otherProps, ['size']), { prefix: prefix, className: cls(className, {
                    [`${prefix}grey`]: theme === 'grey',
                    [`${prefix}white`]: theme === 'white',
                    [`${prefix}xs`]: size === 'xs',
                }) })));
        }
        return (React.createElement(NextInput, Object.assign({}, otherProps, { prefix: prefix, size: size, className: cls(className, {
                [`${prefix}grey`]: theme === 'grey',
                [`${prefix}white`]: theme === 'white',
            }) })));
    }
}
Input.TextArea = ConfigProvider.config(TextArea);
Input.Group = ConfigProvider.config(Group);
Input.Password = ConfigProvider.config(Password);
// contextTypes
Input.contextTypes = {
    theme: PropTypes.string,
};
export default ConfigProvider.config(Input);
