victory-create-container 35.11.2 → 36.1.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.
@@ -173,9 +173,7 @@ var combineContainerMixins = function (mixins, Container) {
173
173
  var match = Class.displayName.match(/Victory(.*)Container/);
174
174
  return match[1] || "";
175
175
  }).join("");
176
- return _temp = _class =
177
- /*#__PURE__*/
178
- function (_NaiveCombinedContain) {
176
+ return _temp = _class = /*#__PURE__*/function (_NaiveCombinedContain) {
179
177
  _inherits(VictoryCombinedContainer, _NaiveCombinedContain);
180
178
 
181
179
  function VictoryCombinedContainer() {
@@ -13236,39 +13234,6 @@ var range = createRange();
13236
13234
  module.exports = range;
13237
13235
 
13238
13236
 
13239
- /***/ }),
13240
-
13241
- /***/ "../../../node_modules/lodash/some.js":
13242
- /*!********************************************!*\
13243
- !*** ../../../node_modules/lodash/some.js ***!
13244
- \********************************************/
13245
- /***/ ((module) => {
13246
-
13247
- /**
13248
- * A specialized version of `_.some` for arrays without support for iteratee
13249
- * shorthands.
13250
- *
13251
- * @private
13252
- * @param {Array} [array] The array to iterate over.
13253
- * @param {Function} predicate The function invoked per iteration.
13254
- * @returns {boolean} Returns `true` if any element passes the predicate check,
13255
- * else `false`.
13256
- */
13257
- function arraySome(array, predicate) {
13258
- var index = -1,
13259
- length = array == null ? 0 : array.length;
13260
-
13261
- while (++index < length) {
13262
- if (predicate(array[index], index, array)) {
13263
- return true;
13264
- }
13265
- }
13266
- return false;
13267
- }
13268
-
13269
- module.exports = arraySome;
13270
-
13271
-
13272
13237
  /***/ }),
13273
13238
 
13274
13239
  /***/ "../../../node_modules/lodash/sortedUniq.js":
@@ -15623,9 +15588,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
15623
15588
  var brushContainerMixin = function (base) {
15624
15589
  var _class, _temp;
15625
15590
 
15626
- return _temp = _class =
15627
- /*#__PURE__*/
15628
- function (_base) {
15591
+ return _temp = _class = /*#__PURE__*/function (_base) {
15629
15592
  _inherits(VictoryBrushContainer, _base);
15630
15593
 
15631
15594
  function VictoryBrushContainer() {
@@ -15912,9 +15875,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
15912
15875
 
15913
15876
 
15914
15877
 
15915
- var VictoryClipContainer =
15916
- /*#__PURE__*/
15917
- function (_React$Component) {
15878
+ var VictoryClipContainer = /*#__PURE__*/function (_React$Component) {
15918
15879
  _inherits(VictoryClipContainer, _React$Component);
15919
15880
 
15920
15881
  function VictoryClipContainer(props) {
@@ -16225,9 +16186,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
16225
16186
 
16226
16187
 
16227
16188
 
16228
- var VictoryContainer =
16229
- /*#__PURE__*/
16230
- function (_React$Component) {
16189
+ var VictoryContainer = /*#__PURE__*/function (_React$Component) {
16231
16190
  _inherits(VictoryContainer, _React$Component);
16232
16191
 
16233
16192
  function VictoryContainer(props) {
@@ -16585,7 +16544,7 @@ var getSingleValue = function (prop) {
16585
16544
  return Array.isArray(prop) ? prop[index] || prop[0] : prop;
16586
16545
  };
16587
16546
 
16588
- var useMultiLineBackgrounds = function (props) {
16547
+ var shouldUseMultilineBackgrounds = function (props) {
16589
16548
  var backgroundStyle = props.backgroundStyle,
16590
16549
  backgroundPadding = props.backgroundPadding;
16591
16550
  return Array.isArray(backgroundStyle) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(backgroundStyle) || Array.isArray(backgroundPadding) && !lodash_isEmpty__WEBPACK_IMPORTED_MODULE_0___default()(backgroundPadding);
@@ -16877,7 +16836,7 @@ var getChildBackgrounds = function (calculatedProps, tspanValues) {
16877
16836
  };
16878
16837
 
16879
16838
  var getBackgroundElement = function (calculatedProps, tspanValues) {
16880
- return useMultiLineBackgrounds(calculatedProps) ? getChildBackgrounds(calculatedProps, tspanValues) : getFullBackground(calculatedProps, tspanValues);
16839
+ return shouldUseMultilineBackgrounds(calculatedProps) ? getChildBackgrounds(calculatedProps, tspanValues) : getFullBackground(calculatedProps, tspanValues);
16881
16840
  };
16882
16841
 
16883
16842
  var calculateSpanDy = function (tspanValues, i, calculatedProps) {
@@ -16888,7 +16847,7 @@ var calculateSpanDy = function (tspanValues, i, calculatedProps) {
16888
16847
  var previousCaps = previous.fontSize - previous.capHeight;
16889
16848
  var currentCaps = current.fontSize - current.capHeight;
16890
16849
  var textHeight = previousHeight - previous.fontSize / 2 + current.fontSize / 2 - previousHeight / 2 + currentHeight / 2 - currentCaps / 2 + previousCaps / 2;
16891
- return useMultiLineBackgrounds(calculatedProps) ? textHeight + current.backgroundPadding.top + previous.backgroundPadding.bottom : textHeight;
16850
+ return shouldUseMultilineBackgrounds(calculatedProps) ? textHeight + current.backgroundPadding.top + previous.backgroundPadding.bottom : textHeight;
16892
16851
  };
16893
16852
 
16894
16853
  var getTSpanDy = function (tspanValues, calculatedProps, i) {
@@ -17173,9 +17132,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
17173
17132
 
17174
17133
 
17175
17134
 
17176
- var Portal =
17177
- /*#__PURE__*/
17178
- function (_React$Component) {
17135
+ var Portal = /*#__PURE__*/function (_React$Component) {
17179
17136
  _inherits(Portal, _React$Component);
17180
17137
 
17181
17138
  function Portal(props) {
@@ -17294,9 +17251,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
17294
17251
 
17295
17252
 
17296
17253
 
17297
- var VictoryPortal =
17298
- /*#__PURE__*/
17299
- function (_React$Component) {
17254
+ var VictoryPortal = /*#__PURE__*/function (_React$Component) {
17300
17255
  _inherits(VictoryPortal, _React$Component);
17301
17256
 
17302
17257
  function VictoryPortal() {
@@ -22202,9 +22157,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
22202
22157
 
22203
22158
 
22204
22159
 
22205
- var Timer =
22206
- /*#__PURE__*/
22207
- function () {
22160
+ var Timer = /*#__PURE__*/function () {
22208
22161
  function Timer() {
22209
22162
  _classCallCheck(this, Timer);
22210
22163
 
@@ -22279,440 +22232,6 @@ function () {
22279
22232
 
22280
22233
 
22281
22234
 
22282
- /***/ }),
22283
-
22284
- /***/ "../../victory-core/es/victory-util/transitions.js":
22285
- /*!*********************************************************!*\
22286
- !*** ../../victory-core/es/victory-util/transitions.js ***!
22287
- \*********************************************************/
22288
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22289
-
22290
- "use strict";
22291
- __webpack_require__.r(__webpack_exports__);
22292
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22293
- /* harmony export */ "getInitialTransitionState": () => (/* binding */ getInitialTransitionState),
22294
- /* harmony export */ "getTransitionPropsFactory": () => (/* binding */ getTransitionPropsFactory)
22295
- /* harmony export */ });
22296
- /* harmony import */ var lodash_keys__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/keys */ "../../../node_modules/lodash/keys.js");
22297
- /* harmony import */ var lodash_keys__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_keys__WEBPACK_IMPORTED_MODULE_0__);
22298
- /* harmony import */ var lodash_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/identity */ "../../../node_modules/lodash/identity.js");
22299
- /* harmony import */ var lodash_identity__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_identity__WEBPACK_IMPORTED_MODULE_1__);
22300
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/lodash/defaults.js");
22301
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_2__);
22302
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/assign */ "../../../node_modules/lodash/assign.js");
22303
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_3__);
22304
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
22305
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
22306
-
22307
-
22308
-
22309
-
22310
-
22311
-
22312
- function getDatumKey(datum, idx) {
22313
- return (datum.key || idx).toString();
22314
- }
22315
-
22316
- function getKeyedData(data) {
22317
- return data.reduce(function (keyedData, datum, idx) {
22318
- var key = getDatumKey(datum, idx);
22319
- keyedData[key] = datum;
22320
- return keyedData;
22321
- }, {});
22322
- }
22323
-
22324
- function getKeyedDataDifference(a, b) {
22325
- var hasDifference = false;
22326
-
22327
- var difference = lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(a).reduce(function (_difference, key) {
22328
- if (!(key in b)) {
22329
- hasDifference = true;
22330
- _difference[key] = true;
22331
- }
22332
-
22333
- return _difference;
22334
- }, {});
22335
-
22336
- return hasDifference && difference;
22337
- }
22338
- /**
22339
- * Calculate which data-points exist in oldData and not nextData -
22340
- * these are the `exiting` data-points. Also calculate which
22341
- * data-points exist in nextData and not oldData - these are the
22342
- * `entering` data-points.
22343
- *
22344
- * @param {Array} oldData this.props.data Array
22345
- * @param {Array} nextData this.props.data Array
22346
- *
22347
- * @return {Object} Object with `entering` and `exiting` properties.
22348
- * entering[datum.key] will be true if the data is
22349
- * entering, and similarly for `exiting`.
22350
- */
22351
-
22352
-
22353
- function getNodeTransitions(oldData, nextData) {
22354
- var oldDataKeyed = oldData && getKeyedData(oldData);
22355
- var nextDataKeyed = nextData && getKeyedData(nextData);
22356
- return {
22357
- entering: oldDataKeyed && getKeyedDataDifference(nextDataKeyed, oldDataKeyed),
22358
- exiting: nextDataKeyed && getKeyedDataDifference(oldDataKeyed, nextDataKeyed)
22359
- };
22360
- }
22361
-
22362
- function getChildData(child) {
22363
- if (child.type && child.type.getData) {
22364
- return child.type.getData(child.props);
22365
- }
22366
-
22367
- return child.props && child.props.data || false;
22368
- }
22369
- /**
22370
- * If a parent component has animation enabled, calculate the transitions
22371
- * for any data of any child component that supports data transitions
22372
- * Data transitions are defined as any two datasets where data nodes exist
22373
- * in the first set and not the second, in the second and not the first,
22374
- * or both.
22375
- *
22376
- * @param {Children} oldChildren this.props.children from old props
22377
- * @param {Children} nextChildren this.props.children from next props
22378
- *
22379
- * @return {Object} Object with the following properties:
22380
- * - nodesWillExit
22381
- * - nodesWillEnter
22382
- * - childrenTransitions
22383
- * - nodesShouldEnter
22384
- */
22385
-
22386
-
22387
- function getInitialTransitionState(oldChildren, nextChildren) {
22388
- var nodesWillExit = false;
22389
- var nodesWillEnter = false;
22390
-
22391
- var getTransition = function (oldChild, newChild) {
22392
- if (!newChild || oldChild.type !== newChild.type) {
22393
- return {};
22394
- }
22395
-
22396
- var _ref = getNodeTransitions(getChildData(oldChild), getChildData(newChild)) || {},
22397
- entering = _ref.entering,
22398
- exiting = _ref.exiting;
22399
-
22400
- nodesWillExit = nodesWillExit || !!exiting;
22401
- nodesWillEnter = nodesWillEnter || !!entering;
22402
- return {
22403
- entering: entering || false,
22404
- exiting: exiting || false
22405
- };
22406
- };
22407
-
22408
- var getTransitionsFromChildren = function (old, next) {
22409
- return old.map(function (child, idx) {
22410
- if (child && child.props && child.props.children && next[idx]) {
22411
- return getTransitionsFromChildren(react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(old[idx].props.children), react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(next[idx].props.children));
22412
- } // get Transition entering and exiting nodes
22413
-
22414
-
22415
- return getTransition(child, next[idx]);
22416
- });
22417
- };
22418
-
22419
- var childrenTransitions = getTransitionsFromChildren(react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(oldChildren), react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(nextChildren));
22420
- return {
22421
- nodesWillExit: nodesWillExit,
22422
- nodesWillEnter: nodesWillEnter,
22423
- childrenTransitions: childrenTransitions,
22424
- // TODO: This may need to be refactored for the following situation.
22425
- // The component receives new props, and the data provided
22426
- // is a perfect match for the previous data and domain except
22427
- // for new nodes. In this case, we wouldn't want a delay before
22428
- // the new nodes appear.
22429
- nodesShouldEnter: false
22430
- };
22431
- }
22432
-
22433
- function getInitialChildProps(animate, data) {
22434
- var after = animate.onEnter && animate.onEnter.after ? animate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
22435
- return {
22436
- data: data.map(function (datum, idx) {
22437
- return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data));
22438
- })
22439
- };
22440
- } // eslint-disable-next-line max-params
22441
-
22442
-
22443
- function getChildBeforeLoad(animate, child, data, cb) {
22444
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
22445
- onEnd: cb
22446
- });
22447
-
22448
- if (animate && animate.onLoad && !animate.onLoad.duration) {
22449
- return {
22450
- animate: animate,
22451
- data: data
22452
- };
22453
- }
22454
-
22455
- var before = animate.onLoad && animate.onLoad.before ? animate.onLoad.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onLoad.before function.
22456
-
22457
- data = data.map(function (datum, idx) {
22458
- return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data));
22459
- });
22460
- return {
22461
- animate: animate,
22462
- data: data,
22463
- clipWidth: 0
22464
- };
22465
- } // eslint-disable-next-line max-params
22466
-
22467
-
22468
- function getChildOnLoad(animate, data, cb) {
22469
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
22470
- onEnd: cb
22471
- });
22472
-
22473
- if (animate && animate.onLoad && !animate.onLoad.duration) {
22474
- return {
22475
- animate: animate,
22476
- data: data
22477
- };
22478
- }
22479
-
22480
- var after = animate.onLoad && animate.onLoad.after ? animate.onLoad.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onLoad.after function.
22481
-
22482
- data = data.map(function (datum, idx) {
22483
- return lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data));
22484
- });
22485
- return {
22486
- animate: animate,
22487
- data: data
22488
- };
22489
- } // eslint-disable-next-line max-params, max-len
22490
-
22491
-
22492
- function getChildPropsOnExit(animate, child, data, exitingNodes, cb) {
22493
- // Whether or not _this_ child has exiting nodes, we want the exit-
22494
- // transition for all children to have the same duration, delay, etc.
22495
- var onExit = animate && animate.onExit;
22496
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onExit);
22497
-
22498
- if (exitingNodes) {
22499
- // After the exit transition occurs, trigger the animations for
22500
- // nodes that are neither exiting or entering.
22501
- animate.onEnd = cb;
22502
- var before = animate.onExit && animate.onExit.before ? animate.onExit.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // If nodes need to exit, transform them with the provided onExit.before function.
22503
-
22504
- data = data.map(function (datum, idx) {
22505
- var key = (datum.key || idx).toString();
22506
- return exitingNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
22507
- });
22508
- }
22509
-
22510
- return {
22511
- animate: animate,
22512
- data: data
22513
- };
22514
- } // eslint-disable-next-line max-params,max-len
22515
-
22516
-
22517
- function getChildPropsBeforeEnter(animate, child, data, enteringNodes, cb) {
22518
- if (enteringNodes) {
22519
- // Perform a normal animation here, except - when it finishes - trigger
22520
- // the transition for entering nodes.
22521
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, {
22522
- onEnd: cb
22523
- });
22524
- var before = animate.onEnter && animate.onEnter.before ? animate.onEnter.before : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default()); // We want the entering nodes to be included in the transition target
22525
- // domain. However, we may not want these nodes to be displayed initially,
22526
- // so perform the `onEnter.before` transformation on each node.
22527
-
22528
- data = data.map(function (datum, idx) {
22529
- var key = (datum.key || idx).toString();
22530
- return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, before(datum, idx, data)) : datum;
22531
- });
22532
- }
22533
-
22534
- return {
22535
- animate: animate,
22536
- data: data
22537
- };
22538
- } // eslint-disable-next-line max-params, max-len
22539
-
22540
-
22541
- function getChildPropsOnEnter(animate, data, enteringNodes, cb) {
22542
- // Whether or not _this_ child has entering nodes, we want the entering-
22543
- // transition for all children to have the same duration, delay, etc.
22544
- var onEnter = animate && animate.onEnter;
22545
- animate = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, onEnter);
22546
-
22547
- if (enteringNodes) {
22548
- // Old nodes have been transitioned to their new values, and the
22549
- // domain should encompass the nodes that will now enter. So perform
22550
- // the `onEnter.after` transformation on each node.
22551
- animate.onEnd = cb;
22552
- var after = animate.onEnter && animate.onEnter.after ? animate.onEnter.after : (lodash_identity__WEBPACK_IMPORTED_MODULE_1___default());
22553
- data = data.map(function (datum, idx) {
22554
- var key = getDatumKey(datum, idx);
22555
- return enteringNodes[key] ? lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, datum, after(datum, idx, data)) : datum;
22556
- });
22557
- }
22558
-
22559
- return {
22560
- animate: animate,
22561
- data: data
22562
- };
22563
- }
22564
- /**
22565
- * getTransitionPropsFactory - putting the Java in JavaScript. This will return a
22566
- * function that returns prop transformations for a child, given that child's props
22567
- * and its index in the parent's children array.
22568
- *
22569
- * In particular, this will include an `animate` object that is set appropriately
22570
- * so that each child will be synchoronized for each stage of a transition
22571
- * animation. It will also include a transformed `data` object, where each datum
22572
- * is transformed by `animate.onExit` and `animate.onEnter` `before` and `after`
22573
- * functions.
22574
- *
22575
- * @param {Object} props `this.props` for the parent component.
22576
- * @param {Object} state `this.state` for the parent component.
22577
- * @param {Function} setState Function that, when called, will `this.setState` on
22578
- * the parent component with the provided object.
22579
- *
22580
- * @return {Function} Child-prop transformation function.
22581
- */
22582
-
22583
-
22584
- function getTransitionPropsFactory(props, state, setState) {
22585
- var nodesWillExit = state && state.nodesWillExit;
22586
- var nodesWillEnter = state && state.nodesWillEnter;
22587
- var nodesShouldEnter = state && state.nodesShouldEnter;
22588
- var nodesShouldLoad = state && state.nodesShouldLoad;
22589
- var nodesDoneLoad = state && state.nodesDoneLoad;
22590
- var childrenTransitions = state && state.childrenTransitions || [];
22591
- var transitionDurations = {
22592
- enter: props.animate && props.animate.onEnter && props.animate.onEnter.duration,
22593
- exit: props.animate && props.animate.onExit && props.animate.onExit.duration,
22594
- load: props.animate && props.animate.onLoad && props.animate.onLoad.duration,
22595
- move: props.animate && props.animate.duration
22596
- };
22597
-
22598
- var onLoad = function (child, data, animate) {
22599
- if (nodesShouldLoad) {
22600
- return getChildOnLoad(animate, data, function () {
22601
- setState({
22602
- nodesShouldLoad: false,
22603
- nodesDoneLoad: true
22604
- });
22605
- });
22606
- }
22607
-
22608
- return getChildBeforeLoad(animate, child, data, function () {
22609
- setState({
22610
- nodesDoneLoad: true
22611
- });
22612
- });
22613
- }; // eslint-disable-next-line max-params
22614
-
22615
-
22616
- var onExit = function (nodes, child, data, animate) {
22617
- return getChildPropsOnExit(animate, child, data, nodes, function () {
22618
- setState({
22619
- nodesWillExit: false
22620
- });
22621
- });
22622
- }; // eslint-disable-next-line max-params
22623
-
22624
-
22625
- var onEnter = function (nodes, child, data, animate) {
22626
- if (nodesShouldEnter) {
22627
- return getChildPropsOnEnter(animate, data, nodes, function () {
22628
- setState({
22629
- nodesWillEnter: false
22630
- });
22631
- });
22632
- }
22633
-
22634
- return getChildPropsBeforeEnter(animate, child, data, nodes, function () {
22635
- setState({
22636
- nodesShouldEnter: true
22637
- });
22638
- });
22639
- };
22640
-
22641
- var getChildTransitionDuration = function (child, type) {
22642
- var animate = child.props.animate;
22643
-
22644
- if (!child.type) {
22645
- return {};
22646
- }
22647
-
22648
- var defaultTransitions = child.props && child.props.polar ? child.type.defaultPolarTransitions || child.type.defaultTransitions : child.type.defaultTransitions;
22649
-
22650
- if (defaultTransitions) {
22651
- var animationDuration = animate[type] && animate[type].duration;
22652
- return animationDuration !== undefined ? animationDuration : defaultTransitions[type] && defaultTransitions[type].duration;
22653
- } else {
22654
- return {};
22655
- }
22656
- }; // eslint-disable-next-line max-statements, complexity, max-len
22657
-
22658
-
22659
- return function getTransitionProps(child, index) {
22660
- var data = getChildData(child) || [];
22661
-
22662
- var animate = lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, props.animate, child.props.animate);
22663
-
22664
- var defaultTransitions = child.props.polar ? child.type.defaultPolarTransitions || child.type.defaultTransitions : child.type.defaultTransitions;
22665
- animate.onExit = lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, animate.onExit, defaultTransitions && defaultTransitions.onExit);
22666
- animate.onEnter = lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, animate.onEnter, defaultTransitions && defaultTransitions.onEnter);
22667
- animate.onLoad = lodash_defaults__WEBPACK_IMPORTED_MODULE_2___default()({}, animate.onLoad, defaultTransitions && defaultTransitions.onLoad);
22668
- var childTransitions = childrenTransitions[index] || childrenTransitions[0];
22669
-
22670
- if (!nodesDoneLoad) {
22671
- // should do onLoad animation
22672
- var load = transitionDurations.load !== undefined ? transitionDurations.load : getChildTransitionDuration(child, "onLoad");
22673
- var animation = {
22674
- duration: load
22675
- };
22676
- return onLoad(child, data, lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, animation));
22677
- } else if (nodesWillExit) {
22678
- var exitingNodes = childTransitions && childTransitions.exiting;
22679
- var exit = transitionDurations.exit !== undefined ? transitionDurations.exit : getChildTransitionDuration(child, "onExit"); // if nodesWillExit, but this child has no exiting nodes, set a delay instead of a duration
22680
-
22681
- var _animation = exitingNodes ? {
22682
- duration: exit
22683
- } : {
22684
- delay: exit
22685
- };
22686
-
22687
- return onExit(exitingNodes, child, data, lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, _animation));
22688
- } else if (nodesWillEnter) {
22689
- var enteringNodes = childTransitions && childTransitions.entering;
22690
- var enter = transitionDurations.enter !== undefined ? transitionDurations.enter : getChildTransitionDuration(child, "onEnter");
22691
- var move = transitionDurations.move !== undefined ? transitionDurations.move : child.props.animate && child.props.animate.duration;
22692
- var _animation2 = {
22693
- duration: nodesShouldEnter && enteringNodes ? enter : move
22694
- };
22695
- return onEnter(enteringNodes, child, data, lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, animate, _animation2));
22696
- } else if (!state && animate && animate.onExit) {
22697
- // This is the initial render, and nodes may enter when props change. Because
22698
- // animation interpolation is determined by old- and next- props, data may need
22699
- // to be augmented with certain properties.
22700
- //
22701
- // For example, it may be desired that exiting nodes go from `opacity: 1` to
22702
- // `opacity: 0`. Without setting this on a per-datum basis, the interpolation
22703
- // might go from `opacity: undefined` to `opacity: 0`, which would result in
22704
- // interpolated `opacity: NaN` values.
22705
- //
22706
- return getInitialChildProps(animate, data);
22707
- }
22708
-
22709
- return {
22710
- animate: animate,
22711
- data: data
22712
- };
22713
- };
22714
- }
22715
-
22716
22235
  /***/ }),
22717
22236
 
22718
22237
  /***/ "../../victory-core/es/victory-util/wrapper.js":
@@ -22724,7 +22243,23 @@ function getTransitionPropsFactory(props, state, setState) {
22724
22243
  "use strict";
22725
22244
  __webpack_require__.r(__webpack_exports__);
22726
22245
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22727
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22246
+ /* harmony export */ "addBinsToParentPropsIfHistogram": () => (/* binding */ addBinsToParentPropsIfHistogram),
22247
+ /* harmony export */ "getDataFromChildren": () => (/* binding */ getDataFromChildren),
22248
+ /* harmony export */ "getData": () => (/* binding */ getData),
22249
+ /* harmony export */ "getWidth": () => (/* binding */ getWidth),
22250
+ /* harmony export */ "getDefaultDomainPadding": () => (/* binding */ getDefaultDomainPadding),
22251
+ /* harmony export */ "getDomainFromChildren": () => (/* binding */ getDomainFromChildren),
22252
+ /* harmony export */ "getDomain": () => (/* binding */ getDomain),
22253
+ /* harmony export */ "getScale": () => (/* binding */ getScale),
22254
+ /* harmony export */ "getAllEvents": () => (/* binding */ getAllEvents),
22255
+ /* harmony export */ "getColor": () => (/* binding */ getColor),
22256
+ /* harmony export */ "getStyle": () => (/* binding */ getStyle),
22257
+ /* harmony export */ "getChildStyle": () => (/* binding */ getChildStyle),
22258
+ /* harmony export */ "getStringsFromCategories": () => (/* binding */ getStringsFromCategories),
22259
+ /* harmony export */ "getStringsFromData": () => (/* binding */ getStringsFromData),
22260
+ /* harmony export */ "getCategoryAndAxisStringsFromChildren": () => (/* binding */ getCategoryAndAxisStringsFromChildren),
22261
+ /* harmony export */ "getStringsFromChildren": () => (/* binding */ getStringsFromChildren),
22262
+ /* harmony export */ "getCategories": () => (/* binding */ getCategories)
22728
22263
  /* harmony export */ });
22729
22264
  /* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/isPlainObject */ "../../../node_modules/lodash/isPlainObject.js");
22730
22265
  /* harmony import */ var lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0__);
@@ -22734,33 +22269,27 @@ __webpack_require__.r(__webpack_exports__);
22734
22269
  /* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_2__);
22735
22270
  /* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/groupBy */ "../../../node_modules/lodash/groupBy.js");
22736
22271
  /* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_3__);
22737
- /* harmony import */ var lodash_some__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/some */ "../../../node_modules/lodash/some.js");
22738
- /* harmony import */ var lodash_some__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_some__WEBPACK_IMPORTED_MODULE_4__);
22739
- /* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/uniq */ "../../../node_modules/lodash/uniq.js");
22740
- /* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_5__);
22741
- /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/isFunction */ "../../../node_modules/lodash/isFunction.js");
22742
- /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_6__);
22743
- /* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash/flatten */ "../../../node_modules/lodash/flatten.js");
22744
- /* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash_flatten__WEBPACK_IMPORTED_MODULE_7__);
22745
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/lodash/defaults.js");
22746
- /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_8__);
22747
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! lodash/assign */ "../../../node_modules/lodash/assign.js");
22748
- /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_9__);
22749
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react */ "react");
22750
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_10__);
22751
- /* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./axis */ "../../victory-core/es/victory-util/axis.js");
22752
- /* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./style */ "../../victory-core/es/victory-util/style.js");
22753
- /* harmony import */ var _transitions__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./transitions */ "../../victory-core/es/victory-util/transitions.js");
22754
- /* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./data */ "../../victory-core/es/victory-util/data.js");
22755
- /* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./domain */ "../../victory-core/es/victory-util/domain.js");
22756
- /* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./events */ "../../victory-core/es/victory-util/events.js");
22757
- /* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./collection */ "../../victory-core/es/victory-util/collection.js");
22758
- /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
22759
- /* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
22760
- /* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
22761
-
22762
-
22763
-
22272
+ /* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash/uniq */ "../../../node_modules/lodash/uniq.js");
22273
+ /* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_4__);
22274
+ /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash/isFunction */ "../../../node_modules/lodash/isFunction.js");
22275
+ /* harmony import */ var lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash_isFunction__WEBPACK_IMPORTED_MODULE_5__);
22276
+ /* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! lodash/flatten */ "../../../node_modules/lodash/flatten.js");
22277
+ /* harmony import */ var lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash_flatten__WEBPACK_IMPORTED_MODULE_6__);
22278
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/lodash/defaults.js");
22279
+ /* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_7__);
22280
+ /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! lodash/assign */ "../../../node_modules/lodash/assign.js");
22281
+ /* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_8__);
22282
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react */ "react");
22283
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_9__);
22284
+ /* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./axis */ "../../victory-core/es/victory-util/axis.js");
22285
+ /* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./style */ "../../victory-core/es/victory-util/style.js");
22286
+ /* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./data */ "../../victory-core/es/victory-util/data.js");
22287
+ /* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./domain */ "../../victory-core/es/victory-util/domain.js");
22288
+ /* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./events */ "../../victory-core/es/victory-util/events.js");
22289
+ /* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./collection */ "../../victory-core/es/victory-util/collection.js");
22290
+ /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
22291
+ /* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
22292
+ /* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
22764
22293
 
22765
22294
 
22766
22295
 
@@ -22769,9 +22298,7 @@ __webpack_require__.r(__webpack_exports__);
22769
22298
 
22770
22299
 
22771
22300
 
22772
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
22773
22301
 
22774
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
22775
22302
 
22776
22303
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
22777
22304
 
@@ -22781,7 +22308,9 @@ function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.
22781
22308
 
22782
22309
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
22783
22310
 
22311
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
22784
22312
 
22313
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
22785
22314
 
22786
22315
 
22787
22316
 
@@ -22792,500 +22321,418 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
22792
22321
 
22793
22322
 
22794
22323
 
22795
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
22796
- getData: function (props, childComponents) {
22797
- if (props.data) {
22798
- return _data__WEBPACK_IMPORTED_MODULE_11__.getData(props);
22799
- }
22800
-
22801
- childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(props.children);
22802
- return this.getDataFromChildren(childComponents);
22803
- },
22804
- getDefaultDomainPadding: function (props, axis, childComponents) {
22805
- if (props.polar || axis !== "x") {
22806
- return undefined;
22807
- }
22808
-
22809
- var groupComponent = childComponents.filter(function (child) {
22810
- return child.type && child.type.role && child.type.role === "group";
22811
- });
22812
22324
 
22813
- if (groupComponent.length < 1) {
22814
- return undefined;
22815
- }
22325
+ function addBinsToParentPropsIfHistogram(_ref) {
22326
+ var children = _ref.children,
22327
+ props = _ref.props,
22328
+ childComponents = _ref.childComponents,
22329
+ parentProps = _ref.parentProps;
22330
+ var someChildrenAreHistograms = children.some(function (child) {
22331
+ return child.type && child.type.role === "histogram";
22332
+ });
22333
+ var allChildrenAreHistograms = someChildrenAreHistograms && children.length && children.every(function (child) {
22334
+ return child.type && child.type.role === "histogram";
22335
+ });
22816
22336
 
22817
- var _groupComponent$0$pro = groupComponent[0].props,
22818
- offset = _groupComponent$0$pro.offset,
22819
- children = _groupComponent$0$pro.children;
22337
+ if (someChildrenAreHistograms && !allChildrenAreHistograms) {
22338
+ _log__WEBPACK_IMPORTED_MODULE_10__.warn("VictoryHistogram only supports being stacked with other VictoryHistogram components. Check to make sure that you are only passing VictoryHistogram components to VictoryStack");
22339
+ } // if we are stacking histograms, we need to generate explicit bins
22340
+ // or else each histogram may end up having different bins
22820
22341
 
22821
- if (!offset) {
22822
- return undefined;
22823
- }
22824
22342
 
22825
- var firstChild = Array.isArray(children) && children[0];
22343
+ if (!allChildrenAreHistograms) {
22344
+ return parentProps;
22345
+ }
22826
22346
 
22827
- if (!firstChild) {
22828
- return undefined;
22829
- }
22347
+ var childBins = props.bins || childComponents[0].props.bins; // if we have explicit bins then we don't need to calculate them
22830
22348
 
22831
- var barWidth = firstChild.props.barWidth;
22832
- var dataLength = firstChild.props.data && firstChild.props.data.length || 1;
22349
+ if (!Array.isArray(childBins)) {
22350
+ var combinedData = children.reduce(function (memo, child) {
22351
+ var xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_11__.createAccessor(child.props.x || "x");
22352
+ return memo.concat(child.props.data.map(function (datum) {
22353
+ return {
22354
+ x: xAccessor(datum)
22355
+ };
22356
+ }));
22357
+ }, []); // use the same function to generate bins as VictoryHistogram but with
22358
+ // the combined data from above, then get explicit bins from that
22833
22359
 
22834
- if (firstChild && firstChild.type.role === "stack") {
22835
- var nestedChild = firstChild.props.children && firstChild.props.children[0];
22360
+ var getFormattedHistogramData = children[0].type.getFormattedData;
22361
+ childBins = getFormattedHistogramData({
22362
+ data: combinedData,
22363
+ bins: childBins
22364
+ }).reduce(function (memo, _ref2, index) {
22365
+ var x0 = _ref2.x0,
22366
+ x1 = _ref2.x1;
22367
+ return index === 0 ? memo.concat([x0, x1]) : memo.concat(x1);
22368
+ }, []);
22369
+ }
22836
22370
 
22837
- if (!nestedChild) {
22838
- return undefined;
22839
- }
22371
+ return _objectSpread({}, parentProps, {
22372
+ bins: childBins
22373
+ });
22374
+ }
22375
+ function getDataFromChildren(props, childComponents) {
22376
+ var polar = props.polar,
22377
+ startAngle = props.startAngle,
22378
+ endAngle = props.endAngle,
22379
+ categories = props.categories,
22380
+ minDomain = props.minDomain,
22381
+ maxDomain = props.maxDomain;
22382
+ var parentProps = {
22383
+ polar: polar,
22384
+ startAngle: startAngle,
22385
+ endAngle: endAngle,
22386
+ categories: categories,
22387
+ minDomain: minDomain,
22388
+ maxDomain: maxDomain
22389
+ };
22390
+ var stack = 0;
22391
+ var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
22392
+ parentProps = addBinsToParentPropsIfHistogram({
22393
+ children: children,
22394
+ props: props,
22395
+ childComponents: childComponents,
22396
+ parentProps: parentProps
22397
+ });
22840
22398
 
22841
- barWidth = nestedChild.props.barWidth;
22842
- dataLength = firstChild.props.children.length;
22843
- }
22399
+ var iteratee = function (child, childName, parent) {
22400
+ var childProps = lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, child.props, parentProps);
22844
22401
 
22845
- var width = barWidth || this.getWidth(props, children.length, dataLength);
22846
- return {
22847
- x: width * children.length / 2 + (offset - width * ((children.length - 1) / 2))
22848
- };
22849
- },
22850
- getDomain: function (props, axis, childComponents) {
22851
- childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(props.children);
22852
- var propsDomain = _domain__WEBPACK_IMPORTED_MODULE_12__.getDomainFromProps(props, axis);
22853
- var domainPadding = this.getDefaultDomainPadding(props, axis, childComponents);
22854
- var domain;
22402
+ var childData;
22855
22403
 
22856
- if (propsDomain) {
22857
- domain = propsDomain;
22404
+ if (!_data__WEBPACK_IMPORTED_MODULE_12__.isDataComponent(child)) {
22405
+ return null;
22406
+ } else if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(child.type.getData)) {
22407
+ child = parent ? react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(child, parent.props) : child;
22408
+ childData = child.type.getData(childProps);
22858
22409
  } else {
22859
- var minDomain = _domain__WEBPACK_IMPORTED_MODULE_12__.getMinFromProps(props, axis);
22860
- var maxDomain = _domain__WEBPACK_IMPORTED_MODULE_12__.getMaxFromProps(props, axis);
22861
- var dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_11__.getData(props);
22862
- var dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_12__.getDomainFromData(props, axis, dataset) : [];
22863
- var childDomain = this.getDomainFromChildren(props, axis, childComponents);
22864
- var min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_13__.getMinValue(_toConsumableArray(dataDomain).concat(_toConsumableArray(childDomain)));
22865
- var max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_13__.getMaxValue(_toConsumableArray(dataDomain).concat(_toConsumableArray(childDomain)));
22866
- domain = _domain__WEBPACK_IMPORTED_MODULE_12__.getDomainFromMinMax(min, max);
22867
- }
22868
-
22869
- return _domain__WEBPACK_IMPORTED_MODULE_12__.formatDomain(domain, lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({
22870
- domainPadding: domainPadding
22871
- }, props), axis);
22872
- },
22873
- getScale: function (props, axis, childComponents) {
22874
- if (props.data) {
22875
- return _scale__WEBPACK_IMPORTED_MODULE_14__.getBaseScale(props, axis);
22410
+ childData = _data__WEBPACK_IMPORTED_MODULE_12__.getData(childProps);
22876
22411
  }
22877
22412
 
22878
- var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(props.children);
22413
+ stack += 1;
22414
+ return childData.map(function (datum, index) {
22415
+ return lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({
22416
+ _stack: stack,
22417
+ _group: index
22418
+ }, datum);
22419
+ });
22420
+ };
22879
22421
 
22880
- var iteratee = function (child) {
22881
- var sharedProps = lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({}, child.props, {
22882
- horizontal: props.horizontal
22883
- });
22422
+ var stacked = children.filter(function (c) {
22423
+ return c.type && c.type.role === "stack";
22424
+ }).length;
22884
22425
 
22885
- return _scale__WEBPACK_IMPORTED_MODULE_14__.getScaleType(sharedProps, axis);
22886
- };
22426
+ var combine = function (memo, val) {
22427
+ return memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_2___default()(val, "_group"));
22428
+ };
22887
22429
 
22888
- var childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_5___default()(_helpers__WEBPACK_IMPORTED_MODULE_15__.reduceChildren(children, iteratee, props)); // default to linear scale if more than one uniq scale type is given by children
22430
+ var datasets = _helpers__WEBPACK_IMPORTED_MODULE_11__.reduceChildren(children, iteratee, props, [], combine);
22431
+ var group = stacked ? "_group" : "_stack";
22432
+ return lodash_values__WEBPACK_IMPORTED_MODULE_1___default()(lodash_groupBy__WEBPACK_IMPORTED_MODULE_3___default()(datasets, group));
22433
+ }
22434
+ function getData(props, childComponents) {
22435
+ if (props.data) {
22436
+ return _data__WEBPACK_IMPORTED_MODULE_12__.getData(props);
22437
+ }
22889
22438
 
22439
+ childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
22440
+ return getDataFromChildren(childComponents);
22441
+ }
22442
+ function getWidth(props, groupLength, seriesLength) {
22443
+ var datasets = props.datasets,
22444
+ horizontal = props.horizontal;
22445
+ var range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_11__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_11__.getRange(props, "x");
22446
+ var extent = Math.abs(range[1] - range[0]);
22447
+ seriesLength = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
22448
+ groupLength = groupLength || datasets.length;
22449
+ var bars = groupLength * seriesLength;
22450
+ var barRatio = 0.5;
22451
+ return Math.round(barRatio * extent / bars);
22452
+ }
22453
+ function getDefaultDomainPadding(props, axis, childComponents) {
22454
+ if (props.polar || axis !== "x") {
22455
+ return undefined;
22456
+ }
22890
22457
 
22891
- return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_14__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_14__.getScaleFromName(childScale[0]);
22892
- },
22893
- setAnimationState: function (props, nextProps) {
22894
- if (!props.animate) {
22895
- return;
22896
- }
22897
-
22898
- if (props.animate.parentState) {
22899
- var nodesWillExit = props.animate.parentState.nodesWillExit;
22900
- var oldProps = nodesWillExit ? props : null;
22901
- this.setState(lodash_defaults__WEBPACK_IMPORTED_MODULE_8___default()({
22902
- oldProps: oldProps,
22903
- nextProps: nextProps
22904
- }, props.animate.parentState));
22905
- } else {
22906
- var oldChildren = react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(props.children);
22907
- var nextChildren = react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(nextProps.children);
22458
+ var groupComponent = childComponents.filter(function (child) {
22459
+ return child.type && child.type.role && child.type.role === "group";
22460
+ });
22908
22461
 
22909
- var isContinuous = function (child) {
22910
- var check = function (c) {
22911
- return c.type && c.type.continuous;
22912
- };
22462
+ if (groupComponent.length < 1) {
22463
+ return undefined;
22464
+ }
22913
22465
 
22914
- return Array.isArray(child) ? lodash_some__WEBPACK_IMPORTED_MODULE_4___default()(child, check) : check(child);
22915
- };
22466
+ var _groupComponent$0$pro = groupComponent[0].props,
22467
+ offset = _groupComponent$0$pro.offset,
22468
+ children = _groupComponent$0$pro.children;
22916
22469
 
22917
- var continuous = !props.polar && lodash_some__WEBPACK_IMPORTED_MODULE_4___default()(oldChildren, function (child) {
22918
- return isContinuous(child) || child.props.children && isContinuous(child.props.children);
22919
- });
22470
+ if (!offset) {
22471
+ return undefined;
22472
+ }
22920
22473
 
22921
- var _Transitions$getIniti = _transitions__WEBPACK_IMPORTED_MODULE_16__.getInitialTransitionState(oldChildren, nextChildren),
22922
- _nodesWillExit = _Transitions$getIniti.nodesWillExit,
22923
- nodesWillEnter = _Transitions$getIniti.nodesWillEnter,
22924
- childrenTransitions = _Transitions$getIniti.childrenTransitions,
22925
- nodesShouldEnter = _Transitions$getIniti.nodesShouldEnter;
22926
-
22927
- this.setState({
22928
- nodesWillExit: _nodesWillExit,
22929
- nodesWillEnter: nodesWillEnter,
22930
- nodesShouldEnter: nodesShouldEnter,
22931
- childrenTransitions: _collection__WEBPACK_IMPORTED_MODULE_13__.isArrayOfArrays(childrenTransitions) ? childrenTransitions[0] : childrenTransitions,
22932
- oldProps: _nodesWillExit ? props : null,
22933
- nextProps: nextProps,
22934
- continuous: continuous
22935
- });
22936
- }
22937
- },
22938
- getAllEvents: function (props) {
22939
- var components = ["groupComponent", "containerComponent", "labelComponent"];
22940
- this.componentEvents = _events__WEBPACK_IMPORTED_MODULE_17__.getComponentEvents(props, components);
22941
- var events = props.events;
22474
+ var firstChild = Array.isArray(children) && children[0];
22942
22475
 
22943
- if (Array.isArray(this.componentEvents)) {
22944
- var _componentEvents;
22476
+ if (!firstChild) {
22477
+ return undefined;
22478
+ }
22945
22479
 
22946
- events = Array.isArray(props.events) ? (_componentEvents = this.componentEvents).concat.apply(_componentEvents, _toConsumableArray(props.events)) : this.componentEvents;
22947
- }
22480
+ var barWidth = firstChild.props.barWidth;
22481
+ var dataLength = firstChild.props.data && firstChild.props.data.length || 1;
22948
22482
 
22949
- return events || [];
22950
- },
22951
- getAnimationProps: function (props, child, index) {
22952
- var _this = this;
22483
+ if (firstChild && firstChild.type.role === "stack") {
22484
+ var nestedChild = firstChild.props.children && firstChild.props.children[0];
22953
22485
 
22954
- if (!props.animate) {
22955
- return child.props.animate;
22486
+ if (!nestedChild) {
22487
+ return undefined;
22956
22488
  }
22957
22489
 
22958
- var getFilteredState = function () {
22959
- var childrenTransitions = _this.state && _this.state.childrenTransitions;
22960
- childrenTransitions = _collection__WEBPACK_IMPORTED_MODULE_13__.isArrayOfArrays(childrenTransitions) ? childrenTransitions[index] : childrenTransitions;
22961
- return lodash_defaults__WEBPACK_IMPORTED_MODULE_8___default()({
22962
- childrenTransitions: childrenTransitions
22963
- }, _this.state);
22964
- };
22490
+ barWidth = nestedChild.props.barWidth;
22491
+ dataLength = firstChild.props.children.length;
22492
+ }
22965
22493
 
22966
- var getTransitions = props.animate && props.animate.getTransitions;
22967
- var state = getFilteredState();
22968
- var parentState = props.animate && props.animate.parentState || state;
22494
+ var width = barWidth || getWidth(props, children.length, dataLength);
22495
+ return {
22496
+ x: width * children.length / 2 + (offset - width * ((children.length - 1) / 2))
22497
+ };
22498
+ }
22499
+ function getDomainFromChildren(props, axis, childComponents) {
22500
+ // eslint-disable-line max-statements, complexity, max-len
22501
+ var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
22502
+ var parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_12__.getData(props, axis) : undefined;
22503
+ var polar = props.polar,
22504
+ startAngle = props.startAngle,
22505
+ endAngle = props.endAngle,
22506
+ categories = props.categories,
22507
+ minDomain = props.minDomain,
22508
+ maxDomain = props.maxDomain,
22509
+ horizontal = props.horizontal;
22510
+ var baseParentProps = {
22511
+ horizontal: horizontal,
22512
+ polar: polar,
22513
+ startAngle: startAngle,
22514
+ endAngle: endAngle,
22515
+ minDomain: minDomain,
22516
+ maxDomain: maxDomain,
22517
+ categories: categories
22518
+ };
22519
+ var parentProps = parentData ? lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(baseParentProps, {
22520
+ data: parentData
22521
+ }) : baseParentProps;
22969
22522
 
22970
- if (!getTransitions) {
22971
- var getTransitionProps = _transitions__WEBPACK_IMPORTED_MODULE_16__.getTransitionPropsFactory(props, state, function (newState) {
22972
- return _this.setState(newState);
22973
- });
22523
+ var iteratee = function (child) {
22524
+ var sharedProps = lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, child.props, parentProps);
22974
22525
 
22975
- getTransitions = function (childComponent) {
22976
- return getTransitionProps(childComponent, index);
22977
- };
22526
+ if (!_domain__WEBPACK_IMPORTED_MODULE_13__.isDomainComponent(child)) {
22527
+ return null;
22528
+ } else if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(child.type.getDomain)) {
22529
+ return child.props && child.type.getDomain(sharedProps, axis);
22530
+ } else {
22531
+ return _domain__WEBPACK_IMPORTED_MODULE_13__.getDomain(sharedProps, axis);
22978
22532
  }
22533
+ };
22979
22534
 
22980
- return lodash_defaults__WEBPACK_IMPORTED_MODULE_8___default()({
22981
- getTransitions: getTransitions,
22982
- parentState: parentState
22983
- }, props.animate, child.props.animate);
22984
- },
22985
- getDomainFromChildren: function (props, axis, childComponents) {
22986
- // eslint-disable-line max-statements, complexity, max-len
22987
- var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(props.children);
22988
- var parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_11__.getData(props, axis) : undefined;
22989
- var polar = props.polar,
22990
- startAngle = props.startAngle,
22991
- endAngle = props.endAngle,
22992
- categories = props.categories,
22993
- minDomain = props.minDomain,
22994
- maxDomain = props.maxDomain,
22995
- horizontal = props.horizontal;
22996
- var baseParentProps = {
22997
- horizontal: horizontal,
22998
- polar: polar,
22999
- startAngle: startAngle,
23000
- endAngle: endAngle,
23001
- minDomain: minDomain,
23002
- maxDomain: maxDomain,
23003
- categories: categories
23004
- };
23005
- var parentProps = parentData ? lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()(baseParentProps, {
23006
- data: parentData
23007
- }) : baseParentProps;
22535
+ var childDomains = _helpers__WEBPACK_IMPORTED_MODULE_11__.reduceChildren(children, iteratee, props);
22536
+ var min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_14__.getMinValue(childDomains);
22537
+ var max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_14__.getMaxValue(childDomains);
22538
+ return [min, max];
22539
+ }
22540
+ function getDomain(props, axis, childComponents) {
22541
+ childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
22542
+ var propsDomain = _domain__WEBPACK_IMPORTED_MODULE_13__.getDomainFromProps(props, axis);
22543
+ var domainPadding = getDefaultDomainPadding(props, axis, childComponents);
22544
+ var domain;
22545
+
22546
+ if (propsDomain) {
22547
+ domain = propsDomain;
22548
+ } else {
22549
+ var minDomain = _domain__WEBPACK_IMPORTED_MODULE_13__.getMinFromProps(props, axis);
22550
+ var maxDomain = _domain__WEBPACK_IMPORTED_MODULE_13__.getMaxFromProps(props, axis);
22551
+ var dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_12__.getData(props);
22552
+ var dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_13__.getDomainFromData(props, axis, dataset) : [];
22553
+ var childDomain = getDomainFromChildren(props, axis, childComponents);
22554
+ var min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_14__.getMinValue(_toConsumableArray(dataDomain).concat(_toConsumableArray(childDomain)));
22555
+ var max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_14__.getMaxValue(_toConsumableArray(dataDomain).concat(_toConsumableArray(childDomain)));
22556
+ domain = _domain__WEBPACK_IMPORTED_MODULE_13__.getDomainFromMinMax(min, max);
22557
+ }
23008
22558
 
23009
- var iteratee = function (child) {
23010
- var sharedProps = lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({}, child.props, parentProps);
22559
+ return _domain__WEBPACK_IMPORTED_MODULE_13__.formatDomain(domain, lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({
22560
+ domainPadding: domainPadding
22561
+ }, props), axis);
22562
+ }
22563
+ function getScale(props, axis, childComponents) {
22564
+ if (props.data) {
22565
+ return _scale__WEBPACK_IMPORTED_MODULE_15__.getBaseScale(props, axis);
22566
+ }
23011
22567
 
23012
- if (!_domain__WEBPACK_IMPORTED_MODULE_12__.isDomainComponent(child)) {
23013
- return null;
23014
- } else if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(child.type.getDomain)) {
23015
- return child.props && child.type.getDomain(sharedProps, axis);
23016
- } else {
23017
- return _domain__WEBPACK_IMPORTED_MODULE_12__.getDomain(sharedProps, axis);
23018
- }
23019
- };
22568
+ var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
23020
22569
 
23021
- var childDomains = _helpers__WEBPACK_IMPORTED_MODULE_15__.reduceChildren(children, iteratee, props);
23022
- var min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_13__.getMinValue(childDomains);
23023
- var max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_13__.getMaxValue(childDomains);
23024
- return [min, max];
23025
- },
23026
- addBinsToParentPropsIfHistogram: function (_ref) {
23027
- var children = _ref.children,
23028
- props = _ref.props,
23029
- childComponents = _ref.childComponents,
23030
- parentProps = _ref.parentProps;
23031
- var someChildrenAreHistograms = children.some(function (child) {
23032
- return child.type && child.type.role === "histogram";
23033
- });
23034
- var allChildrenAreHistograms = someChildrenAreHistograms && children.length && children.every(function (child) {
23035
- return child.type && child.type.role === "histogram";
22570
+ var iteratee = function (child) {
22571
+ var sharedProps = lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, child.props, {
22572
+ horizontal: props.horizontal
23036
22573
  });
23037
22574
 
23038
- if (someChildrenAreHistograms && !allChildrenAreHistograms) {
23039
- _log__WEBPACK_IMPORTED_MODULE_18__.warn("VictoryHistogram only supports being stacked with other VictoryHistogram components. Check to make sure that you are only passing VictoryHistogram components to VictoryStack");
23040
- } // if we are stacking histograms, we need to generate explicit bins
23041
- // or else each histogram may end up having different bins
22575
+ return _scale__WEBPACK_IMPORTED_MODULE_15__.getScaleType(sharedProps, axis);
22576
+ };
23042
22577
 
22578
+ var childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(_helpers__WEBPACK_IMPORTED_MODULE_11__.reduceChildren(children, iteratee, props)); // default to linear scale if more than one uniq scale type is given by children
23043
22579
 
23044
- if (!allChildrenAreHistograms) {
23045
- return parentProps;
23046
- }
23047
22580
 
23048
- var childBins = props.bins || childComponents[0].props.bins; // if we have explicit bins then we don't need to calculate them
22581
+ return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_15__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_15__.getScaleFromName(childScale[0]);
22582
+ }
22583
+ function getAllEvents(props) {
22584
+ var components = ["groupComponent", "containerComponent", "labelComponent"];
22585
+ var componentEvents = _events__WEBPACK_IMPORTED_MODULE_16__.getComponentEvents(props, components);
22586
+ var events = props.events;
23049
22587
 
23050
- if (!Array.isArray(childBins)) {
23051
- var combinedData = children.reduce(function (memo, child) {
23052
- var xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_15__.createAccessor(child.props.x || "x");
23053
- return memo.concat(child.props.data.map(function (datum) {
23054
- return {
23055
- x: xAccessor(datum)
23056
- };
23057
- }));
23058
- }, []); // use the same function to generate bins as VictoryHistogram but with
23059
- // the combined data from above, then get explicit bins from that
23060
-
23061
- var getFormattedHistogramData = children[0].type.getFormattedData;
23062
- childBins = getFormattedHistogramData({
23063
- data: combinedData,
23064
- bins: childBins
23065
- }).reduce(function (memo, _ref2, index) {
23066
- var x0 = _ref2.x0,
23067
- x1 = _ref2.x1;
23068
- return index === 0 ? memo.concat([x0, x1]) : memo.concat(x1);
23069
- }, []);
23070
- }
22588
+ if (Array.isArray(componentEvents)) {
22589
+ events = Array.isArray(props.events) ? componentEvents.concat.apply(componentEvents, _toConsumableArray(props.events)) : componentEvents;
22590
+ }
23071
22591
 
23072
- return _objectSpread({}, parentProps, {
23073
- bins: childBins
23074
- });
23075
- },
23076
- getDataFromChildren: function (props, childComponents) {
23077
- var polar = props.polar,
23078
- startAngle = props.startAngle,
23079
- endAngle = props.endAngle,
23080
- categories = props.categories,
23081
- minDomain = props.minDomain,
23082
- maxDomain = props.maxDomain;
23083
- var parentProps = {
23084
- polar: polar,
23085
- startAngle: startAngle,
23086
- endAngle: endAngle,
23087
- categories: categories,
23088
- minDomain: minDomain,
23089
- maxDomain: maxDomain
23090
- };
23091
- var stack = 0;
23092
- var children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(props.children);
23093
- parentProps = this.addBinsToParentPropsIfHistogram({
23094
- children: children,
23095
- props: props,
23096
- childComponents: childComponents,
23097
- parentProps: parentProps
23098
- });
22592
+ return events || [];
22593
+ }
22594
+ function getColor(calculatedProps, child, index) {
22595
+ // check for styles first
22596
+ var style = calculatedProps.style;
22597
+ var colorScale = calculatedProps.colorScale,
22598
+ color = calculatedProps.color;
23099
22599
 
23100
- var iteratee = function (child, childName, parent) {
23101
- var childProps = lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({}, child.props, parentProps);
22600
+ if (style && style.data && style.data.fill) {
22601
+ return style.data.fill;
22602
+ }
23102
22603
 
23103
- var childData;
22604
+ colorScale = child.props && child.props.colorScale ? child.props.colorScale : colorScale;
22605
+ color = child.props && child.props.color ? child.props.color : color;
23104
22606
 
23105
- if (!_data__WEBPACK_IMPORTED_MODULE_11__.isDataComponent(child)) {
23106
- return null;
23107
- } else if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(child.type.getData)) {
23108
- child = parent ? react__WEBPACK_IMPORTED_MODULE_10___default().cloneElement(child, parent.props) : child;
23109
- childData = child.type.getData(childProps);
23110
- } else {
23111
- childData = _data__WEBPACK_IMPORTED_MODULE_11__.getData(childProps);
23112
- }
22607
+ if (!colorScale && !color) {
22608
+ return undefined;
22609
+ }
23113
22610
 
23114
- stack += 1;
23115
- return childData.map(function (datum, index) {
23116
- return lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({
23117
- _stack: stack,
23118
- _group: index
23119
- }, datum);
23120
- });
23121
- };
22611
+ var colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_17__.getColorScale(colorScale);
22612
+ return color || colors[index % colors.length];
22613
+ }
22614
+ function getStyle(theme, style, role) {
22615
+ var defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
22616
+ return _helpers__WEBPACK_IMPORTED_MODULE_11__.getStyles(style, defaultStyle);
22617
+ }
22618
+ function getChildStyle(child, index, calculatedProps) {
22619
+ var style = calculatedProps.style,
22620
+ role = calculatedProps.role;
22621
+ var childStyle = child.props.style || {};
23122
22622
 
23123
- var stacked = children.filter(function (c) {
23124
- return c.type && c.type.role === "stack";
23125
- }).length;
22623
+ if (Array.isArray(childStyle)) {
22624
+ return childStyle;
22625
+ }
23126
22626
 
23127
- var combine = function (memo, val) {
23128
- return memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_2___default()(val, "_group"));
23129
- };
22627
+ var childRole = child.type && child.type.role;
22628
+ var defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
22629
+ var defaultColor = childRole === "line" ? {
22630
+ fill: "none",
22631
+ stroke: defaultFill
22632
+ } : {
22633
+ fill: defaultFill
22634
+ };
22635
+ var dataWidth = role === "stack" ? {} : {
22636
+ width: getWidth(calculatedProps)
22637
+ };
23130
22638
 
23131
- var datasets = _helpers__WEBPACK_IMPORTED_MODULE_15__.reduceChildren(children, iteratee, props, [], combine);
23132
- var group = stacked ? "_group" : "_stack";
23133
- return lodash_values__WEBPACK_IMPORTED_MODULE_1___default()(lodash_groupBy__WEBPACK_IMPORTED_MODULE_3___default()(datasets, group));
23134
- },
23135
- getColor: function (calculatedProps, child, index) {
23136
- // check for styles first
23137
- var style = calculatedProps.style;
23138
- var colorScale = calculatedProps.colorScale,
23139
- color = calculatedProps.color;
22639
+ var dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({}, childStyle.data, lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, dataWidth, style.data, defaultColor));
23140
22640
 
23141
- if (style && style.data && style.data.fill) {
23142
- return style.data.fill;
23143
- }
22641
+ var labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_7___default()({}, childStyle.labels, style.labels);
23144
22642
 
23145
- colorScale = child.props && child.props.colorScale ? child.props.colorScale : colorScale;
23146
- color = child.props && child.props.color ? child.props.color : color;
22643
+ return {
22644
+ parent: style.parent,
22645
+ data: dataStyle,
22646
+ labels: labelsStyle
22647
+ };
22648
+ }
22649
+ function getStringsFromCategories(childComponents, axis) {
22650
+ var iteratee = function (child) {
22651
+ var childProps = child.props || {};
23147
22652
 
23148
- if (!colorScale && !color) {
23149
- return undefined;
22653
+ if (!_domain__WEBPACK_IMPORTED_MODULE_13__.isDomainComponent(child) || !childProps.categories) {
22654
+ return null;
22655
+ } else {
22656
+ var categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories;
22657
+ var categoryStrings = categories && categories.filter(function (val) {
22658
+ return typeof val === "string";
22659
+ });
22660
+ return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_14__.removeUndefined(categoryStrings) : [];
23150
22661
  }
22662
+ };
23151
22663
 
23152
- var colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_19__.getColorScale(colorScale);
23153
- return color || colors[index % colors.length];
23154
- },
23155
- getWidth: function (props, groupLength, seriesLength) {
23156
- var datasets = props.datasets,
23157
- horizontal = props.horizontal;
23158
- var range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_15__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_15__.getRange(props, "x");
23159
- var extent = Math.abs(range[1] - range[0]);
23160
- seriesLength = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
23161
- groupLength = groupLength || datasets.length;
23162
- var bars = groupLength * seriesLength;
23163
- var barRatio = 0.5;
23164
- return Math.round(barRatio * extent / bars);
23165
- },
23166
- getStyle: function (theme, style, role) {
23167
- var defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
23168
- return _helpers__WEBPACK_IMPORTED_MODULE_15__.getStyles(style, defaultStyle);
23169
- },
23170
- getChildStyle: function (child, index, calculatedProps) {
23171
- var style = calculatedProps.style,
23172
- role = calculatedProps.role;
23173
- var childStyle = child.props.style || {};
22664
+ return _helpers__WEBPACK_IMPORTED_MODULE_11__.reduceChildren(childComponents.slice(0), iteratee);
22665
+ }
22666
+ function getStringsFromData(childComponents) {
22667
+ var iteratee = function (child) {
22668
+ var childProps = child.props || {};
22669
+ var data;
23174
22670
 
23175
- if (Array.isArray(childStyle)) {
23176
- return childStyle;
22671
+ if (!_data__WEBPACK_IMPORTED_MODULE_12__.isDataComponent(child)) {
22672
+ return null;
22673
+ } else if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_5___default()(child.type.getData)) {
22674
+ data = child.type.getData(childProps);
22675
+ } else {
22676
+ data = _data__WEBPACK_IMPORTED_MODULE_12__.getData(childProps);
23177
22677
  }
23178
22678
 
23179
- var childRole = child.type && child.type.role;
23180
- var defaultFill = childRole === "stack" ? undefined : this.getColor(calculatedProps, child, index);
23181
- var defaultColor = childRole === "line" ? {
23182
- fill: "none",
23183
- stroke: defaultFill
23184
- } : {
23185
- fill: defaultFill
23186
- };
23187
- var dataWidth = role === "stack" ? {} : {
23188
- width: this.getWidth(calculatedProps)
23189
- };
23190
-
23191
- var dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_8___default()({}, childStyle.data, lodash_assign__WEBPACK_IMPORTED_MODULE_9___default()({}, dataWidth, style.data, defaultColor));
23192
-
23193
- var labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_8___default()({}, childStyle.labels, style.labels);
23194
-
23195
- return {
23196
- parent: style.parent,
23197
- data: dataStyle,
23198
- labels: labelsStyle
23199
- };
23200
- },
23201
- getStringsFromCategories: function (childComponents, axis) {
23202
- var iteratee = function (child) {
23203
- var childProps = child.props || {};
23204
-
23205
- if (!_domain__WEBPACK_IMPORTED_MODULE_12__.isDomainComponent(child) || !childProps.categories) {
23206
- return null;
23207
- } else {
23208
- var categories = childProps.categories && !Array.isArray(childProps.categories) ? childProps.categories[axis] : childProps.props.categories;
23209
- var categoryStrings = categories && categories.filter(function (val) {
23210
- return typeof val === "string";
23211
- });
23212
- return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_13__.removeUndefined(categoryStrings) : [];
23213
- }
23214
- };
23215
-
23216
- return _helpers__WEBPACK_IMPORTED_MODULE_15__.reduceChildren(childComponents.slice(0), iteratee);
23217
- },
23218
- getStringsFromData: function (childComponents) {
23219
- var iteratee = function (child) {
23220
- var childProps = child.props || {};
23221
- var data;
23222
-
23223
- if (!_data__WEBPACK_IMPORTED_MODULE_11__.isDataComponent(child)) {
23224
- return null;
23225
- } else if (child.type && lodash_isFunction__WEBPACK_IMPORTED_MODULE_6___default()(child.type.getData)) {
23226
- data = child.type.getData(childProps);
23227
- } else {
23228
- data = _data__WEBPACK_IMPORTED_MODULE_11__.getData(childProps);
23229
- }
23230
-
23231
- return data.map(function (d) {
23232
- return {
23233
- x: d.xName,
23234
- y: d.yName
23235
- };
23236
- });
23237
- };
23238
-
23239
- var initialMemo = {
23240
- x: [],
23241
- y: []
23242
- };
23243
-
23244
- var combine = function (memo, datum) {
23245
- var x = Array.isArray(datum) ? datum.map(function (d) {
23246
- return d.x;
23247
- }).filter(Boolean) : datum.x;
23248
- var y = Array.isArray(datum) ? datum.map(function (d) {
23249
- return d.y;
23250
- }).filter(Boolean) : datum.y;
22679
+ return data.map(function (d) {
23251
22680
  return {
23252
- x: x !== undefined ? memo.x.concat(x) : memo.x,
23253
- y: y !== undefined ? memo.y.concat(y) : memo.y
22681
+ x: d.xName,
22682
+ y: d.yName
23254
22683
  };
23255
- };
22684
+ });
22685
+ };
23256
22686
 
23257
- return _helpers__WEBPACK_IMPORTED_MODULE_15__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
23258
- },
23259
- getCategoryAndAxisStringsFromChildren: function (props, axis, childComponents) {
23260
- var categories = lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default()(props.categories) ? props.categories[axis] : props.categories;
23261
- var axisComponent = _axis__WEBPACK_IMPORTED_MODULE_20__.getAxisComponent(childComponents, axis);
23262
- var axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_11__.getStringsFromAxes(axisComponent.props, axis) : [];
23263
- var categoryStrings = categories || this.getStringsFromCategories(childComponents, axis);
23264
- return lodash_uniq__WEBPACK_IMPORTED_MODULE_5___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(_toConsumableArray(categoryStrings).concat(_toConsumableArray(axisStrings))));
23265
- },
23266
- getStringsFromChildren: function (props, childComponents) {
23267
- childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_10___default().Children.toArray(props.children);
23268
- var xStrings = this.getCategoryAndAxisStringsFromChildren(props, "x", childComponents);
23269
- var yStrings = this.getCategoryAndAxisStringsFromChildren(props, "y", childComponents);
23270
- var dataStrings = this.getStringsFromData(childComponents);
23271
- return {
23272
- x: lodash_uniq__WEBPACK_IMPORTED_MODULE_5___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(_toConsumableArray(xStrings).concat(_toConsumableArray(dataStrings.x)))),
23273
- y: lodash_uniq__WEBPACK_IMPORTED_MODULE_5___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_7___default()(_toConsumableArray(yStrings).concat(_toConsumableArray(dataStrings.y))))
23274
- };
23275
- },
23276
- getCategories: function (props, childComponents, allStrings) {
23277
- var xPropCategories = props.categories && !Array.isArray(props.categories) ? props.categories.x : props.categories;
23278
- var yPropCategories = props.categories && !Array.isArray(props.categories) ? props.categories.y : props.categories;
23279
- var fallbackRequired = !xPropCategories || !yPropCategories;
23280
- var fallbackProps = fallbackRequired ? allStrings || this.getStringsFromChildren(props, childComponents) : {};
23281
- var xCategories = xPropCategories || fallbackProps.x;
23282
- var yCategories = yPropCategories || fallbackProps.y;
22687
+ var initialMemo = {
22688
+ x: [],
22689
+ y: []
22690
+ };
22691
+
22692
+ var combine = function (memo, datum) {
22693
+ var x = Array.isArray(datum) ? datum.map(function (d) {
22694
+ return d.x;
22695
+ }).filter(Boolean) : datum.x;
22696
+ var y = Array.isArray(datum) ? datum.map(function (d) {
22697
+ return d.y;
22698
+ }).filter(Boolean) : datum.y;
23283
22699
  return {
23284
- x: xCategories.length > 0 ? xCategories : undefined,
23285
- y: yCategories.length > 0 ? yCategories : undefined
22700
+ x: x !== undefined ? memo.x.concat(x) : memo.x,
22701
+ y: y !== undefined ? memo.y.concat(y) : memo.y
23286
22702
  };
23287
- }
23288
- });
22703
+ };
22704
+
22705
+ return _helpers__WEBPACK_IMPORTED_MODULE_11__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
22706
+ }
22707
+ function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
22708
+ var categories = lodash_isPlainObject__WEBPACK_IMPORTED_MODULE_0___default()(props.categories) ? props.categories[axis] : props.categories;
22709
+ var axisComponent = _axis__WEBPACK_IMPORTED_MODULE_18__.getAxisComponent(childComponents, axis);
22710
+ var axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_12__.getStringsFromAxes(axisComponent.props, axis) : [];
22711
+ var categoryStrings = categories || getStringsFromCategories(childComponents, axis);
22712
+ return lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()(_toConsumableArray(categoryStrings).concat(_toConsumableArray(axisStrings))));
22713
+ }
22714
+ function getStringsFromChildren(props, childComponents) {
22715
+ childComponents = childComponents || react__WEBPACK_IMPORTED_MODULE_9___default().Children.toArray(props.children);
22716
+ var xStrings = getCategoryAndAxisStringsFromChildren(props, "x", childComponents);
22717
+ var yStrings = getCategoryAndAxisStringsFromChildren(props, "y", childComponents);
22718
+ var dataStrings = getStringsFromData(childComponents);
22719
+ return {
22720
+ x: lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()(_toConsumableArray(xStrings).concat(_toConsumableArray(dataStrings.x)))),
22721
+ y: lodash_uniq__WEBPACK_IMPORTED_MODULE_4___default()(lodash_flatten__WEBPACK_IMPORTED_MODULE_6___default()(_toConsumableArray(yStrings).concat(_toConsumableArray(dataStrings.y))))
22722
+ };
22723
+ }
22724
+ function getCategories(props, childComponents, allStrings) {
22725
+ var xPropCategories = props.categories && !Array.isArray(props.categories) ? props.categories.x : props.categories;
22726
+ var yPropCategories = props.categories && !Array.isArray(props.categories) ? props.categories.y : props.categories;
22727
+ var fallbackRequired = !xPropCategories || !yPropCategories;
22728
+ var fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
22729
+ var xCategories = xPropCategories || fallbackProps.x;
22730
+ var yCategories = yPropCategories || fallbackProps.y;
22731
+ return {
22732
+ x: xCategories.length > 0 ? xCategories : undefined,
22733
+ y: yCategories.length > 0 ? yCategories : undefined
22734
+ };
22735
+ }
23289
22736
 
23290
22737
  /***/ }),
23291
22738
 
@@ -23470,9 +22917,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
23470
22917
  var cursorContainerMixin = function (base) {
23471
22918
  var _class, _temp;
23472
22919
 
23473
- return _temp = _class =
23474
- /*#__PURE__*/
23475
- function (_base) {
22920
+ return _temp = _class = /*#__PURE__*/function (_base) {
23476
22921
  _inherits(VictoryCursorContainer, _base);
23477
22922
 
23478
22923
  function VictoryCursorContainer() {
@@ -24021,9 +23466,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
24021
23466
  var selectionContainerMixin = function (base) {
24022
23467
  var _class, _temp;
24023
23468
 
24024
- return _temp = _class =
24025
- /*#__PURE__*/
24026
- function (_base) {
23469
+ return _temp = _class = /*#__PURE__*/function (_base) {
24027
23470
  _inherits(VictorySelectionContainer, _base);
24028
23471
 
24029
23472
  function VictorySelectionContainer() {
@@ -24339,9 +23782,7 @@ var fallbackProps = {
24339
23782
  pointerWidth: 10
24340
23783
  };
24341
23784
 
24342
- var VictoryTooltip =
24343
- /*#__PURE__*/
24344
- function (_React$Component) {
23785
+ var VictoryTooltip = /*#__PURE__*/function (_React$Component) {
24345
23786
  _inherits(VictoryTooltip, _React$Component);
24346
23787
 
24347
23788
  function VictoryTooltip(props) {
@@ -25030,9 +24471,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
25030
24471
  var voronoiContainerMixin = function (base) {
25031
24472
  var _class, _temp;
25032
24473
 
25033
- return _temp = _class =
25034
- /*#__PURE__*/
25035
- function (_base) {
24474
+ return _temp = _class = /*#__PURE__*/function (_base) {
25036
24475
  _inherits(VictoryVoronoiContainer, _base);
25037
24476
 
25038
24477
  function VictoryVoronoiContainer() {
@@ -25679,9 +25118,7 @@ var DEFAULT_DOWNSAMPLE = 150;
25679
25118
  var zoomContainerMixin = function (base) {
25680
25119
  var _class, _temp;
25681
25120
 
25682
- return _temp = _class =
25683
- /*#__PURE__*/
25684
- function (_base) {
25121
+ return _temp = _class = /*#__PURE__*/function (_base) {
25685
25122
  _inherits(VictoryZoomContainer, _base);
25686
25123
 
25687
25124
  function VictoryZoomContainer() {
@@ -26175,9 +25612,9 @@ var RawZoomHelpers = {
26175
25612
  var childrenDomain = {};
26176
25613
 
26177
25614
  if (childComponents.length) {
26178
- childrenDomain = zoomDimension ? _defineProperty({}, zoomDimension, victory_core__WEBPACK_IMPORTED_MODULE_7__.default.getDomainFromChildren(props, zoomDimension, childComponents)) : {
26179
- x: victory_core__WEBPACK_IMPORTED_MODULE_7__.default.getDomainFromChildren(props, "x", childComponents),
26180
- y: victory_core__WEBPACK_IMPORTED_MODULE_7__.default.getDomainFromChildren(props, "y", childComponents)
25615
+ childrenDomain = zoomDimension ? _defineProperty({}, zoomDimension, victory_core__WEBPACK_IMPORTED_MODULE_7__.getDomainFromChildren(props, zoomDimension, childComponents)) : {
25616
+ x: victory_core__WEBPACK_IMPORTED_MODULE_7__.getDomainFromChildren(props, "x", childComponents),
25617
+ y: victory_core__WEBPACK_IMPORTED_MODULE_7__.getDomainFromChildren(props, "y", childComponents)
26181
25618
  };
26182
25619
  }
26183
25620