victory-polar-axis 36.2.1 → 36.3.2

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/LICENSE.txt ADDED
@@ -0,0 +1,30 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2020 Formidable Labs.
4
+
5
+ Copyright (c) 2016-2020 Alexey Svetliakov <https://github.com/asvetliakov>,
6
+ snerks <https://github.com/snerks>, Krzysztof Cebula <https://github.com
7
+ Havret>, Vitaliy Polyanskiy <https://github.com/alreadyExisted>, James Lismore
8
+ <https://github.com/jlismore>, Stack Builders <https://github.com
9
+ stackbuilders>, Esteban Ibarra <https://github.com/ibarrae>, Dominic Lee
10
+ <https://github.com/dominictwlee>, Dave Vedder <https://github.com
11
+ veddermatic>, Alec Flett <https://github.com/alecf> and potentially other
12
+ DefinitelyTyped contributors.
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ The above copyright notice and this permission notice shall be included in all
30
+ copies or substantial portions of the Software.
@@ -14762,11 +14762,12 @@ __webpack_require__.r(__webpack_exports__);
14762
14762
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);
14763
14763
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! prop-types */ "../../../node_modules/prop-types/index.js");
14764
14764
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_6__);
14765
- /* harmony import */ var _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../victory-util/prop-types */ "../../victory-core/es/victory-util/prop-types.js");
14766
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
14765
+ /* harmony import */ var _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../victory-util/prop-types */ "../../victory-core/es/victory-util/prop-types.js");
14766
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
14767
14767
  /* harmony import */ var _victory_portal_portal_context__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../victory-portal/portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
14768
- /* harmony import */ var _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../victory-util/timer-context */ "../../victory-core/es/victory-util/timer-context.js");
14768
+ /* harmony import */ var _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../victory-util/timer-context */ "../../victory-core/es/victory-util/timer-context.js");
14769
14769
  /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
14770
+ /* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
14770
14771
 
14771
14772
 
14772
14773
 
@@ -14799,6 +14800,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
14799
14800
 
14800
14801
 
14801
14802
 
14803
+
14802
14804
  var VictoryContainer =
14803
14805
  /*#__PURE__*/
14804
14806
  function (_React$Component) {
@@ -14969,8 +14971,9 @@ function (_React$Component) {
14969
14971
  preserveAspectRatio = _props.preserveAspectRatio,
14970
14972
  role = _props.role;
14971
14973
  var style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_8__.omit(this.props.style, ["height", "width"]);
14974
+ var userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_9__.getSafeUserProps(this.props);
14972
14975
 
14973
- var svgProps = lodash_assign__WEBPACK_IMPORTED_MODULE_4___default()({
14976
+ var svgProps = lodash_assign__WEBPACK_IMPORTED_MODULE_4___default()(_objectSpread({
14974
14977
  width: width,
14975
14978
  height: height,
14976
14979
  tabIndex: tabIndex,
@@ -14979,7 +14982,7 @@ function (_React$Component) {
14979
14982
  "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
14980
14983
  viewBox: responsive ? "0 0 ".concat(width, " ").concat(height) : undefined,
14981
14984
  preserveAspectRatio: responsive ? preserveAspectRatio : undefined
14982
- }, events);
14985
+ }, userProps), events);
14983
14986
 
14984
14987
  return this.renderContainer(this.props, svgProps, style);
14985
14988
  }
@@ -15013,18 +15016,18 @@ Object.defineProperty(VictoryContainer, "propTypes", {
15013
15016
  containerRef: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().func),
15014
15017
  desc: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
15015
15018
  events: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().object),
15016
- height: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative,
15019
+ height: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative,
15017
15020
  name: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
15018
15021
  origin: prop_types__WEBPACK_IMPORTED_MODULE_6___default().shape({
15019
- x: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative,
15020
- y: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative
15022
+ x: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative,
15023
+ y: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative
15021
15024
  }),
15022
15025
  ouiaId: prop_types__WEBPACK_IMPORTED_MODULE_6___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_6___default().number), (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string)]),
15023
15026
  ouiaSafe: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().bool),
15024
15027
  ouiaType: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
15025
15028
  polar: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().bool),
15026
15029
  portalComponent: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().element),
15027
- portalZIndex: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.integer,
15030
+ portalZIndex: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.integer,
15028
15031
  preserveAspectRatio: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
15029
15032
  responsive: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().bool),
15030
15033
  role: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
@@ -15032,7 +15035,7 @@ Object.defineProperty(VictoryContainer, "propTypes", {
15032
15035
  tabIndex: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().number),
15033
15036
  theme: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().object),
15034
15037
  title: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
15035
- width: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative
15038
+ width: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative
15036
15039
  }
15037
15040
  });
15038
15041
  Object.defineProperty(VictoryContainer, "defaultProps", {
@@ -15041,7 +15044,7 @@ Object.defineProperty(VictoryContainer, "defaultProps", {
15041
15044
  writable: true,
15042
15045
  value: {
15043
15046
  className: "VictoryContainer",
15044
- portalComponent: react__WEBPACK_IMPORTED_MODULE_5___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_10__["default"], null),
15047
+ portalComponent: react__WEBPACK_IMPORTED_MODULE_5___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_11__["default"], null),
15045
15048
  portalZIndex: 99,
15046
15049
  responsive: true,
15047
15050
  role: "img"
@@ -15051,7 +15054,7 @@ Object.defineProperty(VictoryContainer, "contextType", {
15051
15054
  configurable: true,
15052
15055
  enumerable: true,
15053
15056
  writable: true,
15054
- value: _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_11__["default"]
15057
+ value: _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_12__["default"]
15055
15058
  });
15056
15059
 
15057
15060
 
@@ -17261,6 +17264,7 @@ __webpack_require__.r(__webpack_exports__);
17261
17264
  /* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react-fast-compare */ "../../../node_modules/react-fast-compare/index.js");
17262
17265
  /* harmony import */ var react_fast_compare__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react_fast_compare__WEBPACK_IMPORTED_MODULE_10__);
17263
17266
  /* harmony import */ var _victory_transition_victory_transition__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../victory-transition/victory-transition */ "../../victory-core/es/victory-transition/victory-transition.js");
17267
+ /* harmony import */ var _victory_util_user_props__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../victory-util/user-props */ "../../victory-core/es/victory-util/user-props.js");
17264
17268
 
17265
17269
 
17266
17270
 
@@ -17297,6 +17301,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
17297
17301
 
17298
17302
 
17299
17303
 
17304
+
17300
17305
  var datumHasXandY = function (datum) {
17301
17306
  return !lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(datum._x) && !lodash_isNil__WEBPACK_IMPORTED_MODULE_1___default()(datum._y);
17302
17307
  }; // used for checking state changes. Expected components can be passed in via options
@@ -17642,6 +17647,7 @@ var defaultComponents = [{
17642
17647
  var dataComponent = props.dataComponent,
17643
17648
  labelComponent = props.labelComponent,
17644
17649
  groupComponent = props.groupComponent;
17650
+ var userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_13__.getSafeUserProps(props);
17645
17651
  var dataComponents = this.dataKeys.reduce(function (validDataComponents, _dataKey, index) {
17646
17652
  var dataProps = _this9.getComponentProps(dataComponent, "data", index);
17647
17653
 
@@ -17663,7 +17669,8 @@ var defaultComponents = [{
17663
17669
 
17664
17670
  var children = _toConsumableArray(dataComponents).concat(_toConsumableArray(labelComponents));
17665
17671
 
17666
- return this.renderContainer(groupComponent, children);
17672
+ var group = react__WEBPACK_IMPORTED_MODULE_9___default().cloneElement(groupComponent, userProps, children);
17673
+ return this.renderContainer(group, children);
17667
17674
  }
17668
17675
  }]);
17669
17676
 
@@ -21939,6 +21946,103 @@ function getTransitionPropsFactory(props, state, setState) {
21939
21946
 
21940
21947
  /***/ }),
21941
21948
 
21949
+ /***/ "../../victory-core/es/victory-util/user-props.js":
21950
+ /*!********************************************************!*\
21951
+ !*** ../../victory-core/es/victory-util/user-props.js ***!
21952
+ \********************************************************/
21953
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
21954
+
21955
+ "use strict";
21956
+ __webpack_require__.r(__webpack_exports__);
21957
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
21958
+ /* harmony export */ "getSafeUserProps": () => (/* binding */ getSafeUserProps)
21959
+ /* harmony export */ });
21960
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
21961
+
21962
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
21963
+
21964
+ function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
21965
+
21966
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21967
+
21968
+ 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; }
21969
+
21970
+ 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; }
21971
+
21972
+ /*
21973
+ USER_PROPS_SAFELIST is to contain any string deemed safe for user props.
21974
+ The startsWidth array will contain the start of any accepted user-prop that
21975
+ starts with these characters.
21976
+ The exactMatch will contain a list of exact prop names that are accepted.
21977
+ */
21978
+ var USER_PROPS_SAFELIST = {
21979
+ startsWith: ["data-", "aria-"],
21980
+ exactMatch: []
21981
+ };
21982
+ /**
21983
+ * doesPropStartWith: Function that takes a prop's key and runs it against all
21984
+ * options in the USER_PROPS_SAFELIST and checks to see if it starts with any
21985
+ * of those options.
21986
+ * @param {string} key: prop key to be tested against whitelist
21987
+ * @returns {Boolean}: returns true if the key starts with an option or false if
21988
+ * otherwise
21989
+ */
21990
+
21991
+ var doesPropStartWith = function (key) {
21992
+ var startsWith = false;
21993
+ USER_PROPS_SAFELIST.startsWith.forEach(function (starterString) {
21994
+ var regex = new RegExp("\\b(".concat(starterString, ")(\\w|-)+"), "g");
21995
+ if (regex.test(key)) startsWith = true;
21996
+ });
21997
+ return startsWith;
21998
+ };
21999
+ /**
22000
+ * isExactMatch: checks to see if the given key matches any of the 'exactMatch'
22001
+ * items in the whitelist
22002
+ * @param {String} key: prop key to be tested against the whitelist-exact match
22003
+ * array.
22004
+ * @returns {Boolean}: return true if whitelist contains that key, otherwise
22005
+ * returns false.
22006
+ */
22007
+
22008
+
22009
+ var isExactMatch = function (key) {
22010
+ return USER_PROPS_SAFELIST.exactMatch.includes(key);
22011
+ };
22012
+ /**
22013
+ * testIfSafeProp: tests prop's key against both startsWith and exactMatch values
22014
+ * @param {String} key: prop key to be tested against the whitelist
22015
+ * @returns {Boolean}: returns true if found in whitelist, otherwise returns false
22016
+ */
22017
+
22018
+
22019
+ var testIfSafeProp = function (key) {
22020
+ if (doesPropStartWith(key) || isExactMatch(key)) return true;
22021
+ return false;
22022
+ };
22023
+ /**
22024
+ * getSafeUserProps - function that takes in a props object and removes any
22025
+ * key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
22026
+ * object.
22027
+ *
22028
+ * @param {Object} props: props to be filtered against USER_PROPS_SAFELIST
22029
+ * @returns {Object}: object containing remaining acceptable props
22030
+ */
22031
+
22032
+
22033
+ var getSafeUserProps = function (props) {
22034
+ var propsToFilter = _objectSpread({}, props);
22035
+
22036
+ return Object.fromEntries(Object.entries(propsToFilter).filter(function (_ref) {
22037
+ var _ref2 = _slicedToArray(_ref, 1),
22038
+ key = _ref2[0];
22039
+
22040
+ return testIfSafeProp(key);
22041
+ }));
22042
+ };
22043
+
22044
+ /***/ }),
22045
+
21942
22046
  /***/ "react":
21943
22047
  /*!**************************************************************************************!*\
21944
22048
  !*** external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"} ***!