victory 36.6.11 → 36.7.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # victory
2
2
 
3
+ ## 36.7.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix Date equality in axis ([#2642](https://github.com/FormidableLabs/victory/pull/2642))
8
+
9
+ ## 36.6.12
10
+
11
+ ### Patch Changes
12
+
13
+ - Add aria-hidden flag to svg for textsize util to fix accessibility issue ([#2661](https://github.com/FormidableLabs/victory/pull/2661))
14
+
3
15
  ## 36.6.11
4
16
 
5
17
  ## 36.6.10
package/dist/victory.js CHANGED
@@ -11133,6 +11133,14 @@ var getStandaloneOffset = function (props, calculatedValues) {
11133
11133
  x: offsetX !== null && offsetX !== undefined ? offsetX : x,
11134
11134
  y: offsetY !== null && offsetY !== undefined ? offsetY : y
11135
11135
  };
11136
+ };
11137
+
11138
+ var isEqual = function (a, b) {
11139
+ if (a instanceof Date && b instanceof Date) {
11140
+ return a.getTime() === b.getTime();
11141
+ }
11142
+
11143
+ return a === b;
11136
11144
  }; // eslint-disable-next-line complexity
11137
11145
 
11138
11146
 
@@ -11161,8 +11169,8 @@ var getOffset = function (props, calculatedValues) {
11161
11169
  y: calculatedOrientation.x === "bottom" ? props.height : 0
11162
11170
  };
11163
11171
  var originPosition = {
11164
- x: origin.x === domain.x[0] || origin.x === domain.x[1] ? 0 : scale.x(origin.x),
11165
- y: origin.y === domain.y[0] || origin.y === domain.y[1] ? 0 : scale.y(origin.y)
11172
+ x: isEqual(origin.x, domain.x[0]) || isEqual(origin.x, domain.x[1]) ? 0 : scale.x(origin.x),
11173
+ y: isEqual(origin.y, domain.y[0]) || isEqual(origin.y, domain.y[1]) ? 0 : scale.y(origin.y)
11166
11174
  };
11167
11175
  var x = originPosition.x ? Math.abs(originOffset.x - originPosition.x) : orientationOffset.x;
11168
11176
  var y = originPosition.y ? Math.abs(originOffset.y - originPosition.y) : orientationOffset.y;
@@ -11200,8 +11208,8 @@ var getHorizontalOffset = function (props, calculatedValues) {
11200
11208
  x: calculatedOrientation.y === "bottom" ? props.height : 0
11201
11209
  };
11202
11210
  var originPosition = {
11203
- x: origin.x === domain.x[0] || origin.x === domain.x[1] ? 0 : scale.x(origin.x),
11204
- y: origin.y === domain.y[0] || origin.y === domain.y[1] ? 0 : scale.y(origin.y)
11211
+ x: isEqual(origin.x, domain.x[0]) || isEqual(origin.x, domain.x[1]) ? 0 : scale.x(origin.x),
11212
+ y: isEqual(origin.y, domain.y[0]) || isEqual(origin.y, domain.y[1]) ? 0 : scale.y(origin.y)
11205
11213
  };
11206
11214
  var y = originPosition.x ? Math.abs(originOffset.x - originPosition.x) : orientationOffset.x;
11207
11215
  var x = originPosition.y ? Math.abs(originOffset.y - originPosition.y) : orientationOffset.y;
@@ -11432,7 +11440,8 @@ var getBaseProps = function (props, fallbackProps) {
11432
11440
  dimension: otherAxis,
11433
11441
  range: _defineProperty({}, otherAxis, victory_core__WEBPACK_IMPORTED_MODULE_4__.getRange(props, otherAxis)),
11434
11442
  scale: props.scale && props.scale[otherAxis] ? _defineProperty({}, otherAxis, props.scale[otherAxis]) : undefined
11435
- };
11443
+ }; // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
11444
+
11436
11445
  return ticks.reduce(function (childProps, tickValue, index) {
11437
11446
  var _scale$axis, _scale$axis2, _scale$axis3;
11438
11447
 
@@ -12001,9 +12010,10 @@ var evaluateProps = function (props) {
12001
12010
  id: id,
12002
12011
  tabIndex: tabIndex
12003
12012
  });
12004
- };
12013
+ }; // eslint-disable-next-line prefer-arrow-callback
12005
12014
 
12006
- var Bar = function (props) {
12015
+
12016
+ var Bar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.forwardRef)(function Bar(props, ref) {
12007
12017
  props = evaluateProps(props);
12008
12018
  var _props = props,
12009
12019
  polar = _props.polar,
@@ -12024,10 +12034,10 @@ var Bar = function (props) {
12024
12034
  role: props.role,
12025
12035
  shapeRendering: props.shapeRendering,
12026
12036
  transform: props.transform || defaultTransform,
12027
- tabIndex: props.tabIndex
12037
+ tabIndex: props.tabIndex,
12038
+ ref: ref
12028
12039
  }));
12029
- };
12030
-
12040
+ });
12031
12041
  Bar.propTypes = _objectSpread(_objectSpread({}, victory_core__WEBPACK_IMPORTED_MODULE_5__.CommonProps.primitiveProps), {}, {
12032
12042
  alignment: prop_types__WEBPACK_IMPORTED_MODULE_6___default().oneOf(["start", "middle", "end"]),
12033
12043
  barRatio: (prop_types__WEBPACK_IMPORTED_MODULE_6___default().number),
@@ -20340,12 +20350,15 @@ __webpack_require__.r(__webpack_exports__);
20340
20350
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
20341
20351
  var _excluded = ["desc"];
20342
20352
 
20353
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20354
+
20343
20355
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
20344
20356
 
20345
20357
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20346
20358
 
20347
20359
 
20348
- var Path = function (props) {
20360
+ // eslint-disable-next-line prefer-arrow-callback
20361
+ var Path = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function Path(props, ref) {
20349
20362
  // eslint-disable-next-line react/prop-types
20350
20363
  var desc = props.desc,
20351
20364
  rest = _objectWithoutProperties(props, _excluded);
@@ -20353,11 +20366,15 @@ var Path = function (props) {
20353
20366
  return desc ?
20354
20367
  /*#__PURE__*/
20355
20368
  // @ts-expect-error FIXME: "id cannot be a number"
20356
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", rest, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("desc", null, desc)) :
20369
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", _extends({}, rest, {
20370
+ ref: ref
20371
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("desc", null, desc)) :
20357
20372
  /*#__PURE__*/
20358
20373
  // @ts-expect-error FIXME: "id cannot be a number"
20359
- react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", rest);
20360
- };
20374
+ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", _extends({}, rest, {
20375
+ ref: ref
20376
+ }));
20377
+ });
20361
20378
 
20362
20379
  /***/ }),
20363
20380
 
@@ -22285,6 +22302,11 @@ function getStringTicks(props) {
22285
22302
  function getTickArray(props) {
22286
22303
  var tickValues = props.tickValues,
22287
22304
  tickFormat = props.tickFormat;
22305
+
22306
+ if ((tickValues === null || tickValues === void 0 ? void 0 : tickValues.length) === 0) {
22307
+ return [];
22308
+ }
22309
+
22288
22310
  var axis = getAxis(props);
22289
22311
  var stringMap = props.stringMap && props.stringMap[axis];
22290
22312
 
@@ -22399,6 +22421,11 @@ function getTicks(props, scale) {
22399
22421
  var filterZero = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
22400
22422
  var tickCount = props.tickCount;
22401
22423
  var tickArray = getTickArray(props);
22424
+
22425
+ if ((tickArray === null || tickArray === void 0 ? void 0 : tickArray.length) === 0) {
22426
+ return [""];
22427
+ }
22428
+
22402
22429
  var tickValues = tickArray ? tickArray.map(function (v) {
22403
22430
  return v.value;
22404
22431
  }) : undefined;
@@ -22437,7 +22464,7 @@ function getDomainFromData(props, axis) {
22437
22464
  _props$endAngle = props.endAngle,
22438
22465
  endAngle = _props$endAngle === void 0 ? 360 : _props$endAngle;
22439
22466
  var tickArray = getTickArray(props);
22440
- var tickValues = tickArray ? tickArray.map(function (v) {
22467
+ var tickValues = tickArray && (tickArray === null || tickArray === void 0 ? void 0 : tickArray.length) !== 0 ? tickArray.map(function (v) {
22441
22468
  return v.value;
22442
22469
  }) : undefined;
22443
22470
 
@@ -26513,6 +26540,7 @@ var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___defau
26513
26540
  element.setAttribute("width", "300");
26514
26541
  element.setAttribute("height", "300");
26515
26542
  element.setAttribute("viewBox", "0 0 300 300");
26543
+ element.setAttribute("aria-hidden", "true");
26516
26544
  var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
26517
26545
  element.appendChild(containerElement);
26518
26546
  element.style.position = "fixed";