UNPKG

cosmo-ui

Version:
37 lines 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = require("react"); var react_redux_1 = require("react-redux"); var _1 = require("."); var reducers_1 = require("../reducers"); var selectors_1 = require("../selectors"); var actions_1 = require("../actions"); var _TextInput = (function (_super) { tslib_1.__extends(_TextInput, _super); function _TextInput() { return _super !== null && _super.apply(this, arguments) || this; } _TextInput.prototype.renderField = function () { var _a = this.props, name = _a.name, disabled = _a.disabled, placeholder = _a.placeholder; return (React.createElement("input", { ref: this.setFieldRef, className: this.classNames(), name: name, id: name + "Field", placeholder: placeholder, type: "text", value: this.getValueFromState(), disabled: disabled, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur })); }; return _TextInput; }(_1.BaseFormField)); var mapStateToProps = function (state, ownProps) { return (tslib_1.__assign({}, ownProps, { field: selectors_1.mapStateToField(state[reducers_1.FORM_REDUCER_KEY], ownProps) })); }; var mapDispatchToProps = { setFormField: actions_1.setFormField, }; var ConnectedTextInput = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(_TextInput); var TextInput = (function (_super) { tslib_1.__extends(TextInput, _super); function TextInput() { return _super !== null && _super.apply(this, arguments) || this; } TextInput.prototype.render = function () { return React.createElement(ConnectedTextInput, tslib_1.__assign({}, this.props, { formName: this.formName })); }; return TextInput; }(_1.FormFieldWrapper)); exports.TextInput = TextInput; //# sourceMappingURL=text-input.js.map