victory-core 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.
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { VictoryPrimitiveShapeProps } from "./types";
3
- export declare const Path: (props: VictoryPrimitiveShapeProps) => JSX.Element;
3
+ export declare const Path: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<unknown>>;
4
4
  //# sourceMappingURL=path.d.ts.map
@@ -1,11 +1,14 @@
1
1
  var _excluded = ["desc"];
2
2
 
3
+ 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); }
4
+
3
5
  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; }
4
6
 
5
7
  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; }
6
8
 
7
- import React from "react";
8
- export var Path = function (props) {
9
+ import React, { forwardRef } from "react";
10
+ // eslint-disable-next-line prefer-arrow-callback
11
+ export var Path = /*#__PURE__*/forwardRef(function Path(props, ref) {
9
12
  // eslint-disable-next-line react/prop-types
10
13
  var desc = props.desc,
11
14
  rest = _objectWithoutProperties(props, _excluded);
@@ -13,8 +16,12 @@ export var Path = function (props) {
13
16
  return desc ?
14
17
  /*#__PURE__*/
15
18
  // @ts-expect-error FIXME: "id cannot be a number"
16
- React.createElement("path", rest, /*#__PURE__*/React.createElement("desc", null, desc)) :
19
+ React.createElement("path", _extends({}, rest, {
20
+ ref: ref
21
+ }), /*#__PURE__*/React.createElement("desc", null, desc)) :
17
22
  /*#__PURE__*/
18
23
  // @ts-expect-error FIXME: "id cannot be a number"
19
- React.createElement("path", rest);
20
- };
24
+ React.createElement("path", _extends({}, rest, {
25
+ ref: ref
26
+ }));
27
+ });
@@ -44,7 +44,7 @@ export declare function isVertical(props: any): any;
44
44
  */
45
45
  export declare function stringTicks(props: any): boolean;
46
46
  export declare function getTickFormat(props: any, scale: any): any;
47
- export declare function getTicks(props: any, scale: D3Scale, filterZero?: boolean): number[];
47
+ export declare function getTicks(props: any, scale: D3Scale, filterZero?: boolean): number[] | string[];
48
48
  export declare function getDomain(props: any, axis?: any): any;
49
49
  export declare function getAxisValue(props: any, axis: any): any;
50
50
  export declare function modifyProps(props: any, fallbackProps: any): any;
@@ -194,6 +194,11 @@ function getStringTicks(props) {
194
194
  function getTickArray(props) {
195
195
  var tickValues = props.tickValues,
196
196
  tickFormat = props.tickFormat;
197
+
198
+ if ((tickValues === null || tickValues === void 0 ? void 0 : tickValues.length) === 0) {
199
+ return [];
200
+ }
201
+
197
202
  var axis = getAxis(props);
198
203
  var stringMap = props.stringMap && props.stringMap[axis];
199
204
 
@@ -308,6 +313,11 @@ export function getTicks(props, scale) {
308
313
  var filterZero = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
309
314
  var tickCount = props.tickCount;
310
315
  var tickArray = getTickArray(props);
316
+
317
+ if ((tickArray === null || tickArray === void 0 ? void 0 : tickArray.length) === 0) {
318
+ return [""];
319
+ }
320
+
311
321
  var tickValues = tickArray ? tickArray.map(function (v) {
312
322
  return v.value;
313
323
  }) : undefined;
@@ -346,7 +356,7 @@ function getDomainFromData(props, axis) {
346
356
  _props$endAngle = props.endAngle,
347
357
  endAngle = _props$endAngle === void 0 ? 360 : _props$endAngle;
348
358
  var tickArray = getTickArray(props);
349
- var tickValues = tickArray ? tickArray.map(function (v) {
359
+ var tickValues = tickArray && (tickArray === null || tickArray === void 0 ? void 0 : tickArray.length) !== 0 ? tickArray.map(function (v) {
350
360
  return v.value;
351
361
  }) : undefined;
352
362
 
@@ -283,6 +283,7 @@ var _getMeasurementContainer = _memoize(function () {
283
283
  element.setAttribute("width", "300");
284
284
  element.setAttribute("height", "300");
285
285
  element.setAttribute("viewBox", "0 0 300 300");
286
+ element.setAttribute("aria-hidden", "true");
286
287
  var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
287
288
  element.appendChild(containerElement);
288
289
  element.style.position = "fixed";
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { VictoryPrimitiveShapeProps } from "./types";
3
- export declare const Path: (props: VictoryPrimitiveShapeProps) => JSX.Element;
3
+ export declare const Path: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<unknown>>;
4
4
  //# sourceMappingURL=path.d.ts.map
@@ -5,17 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Path = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _excluded = ["desc"];
11
11
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ 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); }
13
17
 
14
18
  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; }
15
19
 
16
20
  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; }
17
21
 
18
- var Path = function (props) {
22
+ // eslint-disable-next-line prefer-arrow-callback
23
+ var Path = /*#__PURE__*/(0, _react.forwardRef)(function Path(props, ref) {
19
24
  // eslint-disable-next-line react/prop-types
20
25
  var desc = props.desc,
21
26
  rest = _objectWithoutProperties(props, _excluded);
@@ -23,10 +28,13 @@ var Path = function (props) {
23
28
  return desc ?
24
29
  /*#__PURE__*/
25
30
  // @ts-expect-error FIXME: "id cannot be a number"
26
- _react.default.createElement("path", rest, /*#__PURE__*/_react.default.createElement("desc", null, desc)) :
31
+ _react.default.createElement("path", _extends({}, rest, {
32
+ ref: ref
33
+ }), /*#__PURE__*/_react.default.createElement("desc", null, desc)) :
27
34
  /*#__PURE__*/
28
35
  // @ts-expect-error FIXME: "id cannot be a number"
29
- _react.default.createElement("path", rest);
30
- };
31
-
36
+ _react.default.createElement("path", _extends({}, rest, {
37
+ ref: ref
38
+ }));
39
+ });
32
40
  exports.Path = Path;
@@ -44,7 +44,7 @@ export declare function isVertical(props: any): any;
44
44
  */
45
45
  export declare function stringTicks(props: any): boolean;
46
46
  export declare function getTickFormat(props: any, scale: any): any;
47
- export declare function getTicks(props: any, scale: D3Scale, filterZero?: boolean): number[];
47
+ export declare function getTicks(props: any, scale: D3Scale, filterZero?: boolean): number[] | string[];
48
48
  export declare function getDomain(props: any, axis?: any): any;
49
49
  export declare function getAxisValue(props: any, axis: any): any;
50
50
  export declare function modifyProps(props: any, fallbackProps: any): any;
@@ -236,6 +236,11 @@ function getStringTicks(props) {
236
236
  function getTickArray(props) {
237
237
  var tickValues = props.tickValues,
238
238
  tickFormat = props.tickFormat;
239
+
240
+ if ((tickValues === null || tickValues === void 0 ? void 0 : tickValues.length) === 0) {
241
+ return [];
242
+ }
243
+
239
244
  var axis = getAxis(props);
240
245
  var stringMap = props.stringMap && props.stringMap[axis];
241
246
 
@@ -349,6 +354,11 @@ function getTicks(props, scale) {
349
354
  var filterZero = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
350
355
  var tickCount = props.tickCount;
351
356
  var tickArray = getTickArray(props);
357
+
358
+ if ((tickArray === null || tickArray === void 0 ? void 0 : tickArray.length) === 0) {
359
+ return [""];
360
+ }
361
+
352
362
  var tickValues = tickArray ? tickArray.map(function (v) {
353
363
  return v.value;
354
364
  }) : undefined;
@@ -388,7 +398,7 @@ function getDomainFromData(props, axis) {
388
398
  _props$endAngle = props.endAngle,
389
399
  endAngle = _props$endAngle === void 0 ? 360 : _props$endAngle;
390
400
  var tickArray = getTickArray(props);
391
- var tickValues = tickArray ? tickArray.map(function (v) {
401
+ var tickValues = tickArray && (tickArray === null || tickArray === void 0 ? void 0 : tickArray.length) !== 0 ? tickArray.map(function (v) {
392
402
  return v.value;
393
403
  }) : undefined;
394
404
 
@@ -294,6 +294,7 @@ var _getMeasurementContainer = (0, _memoize2.default)(function () {
294
294
  element.setAttribute("width", "300");
295
295
  element.setAttribute("height", "300");
296
296
  element.setAttribute("viewBox", "0 0 300 300");
297
+ element.setAttribute("aria-hidden", "true");
297
298
  var containerElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
298
299
  element.appendChild(containerElement);
299
300
  element.style.position = "fixed";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-core",
3
- "version": "36.6.11",
3
+ "version": "36.7.0",
4
4
  "description": "Victory Core",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -23,7 +23,7 @@
23
23
  "lodash": "^4.17.21",
24
24
  "prop-types": "^15.8.1",
25
25
  "react-fast-compare": "^3.2.0",
26
- "victory-vendor": "^36.6.11"
26
+ "victory-vendor": "^36.7.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": ">=16.6.0"
@@ -1,16 +1,20 @@
1
- import React from "react";
1
+ import React, { forwardRef } from "react";
2
2
  import { VictoryPrimitiveShapeProps } from "./types";
3
3
 
4
- export const Path = (props: VictoryPrimitiveShapeProps) => {
4
+ // eslint-disable-next-line prefer-arrow-callback
5
+ export const Path = forwardRef(function Path(
6
+ props: VictoryPrimitiveShapeProps,
7
+ ref,
8
+ ) {
5
9
  // eslint-disable-next-line react/prop-types
6
10
  const { desc, ...rest } = props;
7
11
  return desc ? (
8
12
  // @ts-expect-error FIXME: "id cannot be a number"
9
- <path {...rest}>
13
+ <path {...rest} ref={ref}>
10
14
  <desc>{desc}</desc>
11
15
  </path>
12
16
  ) : (
13
17
  // @ts-expect-error FIXME: "id cannot be a number"
14
- <path {...rest} />
18
+ <path {...rest} ref={ref} />
15
19
  );
16
- };
20
+ });
@@ -181,6 +181,11 @@ function getStringTicks(props) {
181
181
 
182
182
  function getTickArray(props) {
183
183
  const { tickValues, tickFormat } = props;
184
+
185
+ if (tickValues?.length === 0) {
186
+ return [];
187
+ }
188
+
184
189
  const axis = getAxis(props);
185
190
  const stringMap = props.stringMap && props.stringMap[axis];
186
191
  const getTicksFromFormat = () => {
@@ -276,6 +281,11 @@ function downsampleTicks(ticks: number[], tickCount: number) {
276
281
  export function getTicks(props, scale: D3Scale, filterZero = false) {
277
282
  const { tickCount } = props;
278
283
  const tickArray = getTickArray(props);
284
+
285
+ if (tickArray?.length === 0) {
286
+ return [""];
287
+ }
288
+
279
289
  const tickValues = tickArray ? tickArray.map((v) => v.value) : undefined;
280
290
  if (tickValues) {
281
291
  return downsampleTicks(tickValues, tickCount);
@@ -307,7 +317,10 @@ export function getTicks(props, scale: D3Scale, filterZero = false) {
307
317
  function getDomainFromData(props, axis) {
308
318
  const { polar, startAngle = 0, endAngle = 360 } = props;
309
319
  const tickArray = getTickArray(props);
310
- const tickValues = tickArray ? tickArray.map((v) => v.value) : undefined;
320
+ const tickValues =
321
+ tickArray && tickArray?.length !== 0
322
+ ? tickArray.map((v) => v.value)
323
+ : undefined;
311
324
  if (!Array.isArray(tickValues)) {
312
325
  return undefined;
313
326
  }
@@ -270,6 +270,7 @@ const _getMeasurementContainer = memoize(() => {
270
270
  element.setAttribute("width", "300");
271
271
  element.setAttribute("height", "300");
272
272
  element.setAttribute("viewBox", "0 0 300 300");
273
+ element.setAttribute("aria-hidden", "true");
273
274
 
274
275
  const containerElement = document.createElementNS(
275
276
  "http://www.w3.org/2000/svg",