@s-ui/react-atom-input
Advanced tools
Comparing version 1.14.0 to 1.15.0
@@ -5,2 +5,20 @@ # Change Log | ||
<a name="1.15.0"></a> | ||
# 1.15.0 (2018-11-02) | ||
### Bug Fixes | ||
* fix typo ([f0eaec9](https://github.com/SUI-Components/sui-components/commit/f0eaec9)) | ||
### Features | ||
* component prepared for MoleculeInputTags ([2719b1a](https://github.com/SUI-Components/sui-components/commit/2719b1a)) | ||
* custom key onEnter ([ef57dc5](https://github.com/SUI-Components/sui-components/commit/ef57dc5)) | ||
* placeholders instead of mixins ([95300ca](https://github.com/SUI-Components/sui-components/commit/95300ca)) | ||
* use of sui-theme variables ([45a7628](https://github.com/SUI-Components/sui-components/commit/45a7628)) | ||
<a name="1.14.0"></a> | ||
@@ -7,0 +25,0 @@ # 1.14.0 (2018-10-23) |
@@ -62,12 +62,28 @@ 'use strict'; | ||
function Input() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
(0, _classCallCheck3.default)(this, Input); | ||
return (0, _possibleConstructorReturn3.default)(this, (Input.__proto__ || (0, _getPrototypeOf2.default)(Input)).apply(this, arguments)); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Input.__proto__ || (0, _getPrototypeOf2.default)(Input)).call.apply(_ref, [this].concat(args))), _this), _this.changeHandler = function (ev) { | ||
var onChange = _this.props.onChange; | ||
var value = ev.target.value; | ||
onChange && onChange({ value: value, ev: ev }); | ||
}, _this.handleKeyDown = function (ev) { | ||
var _this$props = _this.props, | ||
onEnter = _this$props.onEnter, | ||
onEnterKey = _this$props.onEnterKey; | ||
var key = ev.key; | ||
if (key === onEnterKey && onEnter) onEnter(ev); | ||
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
} | ||
(0, _createClass3.default)(Input, [{ | ||
key: 'changeHandler', | ||
value: function changeHandler(ev, onChange) { | ||
onChange && onChange({ value: ev.target.value, ev: ev }); | ||
} | ||
}, { | ||
key: 'getErrorStateClass', | ||
@@ -81,7 +97,7 @@ value: function getErrorStateClass(errorState) { | ||
key: 'getClassNames', | ||
value: function getClassNames(_ref) { | ||
var size = _ref.size, | ||
charsSize = _ref.charsSize, | ||
hideInput = _ref.hideInput, | ||
errorState = _ref.errorState; | ||
value: function getClassNames(_ref2) { | ||
var size = _ref2.size, | ||
charsSize = _ref2.charsSize, | ||
hideInput = _ref2.hideInput, | ||
errorState = _ref2.errorState; | ||
@@ -93,4 +109,2 @@ return (0, _classnames2.default)(BASE_CLASS, BASE_CLASS + '-' + size, charsSize && BASE_CLASS + '--size', hideInput && BASE_CLASS + '--hidden', this.getErrorStateClass(errorState)); | ||
value: function render() { | ||
var _this2 = this; | ||
var _props = this.props, | ||
@@ -103,3 +117,3 @@ checked = _props.checked, | ||
onBlur = _props.onBlur, | ||
_onChange = _props.onChange, | ||
onFocus = _props.onFocus, | ||
placeholder = _props.placeholder, | ||
@@ -125,6 +139,6 @@ reference = _props.reference, | ||
name: name, | ||
onChange: function onChange(ev) { | ||
return _this2.changeHandler(ev, _onChange); | ||
}, | ||
onChange: this.changeHandler, | ||
onFocus: onFocus, | ||
onBlur: onBlur, | ||
onKeyDown: this.handleKeyDown, | ||
placeholder: placeholder, | ||
@@ -154,2 +168,8 @@ ref: reference, | ||
onChange: _propTypes2.default.func, | ||
/* onFocus callback */ | ||
onFocus: _propTypes2.default.func, | ||
/* onEnter callback */ | ||
onEnter: _propTypes2.default.func, | ||
/* key to provoke the onEnter callback. Valid any value defined here → https://www.w3.org/TR/uievents-key/#named-key-attribute-values */ | ||
onEnterKey: _propTypes2.default.string, | ||
/* A hint to the user of what can be entered in the control. The placeholder text must not contain carriage returns or line-feeds. */ | ||
@@ -174,3 +194,4 @@ placeholder: _propTypes2.default.string, | ||
Input.defaultProps = { | ||
size: SIZES.MEDIUM | ||
size: SIZES.MEDIUM, | ||
onEnterKey: 'Enter' | ||
}; | ||
@@ -177,0 +198,0 @@ |
{ | ||
"name": "@s-ui/react-atom-input", | ||
"version": "1.14.0", | ||
"version": "1.15.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
39887
18
603