Skip to content

Commit

Permalink
Make setRawValue work with redux-form and react-day-picker (#302)
Browse files Browse the repository at this point in the history
* Added SyntheticEvent methods to onChange args

* Tweaked onChange comments
  • Loading branch information
ah-adarlow authored and nosir committed Mar 3, 2018
1 parent 9a3bdb4 commit 5cedb2c
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 75 deletions.
123 changes: 87 additions & 36 deletions dist/cleave-react-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,14 @@ return /******/ (function(modules) { // webpackBootstrap

pps.backspace = false;

owner.onChange({ target: { value: value } });
owner.onChange({
target: { value: value },

// Methods to better resemble a SyntheticEvent
stopPropagation: Util.noop,
preventDefault: Util.noop,
persist: Util.noop
});
},

getRawValue: function getRawValue() {
Expand Down Expand Up @@ -518,12 +525,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ (function(module, exports, __webpack_require__) {

/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

Expand Down Expand Up @@ -554,12 +559,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ (function(module, exports, __webpack_require__) {

/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

Expand Down Expand Up @@ -827,6 +830,27 @@ return /******/ (function(modules) { // webpackBootstrap
*/
componentWillUnmount: 'DEFINE_MANY',

/**
* Replacement for (deprecated) `componentWillMount`.
*
* @optional
*/
UNSAFE_componentWillMount: 'DEFINE_MANY',

/**
* Replacement for (deprecated) `componentWillReceiveProps`.
*
* @optional
*/
UNSAFE_componentWillReceiveProps: 'DEFINE_MANY',

/**
* Replacement for (deprecated) `componentWillUpdate`.
*
* @optional
*/
UNSAFE_componentWillUpdate: 'DEFINE_MANY',

// ==== Advanced methods ====

/**
Expand All @@ -842,6 +866,23 @@ return /******/ (function(modules) { // webpackBootstrap
updateComponent: 'OVERRIDE_BASE'
};

/**
* Similar to ReactClassInterface but for static methods.
*/
var ReactClassStaticInterface = {
/**
* This method is invoked after a component is instantiated and when it
* receives new props. Return an object to update state in response to
* prop changes. Return null to indicate no change to state.
*
* If an object is returned, its keys will be merged into the existing state.
*
* @return {object || null}
* @optional
*/
getDerivedStateFromProps: 'DEFINE_MANY_MERGED'
};

/**
* Mapping from class specification keys to special processing functions.
*
Expand Down Expand Up @@ -1076,6 +1117,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (!statics) {
return;
}

for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
Expand All @@ -1092,14 +1134,25 @@ return /******/ (function(modules) { // webpackBootstrap
name
);

var isInherited = name in Constructor;
_invariant(
!isInherited,
'ReactClass: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be ' +
'due to a mixin.',
name
);
var isAlreadyDefined = name in Constructor;
if (isAlreadyDefined) {
var specPolicy = ReactClassStaticInterface.hasOwnProperty(name)
? ReactClassStaticInterface[name]
: null;

_invariant(
specPolicy === 'DEFINE_MANY_MERGED',
'ReactClass: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be ' +
'due to a mixin.',
name
);

Constructor[name] = createMergedResultFunction(Constructor[name], property);

return;
}

Constructor[name] = property;
}
}
Expand Down Expand Up @@ -1409,6 +1462,12 @@ return /******/ (function(modules) { // webpackBootstrap
'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?',
spec.displayName || 'A component'
);
warning(
!Constructor.prototype.UNSAFE_componentWillRecieveProps,
'%s has a method called UNSAFE_componentWillRecieveProps(). ' +
'Did you mean UNSAFE_componentWillReceiveProps()?',
spec.displayName || 'A component'
);
}

// Reduce time spent doing lookups by setting these on the prototype.
Expand Down Expand Up @@ -1529,11 +1588,9 @@ return /******/ (function(modules) { // webpackBootstrap

/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

Expand All @@ -1553,11 +1610,9 @@ return /******/ (function(modules) { // webpackBootstrap

/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

Expand Down Expand Up @@ -1612,12 +1667,10 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ (function(module, exports, __webpack_require__) {

/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

Expand Down Expand Up @@ -1684,11 +1737,9 @@ return /******/ (function(modules) { // webpackBootstrap

/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/cleave-react-node.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5cedb2c

Please sign in to comment.