@danderson00/react-forms 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ var _default = function _default(props, options) {
22
22
  defaultValue = props.defaultValue;
23
23
 
24
24
  var applyValueTransforms = function applyValueTransforms(value) {
25
- return props.type === 'number' || props.numeric ? +value : value;
25
+ return (props.type === 'number' || props.numeric) && !isNaN(+value) ? +value : value;
26
26
  };
27
27
 
28
28
  var defaultType = {
@@ -53,7 +53,7 @@ var _default = function _default(props, options) {
53
53
  getValueProps: function getValueProps(_ref3) {
54
54
  var currentValue = _ref3.currentValue;
55
55
  return {
56
- value: currentValue || ''
56
+ value: currentValue === undefined ? '' : currentValue
57
57
  };
58
58
  }
59
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danderson00/react-forms",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "Ultra simple, stateless, validated forms for use in React function components",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
package/src/inputTypes.js CHANGED
@@ -3,7 +3,7 @@ const resolveValue = (value, args) => typeof value === 'function' ? value.apply(
3
3
  export default (props, options) => {
4
4
  const { type, checked, value, defaultValue } = props
5
5
 
6
- const applyValueTransforms = value => (props.type === 'number' || props.numeric) ? +value : value
6
+ const applyValueTransforms = value => ((props.type === 'number' || props.numeric) && !isNaN(+value)) ? +value : value
7
7
 
8
8
  const defaultType = {
9
9
  setInitialValue: ({ set }) => {
@@ -26,7 +26,9 @@ export default (props, options) => {
26
26
  throw new Error("Unable to determine input value from event")
27
27
  }
28
28
  },
29
- getValueProps: ({ currentValue }) => ({ value: currentValue || '' })
29
+ getValueProps: ({ currentValue }) => ({
30
+ value: currentValue === undefined ? '' : currentValue
31
+ })
30
32
  }
31
33
 
32
34
  const checkboxValue = (checked, value) => (value === undefined