victory-create-container 37.2.0 → 37.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/CHANGELOG.md +2 -0
- package/dist/victory-create-container.js +109 -117
- package/dist/victory-create-container.min.js +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -8200,7 +8200,7 @@ const VictoryPortal = initialProps => {
|
|
|
8200
8200
|
...defaultProps,
|
|
8201
8201
|
...initialProps
|
|
8202
8202
|
};
|
|
8203
|
-
const id = lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()();
|
|
8203
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()());
|
|
8204
8204
|
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
8205
8205
|
if (!portalContext) {
|
|
8206
8206
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -8611,20 +8611,16 @@ const orange = {
|
|
|
8611
8611
|
"100": "#FEE2D5",
|
|
8612
8612
|
"300": "#FFA981",
|
|
8613
8613
|
"500": "#FF6F2C",
|
|
8614
|
+
"700": "#FF4E1B",
|
|
8614
8615
|
"900": "#D74D26"
|
|
8615
8616
|
};
|
|
8616
8617
|
const red = {
|
|
8617
8618
|
"100": "#FFDCE5",
|
|
8618
8619
|
"300": "#FF9EB7",
|
|
8619
8620
|
"500": "#F82B60",
|
|
8621
|
+
"700": "#D31A3D",
|
|
8620
8622
|
"900": "#BA1E45"
|
|
8621
8623
|
};
|
|
8622
|
-
const pink = {
|
|
8623
|
-
"100": "#FFDAF6",
|
|
8624
|
-
"300": "#F99DE2",
|
|
8625
|
-
"500": "#FF08C2",
|
|
8626
|
-
"900": "#B2158B"
|
|
8627
|
-
};
|
|
8628
8624
|
const purple = {
|
|
8629
8625
|
"100": "#EDE3FE",
|
|
8630
8626
|
"300": "#CDB0FF",
|
|
@@ -8635,6 +8631,7 @@ const blue = {
|
|
|
8635
8631
|
"100": "#CFDFFF",
|
|
8636
8632
|
"300": "#9CC7FF",
|
|
8637
8633
|
"500": "#2D7FF9",
|
|
8634
|
+
"700": "#0056B3",
|
|
8638
8635
|
"900": "#2750AE"
|
|
8639
8636
|
};
|
|
8640
8637
|
const cyan = {
|
|
@@ -8653,27 +8650,28 @@ const green = {
|
|
|
8653
8650
|
"100": "#D1F7C4",
|
|
8654
8651
|
"300": "#93E088",
|
|
8655
8652
|
"500": "#20C933",
|
|
8653
|
+
"700": "#1B9B2A",
|
|
8656
8654
|
"900": "#338A17"
|
|
8657
8655
|
};
|
|
8658
8656
|
const colors = {
|
|
8659
8657
|
blue: blue["500"],
|
|
8660
|
-
|
|
8661
|
-
teal: teal["500"],
|
|
8662
|
-
purple: purple["500"],
|
|
8658
|
+
cyan: cyan["500"],
|
|
8663
8659
|
green: green["500"],
|
|
8660
|
+
yellow: yellow["500"],
|
|
8664
8661
|
orange: orange["500"],
|
|
8665
|
-
cyan: cyan["500"],
|
|
8666
8662
|
red: red["500"],
|
|
8667
|
-
|
|
8663
|
+
purple: purple["500"],
|
|
8664
|
+
teal: teal["500"]
|
|
8668
8665
|
};
|
|
8669
8666
|
const colorScale = Object.values(colors);
|
|
8670
|
-
const grayscale = [gray["
|
|
8671
|
-
const warm = [yellow["500"], orange["500"],
|
|
8672
|
-
const cool = [
|
|
8673
|
-
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
8674
|
-
const redPalette =
|
|
8675
|
-
const greenPalette =
|
|
8676
|
-
const bluePalette =
|
|
8667
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
8668
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
8669
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
8670
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
8671
|
+
const redPalette = Object.values(red);
|
|
8672
|
+
const greenPalette = Object.values(green);
|
|
8673
|
+
const bluePalette = Object.values(blue);
|
|
8674
|
+
const defaultColor = blue["500"];
|
|
8677
8675
|
|
|
8678
8676
|
// *
|
|
8679
8677
|
// * Typography
|
|
@@ -8688,7 +8686,7 @@ const padding = 8;
|
|
|
8688
8686
|
const baseProps = {
|
|
8689
8687
|
width: 450,
|
|
8690
8688
|
height: 300,
|
|
8691
|
-
padding:
|
|
8689
|
+
padding: 60,
|
|
8692
8690
|
colorScale
|
|
8693
8691
|
};
|
|
8694
8692
|
// *
|
|
@@ -8732,7 +8730,7 @@ const clean = {
|
|
|
8732
8730
|
area: Object.assign({
|
|
8733
8731
|
style: {
|
|
8734
8732
|
data: {
|
|
8735
|
-
fill:
|
|
8733
|
+
fill: defaultColor,
|
|
8736
8734
|
strokeWidth: 2,
|
|
8737
8735
|
fillOpacity: 0.5
|
|
8738
8736
|
},
|
|
@@ -8749,7 +8747,7 @@ const clean = {
|
|
|
8749
8747
|
strokeLinejoin
|
|
8750
8748
|
},
|
|
8751
8749
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
8752
|
-
padding,
|
|
8750
|
+
padding: 35,
|
|
8753
8751
|
stroke: "transparent"
|
|
8754
8752
|
}),
|
|
8755
8753
|
grid: {
|
|
@@ -8814,7 +8812,7 @@ const clean = {
|
|
|
8814
8812
|
bar: Object.assign({
|
|
8815
8813
|
style: {
|
|
8816
8814
|
data: {
|
|
8817
|
-
fill:
|
|
8815
|
+
fill: defaultColor,
|
|
8818
8816
|
padding,
|
|
8819
8817
|
strokeWidth: 1,
|
|
8820
8818
|
fillOpacity: 0.5
|
|
@@ -8853,7 +8851,7 @@ const clean = {
|
|
|
8853
8851
|
}),
|
|
8854
8852
|
q1: {
|
|
8855
8853
|
padding,
|
|
8856
|
-
fill:
|
|
8854
|
+
fill: colorScale[0],
|
|
8857
8855
|
rx: borderRadius,
|
|
8858
8856
|
strokeWidth: 2
|
|
8859
8857
|
},
|
|
@@ -8862,7 +8860,7 @@ const clean = {
|
|
|
8862
8860
|
}),
|
|
8863
8861
|
q3: {
|
|
8864
8862
|
padding,
|
|
8865
|
-
fill:
|
|
8863
|
+
fill: colorScale[1],
|
|
8866
8864
|
rx: borderRadius
|
|
8867
8865
|
},
|
|
8868
8866
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -8883,8 +8881,8 @@ const clean = {
|
|
|
8883
8881
|
})
|
|
8884
8882
|
},
|
|
8885
8883
|
candleColors: {
|
|
8886
|
-
positive:
|
|
8887
|
-
negative:
|
|
8884
|
+
positive: green["500"],
|
|
8885
|
+
negative: red["500"]
|
|
8888
8886
|
},
|
|
8889
8887
|
wickStrokeWidth: 2
|
|
8890
8888
|
}, baseProps),
|
|
@@ -8950,7 +8948,7 @@ const clean = {
|
|
|
8950
8948
|
data: {
|
|
8951
8949
|
fill: "transparent",
|
|
8952
8950
|
opacity: 1,
|
|
8953
|
-
stroke:
|
|
8951
|
+
stroke: defaultColor,
|
|
8954
8952
|
strokeWidth: 2,
|
|
8955
8953
|
strokeLinecap,
|
|
8956
8954
|
strokeLinejoin
|
|
@@ -8981,7 +8979,7 @@ const clean = {
|
|
|
8981
8979
|
scatter: Object.assign({
|
|
8982
8980
|
style: {
|
|
8983
8981
|
data: {
|
|
8984
|
-
fill:
|
|
8982
|
+
fill: defaultColor,
|
|
8985
8983
|
opacity: 1,
|
|
8986
8984
|
stroke: "transparent",
|
|
8987
8985
|
strokeWidth: 0
|
|
@@ -9019,9 +9017,8 @@ const clean = {
|
|
|
9019
9017
|
style: {
|
|
9020
9018
|
data: {
|
|
9021
9019
|
fill: blue["100"],
|
|
9022
|
-
stroke:
|
|
9023
|
-
strokeWidth: 2
|
|
9024
|
-
opacity: 0.4
|
|
9020
|
+
stroke: defaultColor,
|
|
9021
|
+
strokeWidth: 2
|
|
9025
9022
|
},
|
|
9026
9023
|
labels: Object.assign({}, baseLabelStyles, {
|
|
9027
9024
|
padding: 5,
|
|
@@ -13040,34 +13037,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13040
13037
|
/* harmony export */ "getDomain": function() { return /* binding */ getDomain; },
|
|
13041
13038
|
/* harmony export */ "getDomainFromChildren": function() { return /* binding */ getDomainFromChildren; },
|
|
13042
13039
|
/* harmony export */ "getScale": function() { return /* binding */ getScale; },
|
|
13043
|
-
/* harmony export */ "getStringsFromCategories": function() { return /* binding */ getStringsFromCategories; },
|
|
13044
13040
|
/* harmony export */ "getStringsFromChildren": function() { return /* binding */ getStringsFromChildren; },
|
|
13041
|
+
/* harmony export */ "getStringsFromChildrenCategories": function() { return /* binding */ getStringsFromChildrenCategories; },
|
|
13045
13042
|
/* harmony export */ "getStringsFromData": function() { return /* binding */ getStringsFromData; },
|
|
13046
13043
|
/* harmony export */ "getStyle": function() { return /* binding */ getStyle; },
|
|
13047
13044
|
/* harmony export */ "getWidth": function() { return /* binding */ getWidth; }
|
|
13048
13045
|
/* harmony export */ });
|
|
13049
|
-
/* harmony import */ var
|
|
13050
|
-
/* harmony import */ var
|
|
13051
|
-
/* harmony import */ var
|
|
13052
|
-
/* harmony import */ var
|
|
13053
|
-
/* harmony import */ var
|
|
13054
|
-
/* harmony import */ var
|
|
13055
|
-
/* harmony import */ var
|
|
13056
|
-
/* harmony import */ var
|
|
13057
|
-
/* harmony import */ var
|
|
13058
|
-
/* harmony import */ var
|
|
13059
|
-
/* harmony import */ var
|
|
13060
|
-
/* harmony import */ var
|
|
13061
|
-
/* harmony import */ var
|
|
13062
|
-
/* harmony import */ var
|
|
13063
|
-
/* harmony import */ var
|
|
13064
|
-
/* harmony import */ var
|
|
13065
|
-
/* harmony import */ var
|
|
13066
|
-
/* harmony import */ var
|
|
13067
|
-
/* harmony import */ var
|
|
13068
|
-
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
13069
|
-
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
13070
|
-
|
|
13046
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqBy.js");
|
|
13047
|
+
/* harmony import */ var lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0__);
|
|
13048
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/groupBy */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/groupBy.js");
|
|
13049
|
+
/* harmony import */ var lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1__);
|
|
13050
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/uniq */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniq.js");
|
|
13051
|
+
/* harmony import */ var lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_uniq__WEBPACK_IMPORTED_MODULE_2__);
|
|
13052
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
13053
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_3__);
|
|
13054
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
|
|
13055
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__);
|
|
13056
|
+
/* harmony import */ var _axis__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./axis */ "../../victory-core/es/victory-util/axis.js");
|
|
13057
|
+
/* harmony import */ var _style__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./style */ "../../victory-core/es/victory-util/style.js");
|
|
13058
|
+
/* harmony import */ var _data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./data */ "../../victory-core/es/victory-util/data.js");
|
|
13059
|
+
/* harmony import */ var _domain__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domain */ "../../victory-core/es/victory-util/domain.js");
|
|
13060
|
+
/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./events */ "../../victory-core/es/victory-util/events.js");
|
|
13061
|
+
/* harmony import */ var _collection__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./collection */ "../../victory-core/es/victory-util/collection.js");
|
|
13062
|
+
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
13063
|
+
/* harmony import */ var _scale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./scale */ "../../victory-core/es/victory-util/scale.js");
|
|
13064
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./log */ "../../victory-core/es/victory-util/log.js");
|
|
13071
13065
|
|
|
13072
13066
|
|
|
13073
13067
|
|
|
@@ -13096,7 +13090,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
13096
13090
|
return child.type && child.type.role === "histogram";
|
|
13097
13091
|
});
|
|
13098
13092
|
if (someChildrenAreHistograms && !allChildrenAreHistograms) {
|
|
13099
|
-
|
|
13093
|
+
_log__WEBPACK_IMPORTED_MODULE_5__.warn("VictoryHistogram only supports being stacked with other VictoryHistogram components. Check to make sure that you are only passing VictoryHistogram components to VictoryStack");
|
|
13100
13094
|
}
|
|
13101
13095
|
|
|
13102
13096
|
// if we are stacking histograms, we need to generate explicit bins
|
|
@@ -13109,7 +13103,7 @@ function addBinsToParentPropsIfHistogram(_ref) {
|
|
|
13109
13103
|
// if we have explicit bins then we don't need to calculate them
|
|
13110
13104
|
if (!Array.isArray(childBins)) {
|
|
13111
13105
|
const combinedData = children.reduce((memo, child) => {
|
|
13112
|
-
const xAccessor =
|
|
13106
|
+
const xAccessor = _helpers__WEBPACK_IMPORTED_MODULE_6__.createAccessor(child.props.x || "x");
|
|
13113
13107
|
return memo.concat(child.props.data.map(datum => ({
|
|
13114
13108
|
x: xAccessor(datum)
|
|
13115
13109
|
})));
|
|
@@ -13152,7 +13146,7 @@ function getDataFromChildren(props, childComponents) {
|
|
|
13152
13146
|
maxDomain
|
|
13153
13147
|
};
|
|
13154
13148
|
let stack = 0;
|
|
13155
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
13149
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13156
13150
|
parentProps = addBinsToParentPropsIfHistogram({
|
|
13157
13151
|
children,
|
|
13158
13152
|
props,
|
|
@@ -13163,13 +13157,13 @@ function getDataFromChildren(props, childComponents) {
|
|
|
13163
13157
|
const childProps = Object.assign({}, child.props, parentProps);
|
|
13164
13158
|
let childData;
|
|
13165
13159
|
let childElement = child;
|
|
13166
|
-
if (!
|
|
13160
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
13167
13161
|
return null;
|
|
13168
|
-
} else if (child.type &&
|
|
13169
|
-
childElement = parent ? /*#__PURE__*/
|
|
13162
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
13163
|
+
childElement = parent ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_4___default().cloneElement(child, parent.props) : child;
|
|
13170
13164
|
childData = childElement.type.getData(childProps);
|
|
13171
13165
|
} else {
|
|
13172
|
-
childData =
|
|
13166
|
+
childData = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
13173
13167
|
}
|
|
13174
13168
|
stack += 1;
|
|
13175
13169
|
return childData.map((datum, index) => Object.assign({
|
|
@@ -13178,23 +13172,23 @@ function getDataFromChildren(props, childComponents) {
|
|
|
13178
13172
|
}, datum));
|
|
13179
13173
|
};
|
|
13180
13174
|
const stacked = children.filter(c => c.type && c.type.role === "stack").length;
|
|
13181
|
-
const combine = (memo, val) => memo.concat(
|
|
13182
|
-
const datasets =
|
|
13175
|
+
const combine = (memo, val) => memo.concat(lodash_uniqBy__WEBPACK_IMPORTED_MODULE_0___default()(val, "_group"));
|
|
13176
|
+
const datasets = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props, [], combine);
|
|
13183
13177
|
const group = stacked ? "_group" : "_stack";
|
|
13184
|
-
return Object.values(
|
|
13178
|
+
return Object.values(lodash_groupBy__WEBPACK_IMPORTED_MODULE_1___default()(datasets, group));
|
|
13185
13179
|
}
|
|
13186
13180
|
function getData(props, childComponents) {
|
|
13187
13181
|
if (props.data) {
|
|
13188
|
-
return
|
|
13182
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
13189
13183
|
}
|
|
13190
|
-
return getDataFromChildren(props, childComponents ||
|
|
13184
|
+
return getDataFromChildren(props, childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children));
|
|
13191
13185
|
}
|
|
13192
13186
|
function getWidth(props, groupLength, seriesLength) {
|
|
13193
13187
|
const {
|
|
13194
13188
|
datasets,
|
|
13195
13189
|
horizontal
|
|
13196
13190
|
} = props;
|
|
13197
|
-
const range = horizontal ?
|
|
13191
|
+
const range = horizontal ? _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "y") : _helpers__WEBPACK_IMPORTED_MODULE_6__.getRange(props, "x");
|
|
13198
13192
|
const extent = Math.abs(range[1] - range[0]);
|
|
13199
13193
|
const seriesLengthValue = seriesLength !== undefined ? seriesLength : Array.isArray(datasets[0]) && datasets[0].length || 1;
|
|
13200
13194
|
const groupLengthValue = groupLength || datasets.length;
|
|
@@ -13240,8 +13234,8 @@ function getDefaultDomainPadding(props, axis, childComponents) {
|
|
|
13240
13234
|
}
|
|
13241
13235
|
function getDomainFromChildren(props, axis, childComponents) {
|
|
13242
13236
|
// eslint-disable-line max-statements, complexity, max-len
|
|
13243
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
13244
|
-
const parentData = props.data ?
|
|
13237
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13238
|
+
const parentData = props.data ? _data__WEBPACK_IMPORTED_MODULE_7__.getData(props) : undefined;
|
|
13245
13239
|
const {
|
|
13246
13240
|
polar,
|
|
13247
13241
|
startAngle,
|
|
@@ -13265,58 +13259,58 @@ function getDomainFromChildren(props, axis, childComponents) {
|
|
|
13265
13259
|
}) : baseParentProps;
|
|
13266
13260
|
const iteratee = child => {
|
|
13267
13261
|
const sharedProps = Object.assign({}, child.props, parentProps);
|
|
13268
|
-
if (!
|
|
13262
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
13269
13263
|
return null;
|
|
13270
|
-
} else if (child.type &&
|
|
13264
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getDomain)) {
|
|
13271
13265
|
return child.props && child.type.getDomain(sharedProps, axis);
|
|
13272
13266
|
}
|
|
13273
|
-
return
|
|
13267
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.getDomain(sharedProps, axis);
|
|
13274
13268
|
};
|
|
13275
|
-
const childDomains =
|
|
13276
|
-
const min = childDomains.length === 0 ? 0 :
|
|
13277
|
-
const max = childDomains.length === 0 ? 1 :
|
|
13269
|
+
const childDomains = _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props);
|
|
13270
|
+
const min = childDomains.length === 0 ? 0 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue(childDomains);
|
|
13271
|
+
const max = childDomains.length === 0 ? 1 : _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue(childDomains);
|
|
13278
13272
|
return [min, max];
|
|
13279
13273
|
}
|
|
13280
13274
|
function getDomain(props, axis, childComponents) {
|
|
13281
|
-
const children = childComponents ||
|
|
13282
|
-
const propsDomain =
|
|
13275
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13276
|
+
const propsDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromProps(props, axis);
|
|
13283
13277
|
const domainPadding = getDefaultDomainPadding(props, axis, children);
|
|
13284
13278
|
let domain;
|
|
13285
13279
|
if (propsDomain) {
|
|
13286
13280
|
domain = propsDomain;
|
|
13287
13281
|
} else {
|
|
13288
|
-
const minDomain =
|
|
13289
|
-
const maxDomain =
|
|
13290
|
-
const dataset = (props.data || props.y) &&
|
|
13291
|
-
const dataDomain = dataset ?
|
|
13282
|
+
const minDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMinFromProps(props, axis);
|
|
13283
|
+
const maxDomain = _domain__WEBPACK_IMPORTED_MODULE_8__.getMaxFromProps(props, axis);
|
|
13284
|
+
const dataset = (props.data || props.y) && _data__WEBPACK_IMPORTED_MODULE_7__.getData(props);
|
|
13285
|
+
const dataDomain = dataset ? _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromData(props, axis, dataset) : [];
|
|
13292
13286
|
const childDomain = getDomainFromChildren(props, axis, children);
|
|
13293
|
-
const min = minDomain ||
|
|
13294
|
-
const max = maxDomain ||
|
|
13295
|
-
domain =
|
|
13287
|
+
const min = minDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMinValue([...dataDomain, ...childDomain]);
|
|
13288
|
+
const max = maxDomain || _collection__WEBPACK_IMPORTED_MODULE_9__.getMaxValue([...dataDomain, ...childDomain]);
|
|
13289
|
+
domain = _domain__WEBPACK_IMPORTED_MODULE_8__.getDomainFromMinMax(min, max);
|
|
13296
13290
|
}
|
|
13297
|
-
return
|
|
13291
|
+
return _domain__WEBPACK_IMPORTED_MODULE_8__.formatDomain(domain, Object.assign({
|
|
13298
13292
|
domainPadding
|
|
13299
13293
|
}, props), axis);
|
|
13300
13294
|
}
|
|
13301
13295
|
function getScale(props, axis, childComponents) {
|
|
13302
13296
|
if (props.data) {
|
|
13303
|
-
return
|
|
13297
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getBaseScale(props, axis);
|
|
13304
13298
|
}
|
|
13305
|
-
const children = childComponents ? childComponents.slice(0) :
|
|
13299
|
+
const children = childComponents ? childComponents.slice(0) : react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13306
13300
|
const iteratee = child => {
|
|
13307
13301
|
const sharedProps = Object.assign({}, child.props, {
|
|
13308
13302
|
horizontal: props.horizontal
|
|
13309
13303
|
});
|
|
13310
|
-
return
|
|
13304
|
+
return _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleType(sharedProps, axis);
|
|
13311
13305
|
};
|
|
13312
|
-
const childScale =
|
|
13306
|
+
const childScale = lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()(_helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(children, iteratee, props));
|
|
13313
13307
|
|
|
13314
13308
|
// default to linear scale if more than one uniq scale type is given by children
|
|
13315
|
-
return childScale.length > 1 ?
|
|
13309
|
+
return childScale.length > 1 ? _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName("linear") : _scale__WEBPACK_IMPORTED_MODULE_10__.getScaleFromName(childScale[0]);
|
|
13316
13310
|
}
|
|
13317
13311
|
function getAllEvents(props) {
|
|
13318
13312
|
const components = ["groupComponent", "containerComponent", "labelComponent"];
|
|
13319
|
-
const componentEvents =
|
|
13313
|
+
const componentEvents = _events__WEBPACK_IMPORTED_MODULE_11__.getComponentEvents(props, components);
|
|
13320
13314
|
let events = props.events;
|
|
13321
13315
|
if (Array.isArray(componentEvents)) {
|
|
13322
13316
|
events = Array.isArray(props.events) ? componentEvents.concat(...props.events) : componentEvents;
|
|
@@ -13342,12 +13336,12 @@ function getColor(calculatedProps, child, index, theme) {
|
|
|
13342
13336
|
if (!colorScale && !color) {
|
|
13343
13337
|
return undefined;
|
|
13344
13338
|
}
|
|
13345
|
-
const colors = Array.isArray(colorScale) ? colorScale :
|
|
13339
|
+
const colors = Array.isArray(colorScale) ? colorScale : _style__WEBPACK_IMPORTED_MODULE_12__.getColorScale(colorScale, theme);
|
|
13346
13340
|
return color || colors[index % colors.length];
|
|
13347
13341
|
}
|
|
13348
13342
|
function getStyle(theme, style, role) {
|
|
13349
13343
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
13350
|
-
return
|
|
13344
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.getStyles(style, defaultStyle);
|
|
13351
13345
|
}
|
|
13352
13346
|
|
|
13353
13347
|
// eslint-disable-next-line max-params
|
|
@@ -13371,8 +13365,8 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
13371
13365
|
const dataWidth = role === "stack" ? {} : {
|
|
13372
13366
|
width: getWidth(calculatedProps)
|
|
13373
13367
|
};
|
|
13374
|
-
const dataStyle =
|
|
13375
|
-
const labelsStyle =
|
|
13368
|
+
const dataStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.data, Object.assign({}, dataWidth, style.data, defaultColor));
|
|
13369
|
+
const labelsStyle = lodash_defaults__WEBPACK_IMPORTED_MODULE_3___default()({}, childStyle.labels, style.labels);
|
|
13376
13370
|
return {
|
|
13377
13371
|
...childStyle,
|
|
13378
13372
|
parent: style.parent,
|
|
@@ -13380,28 +13374,26 @@ function getChildStyle(child, index, calculatedProps, theme) {
|
|
|
13380
13374
|
labels: labelsStyle
|
|
13381
13375
|
};
|
|
13382
13376
|
}
|
|
13383
|
-
function
|
|
13377
|
+
function getStringsFromChildrenCategories(childComponents, axis) {
|
|
13384
13378
|
const iteratee = child => {
|
|
13385
|
-
|
|
13386
|
-
if (!_domain__WEBPACK_IMPORTED_MODULE_9__.isDomainComponent(child) || !childProps.categories) {
|
|
13379
|
+
if (!_domain__WEBPACK_IMPORTED_MODULE_8__.isDomainComponent(child)) {
|
|
13387
13380
|
return null;
|
|
13388
13381
|
}
|
|
13389
|
-
const
|
|
13390
|
-
|
|
13391
|
-
return categoryStrings ? _collection__WEBPACK_IMPORTED_MODULE_10__.removeUndefined(categoryStrings) : [];
|
|
13382
|
+
const childProps = child.props || {};
|
|
13383
|
+
return _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(childProps, axis);
|
|
13392
13384
|
};
|
|
13393
|
-
return
|
|
13385
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee);
|
|
13394
13386
|
}
|
|
13395
13387
|
function getStringsFromData(childComponents) {
|
|
13396
13388
|
const iteratee = child => {
|
|
13397
13389
|
const childProps = child.props || {};
|
|
13398
13390
|
let data;
|
|
13399
|
-
if (!
|
|
13391
|
+
if (!_data__WEBPACK_IMPORTED_MODULE_7__.isDataComponent(child)) {
|
|
13400
13392
|
return null;
|
|
13401
|
-
} else if (child.type &&
|
|
13393
|
+
} else if (child.type && _helpers__WEBPACK_IMPORTED_MODULE_6__.isFunction(child.type.getData)) {
|
|
13402
13394
|
data = child.type.getData(childProps);
|
|
13403
13395
|
} else {
|
|
13404
|
-
data =
|
|
13396
|
+
data = _data__WEBPACK_IMPORTED_MODULE_7__.getData(childProps);
|
|
13405
13397
|
}
|
|
13406
13398
|
return data.map(d => ({
|
|
13407
13399
|
x: d.xName,
|
|
@@ -13420,28 +13412,28 @@ function getStringsFromData(childComponents) {
|
|
|
13420
13412
|
y: y !== undefined ? memo.y.concat(y) : memo.y
|
|
13421
13413
|
};
|
|
13422
13414
|
};
|
|
13423
|
-
return
|
|
13415
|
+
return _helpers__WEBPACK_IMPORTED_MODULE_6__.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
13424
13416
|
}
|
|
13425
13417
|
function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
13426
|
-
const categories =
|
|
13427
|
-
const axisComponent =
|
|
13428
|
-
const axisStrings = axisComponent ?
|
|
13429
|
-
const categoryStrings = categories
|
|
13430
|
-
return
|
|
13418
|
+
const categories = _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, axis);
|
|
13419
|
+
const axisComponent = _axis__WEBPACK_IMPORTED_MODULE_13__.getAxisComponent(childComponents, axis);
|
|
13420
|
+
const axisStrings = axisComponent ? _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
13421
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
13422
|
+
return lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...categoryStrings, ...axisStrings].flat());
|
|
13431
13423
|
}
|
|
13432
13424
|
function getStringsFromChildren(props, childComponents) {
|
|
13433
|
-
const children = childComponents ||
|
|
13425
|
+
const children = childComponents || react__WEBPACK_IMPORTED_MODULE_4___default().Children.toArray(props.children);
|
|
13434
13426
|
const xStrings = getCategoryAndAxisStringsFromChildren(props, "x", children);
|
|
13435
13427
|
const yStrings = getCategoryAndAxisStringsFromChildren(props, "y", children);
|
|
13436
13428
|
const dataStrings = getStringsFromData(children);
|
|
13437
13429
|
return {
|
|
13438
|
-
x:
|
|
13439
|
-
y:
|
|
13430
|
+
x: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...xStrings, ...dataStrings.x].flat()),
|
|
13431
|
+
y: lodash_uniq__WEBPACK_IMPORTED_MODULE_2___default()([...yStrings, ...dataStrings.y].flat())
|
|
13440
13432
|
};
|
|
13441
13433
|
}
|
|
13442
13434
|
function getCategories(props, childComponents, allStrings) {
|
|
13443
|
-
const xPropCategories = props.categories &&
|
|
13444
|
-
const yPropCategories = props.categories &&
|
|
13435
|
+
const xPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "x");
|
|
13436
|
+
const yPropCategories = props.categories && _data__WEBPACK_IMPORTED_MODULE_7__.getStringsFromCategories(props, "y");
|
|
13445
13437
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
13446
13438
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
13447
13439
|
const xCategories = xPropCategories || fallbackProps.x;
|