victory-create-container 36.3.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.
@@ -16200,11 +16200,12 @@ __webpack_require__.r(__webpack_exports__);
16200
16200
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__);
16201
16201
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! prop-types */ "../../../node_modules/prop-types/index.js");
16202
16202
  /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_6__);
16203
- /* 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");
16204
- /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
16203
+ /* 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");
16204
+ /* harmony import */ var _victory_portal_portal__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../victory-portal/portal */ "../../victory-core/es/victory-portal/portal.js");
16205
16205
  /* 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");
16206
- /* 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");
16206
+ /* 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");
16207
16207
  /* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
16208
+ /* 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");
16208
16209
 
16209
16210
 
16210
16211
 
@@ -16237,6 +16238,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
16237
16238
 
16238
16239
 
16239
16240
 
16241
+
16240
16242
  var VictoryContainer =
16241
16243
  /*#__PURE__*/
16242
16244
  function (_React$Component) {
@@ -16407,8 +16409,9 @@ function (_React$Component) {
16407
16409
  preserveAspectRatio = _props.preserveAspectRatio,
16408
16410
  role = _props.role;
16409
16411
  var style = responsive ? this.props.style : _victory_util_helpers__WEBPACK_IMPORTED_MODULE_8__.omit(this.props.style, ["height", "width"]);
16412
+ var userProps = _victory_util_user_props__WEBPACK_IMPORTED_MODULE_9__.getSafeUserProps(this.props);
16410
16413
 
16411
- var svgProps = lodash_assign__WEBPACK_IMPORTED_MODULE_4___default()({
16414
+ var svgProps = lodash_assign__WEBPACK_IMPORTED_MODULE_4___default()(_objectSpread({
16412
16415
  width: width,
16413
16416
  height: height,
16414
16417
  tabIndex: tabIndex,
@@ -16417,7 +16420,7 @@ function (_React$Component) {
16417
16420
  "aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
16418
16421
  viewBox: responsive ? "0 0 ".concat(width, " ").concat(height) : undefined,
16419
16422
  preserveAspectRatio: responsive ? preserveAspectRatio : undefined
16420
- }, events);
16423
+ }, userProps), events);
16421
16424
 
16422
16425
  return this.renderContainer(this.props, svgProps, style);
16423
16426
  }
@@ -16451,18 +16454,18 @@ Object.defineProperty(VictoryContainer, "propTypes", {
16451
16454
  containerRef: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().func),
16452
16455
  desc: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
16453
16456
  events: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().object),
16454
- height: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative,
16457
+ height: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative,
16455
16458
  name: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
16456
16459
  origin: prop_types__WEBPACK_IMPORTED_MODULE_6___default().shape({
16457
- x: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative,
16458
- y: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative
16460
+ x: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative,
16461
+ y: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative
16459
16462
  }),
16460
16463
  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)]),
16461
16464
  ouiaSafe: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().bool),
16462
16465
  ouiaType: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
16463
16466
  polar: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().bool),
16464
16467
  portalComponent: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().element),
16465
- portalZIndex: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.integer,
16468
+ portalZIndex: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.integer,
16466
16469
  preserveAspectRatio: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
16467
16470
  responsive: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().bool),
16468
16471
  role: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
@@ -16470,7 +16473,7 @@ Object.defineProperty(VictoryContainer, "propTypes", {
16470
16473
  tabIndex: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().number),
16471
16474
  theme: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().object),
16472
16475
  title: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().string),
16473
- width: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_9__.nonNegative
16476
+ width: _victory_util_prop_types__WEBPACK_IMPORTED_MODULE_10__.nonNegative
16474
16477
  }
16475
16478
  });
16476
16479
  Object.defineProperty(VictoryContainer, "defaultProps", {
@@ -16479,7 +16482,7 @@ Object.defineProperty(VictoryContainer, "defaultProps", {
16479
16482
  writable: true,
16480
16483
  value: {
16481
16484
  className: "VictoryContainer",
16482
- portalComponent: react__WEBPACK_IMPORTED_MODULE_5___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_10__["default"], null),
16485
+ portalComponent: react__WEBPACK_IMPORTED_MODULE_5___default().createElement(_victory_portal_portal__WEBPACK_IMPORTED_MODULE_11__["default"], null),
16483
16486
  portalZIndex: 99,
16484
16487
  responsive: true,
16485
16488
  role: "img"
@@ -16489,7 +16492,7 @@ Object.defineProperty(VictoryContainer, "contextType", {
16489
16492
  configurable: true,
16490
16493
  enumerable: true,
16491
16494
  writable: true,
16492
- value: _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_11__["default"]
16495
+ value: _victory_util_timer_context__WEBPACK_IMPORTED_MODULE_12__["default"]
16493
16496
  });
16494
16497
 
16495
16498
 
@@ -22291,6 +22294,103 @@ function () {
22291
22294
 
22292
22295
 
22293
22296
 
22297
+ /***/ }),
22298
+
22299
+ /***/ "../../victory-core/es/victory-util/user-props.js":
22300
+ /*!********************************************************!*\
22301
+ !*** ../../victory-core/es/victory-util/user-props.js ***!
22302
+ \********************************************************/
22303
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22304
+
22305
+ "use strict";
22306
+ __webpack_require__.r(__webpack_exports__);
22307
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22308
+ /* harmony export */ "getSafeUserProps": () => (/* binding */ getSafeUserProps)
22309
+ /* harmony export */ });
22310
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
22311
+
22312
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
22313
+
22314
+ 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; }
22315
+
22316
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22317
+
22318
+ 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; }
22319
+
22320
+ 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; }
22321
+
22322
+ /*
22323
+ USER_PROPS_SAFELIST is to contain any string deemed safe for user props.
22324
+ The startsWidth array will contain the start of any accepted user-prop that
22325
+ starts with these characters.
22326
+ The exactMatch will contain a list of exact prop names that are accepted.
22327
+ */
22328
+ var USER_PROPS_SAFELIST = {
22329
+ startsWith: ["data-", "aria-"],
22330
+ exactMatch: []
22331
+ };
22332
+ /**
22333
+ * doesPropStartWith: Function that takes a prop's key and runs it against all
22334
+ * options in the USER_PROPS_SAFELIST and checks to see if it starts with any
22335
+ * of those options.
22336
+ * @param {string} key: prop key to be tested against whitelist
22337
+ * @returns {Boolean}: returns true if the key starts with an option or false if
22338
+ * otherwise
22339
+ */
22340
+
22341
+ var doesPropStartWith = function (key) {
22342
+ var startsWith = false;
22343
+ USER_PROPS_SAFELIST.startsWith.forEach(function (starterString) {
22344
+ var regex = new RegExp("\\b(".concat(starterString, ")(\\w|-)+"), "g");
22345
+ if (regex.test(key)) startsWith = true;
22346
+ });
22347
+ return startsWith;
22348
+ };
22349
+ /**
22350
+ * isExactMatch: checks to see if the given key matches any of the 'exactMatch'
22351
+ * items in the whitelist
22352
+ * @param {String} key: prop key to be tested against the whitelist-exact match
22353
+ * array.
22354
+ * @returns {Boolean}: return true if whitelist contains that key, otherwise
22355
+ * returns false.
22356
+ */
22357
+
22358
+
22359
+ var isExactMatch = function (key) {
22360
+ return USER_PROPS_SAFELIST.exactMatch.includes(key);
22361
+ };
22362
+ /**
22363
+ * testIfSafeProp: tests prop's key against both startsWith and exactMatch values
22364
+ * @param {String} key: prop key to be tested against the whitelist
22365
+ * @returns {Boolean}: returns true if found in whitelist, otherwise returns false
22366
+ */
22367
+
22368
+
22369
+ var testIfSafeProp = function (key) {
22370
+ if (doesPropStartWith(key) || isExactMatch(key)) return true;
22371
+ return false;
22372
+ };
22373
+ /**
22374
+ * getSafeUserProps - function that takes in a props object and removes any
22375
+ * key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
22376
+ * object.
22377
+ *
22378
+ * @param {Object} props: props to be filtered against USER_PROPS_SAFELIST
22379
+ * @returns {Object}: object containing remaining acceptable props
22380
+ */
22381
+
22382
+
22383
+ var getSafeUserProps = function (props) {
22384
+ var propsToFilter = _objectSpread({}, props);
22385
+
22386
+ return Object.fromEntries(Object.entries(propsToFilter).filter(function (_ref) {
22387
+ var _ref2 = _slicedToArray(_ref, 1),
22388
+ key = _ref2[0];
22389
+
22390
+ return testIfSafeProp(key);
22391
+ }));
22392
+ };
22393
+
22294
22394
  /***/ }),
22295
22395
 
22296
22396
  /***/ "../../victory-core/es/victory-util/wrapper.js":
@@ -25633,16 +25733,14 @@ var RawZoomHelpers = {
25633
25733
  return new Date(val);
25634
25734
  }) : newDomain;
25635
25735
  },
25636
- // eslint-disable-next-line max-params
25637
- getDomainScale: function (domain, scale, axis, horizontal) {
25736
+ getDomainScale: function (domain, scale, axis) {
25638
25737
  var axisDomain = Array.isArray(domain) ? domain : domain[axis];
25639
25738
 
25640
25739
  var _axisDomain = _slicedToArray(axisDomain, 2),
25641
25740
  from = _axisDomain[0],
25642
25741
  to = _axisDomain[1];
25643
25742
 
25644
- var otherAxis = axis === "x" ? "y" : "x";
25645
- var range = horizontal ? scale[otherAxis].range() : scale[axis].range();
25743
+ var range = scale[axis].range();
25646
25744
  var plottableWidth = Math.abs(range[0] - range[1]);
25647
25745
  return plottableWidth / (to - from);
25648
25746
  },
@@ -25763,8 +25861,8 @@ var RawZoomHelpers = {
25763
25861
  var lastDomain = this.getLastDomain(targetProps, originalDomain);
25764
25862
  var deltaX = horizontal ? y - startY : startX - x;
25765
25863
  var deltaY = horizontal ? startX - x : y - startY;
25766
- var dx = deltaX / this.getDomainScale(lastDomain, scale, "x", horizontal);
25767
- var dy = deltaY / this.getDomainScale(lastDomain, scale, "y", horizontal);
25864
+ var dx = deltaX / this.getDomainScale(lastDomain, scale, "x");
25865
+ var dy = deltaY / this.getDomainScale(lastDomain, scale, "y");
25768
25866
  var currentDomain = {
25769
25867
  x: zoomDimension === "y" ? originalDomain.x : this.pan(lastDomain.x, originalDomain.x, dx),
25770
25868
  y: zoomDimension === "x" ? originalDomain.y : this.pan(lastDomain.y, originalDomain.y, dy)