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 React, { Component } from 'react';
import cls from 'classnames';
import { Search as NextSearch } from '@alifd/next';
class Search extends Component {
    constructor(props) {
        super(props);
        this.onFocus = e => {
            this.setState({
                focus: true,
            });
            const { onFocus } = this.props;
            onFocus && onFocus(e);
        };
        this.onBlur = e => {
            this.setState({
                focus: false,
            });
            const { onBlur } = this.props;
            onBlur && onBlur(e);
        };
        this.state = {
            focus: false,
        };
    }
    render() {
        const _a = this.props, { prefix = 'next-', size = 'medium', theme = 'white', type = 'normal' } = _a, otherProps = __rest(_a, ["prefix", "size", "theme", "type"]);
        return React.createElement(NextSearch, Object.assign({ size: size }, otherProps, { className: cls(this.props.className, {
                [`${prefix}contain-focus`]: this.state.focus === true,
                [`${prefix}search-small`]: size === 'small',
                [`${prefix}search-xs`]: size === 'xs',
                [`${prefix}search-with-no-title`]: !this.props.searchText,
                [`${prefix}search-gray-theme`]: theme === 'gray',
                [`${prefix}search-white-theme`]: theme === 'white',
                [`${prefix}search-brand-type`]: type === 'brand',
            }), onBlur: this.onBlur, onFocus: this.onFocus }));
    }
}
export default Search;
