react-intl 2.2.3 → 2.3.0

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.
package/CONTRIBUTING.md CHANGED
@@ -33,3 +33,23 @@ Pull requests are very welcome, but should be within the scope of the project, a
33
33
 
34
34
  [pr]: https://github.com/yahoo/react-intl/compare/
35
35
  [fork]: https://github.com/yahoo/react-intl/fork/
36
+
37
+ ## Releasing a new version
38
+
39
+ The following the process to release a new version of the `react-intl` package on npm. This repo uses a protected `master` branch so the process involves creating a Pull Request for the version bump:
40
+
41
+ 1. Make sure local `node_modules` is up to date: `rm -rf node_modules && npm install`.
42
+
43
+ 2. Create a release branch from `master`: `git checkout -b release`
44
+
45
+ 3. Bump version using `npm version` and choose appropriate `patch`, `minor`, `major` argument.
46
+
47
+ 4. Create a Pull Request for your local `release` branch so Travis CI tests run.
48
+
49
+ 5. If all the tests pass successfully, publish your local `release` branch to npm: `npm publish`.
50
+
51
+ 6. Push the Git tag to the main fork: `git push upstream --tags`.
52
+
53
+ 7. Merge the `release` branch PR into `master` **and make sure to create a merge commit** so the Git tag matches.
54
+
55
+ 8. Create a [release](https://github.com/yahoo/react-intl/releases) post for the new release Git tag.
@@ -5,16 +5,17 @@
5
5
  */
6
6
 
7
7
  (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
9
- typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
10
- (factory((global.ReactIntl = global.ReactIntl || {}),global.React));
11
- }(this, (function (exports,React) { 'use strict';
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('prop-types'), require('react')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', 'prop-types', 'react'], factory) :
10
+ (factory((global.ReactIntl = global.ReactIntl || {}),global.PropTypes,global.React));
11
+ }(this, (function (exports,PropTypes,React) { 'use strict';
12
12
 
13
13
  if (typeof React === 'undefined') {
14
14
  throw new ReferenceError('React must be loaded before ReactIntl.');
15
15
  }
16
16
 
17
17
 
18
+ PropTypes = 'default' in PropTypes ? PropTypes['default'] : PropTypes;
18
19
  var React__default = 'default' in React ? React['default'] : React;
19
20
 
20
21
  // GENERATED FILE
@@ -2553,14 +2554,14 @@ var toConsumableArray = function (arr) {
2553
2554
  * See the accompanying LICENSE file for terms.
2554
2555
  */
2555
2556
 
2556
- var bool = React.PropTypes.bool;
2557
- var number = React.PropTypes.number;
2558
- var string = React.PropTypes.string;
2559
- var func = React.PropTypes.func;
2560
- var object = React.PropTypes.object;
2561
- var oneOf = React.PropTypes.oneOf;
2562
- var shape = React.PropTypes.shape;
2563
- var any = React.PropTypes.any;
2557
+ var bool = PropTypes.bool;
2558
+ var number = PropTypes.number;
2559
+ var string = PropTypes.string;
2560
+ var func = PropTypes.func;
2561
+ var object = PropTypes.object;
2562
+ var oneOf = PropTypes.oneOf;
2563
+ var shape = PropTypes.shape;
2564
+ var any = PropTypes.any;
2564
2565
 
2565
2566
  var localeMatcher = oneOf(['best fit', 'lookup']);
2566
2567
  var narrowShortLong = oneOf(['narrow', 'short', 'long']);
@@ -3463,8 +3464,8 @@ IntlProvider.childContextTypes = {
3463
3464
  intl: intlShape.isRequired
3464
3465
  };
3465
3466
  IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
3466
- children: React.PropTypes.element.isRequired,
3467
- initialNow: React.PropTypes.any
3467
+ children: PropTypes.element.isRequired,
3468
+ initialNow: PropTypes.any
3468
3469
  });
3469
3470
 
3470
3471
  /*
@@ -3526,9 +3527,9 @@ FormattedDate.contextTypes = {
3526
3527
  intl: intlShape
3527
3528
  };
3528
3529
  FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
3529
- value: React.PropTypes.any.isRequired,
3530
- format: React.PropTypes.string,
3531
- children: React.PropTypes.func
3530
+ value: PropTypes.any.isRequired,
3531
+ format: PropTypes.string,
3532
+ children: PropTypes.func
3532
3533
  });
3533
3534
 
3534
3535
  /*
@@ -3590,9 +3591,9 @@ FormattedTime.contextTypes = {
3590
3591
  intl: intlShape
3591
3592
  };
3592
3593
  FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
3593
- value: React.PropTypes.any.isRequired,
3594
- format: React.PropTypes.string,
3595
- children: React.PropTypes.func
3594
+ value: PropTypes.any.isRequired,
3595
+ format: PropTypes.string,
3596
+ children: PropTypes.func
3596
3597
  });
3597
3598
 
3598
3599
  /*
@@ -3679,20 +3680,24 @@ var FormattedRelative = function (_Component) {
3679
3680
  value: function scheduleNextUpdate(props, state) {
3680
3681
  var _this2 = this;
3681
3682
 
3682
- var updateInterval = props.updateInterval;
3683
+ // Cancel and pending update because we're scheduling a new update.
3684
+ clearTimeout(this._timer);
3685
+
3686
+ var value = props.value,
3687
+ units = props.units,
3688
+ updateInterval = props.updateInterval;
3683
3689
 
3684
- // If the `updateInterval` is falsy, including `0`, then auto updates
3685
- // have been turned off, so we bail and skip scheduling an update.
3690
+ var time = new Date(value).getTime();
3686
3691
 
3687
- if (!updateInterval) {
3692
+ // If the `updateInterval` is falsy, including `0` or we don't have a
3693
+ // valid date, then auto updates have been turned off, so we bail and
3694
+ // skip scheduling an update.
3695
+ if (!updateInterval || !isFinite(time)) {
3688
3696
  return;
3689
3697
  }
3690
3698
 
3691
- var time = new Date(props.value).getTime();
3692
3699
  var delta = time - state.now;
3693
- var units = props.units || selectUnits(delta);
3694
-
3695
- var unitDelay = getUnitDelay(units);
3700
+ var unitDelay = getUnitDelay(units || selectUnits(delta));
3696
3701
  var unitRemainder = Math.abs(delta % unitDelay);
3697
3702
 
3698
3703
  // We want the largest possible timer delay which will still display
@@ -3701,8 +3706,6 @@ var FormattedRelative = function (_Component) {
3701
3706
  // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
3702
3707
  var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
3703
3708
 
3704
- clearTimeout(this._timer);
3705
-
3706
3709
  this._timer = setTimeout(function () {
3707
3710
  _this2.setState({ now: _this2.context.intl.now() });
3708
3711
  }, delay);
@@ -3777,11 +3780,11 @@ FormattedRelative.defaultProps = {
3777
3780
  updateInterval: 1000 * 10
3778
3781
  };
3779
3782
  FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
3780
- value: React.PropTypes.any.isRequired,
3781
- format: React.PropTypes.string,
3782
- updateInterval: React.PropTypes.number,
3783
- initialNow: React.PropTypes.any,
3784
- children: React.PropTypes.func
3783
+ value: PropTypes.any.isRequired,
3784
+ format: PropTypes.string,
3785
+ updateInterval: PropTypes.number,
3786
+ initialNow: PropTypes.any,
3787
+ children: PropTypes.func
3785
3788
  });
3786
3789
 
3787
3790
  /*
@@ -3843,9 +3846,9 @@ FormattedNumber.contextTypes = {
3843
3846
  intl: intlShape
3844
3847
  };
3845
3848
  FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
3846
- value: React.PropTypes.any.isRequired,
3847
- format: React.PropTypes.string,
3848
- children: React.PropTypes.func
3849
+ value: PropTypes.any.isRequired,
3850
+ format: PropTypes.string,
3851
+ children: PropTypes.func
3849
3852
  });
3850
3853
 
3851
3854
  /*
@@ -3912,16 +3915,16 @@ FormattedPlural.defaultProps = {
3912
3915
  style: 'cardinal'
3913
3916
  };
3914
3917
  FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
3915
- value: React.PropTypes.any.isRequired,
3918
+ value: PropTypes.any.isRequired,
3916
3919
 
3917
- other: React.PropTypes.node.isRequired,
3918
- zero: React.PropTypes.node,
3919
- one: React.PropTypes.node,
3920
- two: React.PropTypes.node,
3921
- few: React.PropTypes.node,
3922
- many: React.PropTypes.node,
3920
+ other: PropTypes.node.isRequired,
3921
+ zero: PropTypes.node,
3922
+ one: PropTypes.node,
3923
+ two: PropTypes.node,
3924
+ few: PropTypes.node,
3925
+ many: PropTypes.node,
3923
3926
 
3924
- children: React.PropTypes.func
3927
+ children: PropTypes.func
3925
3928
  });
3926
3929
 
3927
3930
  /*
@@ -3988,42 +3991,40 @@ var FormattedMessage = function (_Component) {
3988
3991
 
3989
3992
  var hasValues = values && Object.keys(values).length > 0;
3990
3993
  if (hasValues) {
3991
- (function () {
3992
- // Creates a token with a random UID that should not be guessable or
3993
- // conflict with other parts of the `message` string.
3994
- var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
3995
-
3996
- var generateToken = function () {
3997
- var counter = 0;
3998
- return function () {
3999
- return 'ELEMENT-' + uid + '-' + (counter += 1);
4000
- };
4001
- }();
4002
-
4003
- // Splitting with a delimiter to support IE8. When using a regex
4004
- // with a capture group IE8 does not include the capture group in
4005
- // the resulting array.
4006
- tokenDelimiter = '@__' + uid + '__@';
4007
- tokenizedValues = {};
4008
- elements = {};
4009
-
4010
- // Iterates over the `props` to keep track of any React Element
4011
- // values so they can be represented by the `token` as a placeholder
4012
- // when the `message` is formatted. This allows the formatted
4013
- // message to then be broken-up into parts with references to the
4014
- // React Elements inserted back in.
4015
- Object.keys(values).forEach(function (name) {
4016
- var value = values[name];
4017
-
4018
- if (React.isValidElement(value)) {
4019
- var token = generateToken();
4020
- tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
4021
- elements[token] = value;
4022
- } else {
4023
- tokenizedValues[name] = value;
4024
- }
4025
- });
4026
- })();
3994
+ // Creates a token with a random UID that should not be guessable or
3995
+ // conflict with other parts of the `message` string.
3996
+ var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
3997
+
3998
+ var generateToken = function () {
3999
+ var counter = 0;
4000
+ return function () {
4001
+ return 'ELEMENT-' + uid + '-' + (counter += 1);
4002
+ };
4003
+ }();
4004
+
4005
+ // Splitting with a delimiter to support IE8. When using a regex
4006
+ // with a capture group IE8 does not include the capture group in
4007
+ // the resulting array.
4008
+ tokenDelimiter = '@__' + uid + '__@';
4009
+ tokenizedValues = {};
4010
+ elements = {};
4011
+
4012
+ // Iterates over the `props` to keep track of any React Element
4013
+ // values so they can be represented by the `token` as a placeholder
4014
+ // when the `message` is formatted. This allows the formatted
4015
+ // message to then be broken-up into parts with references to the
4016
+ // React Elements inserted back in.
4017
+ Object.keys(values).forEach(function (name) {
4018
+ var value = values[name];
4019
+
4020
+ if (React.isValidElement(value)) {
4021
+ var token = generateToken();
4022
+ tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
4023
+ elements[token] = value;
4024
+ } else {
4025
+ tokenizedValues[name] = value;
4026
+ }
4027
+ });
4027
4028
  }
4028
4029
 
4029
4030
  var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
@@ -4066,9 +4067,9 @@ FormattedMessage.defaultProps = {
4066
4067
  values: {}
4067
4068
  };
4068
4069
  FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
4069
- values: React.PropTypes.object,
4070
- tagName: React.PropTypes.string,
4071
- children: React.PropTypes.func
4070
+ values: PropTypes.object,
4071
+ tagName: PropTypes.string,
4072
+ children: PropTypes.func
4072
4073
  });
4073
4074
 
4074
4075
  /*
@@ -4159,9 +4160,9 @@ FormattedHTMLMessage.defaultProps = {
4159
4160
  values: {}
4160
4161
  };
4161
4162
  FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
4162
- values: React.PropTypes.object,
4163
- tagName: React.PropTypes.string,
4164
- children: React.PropTypes.func
4163
+ values: PropTypes.object,
4164
+ tagName: PropTypes.string,
4165
+ children: PropTypes.func
4165
4166
  });
4166
4167
 
4167
4168
  /*