victory-core 36.6.10 → 36.6.12

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-core
2
2
 
3
+ ## 36.6.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Add aria-hidden flag to svg for textsize util to fix accessibility issue ([#2661](https://github.com/FormidableLabs/victory/pull/2661))
8
+
9
+ ## 36.6.11
10
+
11
+ ### Patch Changes
12
+
13
+ - Fix text size regression when using line-height ([#2615](https://github.com/FormidableLabs/victory/pull/2615))
14
+
3
15
  ## 36.6.10
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -17,4 +17,4 @@
17
17
  Please visit our documentation site to read more about these components
18
18
  https://formidable.com/open-source/victory
19
19
 
20
- To suggest an addition or correction to this documentation please see https://github.com/FormidableLabs/victory/blob/main/docs/src/content/docs
20
+ To suggest an addition or correction to this documentation please see https://github.com/FormidableLabs/victory/blob/main/docs/src/content/docs
@@ -8888,6 +8888,10 @@ var _approximateDimensionsInternal = function (text, style) {
8888
8888
  var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
8889
8889
  var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
8890
8890
  element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
8891
+ element.setAttribute("width", "300");
8892
+ element.setAttribute("height", "300");
8893
+ element.setAttribute("viewBox", "0 0 300 300");
8894
+ element.setAttribute("aria-hidden", "true");
8891
8895
  var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
8892
8896
  element.appendChild(containerElement);
8893
8897
  element.style.position = "fixed";
@@ -8922,7 +8926,6 @@ var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___def
8922
8926
  var params = _prepareParams(style, i);
8923
8927
 
8924
8928
  textElement.style.fontFamily = params.fontFamily;
8925
- textElement.style.transform = "rotate(".concat(params.angle, ")");
8926
8929
  textElement.style.fontSize = "".concat(params.fontSize, "px");
8927
8930
  textElement.style.lineHeight = params.lineHeight;
8928
8931
  textElement.style.fontFamily = params.fontFamily;
@@ -8930,18 +8933,17 @@ var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___def
8930
8933
  textElement.textContent = line;
8931
8934
  textElement.setAttribute("x", "0");
8932
8935
  textElement.setAttribute("y", "".concat(heightAcc));
8933
- heightAcc += params.lineHeight * params.fontSize;
8934
8936
  containerElement.appendChild(textElement);
8937
+ heightAcc += params.lineHeight * textElement.getBoundingClientRect().height;
8935
8938
  }
8936
8939
 
8937
8940
  var _containerElement$get = containerElement.getBoundingClientRect(),
8938
- width = _containerElement$get.width,
8939
- height = _containerElement$get.height;
8941
+ width = _containerElement$get.width;
8940
8942
 
8941
8943
  containerElement.innerHTML = "";
8942
8944
  return {
8943
- width: width,
8944
- height: height
8945
+ width: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(width, heightAcc, style === null || style === void 0 ? void 0 : style.angle) : width,
8946
+ height: style !== null && style !== void 0 && style.angle ? _getSizeWithRotate(heightAcc, width, style === null || style === void 0 ? void 0 : style.angle) : heightAcc
8945
8947
  };
8946
8948
  }, function (text, style) {
8947
8949
  var totalText = Array.isArray(text) ? text.join() : text;