From 3877aa99403ba196e4e55c16b7e04c22c56d26c7 Mon Sep 17 00:00:00 2001 From: Kenan Yusuf Date: Mon, 5 Feb 2024 08:09:44 +0000 Subject: [PATCH] Remove prop-types from many packages (#2758) --- .changeset/rotten-pots-breathe.md | 32 ++ .eslintrc.js | 2 +- docs/package.json | 1 - packages/victory-area/package.json | 1 - packages/victory-area/src/area.tsx | 9 - packages/victory-area/src/victory-area.tsx | 27 -- packages/victory-axis/package.json | 1 - packages/victory-axis/src/victory-axis.tsx | 72 --- packages/victory-bar/package.json | 1 - packages/victory-bar/src/bar.tsx | 1 - packages/victory-box-plot/package.json | 1 - .../victory-box-plot/src/victory-box-plot.tsx | 143 ------ packages/victory-brush-container/package.json | 1 - .../src/victory-brush-container.tsx | 23 +- packages/victory-brush-line/package.json | 1 - .../src/victory-brush-line.tsx | 31 -- packages/victory-candlestick/package.json | 1 - packages/victory-canvas/package.json | 1 - packages/victory-chart/package.json | 1 - packages/victory-chart/src/victory-chart.tsx | 24 - packages/victory-core/package.json | 1 - packages/victory-core/src/exports.test.ts | 17 - .../victory-accessible-group.tsx | 12 - .../victory-animation/victory-animation.tsx | 51 -- .../victory-clip-container.tsx | 34 -- .../victory-container/victory-container.tsx | 35 -- .../src/victory-label/victory-label.tsx | 83 ---- .../src/victory-portal/portal.tsx | 9 - .../src/victory-portal/victory-portal.tsx | 6 - .../src/victory-primitives/arc.tsx | 18 +- .../src/victory-primitives/background.tsx | 18 +- .../src/victory-primitives/border.tsx | 15 +- .../src/victory-primitives/line-segment.tsx | 16 +- .../src/victory-primitives/point.tsx | 30 +- .../src/victory-primitives/whisker.tsx | 24 +- .../victory-transition/victory-transition.tsx | 7 - .../src/victory-util/common-props.tsx | 218 --------- .../victory-core/src/victory-util/index.ts | 1 - .../src/victory-util/prop-types.test.ts | 439 ------------------ .../src/victory-util/prop-types.ts | 254 ---------- .../victory-cursor-container/package.json | 1 - .../src/victory-cursor-container.tsx | 28 +- packages/victory-errorbar/package.json | 1 - packages/victory-errorbar/src/error-bar.tsx | 22 - .../victory-errorbar/src/victory-errorbar.tsx | 28 -- packages/victory-group/package.json | 1 - packages/victory-group/src/victory-group.tsx | 13 - packages/victory-histogram/package.json | 1 - packages/victory-legend/package.json | 1 - packages/victory-line/package.json | 1 - packages/victory-line/src/curve.tsx | 14 - packages/victory-line/src/victory-line.tsx | 28 -- packages/victory-native/src/index.ts | 1 - packages/victory-pie/package.json | 1 - packages/victory-pie/src/slice.tsx | 16 - packages/victory-polar-axis/package.json | 1 - packages/victory-scatter/package.json | 1 - .../victory-scatter/src/victory-scatter.tsx | 26 -- .../victory-selection-container/package.json | 1 - packages/victory-shared-events/package.json | 1 - packages/victory-stack/package.json | 1 - packages/victory-stack/src/victory-stack.tsx | 50 -- packages/victory-tooltip/package.json | 1 - .../victory-tooltip/src/victory-tooltip.tsx | 1 - .../victory-voronoi-container/package.json | 1 - packages/victory-voronoi/package.json | 1 - packages/victory-zoom-container/package.json | 1 - packages/victory/src/victory.test.ts | 3 - pnpm-lock.yaml | 57 +-- stories/victory-histogram.stories.tsx | 2 - stories/victory-legend.stories.tsx | 1 - test/node/victory.test.js | 3 - 72 files changed, 47 insertions(+), 1924 deletions(-) create mode 100644 .changeset/rotten-pots-breathe.md delete mode 100644 packages/victory-core/src/victory-util/prop-types.test.ts delete mode 100644 packages/victory-core/src/victory-util/prop-types.ts diff --git a/.changeset/rotten-pots-breathe.md b/.changeset/rotten-pots-breathe.md new file mode 100644 index 000000000..76769778e --- /dev/null +++ b/.changeset/rotten-pots-breathe.md @@ -0,0 +1,32 @@ +--- +"victory": minor +"victory-area": minor +"victory-axis": minor +"victory-bar": minor +"victory-box-plot": minor +"victory-brush-container": minor +"victory-brush-line": minor +"victory-candlestick": minor +"victory-canvas": minor +"victory-chart": minor +"victory-core": minor +"victory-cursor-container": minor +"victory-errorbar": minor +"victory-group": minor +"victory-histogram": minor +"victory-legend": minor +"victory-line": minor +"victory-native": minor +"victory-pie": minor +"victory-polar-axis": minor +"victory-scatter": minor +"victory-selection-container": minor +"victory-shared-events": minor +"victory-stack": minor +"victory-tooltip": minor +"victory-voronoi": minor +"victory-voronoi-container": minor +"victory-zoom-container": minor +--- + +Remove prop-types definitions and dependency diff --git a/.eslintrc.js b/.eslintrc.js index 4aae1cdfd..0ad0ca818 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -67,7 +67,6 @@ module.exports = { "no-undef": "off", "max-nested-callbacks": "off", "@typescript-eslint/no-empty-function": "off", - "react/prop-types": "off", }, }, { @@ -86,6 +85,7 @@ module.exports = { "plugin:@typescript-eslint/recommended-requiring-type-checking", ], rules: { + "react/prop-types": "off", "no-use-before-define": "off", "valid-jsdoc": "off", "@typescript-eslint/no-use-before-define": [ diff --git a/docs/package.json b/docs/package.json index c8a75b930..c032ebe7d 100644 --- a/docs/package.json +++ b/docs/package.json @@ -28,7 +28,6 @@ "fuse.js": "^3.2.1", "lodash": "^4.17.19", "prismjs": "^1.15.0", - "prop-types": "^15.8.1", "react": "^16.8.0", "react-cool-inview": "^0.5.14", "react-copy-to-clipboard": "^5.0.2", diff --git a/packages/victory-area/package.json b/packages/victory-area/package.json index e16df08cb..e01d4d09f 100644 --- a/packages/victory-area/package.json +++ b/packages/victory-area/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6", "victory-vendor": "^36.8.6" }, diff --git a/packages/victory-area/src/area.tsx b/packages/victory-area/src/area.tsx index 3466f43f0..b4167663f 100644 --- a/packages/victory-area/src/area.tsx +++ b/packages/victory-area/src/area.tsx @@ -1,10 +1,8 @@ /* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }]*/ import React from "react"; -import PropTypes from "prop-types"; import * as d3Shape from "victory-vendor/d3-shape"; import { Helpers, - CommonProps, Path, UserProps, VictoryCommonPrimitiveProps, @@ -176,13 +174,6 @@ export const Area: React.FC = (initialProps) => { : area; }; -Area.propTypes = { - ...CommonProps.primitiveProps, - groupComponent: PropTypes.element, - interpolation: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - pathComponent: PropTypes.element, -}; - export interface AreaProps extends VictoryCommonPrimitiveProps { horizontal?: VictoryCommonThemeProps["horizontal"]; groupComponent?: React.ReactElement; diff --git a/packages/victory-area/src/victory-area.tsx b/packages/victory-area/src/victory-area.tsx index 5cde1a2a0..39c4d157f 100644 --- a/packages/victory-area/src/victory-area.tsx +++ b/packages/victory-area/src/victory-area.tsx @@ -1,13 +1,10 @@ -import PropTypes from "prop-types"; import React from "react"; import { getBaseProps } from "./helper-methods"; import { Area } from "./area"; import { - PropTypes as CustomPropTypes, Helpers, VictoryLabel, VictoryContainer, - CommonProps, DefaultTransitions, VictoryClipContainer, addEvents, @@ -71,30 +68,6 @@ class VictoryAreaBase extends React.Component { "width", ]; - static propTypes = { - ...CommonProps.baseProps, - ...CommonProps.dataProps, - interpolation: PropTypes.oneOfType([ - PropTypes.oneOf([ - "basis", - "cardinal", - "catmullRom", - "linear", - "monotoneX", - "monotoneY", - "natural", - "step", - "stepAfter", - "stepBefore", - ]), - PropTypes.func, - ]), - label: CustomPropTypes.deprecated( - PropTypes.string, - "Use `labels` instead for individual data labels", - ), - }; - static defaultProps: VictoryAreaProps = { containerComponent: , dataComponent: , diff --git a/packages/victory-axis/package.json b/packages/victory-axis/package.json index 4f471e813..d05c15170 100644 --- a/packages/victory-axis/package.json +++ b/packages/victory-axis/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-axis/src/victory-axis.tsx b/packages/victory-axis/src/victory-axis.tsx index 7c9a4a0c3..8040e997f 100644 --- a/packages/victory-axis/src/victory-axis.tsx +++ b/packages/victory-axis/src/victory-axis.tsx @@ -1,10 +1,7 @@ -import PropTypes from "prop-types"; import React from "react"; import { isEmpty } from "lodash"; import { - PropTypes as CustomPropTypes, VictoryLabel, - CommonProps, VictoryContainer, VictoryTheme, LineSegment, @@ -90,75 +87,6 @@ class VictoryAxisBase extends React.Component { }, }; - static propTypes = { - ...CommonProps.baseProps, - axisComponent: PropTypes.element, - axisLabelComponent: PropTypes.element, - axisValue: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.string, - PropTypes.object, - ]), - categories: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.string), - PropTypes.shape({ - x: PropTypes.arrayOf(PropTypes.string), - y: PropTypes.arrayOf(PropTypes.string), - }), - ]), - crossAxis: PropTypes.bool, - dependentAxis: PropTypes.bool, - events: PropTypes.arrayOf( - PropTypes.shape({ - target: PropTypes.oneOf([ - "axis", - "axisLabel", - "grid", - "ticks", - "tickLabels", - ]), - eventKey: PropTypes.oneOfType([ - PropTypes.array, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - ]), - eventHandlers: PropTypes.object, - }), - ), - fixLabelOverlap: PropTypes.bool, - gridComponent: PropTypes.element, - groupComponent: PropTypes.element, - invertAxis: PropTypes.bool, - label: PropTypes.any, - offsetX: PropTypes.number, - offsetY: PropTypes.number, - orientation: PropTypes.oneOf(["top", "bottom", "left", "right"]), - origin: PropTypes.shape({ x: PropTypes.number, y: PropTypes.number }), - stringMap: PropTypes.object, - style: PropTypes.shape({ - parent: PropTypes.object, - axis: PropTypes.object, - axisLabel: PropTypes.object, - grid: PropTypes.object, - ticks: PropTypes.object, - tickLabels: PropTypes.object, - }), - tickComponent: PropTypes.element, - tickCount: CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.greaterThanZero, - ]), - tickFormat: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.homogeneousArray, - ]), - tickLabelComponent: PropTypes.element, - tickValues: CustomPropTypes.homogeneousArray, - }; - static defaultProps = { axisComponent: , axisLabelComponent: , diff --git a/packages/victory-bar/package.json b/packages/victory-bar/package.json index 1b6ba6e21..d29460059 100644 --- a/packages/victory-bar/package.json +++ b/packages/victory-bar/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6", "victory-vendor": "^36.8.6" }, diff --git a/packages/victory-bar/src/bar.tsx b/packages/victory-bar/src/bar.tsx index f2cfd2e6d..6f623b344 100644 --- a/packages/victory-bar/src/bar.tsx +++ b/packages/victory-bar/src/bar.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react/prop-types */ import React, { forwardRef } from "react"; import { Helpers, diff --git a/packages/victory-box-plot/package.json b/packages/victory-box-plot/package.json index dc1fc1f60..b733c0a78 100644 --- a/packages/victory-box-plot/package.json +++ b/packages/victory-box-plot/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6", "victory-vendor": "^36.8.6" }, diff --git a/packages/victory-box-plot/src/victory-box-plot.tsx b/packages/victory-box-plot/src/victory-box-plot.tsx index b27dd0241..f6e70d743 100644 --- a/packages/victory-box-plot/src/victory-box-plot.tsx +++ b/packages/victory-box-plot/src/victory-box-plot.tsx @@ -1,18 +1,15 @@ import React from "react"; -import PropTypes from "prop-types"; import { flatten, isNil } from "lodash"; import { Helpers, VictoryLabel, addEvents, LineSegment, - PropTypes as CustomPropTypes, VictoryContainer, VictoryTheme, Box, Whisker, DefaultTransitions, - CommonProps, UserProps, EventPropTypeInterface, DomainPropType, @@ -142,146 +139,6 @@ class VictoryBoxPlotBase extends React.Component { static displayName = "VictoryBoxPlot"; static role = "boxplot"; static defaultTransitions = DefaultTransitions.discreteTransitions(); - static propTypes = { - ...CommonProps.baseProps, - ...CommonProps.dataProps, - boxWidth: PropTypes.number, - events: PropTypes.arrayOf( - PropTypes.shape({ - target: PropTypes.oneOf([ - "max", - "maxLabels", - "median", - "medianLabels", - "min", - "minLabels", - "q1", - "q1Labels", - "q3", - "q3Labels", - "parent", - ]), - eventKey: PropTypes.oneOfType([ - PropTypes.array, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - ]), - eventHandlers: PropTypes.object, - }), - ), - horizontal: PropTypes.bool, - labelOrientation: PropTypes.oneOfType([ - PropTypes.oneOf(["top", "bottom", "left", "right"]), - PropTypes.shape({ - q1: PropTypes.oneOf(["top", "bottom", "left", "right"]), - q3: PropTypes.oneOf(["top", "bottom", "left", "right"]), - min: PropTypes.oneOf(["top", "bottom", "left", "right"]), - max: PropTypes.oneOf(["top", "bottom", "left", "right"]), - median: PropTypes.oneOf(["top", "bottom", "left", "right"]), - }), - ]), - labels: PropTypes.bool, - max: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string), - ]), - maxComponent: PropTypes.element, - maxLabelComponent: PropTypes.element, - maxLabels: PropTypes.oneOfType([ - PropTypes.func, - PropTypes.array, - PropTypes.bool, - ]), - median: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string), - ]), - medianComponent: PropTypes.element, - medianLabelComponent: PropTypes.element, - medianLabels: PropTypes.oneOfType([ - PropTypes.func, - PropTypes.array, - PropTypes.bool, - ]), - min: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string), - ]), - minComponent: PropTypes.element, - minLabelComponent: PropTypes.element, - minLabels: PropTypes.oneOfType([ - PropTypes.func, - PropTypes.array, - PropTypes.bool, - ]), - q1: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string), - ]), - q1Component: PropTypes.element, - q1LabelComponent: PropTypes.element, - q1Labels: PropTypes.oneOfType([ - PropTypes.func, - PropTypes.array, - PropTypes.bool, - ]), - q3: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string), - ]), - q3Component: PropTypes.element, - q3LabelComponent: PropTypes.element, - q3Labels: PropTypes.oneOfType([ - PropTypes.func, - PropTypes.array, - PropTypes.bool, - ]), - style: PropTypes.shape({ - boxes: PropTypes.object, - labels: PropTypes.object, - parent: PropTypes.object, - max: PropTypes.object, - maxLabels: PropTypes.object, - median: PropTypes.object, - medianLabels: PropTypes.object, - min: PropTypes.object, - minLabels: PropTypes.object, - q1: PropTypes.object, - q1Labels: PropTypes.object, - q3: PropTypes.object, - q3Labels: PropTypes.object, - whiskers: PropTypes.object, - }), - whiskerWidth: PropTypes.number, - }; static defaultProps: VictoryBoxPlotProps = { containerComponent: , diff --git a/packages/victory-brush-container/package.json b/packages/victory-brush-container/package.json index 5feaabc25..ace227b48 100644 --- a/packages/victory-brush-container/package.json +++ b/packages/victory-brush-container/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-core": "^36.8.6" }, diff --git a/packages/victory-brush-container/src/victory-brush-container.tsx b/packages/victory-brush-container/src/victory-brush-container.tsx index bcee2b28b..243a09128 100644 --- a/packages/victory-brush-container/src/victory-brush-container.tsx +++ b/packages/victory-brush-container/src/victory-brush-container.tsx @@ -1,4 +1,3 @@ -import PropTypes from "prop-types"; import React from "react"; import { VictoryContainer, @@ -10,6 +9,7 @@ import { import { BrushHelpers } from "./brush-helpers"; import { defaults } from "lodash"; import isEqual from "react-fast-compare"; + export interface VictoryBrushContainerProps extends VictoryContainerProps { allowDrag?: boolean; allowDraw?: boolean; @@ -42,27 +42,6 @@ type Constructor = new (...args: any[]) => React.Component; export const brushContainerMixin = (base: TBase) => class VictoryBrushContainer extends base { static displayName = "VictoryBrushContainer"; - static propTypes = { - ...VictoryContainer.propTypes, - allowDrag: PropTypes.bool, - allowDraw: PropTypes.bool, - allowResize: PropTypes.bool, - brushComponent: PropTypes.element, - brushDimension: PropTypes.oneOf(["x", "y"]), - brushDomain: PropTypes.shape({ - x: PropTypes.array, - y: PropTypes.array, - }), - brushStyle: PropTypes.object, - defaultBrushArea: PropTypes.oneOf(["all", "disable", "none", "move"]), - disable: PropTypes.bool, - handleComponent: PropTypes.element, - handleStyle: PropTypes.object, - handleWidth: PropTypes.number, - onBrushCleared: PropTypes.func, - onBrushDomainChange: PropTypes.func, - onBrushDomainChangeEnd: PropTypes.func, - }; static defaultProps = { ...VictoryContainer.defaultProps, allowDrag: true, diff --git a/packages/victory-brush-line/package.json b/packages/victory-brush-line/package.json index a51346b3b..1ddddce36 100644 --- a/packages/victory-brush-line/package.json +++ b/packages/victory-brush-line/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-core": "^36.8.6" }, diff --git a/packages/victory-brush-line/src/victory-brush-line.tsx b/packages/victory-brush-line/src/victory-brush-line.tsx index 1db990639..befa0b337 100644 --- a/packages/victory-brush-line/src/victory-brush-line.tsx +++ b/packages/victory-brush-line/src/victory-brush-line.tsx @@ -1,5 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; import { Selection, Helpers, @@ -177,36 +176,6 @@ const fallbackProps = { export class VictoryBrushLine< T extends VictoryBrushLineProps, > extends React.Component { - static propTypes = { - allowDrag: PropTypes.bool, - allowDraw: PropTypes.bool, - allowResize: PropTypes.bool, - brushAreaComponent: PropTypes.element, - brushAreaStyle: PropTypes.object, - brushAreaWidth: PropTypes.number, - brushComponent: PropTypes.element, - brushDimension: PropTypes.oneOf(["x", "y"]), - brushDomain: PropTypes.array, - brushStyle: PropTypes.object, - brushWidth: PropTypes.number, - className: PropTypes.string, - dimension: PropTypes.oneOf(["x", "y"]), - disable: PropTypes.bool, - events: PropTypes.object, - groupComponent: PropTypes.element, - handleComponent: PropTypes.element, - handleStyle: PropTypes.object, - handleWidth: PropTypes.number, - id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - lineComponent: PropTypes.element, - name: PropTypes.string, - onBrushDomainChange: PropTypes.func, - scale: PropTypes.object, - style: PropTypes.object, - type: PropTypes.string, - width: PropTypes.number, - }; - static defaultProps = { allowDrag: true, allowDraw: true, diff --git a/packages/victory-candlestick/package.json b/packages/victory-candlestick/package.json index 2a1aae31a..eec090f83 100644 --- a/packages/victory-candlestick/package.json +++ b/packages/victory-candlestick/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-canvas/package.json b/packages/victory-canvas/package.json index 8de36caa8..03901fa1c 100644 --- a/packages/victory-canvas/package.json +++ b/packages/victory-canvas/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-bar": "^36.8.6", "victory-core": "^36.8.6" }, diff --git a/packages/victory-chart/package.json b/packages/victory-chart/package.json index a62ca3405..d1cac46cf 100644 --- a/packages/victory-chart/package.json +++ b/packages/victory-chart/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-axis": "^36.8.6", "victory-core": "^36.8.6", diff --git a/packages/victory-chart/src/victory-chart.tsx b/packages/victory-chart/src/victory-chart.tsx index 96bec5606..d7d6f76c2 100644 --- a/packages/victory-chart/src/victory-chart.tsx +++ b/packages/victory-chart/src/victory-chart.tsx @@ -1,12 +1,9 @@ import { defaults, isEmpty } from "lodash"; -import PropTypes from "prop-types"; import React from "react"; import { Background, - CommonProps, Helpers, Hooks, - PropTypes as CustomPropTypes, UserProps, VictoryContainer, VictoryTheme, @@ -200,27 +197,6 @@ const VictoryChartImpl: React.FC = (initialProps) => { return React.cloneElement(container, container.props, newChildren); }; -VictoryChartImpl.propTypes = { - ...CommonProps.baseProps, - backgroundComponent: PropTypes.element, - children: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.node), - PropTypes.node, - ]), - defaultAxes: PropTypes.shape({ - independent: PropTypes.element, - dependent: PropTypes.element, - }), - defaultPolarAxes: PropTypes.shape({ - independent: PropTypes.element, - dependent: PropTypes.element, - }), - endAngle: PropTypes.number, - innerRadius: CustomPropTypes.nonNegative, - prependDefaultAxes: PropTypes.bool, - startAngle: PropTypes.number, -}; - export const VictoryChart = React.memo(VictoryChartImpl, isEqual); VictoryChart.displayName = "VictoryChart"; diff --git a/packages/victory-core/package.json b/packages/victory-core/package.json index 5c29feac8..bb2f7b0aa 100644 --- a/packages/victory-core/package.json +++ b/packages/victory-core/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.21", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-vendor": "^36.8.6" }, diff --git a/packages/victory-core/src/exports.test.ts b/packages/victory-core/src/exports.test.ts index 9695cec20..df4c844a5 100644 --- a/packages/victory-core/src/exports.test.ts +++ b/packages/victory-core/src/exports.test.ts @@ -28,7 +28,6 @@ import { ClipPathProps, Collection, ColorScalePropType, - CommonProps, CoordinatesPropType, D3Scale, Data, @@ -68,7 +67,6 @@ import { PortalContext, PortalContextValue, PortalProps, - PropTypes, RangePropType, RangeTuple, Rect, @@ -156,7 +154,6 @@ describe("victory-core", () => { "Circle", "ClipPath", "Collection", - "CommonProps", "Data", "DefaultTransitions", "Domain", @@ -174,7 +171,6 @@ describe("victory-core", () => { "PointPathHelpers", "Portal", "PortalContext", - "PropTypes", "Rect", "Scale", "Selection", @@ -217,7 +213,6 @@ describe("victory-core", () => { "LineHelpers", "Log", "PointPathHelpers", - "PropTypes", "Scale", "Selection", "Style", @@ -365,18 +360,6 @@ describe("victory-core", () => { "triangleDown": [Function], "triangleUp": [Function], }, - "PropTypes": Object { - "allOfType": [Function], - "deprecated": [Function], - "domain": [Function], - "greaterThanZero": [Function], - "homogeneousArray": [Function], - "integer": [Function], - "matchDataLength": [Function], - "nonNegative": [Function], - "regExp": [Function], - "scale": [Function], - }, "Scale": Object { "getBaseScale": [Function], "getDefaultScale": [Function], diff --git a/packages/victory-core/src/victory-accessible-group/victory-accessible-group.tsx b/packages/victory-core/src/victory-accessible-group/victory-accessible-group.tsx index 9ba267007..74ee25c25 100644 --- a/packages/victory-core/src/victory-accessible-group/victory-accessible-group.tsx +++ b/packages/victory-core/src/victory-accessible-group/victory-accessible-group.tsx @@ -1,5 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; export interface VictoryAccessibleGroupProps { desc?: string; @@ -12,17 +11,6 @@ export interface VictoryAccessibleGroupProps { export class VictoryAccessibleGroup extends React.Component { static displayName = "VictoryAccessibleGroup"; - static propTypes = { - "aria-describedby": PropTypes.string, - "aria-label": PropTypes.string, - children: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.node), - PropTypes.node, - ]), - className: PropTypes.string, - desc: PropTypes.string, - tabIndex: PropTypes.number, - }; static defaultProps = { className: "VictoryAccessibleGroup", diff --git a/packages/victory-core/src/victory-animation/victory-animation.tsx b/packages/victory-core/src/victory-animation/victory-animation.tsx index a411a468f..d0ab99d57 100644 --- a/packages/victory-core/src/victory-animation/victory-animation.tsx +++ b/packages/victory-core/src/victory-animation/victory-animation.tsx @@ -1,6 +1,5 @@ /* global setTimeout:false */ import React from "react"; -import PropTypes from "prop-types"; import * as d3Ease from "victory-vendor/d3-ease"; import { victoryInterpolator } from "./util"; import TimerContext from "../victory-util/timer-context"; @@ -86,56 +85,6 @@ export class VictoryAnimation extends React.Component< > { static displayName = "VictoryAnimation"; - static propTypes = { - children: PropTypes.func, - data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), - delay: PropTypes.number, - duration: PropTypes.number, - easing: PropTypes.oneOf([ - "back", - "backIn", - "backOut", - "backInOut", - "bounce", - "bounceIn", - "bounceOut", - "bounceInOut", - "circle", - "circleIn", - "circleOut", - "circleInOut", - "linear", - "linearIn", - "linearOut", - "linearInOut", - "cubic", - "cubicIn", - "cubicOut", - "cubicInOut", - "elastic", - "elasticIn", - "elasticOut", - "elasticInOut", - "exp", - "expIn", - "expOut", - "expInOut", - "poly", - "polyIn", - "polyOut", - "polyInOut", - "quad", - "quadIn", - "quadOut", - "quadInOut", - "sin", - "sinIn", - "sinOut", - "sinInOut", - ]), - onEnd: PropTypes.func, - }; - static defaultProps = { data: {}, delay: 0, diff --git a/packages/victory-core/src/victory-clip-container/victory-clip-container.tsx b/packages/victory-core/src/victory-clip-container/victory-clip-container.tsx index a785000e6..a0cefa3ea 100644 --- a/packages/victory-core/src/victory-clip-container/victory-clip-container.tsx +++ b/packages/victory-core/src/victory-clip-container/victory-clip-container.tsx @@ -1,6 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; -import * as CustomPropTypes from "../victory-util/prop-types"; import * as Helpers from "../victory-util/helpers"; import * as UserProps from "../victory-util/user-props"; import { defaults, isObject, uniqueId } from "lodash"; @@ -34,38 +32,6 @@ export interface VictoryClipContainerProps { export class VictoryClipContainer extends React.Component { static displayName = "VictoryClipContainer"; static role = "container"; - static propTypes = { - "aria-label": PropTypes.string, - children: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.node), - PropTypes.node, - ]), - circleComponent: PropTypes.element, - className: PropTypes.string, - clipHeight: CustomPropTypes.nonNegative, - clipId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - clipPadding: PropTypes.shape({ - top: PropTypes.number, - bottom: PropTypes.number, - left: PropTypes.number, - right: PropTypes.number, - }), - clipPathComponent: PropTypes.element, - clipWidth: CustomPropTypes.nonNegative, - events: PropTypes.object, - groupComponent: PropTypes.element, - origin: PropTypes.shape({ - x: CustomPropTypes.nonNegative, - y: CustomPropTypes.nonNegative, - }), - polar: PropTypes.bool, - radius: CustomPropTypes.nonNegative, - style: PropTypes.object, - tabIndex: PropTypes.number, - transform: PropTypes.string, - translateX: PropTypes.number, - translateY: PropTypes.number, - }; static defaultProps = { circleComponent: , diff --git a/packages/victory-core/src/victory-container/victory-container.tsx b/packages/victory-core/src/victory-container/victory-container.tsx index d200abebc..7020bb44e 100644 --- a/packages/victory-core/src/victory-container/victory-container.tsx +++ b/packages/victory-core/src/victory-container/victory-container.tsx @@ -1,6 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; -import * as CustomPropTypes from "../victory-util/prop-types"; import { defaults, uniqueId, isObject, isFunction } from "lodash"; import { Portal } from "../victory-portal/portal"; import { PortalContext } from "../victory-portal/portal-context"; @@ -48,39 +46,6 @@ export class VictoryContainer< > extends React.Component { static displayName = "VictoryContainer"; static role = "container"; - static propTypes = { - "aria-describedby": PropTypes.string, - "aria-labelledby": PropTypes.string, - children: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.node), - PropTypes.node, - ]), - className: PropTypes.string, - containerId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - containerRef: PropTypes.func, - desc: PropTypes.string, - events: PropTypes.object, - height: CustomPropTypes.nonNegative, - name: PropTypes.string, - origin: PropTypes.shape({ - x: CustomPropTypes.nonNegative, - y: CustomPropTypes.nonNegative, - }), - ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - ouiaSafe: PropTypes.bool, - ouiaType: PropTypes.string, - polar: PropTypes.bool, - portalComponent: PropTypes.element, - portalZIndex: CustomPropTypes.integer, - preserveAspectRatio: PropTypes.string, - responsive: PropTypes.bool, - role: PropTypes.string, - style: PropTypes.object, - tabIndex: PropTypes.number, - theme: PropTypes.object, - title: PropTypes.string, - width: CustomPropTypes.nonNegative, - }; static defaultProps = { className: "VictoryContainer", diff --git a/packages/victory-core/src/victory-label/victory-label.tsx b/packages/victory-core/src/victory-label/victory-label.tsx index 645a72b40..d5ce0fa67 100644 --- a/packages/victory-core/src/victory-label/victory-label.tsx +++ b/packages/victory-core/src/victory-label/victory-label.tsx @@ -1,6 +1,5 @@ /* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/ import { defaults, isEmpty } from "lodash"; -import PropTypes from "prop-types"; import React from "react"; import { VictoryPortal } from "../victory-portal/victory-portal"; import { Rect } from "../victory-primitives/rect"; @@ -9,7 +8,6 @@ import { TSpan } from "../victory-primitives/tspan"; import * as Helpers from "../victory-util/helpers"; import * as LabelHelpers from "../victory-util/label-helpers"; import * as Log from "../victory-util/log"; -import * as CustomPropTypes from "../victory-util/prop-types"; import * as Style from "../victory-util/style"; import * as TextSize from "../victory-util/textsize"; import * as UserProps from "../victory-util/user-props"; @@ -642,84 +640,3 @@ export const VictoryLabel: { VictoryLabel.displayName = "VictoryLabel"; VictoryLabel.role = "label"; VictoryLabel.defaultStyles = defaultStyles; -VictoryLabel.propTypes = { - active: PropTypes.bool, - angle: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - PropTypes.func, - ]), - ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - backgroundComponent: PropTypes.element, - backgroundPadding: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.object, - PropTypes.array, - ]), - backgroundStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), - capHeight: PropTypes.oneOfType([ - PropTypes.string, - CustomPropTypes.nonNegative, - PropTypes.func, - ]), - className: PropTypes.string, - data: PropTypes.array, - datum: PropTypes.any, - // @ts-expect-error "Function is not assignable to string" - desc: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - direction: PropTypes.oneOf(["rtl", "ltr", "inherit"]), - dx: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]), - dy: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]), - events: PropTypes.object, - groupComponent: PropTypes.element, - id: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]), - index: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - inline: PropTypes.bool, - labelPlacement: PropTypes.oneOf(["parallel", "perpendicular", "vertical"]), - lineHeight: PropTypes.oneOfType([ - PropTypes.string, - CustomPropTypes.nonNegative, - PropTypes.func, - PropTypes.array, - ]), - origin: PropTypes.shape({ - x: CustomPropTypes.nonNegative.isRequired, - y: CustomPropTypes.nonNegative.isRequired, - }), - polar: PropTypes.bool, - renderInPortal: PropTypes.bool, - scale: PropTypes.shape({ - x: CustomPropTypes.scale, - y: CustomPropTypes.scale, - }), - style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), - tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - text: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - PropTypes.func, - PropTypes.array, - ]), - // @ts-expect-error Function is not assignable to string" - textAnchor: PropTypes.oneOfType([ - PropTypes.oneOf(["start", "middle", "end", "inherit"]), - PropTypes.func, - ]), - textComponent: PropTypes.element, - title: PropTypes.string, - transform: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.object, - PropTypes.func, - ]), - tspanComponent: PropTypes.element, - // @ts-expect-error Function is not assignable to string" - verticalAnchor: PropTypes.oneOfType([ - PropTypes.oneOf(["start", "middle", "end"]), - PropTypes.func, - ]), - // @ts-expect-error Number is not assignable to string - x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - // @ts-expect-error Number is not assignable to string - y: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), -}; diff --git a/packages/victory-core/src/victory-portal/portal.tsx b/packages/victory-core/src/victory-portal/portal.tsx index b9f7929f4..3195394f4 100644 --- a/packages/victory-core/src/victory-portal/portal.tsx +++ b/packages/victory-core/src/victory-portal/portal.tsx @@ -1,6 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; -import * as CustomPropTypes from "../victory-util/prop-types"; import { keys } from "lodash"; import { PortalContextValue } from "./portal-context"; @@ -18,13 +16,6 @@ export class Portal { static displayName = "Portal"; - static propTypes = { - className: PropTypes.string, - height: CustomPropTypes.nonNegative, - style: PropTypes.object, - viewBox: PropTypes.string, - width: CustomPropTypes.nonNegative, - }; private readonly map: Record; private index: number; diff --git a/packages/victory-core/src/victory-portal/victory-portal.tsx b/packages/victory-core/src/victory-portal/victory-portal.tsx index 79f9ccb63..659f22608 100644 --- a/packages/victory-core/src/victory-portal/victory-portal.tsx +++ b/packages/victory-core/src/victory-portal/victory-portal.tsx @@ -1,5 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; import { defaults } from "lodash"; import * as Log from "../victory-util/log"; import * as Helpers from "../victory-util/helpers"; @@ -19,11 +18,6 @@ export class VictoryPortal extends React.Component { static role = "portal"; - static propTypes = { - children: PropTypes.node, - groupComponent: PropTypes.element, - }; - static defaultProps = { groupComponent: , }; diff --git a/packages/victory-core/src/victory-primitives/arc.tsx b/packages/victory-core/src/victory-primitives/arc.tsx index 861feeb2e..9eaad6a7c 100644 --- a/packages/victory-core/src/victory-primitives/arc.tsx +++ b/packages/victory-core/src/victory-primitives/arc.tsx @@ -1,11 +1,7 @@ /* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 180] }]*/ import React from "react"; -import PropTypes from "prop-types"; import * as Helpers from "../victory-util/helpers"; -import { - CommonProps, - VictoryCommonPrimitiveProps, -} from "../victory-util/common-props"; +import { VictoryCommonPrimitiveProps } from "../victory-util/common-props"; import { Path } from "./path"; export interface ArcProps extends VictoryCommonPrimitiveProps { @@ -85,15 +81,3 @@ export const Arc = (initialProps: ArcProps) => { clipPath: props.clipPath, }); }; - -Arc.propTypes = { - ...CommonProps.primitiveProps, - closedPath: PropTypes.bool, - cx: PropTypes.number, - cy: PropTypes.number, - datum: PropTypes.any, - endAngle: PropTypes.number, - pathComponent: PropTypes.element, - r: PropTypes.number, - startAngle: PropTypes.number, -}; diff --git a/packages/victory-core/src/victory-primitives/background.tsx b/packages/victory-core/src/victory-primitives/background.tsx index 466896bba..04f826d03 100644 --- a/packages/victory-core/src/victory-primitives/background.tsx +++ b/packages/victory-core/src/victory-primitives/background.tsx @@ -1,10 +1,6 @@ import React from "react"; -import PropTypes from "prop-types"; import * as Helpers from "../victory-util/helpers"; -import { - CommonProps, - VictoryCommonPrimitiveProps, -} from "../victory-util/common-props"; +import { VictoryCommonPrimitiveProps } from "../victory-util/common-props"; import { Rect } from "./rect"; import { Circle } from "./circle"; @@ -64,15 +60,3 @@ export const Background = (initialProps: BackgroundProps) => { className: props.className, }); }; - -Background.propTypes = { - ...CommonProps.primitiveProps, - circleComponent: PropTypes.element, - height: PropTypes.number, - rectComponent: PropTypes.element, - rx: PropTypes.number, - ry: PropTypes.number, - width: PropTypes.number, - x: PropTypes.number, - y: PropTypes.number, -}; diff --git a/packages/victory-core/src/victory-primitives/border.tsx b/packages/victory-core/src/victory-primitives/border.tsx index 50adb0cb1..ea7ac0866 100644 --- a/packages/victory-core/src/victory-primitives/border.tsx +++ b/packages/victory-core/src/victory-primitives/border.tsx @@ -1,10 +1,6 @@ import React from "react"; -import PropTypes from "prop-types"; import * as Helpers from "../victory-util/helpers"; -import { - CommonProps, - VictoryCommonPrimitiveProps, -} from "../victory-util/common-props"; +import { VictoryCommonPrimitiveProps } from "../victory-util/common-props"; import { Rect } from "./rect"; export interface BorderProps extends VictoryCommonPrimitiveProps { @@ -62,12 +58,3 @@ export const Border = (initialProps: BorderProps) => { clipPath: props.clipPath, }); }; - -Border.propTypes = { - ...CommonProps.primitiveProps, - height: PropTypes.number, - rectComponent: PropTypes.element, - width: PropTypes.number, - x: PropTypes.number, - y: PropTypes.number, -}; diff --git a/packages/victory-core/src/victory-primitives/line-segment.tsx b/packages/victory-core/src/victory-primitives/line-segment.tsx index f7dae16f1..c45206854 100644 --- a/packages/victory-core/src/victory-primitives/line-segment.tsx +++ b/packages/victory-core/src/victory-primitives/line-segment.tsx @@ -1,10 +1,6 @@ import React from "react"; -import PropTypes from "prop-types"; import * as Helpers from "../victory-util/helpers"; -import { - CommonProps, - VictoryCommonPrimitiveProps, -} from "../victory-util/common-props"; +import { VictoryCommonPrimitiveProps } from "../victory-util/common-props"; import { Line } from "./line"; export interface LineSegmentProps extends VictoryCommonPrimitiveProps { @@ -63,13 +59,3 @@ export const LineSegment = (initialProps: LineSegmentProps) => { clipPath: props.clipPath, }); }; - -LineSegment.propTypes = { - ...CommonProps.primitiveProps, - datum: PropTypes.any, - lineComponent: PropTypes.element, - x1: PropTypes.number, - x2: PropTypes.number, - y1: PropTypes.number, - y2: PropTypes.number, -}; diff --git a/packages/victory-core/src/victory-primitives/point.tsx b/packages/victory-core/src/victory-primitives/point.tsx index 528cf6f22..6b25a213b 100644 --- a/packages/victory-core/src/victory-primitives/point.tsx +++ b/packages/victory-core/src/victory-primitives/point.tsx @@ -1,11 +1,7 @@ -import PropTypes from "prop-types"; import React from "react"; import * as Helpers from "../victory-util/helpers"; import * as pathHelpers from "../victory-util/point-path-helpers"; -import { - CommonProps, - VictoryCommonPrimitiveProps, -} from "../victory-util/common-props"; +import { VictoryCommonPrimitiveProps } from "../victory-util/common-props"; import * as UserProps from "../victory-util/user-props"; import { Path } from "./path"; import { ScatterSymbolType } from "./types"; @@ -90,27 +86,3 @@ export const Point = (initialProps: PointProps) => { ...userProps, }); }; - -Point.propTypes = { - ...CommonProps.primitiveProps, - datum: PropTypes.object, - getPath: PropTypes.func, - pathComponent: PropTypes.element, - size: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - symbol: PropTypes.oneOfType([ - PropTypes.oneOf([ - "circle", - "cross", - "diamond", - "plus", - "minus", - "square", - "star", - "triangleDown", - "triangleUp", - ]), - PropTypes.func, - ]), - x: PropTypes.number, - y: PropTypes.number, -}; diff --git a/packages/victory-core/src/victory-primitives/whisker.tsx b/packages/victory-core/src/victory-primitives/whisker.tsx index 53e8bf3fe..c91b02239 100644 --- a/packages/victory-core/src/victory-primitives/whisker.tsx +++ b/packages/victory-core/src/victory-primitives/whisker.tsx @@ -1,10 +1,6 @@ import React from "react"; -import PropTypes from "prop-types"; import * as Helpers from "../victory-util/helpers"; -import { - CommonProps, - VictoryCommonPrimitiveProps, -} from "../victory-util/common-props"; +import { VictoryCommonPrimitiveProps } from "../victory-util/common-props"; import { Line } from "./line"; export type WhiskerAxes = { @@ -95,21 +91,3 @@ export const Whisker = (initialProps: WhiskerProps) => { ), ]); }; - -Whisker.propTypes = { - ...CommonProps.primitiveProps, - groupComponent: PropTypes.element, - lineComponent: PropTypes.element, - majorWhisker: PropTypes.shape({ - x1: PropTypes.number, - x2: PropTypes.number, - y1: PropTypes.number, - y2: PropTypes.number, - }), - minorWhisker: PropTypes.shape({ - x1: PropTypes.number, - x2: PropTypes.number, - y1: PropTypes.number, - y2: PropTypes.number, - }), -}; diff --git a/packages/victory-core/src/victory-transition/victory-transition.tsx b/packages/victory-core/src/victory-transition/victory-transition.tsx index 9c6d9b355..a795d6d3c 100644 --- a/packages/victory-core/src/victory-transition/victory-transition.tsx +++ b/packages/victory-core/src/victory-transition/victory-transition.tsx @@ -1,5 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; import { VictoryAnimation } from "../victory-animation/victory-animation"; import * as Collection from "../victory-util/collection"; import * as Helpers from "../victory-util/helpers"; @@ -49,12 +48,6 @@ export class VictoryTransition extends React.Component< > { static displayName = "VictoryTransition"; - static propTypes = { - animate: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), - animationWhitelist: PropTypes.array, - children: PropTypes.node, - }; - static contextType = TimerContext; private continuous: boolean; private timer: Timer; diff --git a/packages/victory-core/src/victory-util/common-props.tsx b/packages/victory-core/src/victory-util/common-props.tsx index 1b0153234..dbe8fe8d6 100644 --- a/packages/victory-core/src/victory-util/common-props.tsx +++ b/packages/victory-core/src/victory-util/common-props.tsx @@ -1,5 +1,3 @@ -import PropTypes from "prop-types"; -import * as CustomPropTypes from "./prop-types"; import * as React from "react"; import { OriginType } from "../victory-label/victory-label"; import { PaddingProps, VictoryThemeDefinition } from "../victory-theme/types"; @@ -32,65 +30,6 @@ export interface VictoryDatableProps { y?: DataGetterPropType; y0?: DataGetterPropType; } -const dataProps: React.WeakValidationMap = { - // @ts-expect-error TODO: synchronize the type with this PropTypes - categories: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.string), - PropTypes.shape({ - x: PropTypes.arrayOf(PropTypes.string), - y: PropTypes.arrayOf(PropTypes.string), - }), - ]), - // @ts-expect-error TODO: synchronize the type with this PropTypes - data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), - dataComponent: PropTypes.element, - disableInlineStyles: PropTypes.bool, - labelComponent: PropTypes.element, - labels: PropTypes.oneOfType([PropTypes.func, PropTypes.array]), - samples: CustomPropTypes.nonNegative, - sortKey: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string.isRequired), - ]), - sortOrder: PropTypes.oneOf(["ascending", "descending"]), - style: PropTypes.shape({ - parent: PropTypes.object, - data: PropTypes.object, - labels: PropTypes.object, - }), - x: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string.isRequired), - ]), - y: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string.isRequired), - ]), - y0: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string.isRequired), - ]), -}; export interface VictoryCommonThemeProps { animate?: boolean | AnimatePropTypeInterface; colorScale?: ColorScalePropType; @@ -127,133 +66,6 @@ export interface VictoryCommonThemeProps { export interface VictoryCommonProps extends VictoryCommonThemeProps { theme?: VictoryThemeDefinition; } -const baseProps: React.WeakValidationMap = { - animate: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]), - containerComponent: PropTypes.element, - domain: PropTypes.oneOfType([ - CustomPropTypes.domain, - PropTypes.shape({ x: CustomPropTypes.domain, y: CustomPropTypes.domain }), - ]), - // @ts-expect-error TODO: synchronize the type with this PropTypes - maxDomain: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.instanceOf(Date), - PropTypes.shape({ - x: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]), - y: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]), - }), - ]), - // @ts-expect-error TODO: synchronize the type with this PropTypes - minDomain: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.instanceOf(Date), - PropTypes.shape({ - x: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]), - y: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]), - }), - ]), - // @ts-expect-error TODO: synchronize the type with this PropTypes - domainPadding: PropTypes.oneOfType([ - PropTypes.shape({ - x: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.arrayOf(PropTypes.number), - ]), - y: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.arrayOf(PropTypes.number), - ]), - }), - PropTypes.number, - PropTypes.arrayOf(PropTypes.number), - ]), - eventKey: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - ]), - events: PropTypes.arrayOf( - PropTypes.shape({ - target: PropTypes.oneOf(["data", "labels", "parent"]), - eventKey: PropTypes.oneOfType([ - PropTypes.array, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - ]), - eventHandlers: PropTypes.object, - }), - ), - // @ts-expect-error TODO: synchronize the type with this PropTypes - externalEventMutations: PropTypes.arrayOf( - PropTypes.shape({ - callback: PropTypes.func, - childName: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), - eventKey: PropTypes.oneOfType([ - PropTypes.array, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - ]), - mutation: PropTypes.func, - target: PropTypes.oneOfType([PropTypes.string, PropTypes.array]), - }), - ), - groupComponent: PropTypes.element, - height: CustomPropTypes.nonNegative, - name: PropTypes.string, - // @ts-expect-error TODO: synchronize the type with this PropTypes - origin: PropTypes.shape({ x: PropTypes.number, y: PropTypes.number }), - // @ts-expect-error TODO: synchronize the type with this PropTypes - padding: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.shape({ - top: PropTypes.number, - bottom: PropTypes.number, - left: PropTypes.number, - right: PropTypes.number, - }), - ]), - polar: PropTypes.bool, - range: PropTypes.oneOfType([ - CustomPropTypes.domain, - PropTypes.shape({ - x: CustomPropTypes.domain.isRequired, - y: CustomPropTypes.domain.isRequired, - }), - ]), - scale: PropTypes.oneOfType([ - CustomPropTypes.scale, - PropTypes.shape({ - x: CustomPropTypes.scale.isRequired, - y: CustomPropTypes.scale.isRequired, - }), - ]), - // @ts-expect-error TODO: synchronize the type with this PropTypes - sharedEvents: PropTypes.shape({ - events: PropTypes.array, - getEventState: PropTypes.func, - }), - // @ts-expect-error TODO: synchronize the type with this PropTypes - singleQuadrantDomainPadding: PropTypes.oneOfType([ - PropTypes.bool, - PropTypes.shape({ - x: PropTypes.oneOfType([PropTypes.bool]), - y: PropTypes.oneOfType([PropTypes.bool]), - }), - ]), - standalone: PropTypes.bool, - theme: PropTypes.object, - width: CustomPropTypes.nonNegative, -}; - export interface VictoryCommonPrimitiveProps { active?: boolean; ariaLabel?: StringOrCallback; @@ -276,33 +88,3 @@ export interface VictoryCommonPrimitiveProps { tabIndex?: NumberOrCallback; transform?: string; } -const primitiveProps: React.WeakValidationMap = { - active: PropTypes.bool, - ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - className: PropTypes.string, - clipPath: PropTypes.string, - data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), - desc: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - disableInlineStyles: PropTypes.bool, - events: PropTypes.object, - id: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]), - index: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - // @ts-expect-error TODO: synchronize the type with this PropTypes - origin: PropTypes.shape({ x: PropTypes.number, y: PropTypes.number }), - polar: PropTypes.bool, - role: PropTypes.string, - scale: PropTypes.oneOfType([ - CustomPropTypes.scale, - PropTypes.shape({ x: CustomPropTypes.scale, y: CustomPropTypes.scale }), - ]), - shapeRendering: PropTypes.string, - style: PropTypes.object, - tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - transform: PropTypes.string, -}; - -export const CommonProps = { - dataProps, - baseProps, - primitiveProps, -}; diff --git a/packages/victory-core/src/victory-util/index.ts b/packages/victory-core/src/victory-util/index.ts index cc446454c..9de3baccb 100644 --- a/packages/victory-core/src/victory-util/index.ts +++ b/packages/victory-core/src/victory-util/index.ts @@ -13,7 +13,6 @@ export * as LabelHelpers from "./label-helpers"; export * as LineHelpers from "./line-helpers"; export * as Log from "./log"; export * as PointPathHelpers from "./point-path-helpers"; -export * as PropTypes from "./prop-types"; export * as Scale from "./scale"; export * as Selection from "./selection"; export type { SVGCoordinateType, SVGCoordinateBounds } from "./selection"; diff --git a/packages/victory-core/src/victory-util/prop-types.test.ts b/packages/victory-core/src/victory-util/prop-types.test.ts deleted file mode 100644 index 985879fd0..000000000 --- a/packages/victory-core/src/victory-util/prop-types.test.ts +++ /dev/null @@ -1,439 +0,0 @@ -/* global console */ -/* eslint no-unused-expressions: 0 */ -import React from "react"; -import PropTypes from "prop-types"; -import { PropTypes as CustomPropTypes } from "victory-core"; - -describe("victory-util/prop-types", () => { - const rest = ["location", "propFullName"] as const; - - describe("should be type-safe", () => { - const TestComp: React.FC<{ - number: number; - string: string; - optional?: string; - }> = () => null; - - it("check regular PropTypes", () => { - // Correct usage: - TestComp.propTypes = { number: PropTypes.number.isRequired }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { number: PropTypes.number }; - - // Correct usage: - TestComp.propTypes = { string: PropTypes.string.isRequired }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { string: PropTypes.number }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { string: PropTypes.number.isRequired }; - - // Correct usage: - TestComp.propTypes = { optional: PropTypes.string }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { optional: PropTypes.number }; - }); - - it("CustomPropTypes.integer", () => { - // Correct usage: - TestComp.propTypes = { number: CustomPropTypes.integer.isRequired }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { number: CustomPropTypes.integer }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { string: CustomPropTypes.integer.isRequired }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { string: CustomPropTypes.integer }; - }); - it("CustomPropTypes.greaterThanZero", () => { - // Correct usage: - TestComp.propTypes = { - number: CustomPropTypes.greaterThanZero.isRequired, - }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { number: CustomPropTypes.greaterThanZero }; - TestComp.propTypes = { - // @ts-expect-error Incorrect usage: - string: CustomPropTypes.greaterThanZero.isRequired, - }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { string: CustomPropTypes.greaterThanZero }; - }); - it("CustomPropTypes.nonNegative", () => { - // Correct usage: - TestComp.propTypes = { number: CustomPropTypes.nonNegative.isRequired }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { number: CustomPropTypes.nonNegative }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { string: CustomPropTypes.nonNegative.isRequired }; - // @ts-expect-error Incorrect usage: - TestComp.propTypes = { string: CustomPropTypes.nonNegative }; - }); - }); - - /* eslint-disable no-console */ - describe("deprecated", () => { - const shouldWarn = (message) => { - expect(console.warn).toBeCalledTimes(1); - expect(console.warn).toBeCalledWith(message); - }; - - const shouldError = (message) => { - expect(console.error).toBeCalledTimes(1); - expect(console.error).toBeCalledWith(message); - }; - - const shouldNotError = () => { - expect(console.error).not.toHaveBeenCalled(); - }; - - const validate = (prop) => { - return CustomPropTypes.deprecated(PropTypes.string, "Read more at link")( - { - pName: prop, - }, - "pName", - "ComponentName", - ...rest, - )!; - }; - - beforeEach(() => { - jest.spyOn(console, "warn").mockImplementation(() => null); - jest.spyOn(console, "error").mockImplementation(() => null); - }); - - afterEach(() => { - jest.clearAllMocks(); - }); - - it("Should warn about deprecation and validate OK", () => { - validate("value"); - shouldWarn( - '"pName" property of "ComponentName" has been deprecated Read more at link', - ); - shouldNotError(); - }); - - it(`Should warn about deprecation and throw validation error when property - value is not OK`, () => { - validate({}); - shouldWarn( - '"pName" property of "ComponentName" has been deprecated Read more at link', - ); - shouldError( - "Warning: Failed pName type: Invalid pName `pName` of type `object` supplied to " + - "`ComponentName`, expected `string`.", - ); - }); - }); - /* eslint-enable no-console */ - - describe("allOfType", () => { - const validate = function (prop) { - const validator = CustomPropTypes.allOfType([ - CustomPropTypes.nonNegative, - CustomPropTypes.integer, - ]); - return validator( - { testProp: prop }, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("returns an error if the first validator is false", () => { - const result = validate(-1); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a non-negative number.", - ); - }); - - it("returns an error if the second validator is false", () => { - const result = validate(1.3); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be an integer.", - ); - }); - - it("does not return an error if both validators are true", () => { - const result = validate(3); - expect(result).not.toBeInstanceOf(Error); - }); - }); - - describe("nonNegative", () => { - const validate = function (prop) { - return CustomPropTypes.nonNegative( - { testProp: prop }, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("returns an error for non numeric values", () => { - const result = validate("a"); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a non-negative number.", - ); - }); - - it("returns an error for negative numeric values", () => { - const result = validate(-1); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a non-negative number.", - ); - }); - - it("does not return an error for positive numeric values", () => { - const result = validate(1); - expect(result).not.toBeInstanceOf(Error); - }); - - it("does not return an error for zero", () => { - const result = validate(0); - expect(result).not.toBeInstanceOf(Error); - }); - }); - - describe("integer", () => { - const validate = function (prop) { - return CustomPropTypes.integer( - { testProp: prop }, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("returns an error for non numeric values", () => { - const result = validate("a"); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be an integer.", - ); - }); - - it("returns an error for non-integer numeric values", () => { - const result = validate(2.4); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be an integer.", - ); - }); - - it("does not return an error for integers", () => { - let result = validate(3); - expect(result).not.toBeInstanceOf(Error); - result = validate(-3); - expect(result).not.toBeInstanceOf(Error); - result = validate(0); - expect(result).not.toBeInstanceOf(Error); - }); - }); - - describe("greaterThanZero", () => { - const validate = function (prop) { - return CustomPropTypes.greaterThanZero( - { testProp: prop }, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("returns an error for non numeric values", () => { - const result = validate("a"); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a number greater than zero.", - ); - }); - - it("returns an error for zero", () => { - const result = validate(0); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a number greater than zero.", - ); - }); - - it("returns an error for negative numbers", () => { - const result = validate(-3); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a number greater than zero.", - ); - }); - - it("does not return an error for numbers greater than zero", () => { - let result = validate(0.1); - expect(result).not.toBeInstanceOf(Error); - result = validate(5); - expect(result).not.toBeInstanceOf(Error); - result = validate(1); - expect(result).not.toBeInstanceOf(Error); - }); - }); - - describe("domain", () => { - const validate = function (prop) { - return CustomPropTypes.domain( - { testProp: prop }, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("returns an error for non array values", () => { - const result = validate("a"); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be an array of two unique numeric values.", - ); - }); - - it("returns an error when the length of the array is not two", () => { - const result = validate([1]); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be an array of two unique numeric values.", - ); - }); - - it("returns an error when the values of the array are equal", () => { - const result = validate([1, 1]); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be an array of two unique numeric values.", - ); - }); - - it("does not return an error for two element ascending arrays", () => { - const result = validate([0, 1]); - expect(result).not.toBeInstanceOf(Error); - }); - - it("does not return an error for two element descending arrays", () => { - const result = validate([1, 0]); - expect(result).not.toBeInstanceOf(Error); - }); - - it("does not return an error arrays of dates", () => { - const result = validate([new Date(1980, 1, 1), new Date(1990, 1, 1)]); - expect(result).not.toBeInstanceOf(Error); - }); - }); - - describe("scale", () => { - const validate = function (prop) { - return CustomPropTypes.scale( - { testProp: prop }, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("returns an error for non function values", () => { - const result = validate("a"); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a d3 scale.", - ); - }); - - it("returns an error when the function does not have a domain, range, and copy methods", () => { - const testFunc = () => "oops"; - - const result = validate(testFunc); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be a d3 scale.", - ); - }); - - it.skip("does not return an error when the function is a d3 scale", () => { - // const testFunc = d3.scale.linear; TODO: Mock this rather than depending on d3 - // const result = validate(testFunc); - // expect(result).not.to.be.an.instanceOf(Error); - }); - }); - - describe("homogeneousArray", () => { - const validate = function (prop) { - return CustomPropTypes.homogeneousArray( - { testProp: prop }, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("returns an error for non array values", () => { - const result = validate("a"); - expect(result).toBeInstanceOf(Error); - expect(result.message).toContain( - "`testProp` in `TestComponent` must be an array.", - ); - }); - - it("returns an error when the array has elements of different types", () => { - const result = validate([1, "a"]); - expect(result).toBeInstanceOf(Error); - expect(result.message).toEqual( - "Expected `testProp` in `TestComponent` to be a homogeneous array, but found " + - "types `Number` and `String`.", - ); - }); - - it("does not return an error for empty arrays", () => { - const result = validate([]); - expect(result).not.toBeInstanceOf(Error); - }); - - it("does not return an error for arrays with one item", () => { - const result = validate(["a"]); - expect(result).not.toBeInstanceOf(Error); - }); - - it("does not return an error for arrays where all elements are the same type", () => { - const result = validate([1, 0]); - expect(result).not.toBeInstanceOf(Error); - }); - }); - - describe("matchDataLength", () => { - const validate = function (prop?, dataProp?) { - const props = { testProp: prop, data: dataProp }; - return CustomPropTypes.matchDataLength( - props, - "testProp", - "TestComponent", - ...rest, - )!; - }; - - it("does not return an error when prop is undefined", () => { - expect(validate()).not.toBeInstanceOf(Error); - }); - - it("does not return an error when prop has same length as data", () => { - expect(validate([{}, {}], [1, 2])).not.toBeInstanceOf(Error); - }); - - it("returns an error when prop doesn't have same length as data", () => { - const result = validate([{}], [1, 2]); - expect(result).toBeInstanceOf(Error); - expect(result).toHaveProperty( - "message", - "Length of data and testProp arrays must match.", - ); - }); - }); -}); diff --git a/packages/victory-core/src/victory-util/prop-types.ts b/packages/victory-core/src/victory-util/prop-types.ts deleted file mode 100644 index 87a95a532..000000000 --- a/packages/victory-core/src/victory-util/prop-types.ts +++ /dev/null @@ -1,254 +0,0 @@ -/* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }] */ -/* eslint-disable max-params */ - -import { find, isRegExp } from "lodash"; -import * as Log from "./log"; -import PropTypes from "prop-types"; -import * as Scale from "./scale"; -import { D3Scale, ScaleName } from "../types/prop-types"; - -/** - * Return a new validator based on `validator` but with the option to chain - * `isRequired` onto the validation. This is nearly identical to how React - * does it internally, but they don't expose their helper for us to use. - * @param {Function} validator Validation function. - * @returns {Function} Validator with `isRequired` option. - */ -const makeChainable = function (validator: PropTypes.Validator) { - const createChainable = - (isRequired: boolean): PropTypes.Validator => - (props, propName, componentName, ...rest) => { - const value = props[propName]; - if (value === undefined || value === null) { - if (isRequired) { - return new Error( - `Required \`${propName}\` was not specified in \`${componentName}\`.`, - ); - } - return null; - } - return validator(props, propName, componentName, ...rest); - }; - const chainable = Object.assign(createChainable(false), { - isRequired: createChainable(true), - }); - return chainable as PropTypes.Requireable; -}; - -const nullConstructor = () => null; -const undefinedConstructor = () => undefined; - -/** - * Get the constructor of `value`. If `value` is null or undefined, return the - * special singletons `nullConstructor` or `undefinedConstructor`, respectively. - * @param {*} value Instance to return the constructor of. - * @returns {Function} Constructor of `value`. - */ -const getConstructor = (value) => { - if (value === undefined) { - return undefinedConstructor; - } else if (value === null) { - return nullConstructor; - } - return value.constructor; -}; - -/** - * Get the name of the constructor used to create `value`, using - * `Object.prototype.toString`. If the value is null or undefined, return - * "null" or "undefined", respectively. - * @param {*} value Instance to return the constructor name of. - * @returns {String} Name of the constructor. - */ -const getConstructorName = (value) => { - if (value === undefined) { - return "undefined"; - } else if (value === null) { - return "null"; - } - return Object.prototype.toString.call(value).slice(8, -1); // eslint-disable-line no-magic-numbers -}; - -/** - * Return a new validator based on `propType` but which logs a `console.error` - * with `explanation` if used. - * @param {Function} propType The old, deprecated propType. - * @param {String} explanation The message to provide the user of the deprecated propType. - * @returns {Function} Validator which logs usage of this propType - */ -export function deprecated( - propType: PropTypes.Validator, - explanation: string, -): PropTypes.Validator { - return (props, propName, componentName) => { - const value = props[propName]; - if (value !== null && value !== undefined) { - Log.warn( - `"${propName}" property of "${componentName}" has been deprecated ${explanation}`, - ); - } - PropTypes.checkPropTypes( - { [propName]: propType }, - props, - propName, - componentName, - ); - return null; - }; -} - -/** - * Return a new validator which returns true - * if and only if all validators passed as arguments return true. - * Like React.propTypes.oneOfType, except "all" instead of "any" - * @param {Array} validators Validation functions. - * @returns {Function} Combined validator function - */ -export function allOfType(validators: Array>) { - return makeChainable((props, propName, componentName, ...rest) => { - return validators.reduce( - (result, validator) => - result || validator(props, propName, componentName, ...rest), - null, - ); - }); -} - -/** - * Check that the value is a non-negative number. - */ -export const nonNegative = makeChainable( - (props, propName, componentName) => { - const value = props[propName]; - if (typeof value !== "number" || value < 0) { - return new Error( - `\`${propName}\` in \`${componentName}\` must be a non-negative number.`, - ); - } - return null; - }, -); - -/** - * Check that the value is an integer. - */ -export const integer = makeChainable( - (props, propName, componentName) => { - const value = props[propName]; - if (typeof value !== "number" || value % 1 !== 0) { - return new Error( - `\`${propName}\` in \`${componentName}\` must be an integer.`, - ); - } - return null; - }, -); - -/** - * Check that the value is greater than zero. - */ -export const greaterThanZero = makeChainable( - (props, propName, componentName) => { - const value = props[propName]; - if (typeof value !== "number" || value <= 0) { - return new Error( - `\`${propName}\` in \`${componentName}\` must be a number greater than zero.`, - ); - } - return null; - }, -); - -/** - * Check that the value is an Array of two unique values. - */ -export const domain = makeChainable<[number, number]>( - (props, propName, componentName) => { - const value = props[propName]; - if (!Array.isArray(value) || value.length !== 2 || value[1] === value[0]) { - return new Error( - `\`${propName}\` in \`${componentName}\` must be an array of two unique numeric values.`, - ); - } - return null; - }, -); - -/** - * Check that the value looks like a d3 `scale` function. - */ -export const scale = makeChainable( - (props, propName, componentName) => { - const value = props[propName]; - if (!Scale.validScale(value)) { - return new Error( - `\`${propName}\` in \`${componentName}\` must be a d3 scale.`, - ); - } - return null; - }, -); - -/** - * Check that an array contains items of the same type. - */ -export const homogeneousArray = makeChainable( - (props, propName, componentName) => { - const values = props[propName]; - if (!Array.isArray(values)) { - return new Error( - `\`${propName}\` in \`${componentName}\` must be an array.`, - ); - } - - if (values.length < 2) { - return null; - } - - const comparisonConstructor = getConstructor(values[0]); - - const typeMismatchedValue = find(values, (value) => { - return comparisonConstructor !== getConstructor(value); - }); - - if (typeMismatchedValue) { - const constructorName = getConstructorName(values[0]); - const otherConstructorName = getConstructorName(typeMismatchedValue); - - return new Error( - `Expected \`${propName}\` in \`${componentName}\` to be a ` + - `homogeneous array, but found types \`${constructorName}\` and ` + - `\`${otherConstructorName}\`.`, - ); - } - return null; - }, -); - -/** - * Check that array prop length matches props.data.length - */ -export const matchDataLength = makeChainable((props, propName) => { - if ( - props[propName] && - Array.isArray(props[propName]) && - props[propName].length !== props.data.length - ) { - return new Error(`Length of data and ${propName} arrays must match.`); - } - return null; -}); - -/** - * Check that the value is a regular expression - */ -export const regExp = makeChainable( - (props, propName, componentName) => { - if (props[propName] && !isRegExp(props[propName])) { - return new Error( - `\`${propName}\` in \`${componentName}\` must be a regular expression.`, - ); - } - return null; - }, -); diff --git a/packages/victory-cursor-container/package.json b/packages/victory-cursor-container/package.json index 0605408fa..12dfbf74f 100644 --- a/packages/victory-cursor-container/package.json +++ b/packages/victory-cursor-container/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-cursor-container/src/victory-cursor-container.tsx b/packages/victory-cursor-container/src/victory-cursor-container.tsx index d0fa2f59b..27e5c0dd7 100644 --- a/packages/victory-cursor-container/src/victory-cursor-container.tsx +++ b/packages/victory-cursor-container/src/victory-cursor-container.tsx @@ -1,14 +1,13 @@ -import PropTypes from "prop-types"; import React from "react"; import { VictoryContainer, - VictoryLabel, - LineSegment, Helpers, VictoryContainerProps, CoordinatesPropType, VictoryLabelProps, ValueOrAccessor, + VictoryLabel, + LineSegment, } from "victory-core"; import { defaults, isObject } from "lodash"; import { CursorHelpers } from "./cursor-helpers"; @@ -38,28 +37,6 @@ export function cursorContainerMixin< // @ts-expect-error "TS2545: A mixin class must have a constructor with a single rest parameter of type 'any[]'." return class VictoryCursorContainer extends Base { static displayName = "VictoryCursorContainer"; - static propTypes = { - ...VictoryContainer.propTypes, - cursorDimension: PropTypes.oneOf(["x", "y"]), - cursorLabel: PropTypes.func, - cursorLabelComponent: PropTypes.element, - cursorLabelOffset: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.shape({ - x: PropTypes.number, - y: PropTypes.number, - }), - ]), - defaultCursorValue: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.shape({ - x: PropTypes.number, - y: PropTypes.number, - }), - ]), - disable: PropTypes.bool, - onCursorChange: PropTypes.func, - }; static defaultProps = { ...VictoryContainer.defaultProps, cursorLabelComponent: , @@ -69,7 +46,6 @@ export function cursorContainerMixin< }, cursorComponent: , }; - static defaultEvents = (props) => { return [ { diff --git a/packages/victory-errorbar/package.json b/packages/victory-errorbar/package.json index 17a1dfc9c..a21ca1b6a 100644 --- a/packages/victory-errorbar/package.json +++ b/packages/victory-errorbar/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-errorbar/src/error-bar.tsx b/packages/victory-errorbar/src/error-bar.tsx index 752a03ea2..9869731df 100644 --- a/packages/victory-errorbar/src/error-bar.tsx +++ b/packages/victory-errorbar/src/error-bar.tsx @@ -1,9 +1,7 @@ /* eslint-disable max-statements */ import React from "react"; -import PropTypes from "prop-types"; import { Helpers, - CommonProps, Line, UserProps, VictoryCommonPrimitiveProps, @@ -139,23 +137,3 @@ export const ErrorBar = ( children, ); }; - -ErrorBar.propTypes = { - ...CommonProps.primitiveProps, - borderWidth: PropTypes.number, - datum: PropTypes.object, - errorX: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.array, - PropTypes.bool, - ]), - errorY: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.array, - PropTypes.bool, - ]), - groupComponent: PropTypes.element, - lineComponent: PropTypes.element, - x: PropTypes.number, - y: PropTypes.number, -}; diff --git a/packages/victory-errorbar/src/victory-errorbar.tsx b/packages/victory-errorbar/src/victory-errorbar.tsx index 993f83dfa..6849e7968 100644 --- a/packages/victory-errorbar/src/victory-errorbar.tsx +++ b/packages/victory-errorbar/src/victory-errorbar.tsx @@ -1,14 +1,11 @@ -import PropTypes from "prop-types"; import React from "react"; import { - PropTypes as CustomPropTypes, Helpers, VictoryLabel, addEvents, VictoryContainer, VictoryTheme, DefaultTransitions, - CommonProps, UserProps, EventPropTypeInterface, StringOrNumberOrCallback, @@ -77,31 +74,6 @@ class VictoryErrorBarBase extends React.Component { static role = "errorbar"; static defaultTransitions = DefaultTransitions.discreteTransitions(); - static propTypes = { - ...CommonProps.baseProps, - ...CommonProps.dataProps, - borderWidth: PropTypes.number, - errorX: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string), - ]), - errorY: PropTypes.oneOfType([ - PropTypes.func, - CustomPropTypes.allOfType([ - CustomPropTypes.integer, - CustomPropTypes.nonNegative, - ]), - PropTypes.string, - PropTypes.arrayOf(PropTypes.string), - ]), - horizontal: PropTypes.bool, - }; - static defaultProps: VictoryErrorBarProps = { containerComponent: , data: defaultData, diff --git a/packages/victory-group/package.json b/packages/victory-group/package.json index 8b2c44da2..8640da153 100644 --- a/packages/victory-group/package.json +++ b/packages/victory-group/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-core": "^36.8.6", "victory-shared-events": "^36.8.6" diff --git a/packages/victory-group/src/victory-group.tsx b/packages/victory-group/src/victory-group.tsx index edd437256..007a36a1a 100644 --- a/packages/victory-group/src/victory-group.tsx +++ b/packages/victory-group/src/victory-group.tsx @@ -1,10 +1,8 @@ import { defaults, isEmpty } from "lodash"; -import PropTypes from "prop-types"; import React from "react"; import { CategoryPropType, ColorScalePropType, - CommonProps, DomainPaddingPropType, DomainPropType, EventPropTypeInterface, @@ -189,17 +187,6 @@ const VictoryGroupBase: React.FC = (initialProps) => { return React.cloneElement(container, container.props, newChildren); }; -VictoryGroupBase.propTypes = { - ...CommonProps.baseProps, - ...CommonProps.dataProps, - children: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.node), - PropTypes.node, - ]), - horizontal: PropTypes.bool, - offset: PropTypes.number, -}; - const componentConfig: VictoryComponentConfiguration = { role: "group", expectedComponents: [ diff --git a/packages/victory-histogram/package.json b/packages/victory-histogram/package.json index a7dede108..6988382d5 100644 --- a/packages/victory-histogram/package.json +++ b/packages/victory-histogram/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-bar": "^36.8.6", "victory-core": "^36.8.6", diff --git a/packages/victory-legend/package.json b/packages/victory-legend/package.json index 036fccc48..84b783b6a 100644 --- a/packages/victory-legend/package.json +++ b/packages/victory-legend/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-line/package.json b/packages/victory-line/package.json index cd579b37e..62358d6c7 100644 --- a/packages/victory-line/package.json +++ b/packages/victory-line/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6", "victory-vendor": "^36.8.6" }, diff --git a/packages/victory-line/src/curve.tsx b/packages/victory-line/src/curve.tsx index 73d4af784..c958e8208 100644 --- a/packages/victory-line/src/curve.tsx +++ b/packages/victory-line/src/curve.tsx @@ -1,9 +1,7 @@ /* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }]*/ import React from "react"; -import PropTypes from "prop-types"; import { Helpers, - CommonProps, Path, LineHelpers, UserProps, @@ -64,18 +62,6 @@ export const Curve: React.FC = (initialProps) => { }); }; -Curve.propTypes = { - ...CommonProps.primitiveProps, - interpolation: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - openCurve: PropTypes.bool, - origin: PropTypes.shape({ - x: PropTypes.number.isRequired, - y: PropTypes.number.isRequired, - }), - pathComponent: PropTypes.element, - polar: PropTypes.bool, -}; - export interface CurveProps extends VictoryCommonPrimitiveProps { ariaLabel?: StringOrCallback; // eslint-disable-next-line @typescript-eslint/ban-types diff --git a/packages/victory-line/src/victory-line.tsx b/packages/victory-line/src/victory-line.tsx index d970ff2de..1f0c890bb 100644 --- a/packages/victory-line/src/victory-line.tsx +++ b/packages/victory-line/src/victory-line.tsx @@ -1,9 +1,7 @@ -import PropTypes from "prop-types"; import React from "react"; import { getBaseProps } from "./helper-methods"; import { Curve } from "./curve"; import { - PropTypes as CustomPropTypes, Helpers, VictoryLabel, addEvents, @@ -13,7 +11,6 @@ import { VictoryClipContainer, Data, Domain, - CommonProps, UserProps, EventPropTypeInterface, InterpolationPropType, @@ -66,31 +63,6 @@ class VictoryLineBase extends React.Component { DefaultTransitions.continuousPolarTransitions(); static continuous = true; - static propTypes = { - ...CommonProps.baseProps, - ...CommonProps.dataProps, - interpolation: PropTypes.oneOfType([ - PropTypes.oneOf([ - "basis", - "bundle", - "cardinal", - "catmullRom", - "linear", - "monotoneX", - "monotoneY", - "natural", - "step", - "stepAfter", - "stepBefore", - ]), - PropTypes.func, - ]), - label: CustomPropTypes.deprecated( - PropTypes.string, - "Use `labels` instead for individual data labels", - ), - }; - static defaultProps = { containerComponent: , dataComponent: , diff --git a/packages/victory-native/src/index.ts b/packages/victory-native/src/index.ts index 88891ea33..47d352720 100644 --- a/packages/victory-native/src/index.ts +++ b/packages/victory-native/src/index.ts @@ -10,7 +10,6 @@ export { Events, Helpers, Log, - PropTypes, Scale, Style, TextSize, diff --git a/packages/victory-pie/package.json b/packages/victory-pie/package.json index f0b5da487..b1f78dd8e 100644 --- a/packages/victory-pie/package.json +++ b/packages/victory-pie/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6", "victory-vendor": "^36.8.6" }, diff --git a/packages/victory-pie/src/slice.tsx b/packages/victory-pie/src/slice.tsx index dbae193b5..0032667a0 100644 --- a/packages/victory-pie/src/slice.tsx +++ b/packages/victory-pie/src/slice.tsx @@ -1,8 +1,6 @@ import React from "react"; -import PropTypes from "prop-types"; import { Helpers, - CommonProps, Path, NumberOrCallback, SliceNumberOrCallback, @@ -135,17 +133,3 @@ export const Slice = (initialProps: SliceProps) => { tabIndex: props.tabIndex, }); }; - -Slice.propTypes = { - ...CommonProps.primitiveProps, - cornerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - datum: PropTypes.object, - innerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - padAngle: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - pathComponent: PropTypes.element, - pathFunction: PropTypes.func, - radius: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - slice: PropTypes.object, - sliceEndAngle: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), - sliceStartAngle: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), -}; diff --git a/packages/victory-polar-axis/package.json b/packages/victory-polar-axis/package.json index 5c5c9f638..4cb8bbb22 100644 --- a/packages/victory-polar-axis/package.json +++ b/packages/victory-polar-axis/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-scatter/package.json b/packages/victory-scatter/package.json index 026a3a8fe..7f8a9ed4a 100644 --- a/packages/victory-scatter/package.json +++ b/packages/victory-scatter/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-scatter/src/victory-scatter.tsx b/packages/victory-scatter/src/victory-scatter.tsx index 098714c0f..1c6880bc0 100644 --- a/packages/victory-scatter/src/victory-scatter.tsx +++ b/packages/victory-scatter/src/victory-scatter.tsx @@ -1,11 +1,8 @@ -import PropTypes from "prop-types"; import React from "react"; import { - PropTypes as CustomPropTypes, Helpers, VictoryLabel, addEvents, - CommonProps, VictoryContainer, VictoryTheme, DefaultTransitions, @@ -76,29 +73,6 @@ class VictoryScatterBase extends React.Component { static role = "scatter"; static defaultTransitions = DefaultTransitions.discreteTransitions(); - static propTypes = { - ...CommonProps.baseProps, - ...CommonProps.dataProps, - bubbleProperty: PropTypes.string, - maxBubbleSize: CustomPropTypes.nonNegative, - minBubbleSize: CustomPropTypes.nonNegative, - size: PropTypes.oneOfType([CustomPropTypes.nonNegative, PropTypes.func]), - symbol: PropTypes.oneOfType([ - PropTypes.oneOf([ - "circle", - "cross", - "diamond", - "plus", - "minus", - "square", - "star", - "triangleDown", - "triangleUp", - ]), - PropTypes.func, - ]), - }; - static defaultProps: VictoryScatterProps = { containerComponent: , dataComponent: , diff --git a/packages/victory-selection-container/package.json b/packages/victory-selection-container/package.json index 6adae05bb..d220fed68 100644 --- a/packages/victory-selection-container/package.json +++ b/packages/victory-selection-container/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-shared-events/package.json b/packages/victory-shared-events/package.json index 649d44c83..8ffd96f21 100644 --- a/packages/victory-shared-events/package.json +++ b/packages/victory-shared-events/package.json @@ -22,7 +22,6 @@ "dependencies": { "json-stringify-safe": "^5.0.1", "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-core": "^36.8.6" }, diff --git a/packages/victory-stack/package.json b/packages/victory-stack/package.json index 8bfb1c9be..c49a80af0 100644 --- a/packages/victory-stack/package.json +++ b/packages/victory-stack/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-core": "^36.8.6", "victory-shared-events": "^36.8.6" diff --git a/packages/victory-stack/src/victory-stack.tsx b/packages/victory-stack/src/victory-stack.tsx index 7014e02e1..2f8d0a7f8 100644 --- a/packages/victory-stack/src/victory-stack.tsx +++ b/packages/victory-stack/src/victory-stack.tsx @@ -1,5 +1,4 @@ import { defaults, isEmpty } from "lodash"; -import PropTypes from "prop-types"; import React from "react"; import { CategoryPropType, @@ -11,10 +10,8 @@ import { VictoryLabelableProps, VictoryMultiLabelableProps, VictoryStyleInterface, - CommonProps, Helpers, Hooks, - PropTypes as CustomPropTypes, UserProps, VictoryComponentConfiguration, VictoryContainer, @@ -190,53 +187,6 @@ const VictoryStackBase = (initialProps: VictoryStackProps) => { return React.cloneElement(container, container.props, newChildren); }; -VictoryStackBase.propTypes = { - ...CommonProps.baseProps, - bins: PropTypes.oneOfType([ - PropTypes.arrayOf( - PropTypes.oneOfType([ - CustomPropTypes.nonNegative, - PropTypes.instanceOf(Date), - ]), - ), - CustomPropTypes.nonNegative, - ]), - categories: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.string), - PropTypes.shape({ - x: PropTypes.arrayOf(PropTypes.string), - y: PropTypes.arrayOf(PropTypes.string), - }), - ]), - children: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.node), - PropTypes.node, - ]), - colorScale: PropTypes.oneOfType([ - PropTypes.arrayOf(PropTypes.string), - PropTypes.oneOf([ - "grayscale", - "qualitative", - "heatmap", - "warm", - "cool", - "red", - "green", - "blue", - ]), - ]), - fillInMissingData: PropTypes.bool, - horizontal: PropTypes.bool, - labelComponent: PropTypes.element, - labels: PropTypes.oneOfType([PropTypes.func, PropTypes.array]), - style: PropTypes.shape({ - parent: PropTypes.object, - data: PropTypes.object, - labels: PropTypes.object, - }), - xOffset: PropTypes.number, -}; - const componentConfig: VictoryComponentConfiguration = { role: "stack", expectedComponents: [ diff --git a/packages/victory-tooltip/package.json b/packages/victory-tooltip/package.json index dc3a867ce..286defcaf 100644 --- a/packages/victory-tooltip/package.json +++ b/packages/victory-tooltip/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "devDependencies": { diff --git a/packages/victory-tooltip/src/victory-tooltip.tsx b/packages/victory-tooltip/src/victory-tooltip.tsx index 9c570cfe4..005510f1e 100644 --- a/packages/victory-tooltip/src/victory-tooltip.tsx +++ b/packages/victory-tooltip/src/victory-tooltip.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react/prop-types */ import React from "react"; import { TextSize, diff --git a/packages/victory-voronoi-container/package.json b/packages/victory-voronoi-container/package.json index 8c7644ace..81335b9f5 100644 --- a/packages/victory-voronoi-container/package.json +++ b/packages/victory-voronoi-container/package.json @@ -22,7 +22,6 @@ "dependencies": { "delaunay-find": "0.0.6", "lodash": "^4.17.19", - "prop-types": "^15.8.1", "react-fast-compare": "^3.2.0", "victory-core": "^36.8.6", "victory-tooltip": "^36.8.6" diff --git a/packages/victory-voronoi/package.json b/packages/victory-voronoi/package.json index 66857bc8c..59d4e59ef 100644 --- a/packages/victory-voronoi/package.json +++ b/packages/victory-voronoi/package.json @@ -22,7 +22,6 @@ "dependencies": { "d3-voronoi": "^1.1.4", "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory-zoom-container/package.json b/packages/victory-zoom-container/package.json index c183054d1..6a63a2484 100644 --- a/packages/victory-zoom-container/package.json +++ b/packages/victory-zoom-container/package.json @@ -21,7 +21,6 @@ "license": "MIT", "dependencies": { "lodash": "^4.17.19", - "prop-types": "^15.8.1", "victory-core": "^36.8.6" }, "peerDependencies": { diff --git a/packages/victory/src/victory.test.ts b/packages/victory/src/victory.test.ts index 1b4c40404..50b0ce5c7 100644 --- a/packages/victory/src/victory.test.ts +++ b/packages/victory/src/victory.test.ts @@ -51,7 +51,6 @@ import { Point, PointProps, Portal, - PropTypes, RawZoomHelpers, Rect, Scale, @@ -310,7 +309,6 @@ describe("victory", () => { "Circle", "ClipPath", "Collection", - "CommonProps", "CursorHelpers", "Curve", "Data", @@ -332,7 +330,6 @@ describe("victory", () => { "PointPathHelpers", "Portal", "PortalContext", - "PropTypes", "RawZoomHelpers", "Rect", "Scale", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 87368f2c8..7d1dcb6c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -259,14 +259,12 @@ importers: packages/victory-area: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-area: '*' victory-chart: '*' victory-core: ^36.8.6 victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core victory-vendor: link:../victory-vendor devDependencies: @@ -276,13 +274,11 @@ importers: packages/victory-axis: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-axis: '*' victory-chart: '*' victory-core: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core devDependencies: victory-axis: 'link:' @@ -291,14 +287,12 @@ importers: packages/victory-bar: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-bar: '*' victory-chart: '*' victory-core: ^36.8.6 victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core victory-vendor: link:../victory-vendor devDependencies: @@ -308,14 +302,12 @@ importers: packages/victory-box-plot: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-box-plot: '*' victory-chart: ^36.8.6 victory-core: ^36.8.6 victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core victory-vendor: link:../victory-vendor devDependencies: @@ -325,13 +317,11 @@ importers: packages/victory-brush-container: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-brush-container: '*' victory-core: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-core: link:../victory-core devDependencies: @@ -340,26 +330,22 @@ importers: packages/victory-brush-line: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-core: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-core: link:../victory-core packages/victory-candlestick: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-candlestick: '*' victory-chart: ^36.8.6 victory-core: ^36.8.6 victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core devDependencies: victory-candlestick: 'link:' @@ -369,19 +355,16 @@ importers: packages/victory-canvas: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-bar: ^36.8.6 victory-core: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-bar: link:../victory-bar victory-core: link:../victory-core packages/victory-chart: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-axis: ^36.8.6 victory-chart: '*' @@ -391,7 +374,6 @@ importers: victory-shared-events: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-axis: link:../victory-axis victory-core: link:../victory-core @@ -404,7 +386,6 @@ importers: packages/victory-core: specifiers: lodash: ^4.17.21 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-axis: '*' victory-bar: '*' @@ -413,7 +394,6 @@ importers: victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-vendor: link:../victory-vendor devDependencies: @@ -443,22 +423,18 @@ importers: packages/victory-cursor-container: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core packages/victory-errorbar: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 victory-errorbar: '*' dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core devDependencies: victory-errorbar: 'link:' @@ -466,7 +442,6 @@ importers: packages/victory-group: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-bar: '*' victory-core: ^36.8.6 @@ -474,7 +449,6 @@ importers: victory-shared-events: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-core: link:../victory-core victory-shared-events: link:../victory-shared-events @@ -485,7 +459,6 @@ importers: packages/victory-histogram: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-bar: ^36.8.6 victory-core: ^36.8.6 @@ -493,7 +466,6 @@ importers: victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-bar: link:../victory-bar victory-core: link:../victory-core @@ -504,12 +476,10 @@ importers: packages/victory-legend: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 victory-legend: '*' dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core devDependencies: victory-legend: 'link:' @@ -517,14 +487,12 @@ importers: packages/victory-line: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-chart: '*' victory-core: ^36.8.6 victory-line: '*' victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core victory-vendor: link:../victory-vendor devDependencies: @@ -607,13 +575,11 @@ importers: packages/victory-pie: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 victory-pie: '*' victory-vendor: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core victory-vendor: link:../victory-vendor devDependencies: @@ -622,22 +588,18 @@ importers: packages/victory-polar-axis: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core packages/victory-scatter: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 victory-scatter: '*' dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core devDependencies: victory-scatter: 'link:' @@ -645,13 +607,11 @@ importers: packages/victory-selection-container: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-bar: ^36.8.6 victory-core: ^36.8.6 victory-selection-container: '*' dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core devDependencies: victory-bar: link:../victory-bar @@ -661,20 +621,17 @@ importers: specifiers: json-stringify-safe: ^5.0.1 lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-core: ^36.8.6 dependencies: json-stringify-safe: 5.0.1 lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-core: link:../victory-core packages/victory-stack: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-bar: '*' victory-core: ^36.8.6 @@ -683,7 +640,6 @@ importers: victory-stack: '*' dependencies: lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-core: link:../victory-core victory-shared-events: link:../victory-shared-events @@ -695,12 +651,10 @@ importers: packages/victory-tooltip: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 victory-tooltip: '*' dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core devDependencies: victory-tooltip: 'link:' @@ -758,26 +712,22 @@ importers: specifiers: d3-voronoi: ^1.1.4 lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 dependencies: d3-voronoi: 1.1.4 lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core packages/victory-voronoi-container: specifiers: delaunay-find: 0.0.6 lodash: ^4.17.19 - prop-types: ^15.8.1 react-fast-compare: ^3.2.0 victory-core: ^36.8.6 victory-tooltip: ^36.8.6 dependencies: delaunay-find: 0.0.6 lodash: 4.17.21 - prop-types: 15.8.1 react-fast-compare: 3.2.0 victory-core: link:../victory-core victory-tooltip: link:../victory-tooltip @@ -785,11 +735,9 @@ importers: packages/victory-zoom-container: specifiers: lodash: ^4.17.19 - prop-types: ^15.8.1 victory-core: ^36.8.6 dependencies: lodash: 4.17.21 - prop-types: 15.8.1 victory-core: link:../victory-core packages: @@ -13117,6 +13065,7 @@ packages: /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + dev: true /js-yaml/3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} @@ -13609,6 +13558,7 @@ packages: hasBin: true dependencies: js-tokens: 4.0.0 + dev: true /lower-case/2.0.2: resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} @@ -14541,6 +14491,7 @@ packages: /object-assign/4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} + dev: true /object-copy/0.1.0: resolution: {integrity: sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==} @@ -15318,6 +15269,7 @@ packages: loose-envify: 1.4.0 object-assign: 4.1.1 react-is: 16.13.1 + dev: true /proper-lockfile/4.1.2: resolution: {integrity: sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==} @@ -15579,6 +15531,7 @@ packages: /react-is/16.13.1: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + dev: true /react-is/17.0.2: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} diff --git a/stories/victory-histogram.stories.tsx b/stories/victory-histogram.stories.tsx index 640f2bae4..824acd9c1 100644 --- a/stories/victory-histogram.stories.tsx +++ b/stories/victory-histogram.stories.tsx @@ -331,7 +331,6 @@ export const CornerRadius = () => { export const GetPath = () => { const verticalPathFn = (props) => { - // eslint-disable-next-line react/prop-types const { x0, x1, y0, y1 } = props; return `M ${x0}, ${y0} L ${(x1 + x0) / 2}, ${y1} @@ -340,7 +339,6 @@ export const GetPath = () => { }; const horizontalPathFn = (props) => { - // eslint-disable-next-line react/prop-types const { x0, x1, y0, y1 } = props; return `M ${x0}, ${y1} L ${x1}, ${(y0 + y1) / 2} diff --git a/stories/victory-legend.stories.tsx b/stories/victory-legend.stories.tsx index 87b54d278..17a2e8a37 100644 --- a/stories/victory-legend.stories.tsx +++ b/stories/victory-legend.stories.tsx @@ -44,7 +44,6 @@ const getData = (num) => { })); }; -// eslint-disable-next-line react/prop-types const Wrapper = ({ children }) => { return ( diff --git a/test/node/victory.test.js b/test/node/victory.test.js index e75aa38e5..703afb903 100644 --- a/test/node/victory.test.js +++ b/test/node/victory.test.js @@ -213,9 +213,6 @@ describe("victory", () => { it("exports Portal", () => { expect(Victory.Portal).toBeDefined(); }); - it("exports PropTypes", () => { - expect(Victory.PropTypes).toBeDefined(); - }); it("exports RawZoomHelpers", () => { expect(Victory.RawZoomHelpers).toBeDefined(); });