react-intl 2.2.0 → 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/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2016, Yahoo Inc.
2
+ * Copyright 2017, Yahoo Inc.
3
3
  * Copyrights licensed under the New BSD License.
4
4
  * See the accompanying LICENSE file for terms.
5
5
  */
@@ -13,6 +13,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
13
13
  var allLocaleData = _interopDefault(require('../locale-data/index.js'));
14
14
  var IntlMessageFormat = _interopDefault(require('intl-messageformat'));
15
15
  var IntlRelativeFormat = _interopDefault(require('intl-relativeformat'));
16
+ var PropTypes = _interopDefault(require('prop-types'));
16
17
  var React = require('react');
17
18
  var React__default = _interopDefault(React);
18
19
  var invariant = _interopDefault(require('invariant'));
@@ -72,257 +73,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
72
73
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
73
74
  };
74
75
 
75
- var jsx = function () {
76
- var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
77
- return function createRawReactElement(type, props, key, children) {
78
- var defaultProps = type && type.defaultProps;
79
- var childrenLength = arguments.length - 3;
80
76
 
81
- if (!props && childrenLength !== 0) {
82
- props = {};
83
- }
84
-
85
- if (props && defaultProps) {
86
- for (var propName in defaultProps) {
87
- if (props[propName] === void 0) {
88
- props[propName] = defaultProps[propName];
89
- }
90
- }
91
- } else if (!props) {
92
- props = defaultProps || {};
93
- }
94
-
95
- if (childrenLength === 1) {
96
- props.children = children;
97
- } else if (childrenLength > 1) {
98
- var childArray = Array(childrenLength);
99
-
100
- for (var i = 0; i < childrenLength; i++) {
101
- childArray[i] = arguments[i + 3];
102
- }
103
-
104
- props.children = childArray;
105
- }
106
-
107
- return {
108
- $$typeof: REACT_ELEMENT_TYPE,
109
- type: type,
110
- key: key === undefined ? null : '' + key,
111
- ref: null,
112
- props: props,
113
- _owner: null
114
- };
115
- };
116
- }();
117
-
118
- var asyncIterator = function (iterable) {
119
- if (typeof Symbol === "function") {
120
- if (Symbol.asyncIterator) {
121
- var method = iterable[Symbol.asyncIterator];
122
- if (method != null) return method.call(iterable);
123
- }
124
-
125
- if (Symbol.iterator) {
126
- return iterable[Symbol.iterator]();
127
- }
128
- }
129
-
130
- throw new TypeError("Object is not async iterable");
131
- };
132
-
133
- var asyncGenerator = function () {
134
- function AwaitValue(value) {
135
- this.value = value;
136
- }
137
-
138
- function AsyncGenerator(gen) {
139
- var front, back;
140
-
141
- function send(key, arg) {
142
- return new Promise(function (resolve, reject) {
143
- var request = {
144
- key: key,
145
- arg: arg,
146
- resolve: resolve,
147
- reject: reject,
148
- next: null
149
- };
150
-
151
- if (back) {
152
- back = back.next = request;
153
- } else {
154
- front = back = request;
155
- resume(key, arg);
156
- }
157
- });
158
- }
159
-
160
- function resume(key, arg) {
161
- try {
162
- var result = gen[key](arg);
163
- var value = result.value;
164
-
165
- if (value instanceof AwaitValue) {
166
- Promise.resolve(value.value).then(function (arg) {
167
- resume("next", arg);
168
- }, function (arg) {
169
- resume("throw", arg);
170
- });
171
- } else {
172
- settle(result.done ? "return" : "normal", result.value);
173
- }
174
- } catch (err) {
175
- settle("throw", err);
176
- }
177
- }
178
-
179
- function settle(type, value) {
180
- switch (type) {
181
- case "return":
182
- front.resolve({
183
- value: value,
184
- done: true
185
- });
186
- break;
187
77
 
188
- case "throw":
189
- front.reject(value);
190
- break;
191
78
 
192
- default:
193
- front.resolve({
194
- value: value,
195
- done: false
196
- });
197
- break;
198
- }
199
79
 
200
- front = front.next;
201
80
 
202
- if (front) {
203
- resume(front.key, front.arg);
204
- } else {
205
- back = null;
206
- }
207
- }
208
81
 
209
- this._invoke = send;
210
82
 
211
- if (typeof gen.return !== "function") {
212
- this.return = undefined;
213
- }
214
- }
215
83
 
216
- if (typeof Symbol === "function" && Symbol.asyncIterator) {
217
- AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
218
- return this;
219
- };
220
- }
221
-
222
- AsyncGenerator.prototype.next = function (arg) {
223
- return this._invoke("next", arg);
224
- };
225
-
226
- AsyncGenerator.prototype.throw = function (arg) {
227
- return this._invoke("throw", arg);
228
- };
229
-
230
- AsyncGenerator.prototype.return = function (arg) {
231
- return this._invoke("return", arg);
232
- };
233
-
234
- return {
235
- wrap: function (fn) {
236
- return function () {
237
- return new AsyncGenerator(fn.apply(this, arguments));
238
- };
239
- },
240
- await: function (value) {
241
- return new AwaitValue(value);
242
- }
243
- };
244
- }();
245
-
246
- var asyncGeneratorDelegate = function (inner, awaitWrap) {
247
- var iter = {},
248
- waiting = false;
249
-
250
- function pump(key, value) {
251
- waiting = true;
252
- value = new Promise(function (resolve) {
253
- resolve(inner[key](value));
254
- });
255
- return {
256
- done: false,
257
- value: awaitWrap(value)
258
- };
259
- }
260
-
261
-
262
-
263
- if (typeof Symbol === "function" && Symbol.iterator) {
264
- iter[Symbol.iterator] = function () {
265
- return this;
266
- };
267
- }
268
-
269
- iter.next = function (value) {
270
- if (waiting) {
271
- waiting = false;
272
- return value;
273
- }
274
-
275
- return pump("next", value);
276
- };
277
-
278
- if (typeof inner.throw === "function") {
279
- iter.throw = function (value) {
280
- if (waiting) {
281
- waiting = false;
282
- throw value;
283
- }
284
-
285
- return pump("throw", value);
286
- };
287
- }
288
-
289
- if (typeof inner.return === "function") {
290
- iter.return = function (value) {
291
- return pump("return", value);
292
- };
293
- }
294
-
295
- return iter;
296
- };
297
-
298
- var asyncToGenerator = function (fn) {
299
- return function () {
300
- var gen = fn.apply(this, arguments);
301
- return new Promise(function (resolve, reject) {
302
- function step(key, arg) {
303
- try {
304
- var info = gen[key](arg);
305
- var value = info.value;
306
- } catch (error) {
307
- reject(error);
308
- return;
309
- }
310
-
311
- if (info.done) {
312
- resolve(value);
313
- } else {
314
- return Promise.resolve(value).then(function (value) {
315
- step("next", value);
316
- }, function (err) {
317
- step("throw", err);
318
- });
319
- }
320
- }
321
84
 
322
- return step("next");
323
- });
324
- };
325
- };
326
85
 
327
86
  var classCallCheck = function (instance, Constructor) {
328
87
  if (!(instance instanceof Constructor)) {
@@ -348,31 +107,9 @@ var createClass = function () {
348
107
  };
349
108
  }();
350
109
 
351
- var defineEnumerableProperties = function (obj, descs) {
352
- for (var key in descs) {
353
- var desc = descs[key];
354
- desc.configurable = desc.enumerable = true;
355
- if ("value" in desc) desc.writable = true;
356
- Object.defineProperty(obj, key, desc);
357
- }
358
-
359
- return obj;
360
- };
361
-
362
- var defaults = function (obj, defaults) {
363
- var keys = Object.getOwnPropertyNames(defaults);
364
110
 
365
- for (var i = 0; i < keys.length; i++) {
366
- var key = keys[i];
367
- var value = Object.getOwnPropertyDescriptor(defaults, key);
368
111
 
369
- if (value && value.configurable && obj[key] === undefined) {
370
- Object.defineProperty(obj, key, value);
371
- }
372
- }
373
112
 
374
- return obj;
375
- };
376
113
 
377
114
  var defineProperty = function (obj, key, value) {
378
115
  if (key in obj) {
@@ -403,30 +140,7 @@ var _extends = Object.assign || function (target) {
403
140
  return target;
404
141
  };
405
142
 
406
- var get = function get(object, property, receiver) {
407
- if (object === null) object = Function.prototype;
408
- var desc = Object.getOwnPropertyDescriptor(object, property);
409
-
410
- if (desc === undefined) {
411
- var parent = Object.getPrototypeOf(object);
412
-
413
- if (parent === null) {
414
- return undefined;
415
- } else {
416
- return get(parent, property, receiver);
417
- }
418
- } else if ("value" in desc) {
419
- return desc.value;
420
- } else {
421
- var getter = desc.get;
422
-
423
- if (getter === undefined) {
424
- return undefined;
425
- }
426
143
 
427
- return getter.call(receiver);
428
- }
429
- };
430
144
 
431
145
  var inherits = function (subClass, superClass) {
432
146
  if (typeof superClass !== "function" && superClass !== null) {
@@ -444,46 +158,13 @@ var inherits = function (subClass, superClass) {
444
158
  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
445
159
  };
446
160
 
447
- var _instanceof = function (left, right) {
448
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
449
- return right[Symbol.hasInstance](left);
450
- } else {
451
- return left instanceof right;
452
- }
453
- };
454
161
 
455
- var interopRequireDefault = function (obj) {
456
- return obj && obj.__esModule ? obj : {
457
- default: obj
458
- };
459
- };
460
162
 
461
- var interopRequireWildcard = function (obj) {
462
- if (obj && obj.__esModule) {
463
- return obj;
464
- } else {
465
- var newObj = {};
466
163
 
467
- if (obj != null) {
468
- for (var key in obj) {
469
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
470
- }
471
- }
472
164
 
473
- newObj.default = obj;
474
- return newObj;
475
- }
476
- };
477
165
 
478
- var newArrowCheck = function (innerThis, boundThis) {
479
- if (innerThis !== boundThis) {
480
- throw new TypeError("Cannot instantiate an arrow function");
481
- }
482
- };
483
166
 
484
- var objectDestructuringEmpty = function (obj) {
485
- if (obj == null) throw new TypeError("Cannot destructure undefined");
486
- };
167
+
487
168
 
488
169
  var objectWithoutProperties = function (obj, keys) {
489
170
  var target = {};
@@ -505,112 +186,23 @@ var possibleConstructorReturn = function (self, call) {
505
186
  return call && (typeof call === "object" || typeof call === "function") ? call : self;
506
187
  };
507
188
 
508
- var selfGlobal = typeof global === "undefined" ? self : global;
509
189
 
510
- var set = function set(object, property, value, receiver) {
511
- var desc = Object.getOwnPropertyDescriptor(object, property);
512
190
 
513
- if (desc === undefined) {
514
- var parent = Object.getPrototypeOf(object);
515
191
 
516
- if (parent !== null) {
517
- set(parent, property, value, receiver);
518
- }
519
- } else if ("value" in desc && desc.writable) {
520
- desc.value = value;
521
- } else {
522
- var setter = desc.set;
523
192
 
524
- if (setter !== undefined) {
525
- setter.call(receiver, value);
526
- }
527
- }
528
193
 
529
- return value;
530
- };
531
194
 
532
- var slicedToArray = function () {
533
- function sliceIterator(arr, i) {
534
- var _arr = [];
535
- var _n = true;
536
- var _d = false;
537
- var _e = undefined;
538
195
 
539
- try {
540
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
541
- _arr.push(_s.value);
542
196
 
543
- if (i && _arr.length === i) break;
544
- }
545
- } catch (err) {
546
- _d = true;
547
- _e = err;
548
- } finally {
549
- try {
550
- if (!_n && _i["return"]) _i["return"]();
551
- } finally {
552
- if (_d) throw _e;
553
- }
554
- }
555
197
 
556
- return _arr;
557
- }
558
198
 
559
- return function (arr, i) {
560
- if (Array.isArray(arr)) {
561
- return arr;
562
- } else if (Symbol.iterator in Object(arr)) {
563
- return sliceIterator(arr, i);
564
- } else {
565
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
566
- }
567
- };
568
- }();
569
199
 
570
- var slicedToArrayLoose = function (arr, i) {
571
- if (Array.isArray(arr)) {
572
- return arr;
573
- } else if (Symbol.iterator in Object(arr)) {
574
- var _arr = [];
575
200
 
576
- for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
577
- _arr.push(_step.value);
578
201
 
579
- if (i && _arr.length === i) break;
580
- }
581
202
 
582
- return _arr;
583
- } else {
584
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
585
- }
586
- };
587
203
 
588
- var taggedTemplateLiteral = function (strings, raw) {
589
- return Object.freeze(Object.defineProperties(strings, {
590
- raw: {
591
- value: Object.freeze(raw)
592
- }
593
- }));
594
- };
595
204
 
596
- var taggedTemplateLiteralLoose = function (strings, raw) {
597
- strings.raw = raw;
598
- return strings;
599
- };
600
205
 
601
- var temporalRef = function (val, name, undef) {
602
- if (val === undef) {
603
- throw new ReferenceError(name + " is not defined - temporal dead zone");
604
- } else {
605
- return val;
606
- }
607
- };
608
-
609
- var temporalUndefined = {};
610
-
611
- var toArray = function (arr) {
612
- return Array.isArray(arr) ? arr : Array.from(arr);
613
- };
614
206
 
615
207
  var toConsumableArray = function (arr) {
616
208
  if (Array.isArray(arr)) {
@@ -622,56 +214,20 @@ var toConsumableArray = function (arr) {
622
214
  }
623
215
  };
624
216
 
625
-
626
-
627
- var babelHelpers$1 = Object.freeze({
628
- jsx: jsx,
629
- asyncIterator: asyncIterator,
630
- asyncGenerator: asyncGenerator,
631
- asyncGeneratorDelegate: asyncGeneratorDelegate,
632
- asyncToGenerator: asyncToGenerator,
633
- classCallCheck: classCallCheck,
634
- createClass: createClass,
635
- defineEnumerableProperties: defineEnumerableProperties,
636
- defaults: defaults,
637
- defineProperty: defineProperty,
638
- get: get,
639
- inherits: inherits,
640
- interopRequireDefault: interopRequireDefault,
641
- interopRequireWildcard: interopRequireWildcard,
642
- newArrowCheck: newArrowCheck,
643
- objectDestructuringEmpty: objectDestructuringEmpty,
644
- objectWithoutProperties: objectWithoutProperties,
645
- possibleConstructorReturn: possibleConstructorReturn,
646
- selfGlobal: selfGlobal,
647
- set: set,
648
- slicedToArray: slicedToArray,
649
- slicedToArrayLoose: slicedToArrayLoose,
650
- taggedTemplateLiteral: taggedTemplateLiteral,
651
- taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,
652
- temporalRef: temporalRef,
653
- temporalUndefined: temporalUndefined,
654
- toArray: toArray,
655
- toConsumableArray: toConsumableArray,
656
- typeof: _typeof,
657
- extends: _extends,
658
- instanceof: _instanceof
659
- });
660
-
661
217
  /*
662
218
  * Copyright 2015, Yahoo Inc.
663
219
  * Copyrights licensed under the New BSD License.
664
220
  * See the accompanying LICENSE file for terms.
665
221
  */
666
222
 
667
- var bool = React.PropTypes.bool;
668
- var number = React.PropTypes.number;
669
- var string = React.PropTypes.string;
670
- var func = React.PropTypes.func;
671
- var object = React.PropTypes.object;
672
- var oneOf = React.PropTypes.oneOf;
673
- var shape = React.PropTypes.shape;
674
- var node = React.PropTypes.node;
223
+ var bool = PropTypes.bool;
224
+ var number = PropTypes.number;
225
+ var string = PropTypes.string;
226
+ var func = PropTypes.func;
227
+ var object = PropTypes.object;
228
+ var oneOf = PropTypes.oneOf;
229
+ var shape = PropTypes.shape;
230
+ var any = PropTypes.any;
675
231
 
676
232
  var localeMatcher = oneOf(['best fit', 'lookup']);
677
233
  var narrowShortLong = oneOf(['narrow', 'short', 'long']);
@@ -682,7 +238,7 @@ var intlConfigPropTypes = {
682
238
  locale: string,
683
239
  formats: object,
684
240
  messages: object,
685
- textComponent: node,
241
+ textComponent: any,
686
242
 
687
243
  defaultLocale: string,
688
244
  defaultFormats: object
@@ -698,7 +254,7 @@ var intlFormatPropTypes = {
698
254
  formatHTMLMessage: funcReq
699
255
  };
700
256
 
701
- var intlShape = shape(babelHelpers$1['extends']({}, intlConfigPropTypes, intlFormatPropTypes, {
257
+ var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, {
702
258
  formatters: object,
703
259
  now: funcReq
704
260
  }));
@@ -806,7 +362,7 @@ function shallowEquals(objA, objB) {
806
362
  return true;
807
363
  }
808
364
 
809
- if ((typeof objA === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](objB)) !== 'object' || objB === null) {
365
+ if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
810
366
  return false;
811
367
  }
812
368
 
@@ -885,7 +441,7 @@ function injectIntl(WrappedComponent) {
885
441
  }, {
886
442
  key: 'render',
887
443
  value: function render() {
888
- return React__default.createElement(WrappedComponent, babelHelpers$1['extends']({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
444
+ return React__default.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
889
445
  ref: withRef ? 'wrappedInstance' : null
890
446
  }));
891
447
  }
@@ -1018,7 +574,7 @@ function formatTime(config, state, value) {
1018
574
 
1019
575
  if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
1020
576
  // Add default formatting options if hour, minute, or second isn't defined.
1021
- filteredOptions = babelHelpers$1['extends']({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
577
+ filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
1022
578
  }
1023
579
 
1024
580
  try {
@@ -1046,7 +602,7 @@ function formatRelative(config, state, value) {
1046
602
 
1047
603
  // Capture the current threshold values, then temporarily override them with
1048
604
  // specific values just for this render.
1049
- var oldThresholds = babelHelpers$1['extends']({}, IntlRelativeFormat.thresholds);
605
+ var oldThresholds = _extends({}, IntlRelativeFormat.thresholds);
1050
606
  updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
1051
607
 
1052
608
  try {
@@ -1260,7 +816,7 @@ var IntlProvider = function (_Component) {
1260
816
  getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
1261
817
  } : _ref$formatters;
1262
818
 
1263
- _this.state = babelHelpers$1['extends']({}, formatters, {
819
+ _this.state = _extends({}, formatters, {
1264
820
 
1265
821
  // Wrapper to provide stable "now" time for initial render.
1266
822
  now: function now() {
@@ -1305,7 +861,7 @@ var IntlProvider = function (_Component) {
1305
861
  // The `messages` are overridden to the `defaultProps` empty object
1306
862
  // to maintain referential equality across re-renders. It's assumed
1307
863
  // each <FormattedMessage> contains a `defaultMessage` prop.
1308
- config = babelHelpers$1['extends']({}, config, {
864
+ config = _extends({}, config, {
1309
865
  locale: defaultLocale,
1310
866
  formats: defaultFormats,
1311
867
  messages: defaultProps.messages
@@ -1336,7 +892,7 @@ var IntlProvider = function (_Component) {
1336
892
 
1337
893
 
1338
894
  return {
1339
- intl: babelHelpers$1['extends']({}, config, boundFormatFns, {
895
+ intl: _extends({}, config, boundFormatFns, {
1340
896
  formatters: formatters,
1341
897
  now: now
1342
898
  })
@@ -1372,9 +928,9 @@ IntlProvider.contextTypes = {
1372
928
  IntlProvider.childContextTypes = {
1373
929
  intl: intlShape.isRequired
1374
930
  };
1375
- process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = babelHelpers$1['extends']({}, intlConfigPropTypes, {
1376
- children: React.PropTypes.element.isRequired,
1377
- initialNow: React.PropTypes.any
931
+ process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
932
+ children: PropTypes.element.isRequired,
933
+ initialNow: PropTypes.any
1378
934
  }) : void 0;
1379
935
 
1380
936
  /*
@@ -1435,10 +991,10 @@ FormattedDate.displayName = 'FormattedDate';
1435
991
  FormattedDate.contextTypes = {
1436
992
  intl: intlShape
1437
993
  };
1438
- process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = babelHelpers$1['extends']({}, dateTimeFormatPropTypes, {
1439
- value: React.PropTypes.any.isRequired,
1440
- format: React.PropTypes.string,
1441
- children: React.PropTypes.func
994
+ process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
995
+ value: PropTypes.any.isRequired,
996
+ format: PropTypes.string,
997
+ children: PropTypes.func
1442
998
  }) : void 0;
1443
999
 
1444
1000
  /*
@@ -1499,10 +1055,10 @@ FormattedTime.displayName = 'FormattedTime';
1499
1055
  FormattedTime.contextTypes = {
1500
1056
  intl: intlShape
1501
1057
  };
1502
- process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = babelHelpers$1['extends']({}, dateTimeFormatPropTypes, {
1503
- value: React.PropTypes.any.isRequired,
1504
- format: React.PropTypes.string,
1505
- children: React.PropTypes.func
1058
+ process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
1059
+ value: PropTypes.any.isRequired,
1060
+ format: PropTypes.string,
1061
+ children: PropTypes.func
1506
1062
  }) : void 0;
1507
1063
 
1508
1064
  /*
@@ -1589,20 +1145,24 @@ var FormattedRelative = function (_Component) {
1589
1145
  value: function scheduleNextUpdate(props, state) {
1590
1146
  var _this2 = this;
1591
1147
 
1592
- var updateInterval = props.updateInterval;
1148
+ // Cancel and pending update because we're scheduling a new update.
1149
+ clearTimeout(this._timer);
1150
+
1151
+ var value = props.value,
1152
+ units = props.units,
1153
+ updateInterval = props.updateInterval;
1593
1154
 
1594
- // If the `updateInterval` is falsy, including `0`, then auto updates
1595
- // have been turned off, so we bail and skip scheduling an update.
1155
+ var time = new Date(value).getTime();
1596
1156
 
1597
- if (!updateInterval) {
1157
+ // If the `updateInterval` is falsy, including `0` or we don't have a
1158
+ // valid date, then auto updates have been turned off, so we bail and
1159
+ // skip scheduling an update.
1160
+ if (!updateInterval || !isFinite(time)) {
1598
1161
  return;
1599
1162
  }
1600
1163
 
1601
- var time = new Date(props.value).getTime();
1602
1164
  var delta = time - state.now;
1603
- var units = props.units || selectUnits(delta);
1604
-
1605
- var unitDelay = getUnitDelay(units);
1165
+ var unitDelay = getUnitDelay(units || selectUnits(delta));
1606
1166
  var unitRemainder = Math.abs(delta % unitDelay);
1607
1167
 
1608
1168
  // We want the largest possible timer delay which will still display
@@ -1611,8 +1171,6 @@ var FormattedRelative = function (_Component) {
1611
1171
  // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1612
1172
  var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1613
1173
 
1614
- clearTimeout(this._timer);
1615
-
1616
1174
  this._timer = setTimeout(function () {
1617
1175
  _this2.setState({ now: _this2.context.intl.now() });
1618
1176
  }, delay);
@@ -1663,7 +1221,7 @@ var FormattedRelative = function (_Component) {
1663
1221
  children = _props.children;
1664
1222
 
1665
1223
 
1666
- var formattedRelative = formatRelative(value, babelHelpers$1['extends']({}, this.props, this.state));
1224
+ var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
1667
1225
 
1668
1226
  if (typeof children === 'function') {
1669
1227
  return children(formattedRelative);
@@ -1686,12 +1244,12 @@ FormattedRelative.contextTypes = {
1686
1244
  FormattedRelative.defaultProps = {
1687
1245
  updateInterval: 1000 * 10
1688
1246
  };
1689
- process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = babelHelpers$1['extends']({}, relativeFormatPropTypes, {
1690
- value: React.PropTypes.any.isRequired,
1691
- format: React.PropTypes.string,
1692
- updateInterval: React.PropTypes.number,
1693
- initialNow: React.PropTypes.any,
1694
- children: React.PropTypes.func
1247
+ process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
1248
+ value: PropTypes.any.isRequired,
1249
+ format: PropTypes.string,
1250
+ updateInterval: PropTypes.number,
1251
+ initialNow: PropTypes.any,
1252
+ children: PropTypes.func
1695
1253
  }) : void 0;
1696
1254
 
1697
1255
  /*
@@ -1752,10 +1310,10 @@ FormattedNumber.displayName = 'FormattedNumber';
1752
1310
  FormattedNumber.contextTypes = {
1753
1311
  intl: intlShape
1754
1312
  };
1755
- process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = babelHelpers$1['extends']({}, numberFormatPropTypes, {
1756
- value: React.PropTypes.any.isRequired,
1757
- format: React.PropTypes.string,
1758
- children: React.PropTypes.func
1313
+ process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
1314
+ value: PropTypes.any.isRequired,
1315
+ format: PropTypes.string,
1316
+ children: PropTypes.func
1759
1317
  }) : void 0;
1760
1318
 
1761
1319
  /*
@@ -1821,17 +1379,17 @@ FormattedPlural.contextTypes = {
1821
1379
  FormattedPlural.defaultProps = {
1822
1380
  style: 'cardinal'
1823
1381
  };
1824
- process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = babelHelpers$1['extends']({}, pluralFormatPropTypes, {
1825
- value: React.PropTypes.any.isRequired,
1382
+ process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
1383
+ value: PropTypes.any.isRequired,
1826
1384
 
1827
- other: React.PropTypes.node.isRequired,
1828
- zero: React.PropTypes.node,
1829
- one: React.PropTypes.node,
1830
- two: React.PropTypes.node,
1831
- few: React.PropTypes.node,
1832
- many: React.PropTypes.node,
1385
+ other: PropTypes.node.isRequired,
1386
+ zero: PropTypes.node,
1387
+ one: PropTypes.node,
1388
+ two: PropTypes.node,
1389
+ few: PropTypes.node,
1390
+ many: PropTypes.node,
1833
1391
 
1834
- children: React.PropTypes.func
1392
+ children: PropTypes.func
1835
1393
  }) : void 0;
1836
1394
 
1837
1395
  /*
@@ -1866,7 +1424,7 @@ var FormattedMessage = function (_Component) {
1866
1424
  // Since `values` has already been checked, we know they're not
1867
1425
  // different, so the current `values` are carried over so the shallow
1868
1426
  // equals comparison on the other props isn't affected by the `values`.
1869
- var nextPropsToCheck = babelHelpers$1['extends']({}, nextProps, {
1427
+ var nextPropsToCheck = _extends({}, nextProps, {
1870
1428
  values: values
1871
1429
  });
1872
1430
 
@@ -1898,42 +1456,40 @@ var FormattedMessage = function (_Component) {
1898
1456
 
1899
1457
  var hasValues = values && Object.keys(values).length > 0;
1900
1458
  if (hasValues) {
1901
- (function () {
1902
- // Creates a token with a random UID that should not be guessable or
1903
- // conflict with other parts of the `message` string.
1904
- var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1905
-
1906
- var generateToken = function () {
1907
- var counter = 0;
1908
- return function () {
1909
- return 'ELEMENT-' + uid + '-' + (counter += 1);
1910
- };
1911
- }();
1912
-
1913
- // Splitting with a delimiter to support IE8. When using a regex
1914
- // with a capture group IE8 does not include the capture group in
1915
- // the resulting array.
1916
- tokenDelimiter = '@__' + uid + '__@';
1917
- tokenizedValues = {};
1918
- elements = {};
1919
-
1920
- // Iterates over the `props` to keep track of any React Element
1921
- // values so they can be represented by the `token` as a placeholder
1922
- // when the `message` is formatted. This allows the formatted
1923
- // message to then be broken-up into parts with references to the
1924
- // React Elements inserted back in.
1925
- Object.keys(values).forEach(function (name) {
1926
- var value = values[name];
1927
-
1928
- if (React.isValidElement(value)) {
1929
- var token = generateToken();
1930
- tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1931
- elements[token] = value;
1932
- } else {
1933
- tokenizedValues[name] = value;
1934
- }
1935
- });
1936
- })();
1459
+ // Creates a token with a random UID that should not be guessable or
1460
+ // conflict with other parts of the `message` string.
1461
+ var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1462
+
1463
+ var generateToken = function () {
1464
+ var counter = 0;
1465
+ return function () {
1466
+ return 'ELEMENT-' + uid + '-' + (counter += 1);
1467
+ };
1468
+ }();
1469
+
1470
+ // Splitting with a delimiter to support IE8. When using a regex
1471
+ // with a capture group IE8 does not include the capture group in
1472
+ // the resulting array.
1473
+ tokenDelimiter = '@__' + uid + '__@';
1474
+ tokenizedValues = {};
1475
+ elements = {};
1476
+
1477
+ // Iterates over the `props` to keep track of any React Element
1478
+ // values so they can be represented by the `token` as a placeholder
1479
+ // when the `message` is formatted. This allows the formatted
1480
+ // message to then be broken-up into parts with references to the
1481
+ // React Elements inserted back in.
1482
+ Object.keys(values).forEach(function (name) {
1483
+ var value = values[name];
1484
+
1485
+ if (React.isValidElement(value)) {
1486
+ var token = generateToken();
1487
+ tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1488
+ elements[token] = value;
1489
+ } else {
1490
+ tokenizedValues[name] = value;
1491
+ }
1492
+ });
1937
1493
  }
1938
1494
 
1939
1495
  var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
@@ -1960,11 +1516,9 @@ var FormattedMessage = function (_Component) {
1960
1516
  return children.apply(undefined, toConsumableArray(nodes));
1961
1517
  }
1962
1518
 
1963
- return React__default.createElement(
1964
- Component$$1,
1965
- null,
1966
- nodes
1967
- );
1519
+ // Needs to use `createElement()` instead of JSX, otherwise React will
1520
+ // warn about a missing `key` prop with rich-text message formatting.
1521
+ return React.createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
1968
1522
  }
1969
1523
  }]);
1970
1524
  return FormattedMessage;
@@ -1977,10 +1531,10 @@ FormattedMessage.contextTypes = {
1977
1531
  FormattedMessage.defaultProps = {
1978
1532
  values: {}
1979
1533
  };
1980
- process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = babelHelpers$1['extends']({}, messageDescriptorPropTypes, {
1981
- values: React.PropTypes.object,
1982
- tagName: React.PropTypes.string,
1983
- children: React.PropTypes.func
1534
+ process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1535
+ values: PropTypes.object,
1536
+ tagName: PropTypes.string,
1537
+ children: PropTypes.func
1984
1538
  }) : void 0;
1985
1539
 
1986
1540
  /*
@@ -2015,7 +1569,7 @@ var FormattedHTMLMessage = function (_Component) {
2015
1569
  // Since `values` has already been checked, we know they're not
2016
1570
  // different, so the current `values` are carried over so the shallow
2017
1571
  // equals comparison on the other props isn't affected by the `values`.
2018
- var nextPropsToCheck = babelHelpers$1['extends']({}, nextProps, {
1572
+ var nextPropsToCheck = _extends({}, nextProps, {
2019
1573
  values: values
2020
1574
  });
2021
1575
 
@@ -2070,10 +1624,10 @@ FormattedHTMLMessage.contextTypes = {
2070
1624
  FormattedHTMLMessage.defaultProps = {
2071
1625
  values: {}
2072
1626
  };
2073
- process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = babelHelpers$1['extends']({}, messageDescriptorPropTypes, {
2074
- values: React.PropTypes.object,
2075
- tagName: React.PropTypes.string,
2076
- children: React.PropTypes.func
1627
+ process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1628
+ values: PropTypes.object,
1629
+ tagName: PropTypes.string,
1630
+ children: PropTypes.func
2077
1631
  }) : void 0;
2078
1632
 
2079
1633
  /*