@s-ui/react-molecule-input-field
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -5,2 +5,12 @@ # Change Log | ||
# 3.1.0 (2020-01-30) | ||
### Features | ||
* add new alert text type ([06b2d63](https://github.com/SUI-Components/sui-components/commit/06b2d63fcc37088f5f8ab554f5c26efbf6b32d76)) | ||
* reduce function arguments to one ([8d3f470](https://github.com/SUI-Components/sui-components/commit/8d3f470055130ac2dd873312bf268202730130a8)) | ||
# 3.0.0 (2020-01-14) | ||
@@ -7,0 +17,0 @@ |
@@ -5,20 +5,40 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
import MoleculeField from '@s-ui/react-molecule-field'; | ||
import AtomInput from '@s-ui/react-atom-input'; | ||
import AtomInput, { inputStates } from '@s-ui/react-atom-input'; | ||
var getErrorState = function getErrorState(success, error) { | ||
if (success) return false; | ||
if (error) return true; | ||
var getErrorState = function getErrorState(_ref) { | ||
var successText = _ref.successText, | ||
errorText = _ref.errorText; | ||
if (successText) return false; | ||
if (errorText) return true; | ||
}; | ||
var MoleculeInputField = function MoleculeInputField(_ref) { | ||
var id = _ref.id, | ||
label = _ref.label, | ||
successText = _ref.successText, | ||
errorText = _ref.errorText, | ||
helpText = _ref.helpText, | ||
inline = _ref.inline, | ||
onChange = _ref.onChange, | ||
props = _objectWithoutPropertiesLoose(_ref, ["id", "label", "successText", "errorText", "helpText", "inline", "onChange"]); | ||
var getState = function getState(_ref2) { | ||
var successText = _ref2.successText, | ||
errorState = _ref2.errorState, | ||
alertText = _ref2.alertText; | ||
if (successText) return inputStates.SUCCESS; | ||
if (errorState) return inputStates.ERROR; | ||
if (alertText) return inputStates.ALERT; | ||
}; | ||
var errorState = getErrorState(successText, errorText); | ||
var MoleculeInputField = function MoleculeInputField(_ref3) { | ||
var id = _ref3.id, | ||
label = _ref3.label, | ||
successText = _ref3.successText, | ||
errorText = _ref3.errorText, | ||
alertText = _ref3.alertText, | ||
helpText = _ref3.helpText, | ||
inline = _ref3.inline, | ||
onChange = _ref3.onChange, | ||
props = _objectWithoutPropertiesLoose(_ref3, ["id", "label", "successText", "errorText", "alertText", "helpText", "inline", "onChange"]); | ||
var errorState = getErrorState({ | ||
successText: successText, | ||
errorText: errorText | ||
}); | ||
var inputState = getState({ | ||
successText: successText, | ||
errorState: errorState, | ||
alertText: alertText | ||
}); | ||
return React.createElement(MoleculeField, { | ||
@@ -29,2 +49,3 @@ name: id, | ||
errorText: errorText, | ||
alertText: alertText, | ||
helpText: helpText, | ||
@@ -35,3 +56,4 @@ inline: inline, | ||
id: id, | ||
errorState: errorState | ||
errorState: errorState, | ||
state: inputState | ||
}, props))); | ||
@@ -38,0 +60,0 @@ }; |
{ | ||
"name": "@s-ui/react-molecule-input-field", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -55,2 +55,11 @@ # MoleculeInputField | ||
### With `alertText` | ||
``` | ||
<MoleculeInputField | ||
id="notes" | ||
label="Notes" | ||
alertText="All wrong!" | ||
/> | ||
### With `helpText` | ||
@@ -57,0 +66,0 @@ ``` |
14544
54
85