victory-bar 36.6.7 → 36.6.10
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 +20 -0
- package/dist/victory-bar.js +229 -15
- package/dist/victory-bar.min.js +1 -1
- package/es/v37/victory-bar.stories.d.ts +5 -0
- package/es/v37/victory-bar.stories.js +5 -0
- package/lib/v37/victory-bar.stories.d.ts +5 -0
- package/lib/v37/victory-bar.stories.js +5 -0
- package/package.json +7 -4
- package/src/v37/victory-bar.stories.tsx +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# victory-bar
|
|
2
2
|
|
|
3
|
+
## 36.6.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Setup NPM Provenance ([#2590](https://github.com/FormidableLabs/victory/pull/2590))
|
|
8
|
+
|
|
9
|
+
## 36.6.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Setup NPM Provenance ([#2587](https://github.com/FormidableLabs/victory/pull/2587))
|
|
14
|
+
|
|
15
|
+
## 36.6.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies []:
|
|
20
|
+
- victory-core@36.6.8
|
|
21
|
+
- victory-vendor@36.6.8
|
|
22
|
+
|
|
3
23
|
## 36.6.7
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/victory-bar.js
CHANGED
|
@@ -1250,6 +1250,48 @@ VictoryBar.getBaseProps = function (props) {
|
|
|
1250
1250
|
VictoryBar.expectedComponents = ["dataComponent", "labelComponent", "groupComponent", "containerComponent"];
|
|
1251
1251
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,victory_core__WEBPACK_IMPORTED_MODULE_12__.addEvents)(VictoryBar));
|
|
1252
1252
|
|
|
1253
|
+
/***/ }),
|
|
1254
|
+
|
|
1255
|
+
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js":
|
|
1256
|
+
/*!***********************************************************************************!*\
|
|
1257
|
+
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js ***!
|
|
1258
|
+
\***********************************************************************************/
|
|
1259
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1260
|
+
|
|
1261
|
+
var listCacheClear = __webpack_require__(/*! ./_listCacheClear */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js"),
|
|
1262
|
+
listCacheDelete = __webpack_require__(/*! ./_listCacheDelete */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js"),
|
|
1263
|
+
listCacheGet = __webpack_require__(/*! ./_listCacheGet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js"),
|
|
1264
|
+
listCacheHas = __webpack_require__(/*! ./_listCacheHas */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js"),
|
|
1265
|
+
listCacheSet = __webpack_require__(/*! ./_listCacheSet */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js");
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Creates an list cache object.
|
|
1269
|
+
*
|
|
1270
|
+
* @private
|
|
1271
|
+
* @constructor
|
|
1272
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1273
|
+
*/
|
|
1274
|
+
function ListCache(entries) {
|
|
1275
|
+
var index = -1,
|
|
1276
|
+
length = entries == null ? 0 : entries.length;
|
|
1277
|
+
|
|
1278
|
+
this.clear();
|
|
1279
|
+
while (++index < length) {
|
|
1280
|
+
var entry = entries[index];
|
|
1281
|
+
this.set(entry[0], entry[1]);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
// Add methods to `ListCache`.
|
|
1286
|
+
ListCache.prototype.clear = listCacheClear;
|
|
1287
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
1288
|
+
ListCache.prototype.get = listCacheGet;
|
|
1289
|
+
ListCache.prototype.has = listCacheHas;
|
|
1290
|
+
ListCache.prototype.set = listCacheSet;
|
|
1291
|
+
|
|
1292
|
+
module.exports = ListCache;
|
|
1293
|
+
|
|
1294
|
+
|
|
1253
1295
|
/***/ }),
|
|
1254
1296
|
|
|
1255
1297
|
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_SetCache.js":
|
|
@@ -5824,6 +5866,89 @@ function last(array) {
|
|
|
5824
5866
|
module.exports = last;
|
|
5825
5867
|
|
|
5826
5868
|
|
|
5869
|
+
/***/ }),
|
|
5870
|
+
|
|
5871
|
+
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js":
|
|
5872
|
+
/*!*********************************************************************************!*\
|
|
5873
|
+
!*** ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js ***!
|
|
5874
|
+
\*********************************************************************************/
|
|
5875
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
5876
|
+
|
|
5877
|
+
var MapCache = __webpack_require__(/*! ./_MapCache */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js");
|
|
5878
|
+
|
|
5879
|
+
/** Error message constants. */
|
|
5880
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
5881
|
+
|
|
5882
|
+
/**
|
|
5883
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
5884
|
+
* provided, it determines the cache key for storing the result based on the
|
|
5885
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
5886
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
5887
|
+
* is invoked with the `this` binding of the memoized function.
|
|
5888
|
+
*
|
|
5889
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
5890
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
5891
|
+
* constructor with one whose instances implement the
|
|
5892
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
5893
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
5894
|
+
*
|
|
5895
|
+
* @static
|
|
5896
|
+
* @memberOf _
|
|
5897
|
+
* @since 0.1.0
|
|
5898
|
+
* @category Function
|
|
5899
|
+
* @param {Function} func The function to have its output memoized.
|
|
5900
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
5901
|
+
* @returns {Function} Returns the new memoized function.
|
|
5902
|
+
* @example
|
|
5903
|
+
*
|
|
5904
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
5905
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
5906
|
+
*
|
|
5907
|
+
* var values = _.memoize(_.values);
|
|
5908
|
+
* values(object);
|
|
5909
|
+
* // => [1, 2]
|
|
5910
|
+
*
|
|
5911
|
+
* values(other);
|
|
5912
|
+
* // => [3, 4]
|
|
5913
|
+
*
|
|
5914
|
+
* object.a = 2;
|
|
5915
|
+
* values(object);
|
|
5916
|
+
* // => [1, 2]
|
|
5917
|
+
*
|
|
5918
|
+
* // Modify the result cache.
|
|
5919
|
+
* values.cache.set(object, ['a', 'b']);
|
|
5920
|
+
* values(object);
|
|
5921
|
+
* // => ['a', 'b']
|
|
5922
|
+
*
|
|
5923
|
+
* // Replace `_.memoize.Cache`.
|
|
5924
|
+
* _.memoize.Cache = WeakMap;
|
|
5925
|
+
*/
|
|
5926
|
+
function memoize(func, resolver) {
|
|
5927
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
5928
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
5929
|
+
}
|
|
5930
|
+
var memoized = function() {
|
|
5931
|
+
var args = arguments,
|
|
5932
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
5933
|
+
cache = memoized.cache;
|
|
5934
|
+
|
|
5935
|
+
if (cache.has(key)) {
|
|
5936
|
+
return cache.get(key);
|
|
5937
|
+
}
|
|
5938
|
+
var result = func.apply(this, args);
|
|
5939
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
5940
|
+
return result;
|
|
5941
|
+
};
|
|
5942
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
5943
|
+
return memoized;
|
|
5944
|
+
}
|
|
5945
|
+
|
|
5946
|
+
// Expose `MapCache`.
|
|
5947
|
+
memoize.Cache = MapCache;
|
|
5948
|
+
|
|
5949
|
+
module.exports = memoize;
|
|
5950
|
+
|
|
5951
|
+
|
|
5827
5952
|
/***/ }),
|
|
5828
5953
|
|
|
5829
5954
|
/***/ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/negate.js":
|
|
@@ -13928,12 +14053,23 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13928
14053
|
/* harmony export */ "approximateTextSize": () => (/* binding */ approximateTextSize),
|
|
13929
14054
|
/* harmony export */ "convertLengthToPixels": () => (/* binding */ convertLengthToPixels)
|
|
13930
14055
|
/* harmony export */ });
|
|
13931
|
-
/* harmony import */ var
|
|
13932
|
-
/* harmony import */ var
|
|
13933
|
-
/* harmony import */ var
|
|
13934
|
-
/* harmony import */ var
|
|
14056
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/memoize */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js");
|
|
14057
|
+
/* harmony import */ var lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_memoize__WEBPACK_IMPORTED_MODULE_0__);
|
|
14058
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
14059
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
14060
|
+
/* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash/assign */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/assign.js");
|
|
14061
|
+
/* harmony import */ var lodash_assign__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_assign__WEBPACK_IMPORTED_MODULE_2__);
|
|
14062
|
+
|
|
14063
|
+
|
|
13935
14064
|
|
|
13936
14065
|
|
|
14066
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14067
|
+
|
|
14068
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14069
|
+
|
|
14070
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
14071
|
+
|
|
14072
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13937
14073
|
|
|
13938
14074
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13939
14075
|
|
|
@@ -14138,9 +14274,9 @@ var convertLengthToPixels = function (length, fontSize) {
|
|
|
14138
14274
|
var _prepareParams = function (inputStyle, index) {
|
|
14139
14275
|
var lineStyle = Array.isArray(inputStyle) ? inputStyle[index] : inputStyle;
|
|
14140
14276
|
|
|
14141
|
-
var style =
|
|
14277
|
+
var style = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()({}, lineStyle, defaultStyle);
|
|
14142
14278
|
|
|
14143
|
-
return
|
|
14279
|
+
return lodash_assign__WEBPACK_IMPORTED_MODULE_2___default()({}, style, {
|
|
14144
14280
|
fontFamily: style.fontFamily,
|
|
14145
14281
|
letterSpacing: typeof style.letterSpacing === "number" ? style.letterSpacing : convertLengthToPixels(String(style.letterSpacing), style.fontSize),
|
|
14146
14282
|
fontSize: typeof style.fontSize === "number" ? style.fontSize : convertLengthToPixels(String(style.fontSize))
|
|
@@ -14187,21 +14323,99 @@ var _approximateTextHeightInternal = function (text, style) {
|
|
|
14187
14323
|
}, 0);
|
|
14188
14324
|
};
|
|
14189
14325
|
|
|
14326
|
+
var _approximateDimensionsInternal = function (text, style) {
|
|
14327
|
+
var angle = Array.isArray(style) ? style[0] && style[0].angle : style && style.angle;
|
|
14328
|
+
|
|
14329
|
+
var height = _approximateTextHeightInternal(text, style);
|
|
14330
|
+
|
|
14331
|
+
var width = _approximateTextWidthInternal(text, style);
|
|
14332
|
+
|
|
14333
|
+
var widthWithRotate = angle ? _getSizeWithRotate(width, height, angle) : width;
|
|
14334
|
+
var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
|
|
14335
|
+
return {
|
|
14336
|
+
width: widthWithRotate,
|
|
14337
|
+
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
14338
|
+
};
|
|
14339
|
+
};
|
|
14340
|
+
|
|
14341
|
+
var _getMeasurementContainer = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function () {
|
|
14342
|
+
var element = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
14343
|
+
element.setAttribute("xlink", "http://www.w3.org/1999/xlink");
|
|
14344
|
+
var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
14345
|
+
element.appendChild(containerElement);
|
|
14346
|
+
element.style.position = "fixed";
|
|
14347
|
+
element.style.top = "-9999px";
|
|
14348
|
+
element.style.left = "-9999px";
|
|
14349
|
+
document.body.appendChild(element);
|
|
14350
|
+
return containerElement;
|
|
14351
|
+
});
|
|
14352
|
+
|
|
14353
|
+
var styleToKeyComponent = function (style) {
|
|
14354
|
+
if (!style) {
|
|
14355
|
+
return "null";
|
|
14356
|
+
}
|
|
14357
|
+
|
|
14358
|
+
return "".concat(style.angle, ":").concat(style.fontFamily, ":").concat(style.fontSize, ":").concat(style.letterSpacing, ":").concat(style.lineHeight);
|
|
14359
|
+
};
|
|
14360
|
+
|
|
14361
|
+
var _measureDimensionsInternal = lodash_memoize__WEBPACK_IMPORTED_MODULE_0___default()(function (text, style) {
|
|
14362
|
+
var containerElement = _getMeasurementContainer();
|
|
14363
|
+
|
|
14364
|
+
var lines = _splitToLines(text);
|
|
14365
|
+
|
|
14366
|
+
var heightAcc = 0;
|
|
14367
|
+
|
|
14368
|
+
for (var _ref of lines.entries()) {
|
|
14369
|
+
var _ref2 = _slicedToArray(_ref, 2);
|
|
14370
|
+
|
|
14371
|
+
var i = _ref2[0];
|
|
14372
|
+
var line = _ref2[1];
|
|
14373
|
+
var textElement = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
14374
|
+
|
|
14375
|
+
var params = _prepareParams(style, i);
|
|
14376
|
+
|
|
14377
|
+
textElement.style.fontFamily = params.fontFamily;
|
|
14378
|
+
textElement.style.transform = "rotate(".concat(params.angle, ")");
|
|
14379
|
+
textElement.style.fontSize = "".concat(params.fontSize, "px");
|
|
14380
|
+
textElement.style.lineHeight = params.lineHeight;
|
|
14381
|
+
textElement.style.fontFamily = params.fontFamily;
|
|
14382
|
+
textElement.style.letterSpacing = params.letterSpacing;
|
|
14383
|
+
textElement.textContent = line;
|
|
14384
|
+
textElement.setAttribute("x", "0");
|
|
14385
|
+
textElement.setAttribute("y", "".concat(heightAcc));
|
|
14386
|
+
heightAcc += params.lineHeight * params.fontSize;
|
|
14387
|
+
containerElement.appendChild(textElement);
|
|
14388
|
+
}
|
|
14389
|
+
|
|
14390
|
+
var _containerElement$get = containerElement.getBoundingClientRect(),
|
|
14391
|
+
width = _containerElement$get.width,
|
|
14392
|
+
height = _containerElement$get.height;
|
|
14393
|
+
|
|
14394
|
+
containerElement.innerHTML = "";
|
|
14395
|
+
return {
|
|
14396
|
+
width: width,
|
|
14397
|
+
height: height
|
|
14398
|
+
};
|
|
14399
|
+
}, function (text, style) {
|
|
14400
|
+
var totalText = Array.isArray(text) ? text.join() : text;
|
|
14401
|
+
var totalStyle = Array.isArray(style) ? style.map(styleToKeyComponent).join() : styleToKeyComponent(style);
|
|
14402
|
+
return "".concat(totalText, "::").concat(totalStyle);
|
|
14403
|
+
});
|
|
14404
|
+
|
|
14190
14405
|
// Stubbable implementation.
|
|
14191
14406
|
var _approximateTextSizeInternal = {
|
|
14192
14407
|
impl: function (text, style) {
|
|
14193
|
-
var
|
|
14408
|
+
var __debugForceApproximate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
14194
14409
|
|
|
14195
|
-
|
|
14410
|
+
// Attempt to first measure the element in DOM. If there is no DOM, fallback
|
|
14411
|
+
// to the less accurate approximation algorithm.
|
|
14412
|
+
var isClient = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
14196
14413
|
|
|
14197
|
-
|
|
14414
|
+
if (!isClient || __debugForceApproximate) {
|
|
14415
|
+
return _approximateDimensionsInternal(text, style);
|
|
14416
|
+
}
|
|
14198
14417
|
|
|
14199
|
-
|
|
14200
|
-
var heightWithRotate = angle ? _getSizeWithRotate(height, width, angle) : height;
|
|
14201
|
-
return {
|
|
14202
|
-
width: widthWithRotate,
|
|
14203
|
-
height: heightWithRotate * coefficients.heightOverlapCoef
|
|
14204
|
-
};
|
|
14418
|
+
return _measureDimensionsInternal(text, style);
|
|
14205
14419
|
}
|
|
14206
14420
|
};
|
|
14207
14421
|
/**
|