/**
 * DevExtreme (esm/renovation/ui/editors/drop_down_editors/select_box.js)
 * Version: 23.2.6 (build 24140-0112)
 * Build date: Sun May 19 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _extends from "@babel/runtime/helpers/esm/extends";
var _excluded = ["accessKey", "activeStateEnabled", "className", "dataSource", "defaultValue", "disabled", "displayExpr", "focusStateEnabled", "height", "hint", "hoverStateEnabled", "inputAttr", "isDirty", "isValid", "label", "labelMode", "name", "onClick", "onFocusIn", "onKeyDown", "placeholder", "readOnly", "rtlEnabled", "searchEnabled", "tabIndex", "validationError", "validationErrors", "validationMessageMode", "validationMessagePosition", "validationStatus", "value", "valueChange", "valueExpr", "visible", "width"];
import {
    createComponentVNode,
    normalizeProps
} from "inferno";
import {
    BaseInfernoComponent
} from "@devextreme/runtime/inferno";
import LegacySelectBox from "../../../../ui/select_box";
import {
    DomComponentWrapper
} from "../../common/dom_component_wrapper";
import {
    EditorProps
} from "../common/editor";
import {
    EditorStateProps
} from "../common/editor_state_props";
import {
    EditorLabelProps
} from "../common/editor_label_props";
export var viewFunction = _ref => {
    var {
        componentProps: componentProps,
        restAttributes: restAttributes
    } = _ref;
    return normalizeProps(createComponentVNode(2, DomComponentWrapper, _extends({
        componentType: LegacySelectBox,
        componentProps: componentProps,
        templateNames: ["dropDownButtonTemplate", "groupTemplate", "itemTemplate"]
    }, restAttributes)))
};
export var SelectBoxProps = Object.create(Object.prototype, _extends(Object.getOwnPropertyDescriptors(EditorProps), Object.getOwnPropertyDescriptors({
    placeholder: "",
    hoverStateEnabled: true,
    searchEnabled: false,
    defaultValue: null,
    isReactComponentWrapper: true
})));
export var SelectBoxPropsType = {
    get placeholder() {
        return SelectBoxProps.placeholder
    },
    get hoverStateEnabled() {
        return EditorStateProps.hoverStateEnabled
    },
    get searchEnabled() {
        return SelectBoxProps.searchEnabled
    },
    get defaultValue() {
        return SelectBoxProps.defaultValue
    },
    get readOnly() {
        return SelectBoxProps.readOnly
    },
    get name() {
        return SelectBoxProps.name
    },
    get validationError() {
        return SelectBoxProps.validationError
    },
    get validationErrors() {
        return SelectBoxProps.validationErrors
    },
    get validationMessageMode() {
        return SelectBoxProps.validationMessageMode
    },
    get validationMessagePosition() {
        return SelectBoxProps.validationMessagePosition
    },
    get validationStatus() {
        return SelectBoxProps.validationStatus
    },
    get isValid() {
        return SelectBoxProps.isValid
    },
    get isDirty() {
        return SelectBoxProps.isDirty
    },
    get inputAttr() {
        return SelectBoxProps.inputAttr
    },
    get className() {
        return SelectBoxProps.className
    },
    get activeStateEnabled() {
        return EditorStateProps.activeStateEnabled
    },
    get disabled() {
        return SelectBoxProps.disabled
    },
    get focusStateEnabled() {
        return EditorStateProps.focusStateEnabled
    },
    get tabIndex() {
        return SelectBoxProps.tabIndex
    },
    get visible() {
        return SelectBoxProps.visible
    },
    get label() {
        return EditorLabelProps.label
    },
    get labelMode() {
        return EditorLabelProps.labelMode
    },
    isReactComponentWrapper: true
};
export class SelectBox extends BaseInfernoComponent {
    constructor(props) {
        super(props);
        this.state = {
            value: void 0 !== this.props.value ? this.props.value : this.props.defaultValue
        }
    }
    get componentProps() {
        return _extends({}, this.props, {
            value: void 0 !== this.props.value ? this.props.value : this.state.value
        })
    }
    get restAttributes() {
        var _this$props$value = _extends({}, this.props, {
                value: void 0 !== this.props.value ? this.props.value : this.state.value
            }),
            restProps = _objectWithoutPropertiesLoose(_this$props$value, _excluded);
        return restProps
    }
    render() {
        var props = this.props;
        return viewFunction({
            props: _extends({}, props, {
                value: void 0 !== this.props.value ? this.props.value : this.state.value
            }),
            componentProps: this.componentProps,
            restAttributes: this.restAttributes
        })
    }
}
SelectBox.defaultProps = SelectBoxPropsType;
