victory-core 36.8.6 → 36.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/victory-core.js +74 -2349
- package/dist/victory-core.min.js +1 -1
- package/es/victory-accessible-group/victory-accessible-group.d.ts +0 -9
- package/es/victory-accessible-group/victory-accessible-group.js +0 -9
- package/es/victory-animation/victory-animation.d.ts +0 -9
- package/es/victory-animation/victory-animation.js +0 -9
- package/es/victory-clip-container/victory-clip-container.d.ts +0 -30
- package/es/victory-clip-container/victory-clip-container.js +0 -31
- package/es/victory-container/victory-container.d.ts +0 -31
- package/es/victory-container/victory-container.js +0 -32
- package/es/victory-label/victory-label.js +1 -52
- package/es/victory-portal/portal.d.ts +0 -8
- package/es/victory-portal/portal.js +1 -10
- package/es/victory-portal/victory-portal.d.ts +0 -5
- package/es/victory-portal/victory-portal.js +0 -5
- package/es/victory-primitives/arc.d.ts +1 -32
- package/es/victory-primitives/arc.js +1 -13
- package/es/victory-primitives/background.d.ts +1 -32
- package/es/victory-primitives/background.js +1 -13
- package/es/victory-primitives/border.d.ts +1 -29
- package/es/victory-primitives/border.js +1 -10
- package/es/victory-primitives/line-segment.d.ts +1 -30
- package/es/victory-primitives/line-segment.js +1 -11
- package/es/victory-primitives/point.d.ts +1 -31
- package/es/victory-primitives/point.js +1 -12
- package/es/victory-primitives/whisker.d.ts +1 -38
- package/es/victory-primitives/whisker.js +1 -19
- package/es/victory-transition/victory-transition.d.ts +0 -6
- package/es/victory-transition/victory-transition.js +0 -6
- package/es/victory-util/common-props.d.ts +0 -5
- package/es/victory-util/common-props.js +1 -132
- package/es/victory-util/index.d.ts +0 -1
- package/es/victory-util/index.js +0 -2
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +0 -9
- package/lib/victory-accessible-group/victory-accessible-group.js +0 -10
- package/lib/victory-animation/victory-animation.d.ts +0 -9
- package/lib/victory-animation/victory-animation.js +0 -10
- package/lib/victory-clip-container/victory-clip-container.d.ts +0 -30
- package/lib/victory-clip-container/victory-clip-container.js +0 -33
- package/lib/victory-container/victory-container.d.ts +0 -31
- package/lib/victory-container/victory-container.js +0 -34
- package/lib/victory-label/victory-label.js +1 -54
- package/lib/victory-portal/portal.d.ts +0 -8
- package/lib/victory-portal/portal.js +1 -16
- package/lib/victory-portal/victory-portal.d.ts +0 -5
- package/lib/victory-portal/victory-portal.js +0 -6
- package/lib/victory-primitives/arc.d.ts +1 -32
- package/lib/victory-primitives/arc.js +1 -15
- package/lib/victory-primitives/background.d.ts +1 -32
- package/lib/victory-primitives/background.js +1 -15
- package/lib/victory-primitives/border.d.ts +1 -29
- package/lib/victory-primitives/border.js +1 -12
- package/lib/victory-primitives/line-segment.d.ts +1 -30
- package/lib/victory-primitives/line-segment.js +1 -13
- package/lib/victory-primitives/point.d.ts +1 -31
- package/lib/victory-primitives/point.js +1 -14
- package/lib/victory-primitives/whisker.d.ts +1 -38
- package/lib/victory-primitives/whisker.js +1 -21
- package/lib/victory-transition/victory-transition.d.ts +0 -6
- package/lib/victory-transition/victory-transition.js +0 -7
- package/lib/victory-util/common-props.d.ts +0 -5
- package/lib/victory-util/common-props.js +1 -148
- package/lib/victory-util/index.d.ts +0 -1
- package/lib/victory-util/index.js +1 -6
- package/package.json +2 -3
- package/src/victory-accessible-group/victory-accessible-group.tsx +0 -12
- package/src/victory-animation/victory-animation.tsx +0 -51
- package/src/victory-clip-container/victory-clip-container.tsx +0 -34
- package/src/victory-container/victory-container.tsx +0 -35
- package/src/victory-label/victory-label.tsx +0 -83
- package/src/victory-portal/portal.tsx +0 -9
- package/src/victory-portal/victory-portal.tsx +0 -6
- package/src/victory-primitives/arc.tsx +1 -17
- package/src/victory-primitives/background.tsx +1 -17
- package/src/victory-primitives/border.tsx +1 -14
- package/src/victory-primitives/line-segment.tsx +1 -15
- package/src/victory-primitives/point.tsx +1 -29
- package/src/victory-primitives/whisker.tsx +1 -23
- package/src/victory-transition/victory-transition.tsx +0 -7
- package/src/victory-util/common-props.tsx +0 -218
- package/src/victory-util/index.ts +0 -1
- package/es/victory-util/prop-types.d.ts +0 -51
- package/es/victory-util/prop-types.js +0 -241
- package/lib/victory-util/prop-types.d.ts +0 -51
- package/lib/victory-util/prop-types.js +0 -269
- package/src/victory-util/prop-types.ts +0 -254
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import * as Helpers from "../victory-util/helpers";
|
|
4
|
-
import {
|
|
5
|
-
CommonProps,
|
|
6
|
-
VictoryCommonPrimitiveProps,
|
|
7
|
-
} from "../victory-util/common-props";
|
|
3
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
|
|
8
4
|
import { Line } from "./line";
|
|
9
5
|
|
|
10
6
|
export interface LineSegmentProps extends VictoryCommonPrimitiveProps {
|
|
@@ -63,13 +59,3 @@ export const LineSegment = (initialProps: LineSegmentProps) => {
|
|
|
63
59
|
clipPath: props.clipPath,
|
|
64
60
|
});
|
|
65
61
|
};
|
|
66
|
-
|
|
67
|
-
LineSegment.propTypes = {
|
|
68
|
-
...CommonProps.primitiveProps,
|
|
69
|
-
datum: PropTypes.any,
|
|
70
|
-
lineComponent: PropTypes.element,
|
|
71
|
-
x1: PropTypes.number,
|
|
72
|
-
x2: PropTypes.number,
|
|
73
|
-
y1: PropTypes.number,
|
|
74
|
-
y2: PropTypes.number,
|
|
75
|
-
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import * as Helpers from "../victory-util/helpers";
|
|
4
3
|
import * as pathHelpers from "../victory-util/point-path-helpers";
|
|
5
|
-
import {
|
|
6
|
-
CommonProps,
|
|
7
|
-
VictoryCommonPrimitiveProps,
|
|
8
|
-
} from "../victory-util/common-props";
|
|
4
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
|
|
9
5
|
import * as UserProps from "../victory-util/user-props";
|
|
10
6
|
import { Path } from "./path";
|
|
11
7
|
import { ScatterSymbolType } from "./types";
|
|
@@ -90,27 +86,3 @@ export const Point = (initialProps: PointProps) => {
|
|
|
90
86
|
...userProps,
|
|
91
87
|
});
|
|
92
88
|
};
|
|
93
|
-
|
|
94
|
-
Point.propTypes = {
|
|
95
|
-
...CommonProps.primitiveProps,
|
|
96
|
-
datum: PropTypes.object,
|
|
97
|
-
getPath: PropTypes.func,
|
|
98
|
-
pathComponent: PropTypes.element,
|
|
99
|
-
size: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
100
|
-
symbol: PropTypes.oneOfType([
|
|
101
|
-
PropTypes.oneOf([
|
|
102
|
-
"circle",
|
|
103
|
-
"cross",
|
|
104
|
-
"diamond",
|
|
105
|
-
"plus",
|
|
106
|
-
"minus",
|
|
107
|
-
"square",
|
|
108
|
-
"star",
|
|
109
|
-
"triangleDown",
|
|
110
|
-
"triangleUp",
|
|
111
|
-
]),
|
|
112
|
-
PropTypes.func,
|
|
113
|
-
]),
|
|
114
|
-
x: PropTypes.number,
|
|
115
|
-
y: PropTypes.number,
|
|
116
|
-
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import * as Helpers from "../victory-util/helpers";
|
|
4
|
-
import {
|
|
5
|
-
CommonProps,
|
|
6
|
-
VictoryCommonPrimitiveProps,
|
|
7
|
-
} from "../victory-util/common-props";
|
|
3
|
+
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
|
|
8
4
|
import { Line } from "./line";
|
|
9
5
|
|
|
10
6
|
export type WhiskerAxes = {
|
|
@@ -95,21 +91,3 @@ export const Whisker = (initialProps: WhiskerProps) => {
|
|
|
95
91
|
),
|
|
96
92
|
]);
|
|
97
93
|
};
|
|
98
|
-
|
|
99
|
-
Whisker.propTypes = {
|
|
100
|
-
...CommonProps.primitiveProps,
|
|
101
|
-
groupComponent: PropTypes.element,
|
|
102
|
-
lineComponent: PropTypes.element,
|
|
103
|
-
majorWhisker: PropTypes.shape({
|
|
104
|
-
x1: PropTypes.number,
|
|
105
|
-
x2: PropTypes.number,
|
|
106
|
-
y1: PropTypes.number,
|
|
107
|
-
y2: PropTypes.number,
|
|
108
|
-
}),
|
|
109
|
-
minorWhisker: PropTypes.shape({
|
|
110
|
-
x1: PropTypes.number,
|
|
111
|
-
x2: PropTypes.number,
|
|
112
|
-
y1: PropTypes.number,
|
|
113
|
-
y2: PropTypes.number,
|
|
114
|
-
}),
|
|
115
|
-
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { VictoryAnimation } from "../victory-animation/victory-animation";
|
|
4
3
|
import * as Collection from "../victory-util/collection";
|
|
5
4
|
import * as Helpers from "../victory-util/helpers";
|
|
@@ -49,12 +48,6 @@ export class VictoryTransition extends React.Component<
|
|
|
49
48
|
> {
|
|
50
49
|
static displayName = "VictoryTransition";
|
|
51
50
|
|
|
52
|
-
static propTypes = {
|
|
53
|
-
animate: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
54
|
-
animationWhitelist: PropTypes.array,
|
|
55
|
-
children: PropTypes.node,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
51
|
static contextType = TimerContext;
|
|
59
52
|
private continuous: boolean;
|
|
60
53
|
private timer: Timer;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
|
-
import * as CustomPropTypes from "./prop-types";
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { OriginType } from "../victory-label/victory-label";
|
|
5
3
|
import { PaddingProps, VictoryThemeDefinition } from "../victory-theme/types";
|
|
@@ -32,65 +30,6 @@ export interface VictoryDatableProps {
|
|
|
32
30
|
y?: DataGetterPropType;
|
|
33
31
|
y0?: DataGetterPropType;
|
|
34
32
|
}
|
|
35
|
-
const dataProps: React.WeakValidationMap<VictoryDatableProps> = {
|
|
36
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
37
|
-
categories: PropTypes.oneOfType([
|
|
38
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
39
|
-
PropTypes.shape({
|
|
40
|
-
x: PropTypes.arrayOf(PropTypes.string),
|
|
41
|
-
y: PropTypes.arrayOf(PropTypes.string),
|
|
42
|
-
}),
|
|
43
|
-
]),
|
|
44
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
45
|
-
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
46
|
-
dataComponent: PropTypes.element,
|
|
47
|
-
disableInlineStyles: PropTypes.bool,
|
|
48
|
-
labelComponent: PropTypes.element,
|
|
49
|
-
labels: PropTypes.oneOfType([PropTypes.func, PropTypes.array]),
|
|
50
|
-
samples: CustomPropTypes.nonNegative,
|
|
51
|
-
sortKey: PropTypes.oneOfType([
|
|
52
|
-
PropTypes.func,
|
|
53
|
-
CustomPropTypes.allOfType([
|
|
54
|
-
CustomPropTypes.integer,
|
|
55
|
-
CustomPropTypes.nonNegative,
|
|
56
|
-
]),
|
|
57
|
-
PropTypes.string,
|
|
58
|
-
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
59
|
-
]),
|
|
60
|
-
sortOrder: PropTypes.oneOf(["ascending", "descending"]),
|
|
61
|
-
style: PropTypes.shape({
|
|
62
|
-
parent: PropTypes.object,
|
|
63
|
-
data: PropTypes.object,
|
|
64
|
-
labels: PropTypes.object,
|
|
65
|
-
}),
|
|
66
|
-
x: PropTypes.oneOfType([
|
|
67
|
-
PropTypes.func,
|
|
68
|
-
CustomPropTypes.allOfType([
|
|
69
|
-
CustomPropTypes.integer,
|
|
70
|
-
CustomPropTypes.nonNegative,
|
|
71
|
-
]),
|
|
72
|
-
PropTypes.string,
|
|
73
|
-
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
74
|
-
]),
|
|
75
|
-
y: PropTypes.oneOfType([
|
|
76
|
-
PropTypes.func,
|
|
77
|
-
CustomPropTypes.allOfType([
|
|
78
|
-
CustomPropTypes.integer,
|
|
79
|
-
CustomPropTypes.nonNegative,
|
|
80
|
-
]),
|
|
81
|
-
PropTypes.string,
|
|
82
|
-
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
83
|
-
]),
|
|
84
|
-
y0: PropTypes.oneOfType([
|
|
85
|
-
PropTypes.func,
|
|
86
|
-
CustomPropTypes.allOfType([
|
|
87
|
-
CustomPropTypes.integer,
|
|
88
|
-
CustomPropTypes.nonNegative,
|
|
89
|
-
]),
|
|
90
|
-
PropTypes.string,
|
|
91
|
-
PropTypes.arrayOf(PropTypes.string.isRequired),
|
|
92
|
-
]),
|
|
93
|
-
};
|
|
94
33
|
export interface VictoryCommonThemeProps {
|
|
95
34
|
animate?: boolean | AnimatePropTypeInterface;
|
|
96
35
|
colorScale?: ColorScalePropType;
|
|
@@ -127,133 +66,6 @@ export interface VictoryCommonThemeProps {
|
|
|
127
66
|
export interface VictoryCommonProps extends VictoryCommonThemeProps {
|
|
128
67
|
theme?: VictoryThemeDefinition;
|
|
129
68
|
}
|
|
130
|
-
const baseProps: React.WeakValidationMap<VictoryCommonProps> = {
|
|
131
|
-
animate: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
132
|
-
containerComponent: PropTypes.element,
|
|
133
|
-
domain: PropTypes.oneOfType([
|
|
134
|
-
CustomPropTypes.domain,
|
|
135
|
-
PropTypes.shape({ x: CustomPropTypes.domain, y: CustomPropTypes.domain }),
|
|
136
|
-
]),
|
|
137
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
138
|
-
maxDomain: PropTypes.oneOfType([
|
|
139
|
-
PropTypes.number,
|
|
140
|
-
PropTypes.instanceOf(Date),
|
|
141
|
-
PropTypes.shape({
|
|
142
|
-
x: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
143
|
-
y: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
144
|
-
}),
|
|
145
|
-
]),
|
|
146
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
147
|
-
minDomain: PropTypes.oneOfType([
|
|
148
|
-
PropTypes.number,
|
|
149
|
-
PropTypes.instanceOf(Date),
|
|
150
|
-
PropTypes.shape({
|
|
151
|
-
x: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
152
|
-
y: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
153
|
-
}),
|
|
154
|
-
]),
|
|
155
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
156
|
-
domainPadding: PropTypes.oneOfType([
|
|
157
|
-
PropTypes.shape({
|
|
158
|
-
x: PropTypes.oneOfType([
|
|
159
|
-
PropTypes.number,
|
|
160
|
-
PropTypes.arrayOf(PropTypes.number),
|
|
161
|
-
]),
|
|
162
|
-
y: PropTypes.oneOfType([
|
|
163
|
-
PropTypes.number,
|
|
164
|
-
PropTypes.arrayOf(PropTypes.number),
|
|
165
|
-
]),
|
|
166
|
-
}),
|
|
167
|
-
PropTypes.number,
|
|
168
|
-
PropTypes.arrayOf(PropTypes.number),
|
|
169
|
-
]),
|
|
170
|
-
eventKey: PropTypes.oneOfType([
|
|
171
|
-
PropTypes.func,
|
|
172
|
-
CustomPropTypes.allOfType([
|
|
173
|
-
CustomPropTypes.integer,
|
|
174
|
-
CustomPropTypes.nonNegative,
|
|
175
|
-
]),
|
|
176
|
-
PropTypes.string,
|
|
177
|
-
]),
|
|
178
|
-
events: PropTypes.arrayOf(
|
|
179
|
-
PropTypes.shape({
|
|
180
|
-
target: PropTypes.oneOf(["data", "labels", "parent"]),
|
|
181
|
-
eventKey: PropTypes.oneOfType([
|
|
182
|
-
PropTypes.array,
|
|
183
|
-
CustomPropTypes.allOfType([
|
|
184
|
-
CustomPropTypes.integer,
|
|
185
|
-
CustomPropTypes.nonNegative,
|
|
186
|
-
]),
|
|
187
|
-
PropTypes.string,
|
|
188
|
-
]),
|
|
189
|
-
eventHandlers: PropTypes.object,
|
|
190
|
-
}),
|
|
191
|
-
),
|
|
192
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
193
|
-
externalEventMutations: PropTypes.arrayOf(
|
|
194
|
-
PropTypes.shape({
|
|
195
|
-
callback: PropTypes.func,
|
|
196
|
-
childName: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
197
|
-
eventKey: PropTypes.oneOfType([
|
|
198
|
-
PropTypes.array,
|
|
199
|
-
CustomPropTypes.allOfType([
|
|
200
|
-
CustomPropTypes.integer,
|
|
201
|
-
CustomPropTypes.nonNegative,
|
|
202
|
-
]),
|
|
203
|
-
PropTypes.string,
|
|
204
|
-
]),
|
|
205
|
-
mutation: PropTypes.func,
|
|
206
|
-
target: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
207
|
-
}),
|
|
208
|
-
),
|
|
209
|
-
groupComponent: PropTypes.element,
|
|
210
|
-
height: CustomPropTypes.nonNegative,
|
|
211
|
-
name: PropTypes.string,
|
|
212
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
213
|
-
origin: PropTypes.shape({ x: PropTypes.number, y: PropTypes.number }),
|
|
214
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
215
|
-
padding: PropTypes.oneOfType([
|
|
216
|
-
PropTypes.number,
|
|
217
|
-
PropTypes.shape({
|
|
218
|
-
top: PropTypes.number,
|
|
219
|
-
bottom: PropTypes.number,
|
|
220
|
-
left: PropTypes.number,
|
|
221
|
-
right: PropTypes.number,
|
|
222
|
-
}),
|
|
223
|
-
]),
|
|
224
|
-
polar: PropTypes.bool,
|
|
225
|
-
range: PropTypes.oneOfType([
|
|
226
|
-
CustomPropTypes.domain,
|
|
227
|
-
PropTypes.shape({
|
|
228
|
-
x: CustomPropTypes.domain.isRequired,
|
|
229
|
-
y: CustomPropTypes.domain.isRequired,
|
|
230
|
-
}),
|
|
231
|
-
]),
|
|
232
|
-
scale: PropTypes.oneOfType([
|
|
233
|
-
CustomPropTypes.scale,
|
|
234
|
-
PropTypes.shape({
|
|
235
|
-
x: CustomPropTypes.scale.isRequired,
|
|
236
|
-
y: CustomPropTypes.scale.isRequired,
|
|
237
|
-
}),
|
|
238
|
-
]),
|
|
239
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
240
|
-
sharedEvents: PropTypes.shape({
|
|
241
|
-
events: PropTypes.array,
|
|
242
|
-
getEventState: PropTypes.func,
|
|
243
|
-
}),
|
|
244
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
245
|
-
singleQuadrantDomainPadding: PropTypes.oneOfType([
|
|
246
|
-
PropTypes.bool,
|
|
247
|
-
PropTypes.shape({
|
|
248
|
-
x: PropTypes.oneOfType([PropTypes.bool]),
|
|
249
|
-
y: PropTypes.oneOfType([PropTypes.bool]),
|
|
250
|
-
}),
|
|
251
|
-
]),
|
|
252
|
-
standalone: PropTypes.bool,
|
|
253
|
-
theme: PropTypes.object,
|
|
254
|
-
width: CustomPropTypes.nonNegative,
|
|
255
|
-
};
|
|
256
|
-
|
|
257
69
|
export interface VictoryCommonPrimitiveProps {
|
|
258
70
|
active?: boolean;
|
|
259
71
|
ariaLabel?: StringOrCallback;
|
|
@@ -276,33 +88,3 @@ export interface VictoryCommonPrimitiveProps {
|
|
|
276
88
|
tabIndex?: NumberOrCallback;
|
|
277
89
|
transform?: string;
|
|
278
90
|
}
|
|
279
|
-
const primitiveProps: React.WeakValidationMap<VictoryCommonPrimitiveProps> = {
|
|
280
|
-
active: PropTypes.bool,
|
|
281
|
-
ariaLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
282
|
-
className: PropTypes.string,
|
|
283
|
-
clipPath: PropTypes.string,
|
|
284
|
-
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
285
|
-
desc: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
286
|
-
disableInlineStyles: PropTypes.bool,
|
|
287
|
-
events: PropTypes.object,
|
|
288
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.func]),
|
|
289
|
-
index: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
290
|
-
// @ts-expect-error TODO: synchronize the type with this PropTypes
|
|
291
|
-
origin: PropTypes.shape({ x: PropTypes.number, y: PropTypes.number }),
|
|
292
|
-
polar: PropTypes.bool,
|
|
293
|
-
role: PropTypes.string,
|
|
294
|
-
scale: PropTypes.oneOfType([
|
|
295
|
-
CustomPropTypes.scale,
|
|
296
|
-
PropTypes.shape({ x: CustomPropTypes.scale, y: CustomPropTypes.scale }),
|
|
297
|
-
]),
|
|
298
|
-
shapeRendering: PropTypes.string,
|
|
299
|
-
style: PropTypes.object,
|
|
300
|
-
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
301
|
-
transform: PropTypes.string,
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
export const CommonProps = {
|
|
305
|
-
dataProps,
|
|
306
|
-
baseProps,
|
|
307
|
-
primitiveProps,
|
|
308
|
-
};
|
|
@@ -13,7 +13,6 @@ export * as LabelHelpers from "./label-helpers";
|
|
|
13
13
|
export * as LineHelpers from "./line-helpers";
|
|
14
14
|
export * as Log from "./log";
|
|
15
15
|
export * as PointPathHelpers from "./point-path-helpers";
|
|
16
|
-
export * as PropTypes from "./prop-types";
|
|
17
16
|
export * as Scale from "./scale";
|
|
18
17
|
export * as Selection from "./selection";
|
|
19
18
|
export type { SVGCoordinateType, SVGCoordinateBounds } from "./selection";
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
|
-
import { D3Scale, ScaleName } from "../types/prop-types";
|
|
3
|
-
/**
|
|
4
|
-
* Return a new validator based on `propType` but which logs a `console.error`
|
|
5
|
-
* with `explanation` if used.
|
|
6
|
-
* @param {Function} propType The old, deprecated propType.
|
|
7
|
-
* @param {String} explanation The message to provide the user of the deprecated propType.
|
|
8
|
-
* @returns {Function} Validator which logs usage of this propType
|
|
9
|
-
*/
|
|
10
|
-
export declare function deprecated<T>(propType: PropTypes.Validator<T>, explanation: string): PropTypes.Validator<T>;
|
|
11
|
-
/**
|
|
12
|
-
* Return a new validator which returns true
|
|
13
|
-
* if and only if all validators passed as arguments return true.
|
|
14
|
-
* Like React.propTypes.oneOfType, except "all" instead of "any"
|
|
15
|
-
* @param {Array} validators Validation functions.
|
|
16
|
-
* @returns {Function} Combined validator function
|
|
17
|
-
*/
|
|
18
|
-
export declare function allOfType<T>(validators: Array<PropTypes.Validator<T>>): PropTypes.Requireable<T | undefined>;
|
|
19
|
-
/**
|
|
20
|
-
* Check that the value is a non-negative number.
|
|
21
|
-
*/
|
|
22
|
-
export declare const nonNegative: PropTypes.Requireable<number | undefined>;
|
|
23
|
-
/**
|
|
24
|
-
* Check that the value is an integer.
|
|
25
|
-
*/
|
|
26
|
-
export declare const integer: PropTypes.Requireable<number | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* Check that the value is greater than zero.
|
|
29
|
-
*/
|
|
30
|
-
export declare const greaterThanZero: PropTypes.Requireable<number | undefined>;
|
|
31
|
-
/**
|
|
32
|
-
* Check that the value is an Array of two unique values.
|
|
33
|
-
*/
|
|
34
|
-
export declare const domain: PropTypes.Requireable<[number, number] | undefined>;
|
|
35
|
-
/**
|
|
36
|
-
* Check that the value looks like a d3 `scale` function.
|
|
37
|
-
*/
|
|
38
|
-
export declare const scale: PropTypes.Requireable<ScaleName | D3Scale<any> | undefined>;
|
|
39
|
-
/**
|
|
40
|
-
* Check that an array contains items of the same type.
|
|
41
|
-
*/
|
|
42
|
-
export declare const homogeneousArray: PropTypes.Requireable<unknown[] | undefined>;
|
|
43
|
-
/**
|
|
44
|
-
* Check that array prop length matches props.data.length
|
|
45
|
-
*/
|
|
46
|
-
export declare const matchDataLength: PropTypes.Requireable<unknown[] | undefined>;
|
|
47
|
-
/**
|
|
48
|
-
* Check that the value is a regular expression
|
|
49
|
-
*/
|
|
50
|
-
export declare const regExp: PropTypes.Requireable<RegExp | undefined>;
|
|
51
|
-
//# sourceMappingURL=prop-types.d.ts.map
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import _isRegExp from "lodash/isRegExp";
|
|
2
|
-
import _find from "lodash/find";
|
|
3
|
-
|
|
4
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
|
|
6
|
-
import * as Log from "./log";
|
|
7
|
-
import PropTypes from "prop-types";
|
|
8
|
-
import * as Scale from "./scale";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Return a new validator based on `validator` but with the option to chain
|
|
12
|
-
* `isRequired` onto the validation. This is nearly identical to how React
|
|
13
|
-
* does it internally, but they don't expose their helper for us to use.
|
|
14
|
-
* @param {Function} validator Validation function.
|
|
15
|
-
* @returns {Function} Validator with `isRequired` option.
|
|
16
|
-
*/
|
|
17
|
-
var makeChainable = function (validator) {
|
|
18
|
-
var createChainable = function (isRequired) {
|
|
19
|
-
return function (props, propName, componentName) {
|
|
20
|
-
var value = props[propName];
|
|
21
|
-
|
|
22
|
-
if (value === undefined || value === null) {
|
|
23
|
-
if (isRequired) {
|
|
24
|
-
return new Error("Required `".concat(propName, "` was not specified in `").concat(componentName, "`."));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
31
|
-
rest[_key - 3] = arguments[_key];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return validator.apply(void 0, [props, propName, componentName].concat(rest));
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var chainable = Object.assign(createChainable(false), {
|
|
39
|
-
isRequired: createChainable(true)
|
|
40
|
-
});
|
|
41
|
-
return chainable;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
var nullConstructor = function () {
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
var undefinedConstructor = function () {
|
|
49
|
-
return undefined;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Get the constructor of `value`. If `value` is null or undefined, return the
|
|
53
|
-
* special singletons `nullConstructor` or `undefinedConstructor`, respectively.
|
|
54
|
-
* @param {*} value Instance to return the constructor of.
|
|
55
|
-
* @returns {Function} Constructor of `value`.
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var getConstructor = function (value) {
|
|
60
|
-
if (value === undefined) {
|
|
61
|
-
return undefinedConstructor;
|
|
62
|
-
} else if (value === null) {
|
|
63
|
-
return nullConstructor;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return value.constructor;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Get the name of the constructor used to create `value`, using
|
|
70
|
-
* `Object.prototype.toString`. If the value is null or undefined, return
|
|
71
|
-
* "null" or "undefined", respectively.
|
|
72
|
-
* @param {*} value Instance to return the constructor name of.
|
|
73
|
-
* @returns {String} Name of the constructor.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var getConstructorName = function (value) {
|
|
78
|
-
if (value === undefined) {
|
|
79
|
-
return "undefined";
|
|
80
|
-
} else if (value === null) {
|
|
81
|
-
return "null";
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return Object.prototype.toString.call(value).slice(8, -1); // eslint-disable-line no-magic-numbers
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Return a new validator based on `propType` but which logs a `console.error`
|
|
88
|
-
* with `explanation` if used.
|
|
89
|
-
* @param {Function} propType The old, deprecated propType.
|
|
90
|
-
* @param {String} explanation The message to provide the user of the deprecated propType.
|
|
91
|
-
* @returns {Function} Validator which logs usage of this propType
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
export function deprecated(propType, explanation) {
|
|
96
|
-
return function (props, propName, componentName) {
|
|
97
|
-
var value = props[propName];
|
|
98
|
-
|
|
99
|
-
if (value !== null && value !== undefined) {
|
|
100
|
-
Log.warn("\"".concat(propName, "\" property of \"").concat(componentName, "\" has been deprecated ").concat(explanation));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
PropTypes.checkPropTypes(_defineProperty({}, propName, propType), props, propName, componentName);
|
|
104
|
-
return null;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Return a new validator which returns true
|
|
109
|
-
* if and only if all validators passed as arguments return true.
|
|
110
|
-
* Like React.propTypes.oneOfType, except "all" instead of "any"
|
|
111
|
-
* @param {Array} validators Validation functions.
|
|
112
|
-
* @returns {Function} Combined validator function
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
export function allOfType(validators) {
|
|
116
|
-
return makeChainable(function (props, propName, componentName) {
|
|
117
|
-
for (var _len2 = arguments.length, rest = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
|
118
|
-
rest[_key2 - 3] = arguments[_key2];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return validators.reduce(function (result, validator) {
|
|
122
|
-
return result || validator.apply(void 0, [props, propName, componentName].concat(rest));
|
|
123
|
-
}, null);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Check that the value is a non-negative number.
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
export var nonNegative = makeChainable(function (props, propName, componentName) {
|
|
131
|
-
var value = props[propName];
|
|
132
|
-
|
|
133
|
-
if (typeof value !== "number" || value < 0) {
|
|
134
|
-
return new Error("`".concat(propName, "` in `").concat(componentName, "` must be a non-negative number."));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return null;
|
|
138
|
-
});
|
|
139
|
-
/**
|
|
140
|
-
* Check that the value is an integer.
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
export var integer = makeChainable(function (props, propName, componentName) {
|
|
144
|
-
var value = props[propName];
|
|
145
|
-
|
|
146
|
-
if (typeof value !== "number" || value % 1 !== 0) {
|
|
147
|
-
return new Error("`".concat(propName, "` in `").concat(componentName, "` must be an integer."));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return null;
|
|
151
|
-
});
|
|
152
|
-
/**
|
|
153
|
-
* Check that the value is greater than zero.
|
|
154
|
-
*/
|
|
155
|
-
|
|
156
|
-
export var greaterThanZero = makeChainable(function (props, propName, componentName) {
|
|
157
|
-
var value = props[propName];
|
|
158
|
-
|
|
159
|
-
if (typeof value !== "number" || value <= 0) {
|
|
160
|
-
return new Error("`".concat(propName, "` in `").concat(componentName, "` must be a number greater than zero."));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return null;
|
|
164
|
-
});
|
|
165
|
-
/**
|
|
166
|
-
* Check that the value is an Array of two unique values.
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
export var domain = makeChainable(function (props, propName, componentName) {
|
|
170
|
-
var value = props[propName];
|
|
171
|
-
|
|
172
|
-
if (!Array.isArray(value) || value.length !== 2 || value[1] === value[0]) {
|
|
173
|
-
return new Error("`".concat(propName, "` in `").concat(componentName, "` must be an array of two unique numeric values."));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return null;
|
|
177
|
-
});
|
|
178
|
-
/**
|
|
179
|
-
* Check that the value looks like a d3 `scale` function.
|
|
180
|
-
*/
|
|
181
|
-
|
|
182
|
-
export var scale = makeChainable(function (props, propName, componentName) {
|
|
183
|
-
var value = props[propName];
|
|
184
|
-
|
|
185
|
-
if (!Scale.validScale(value)) {
|
|
186
|
-
return new Error("`".concat(propName, "` in `").concat(componentName, "` must be a d3 scale."));
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return null;
|
|
190
|
-
});
|
|
191
|
-
/**
|
|
192
|
-
* Check that an array contains items of the same type.
|
|
193
|
-
*/
|
|
194
|
-
|
|
195
|
-
export var homogeneousArray = makeChainable(function (props, propName, componentName) {
|
|
196
|
-
var values = props[propName];
|
|
197
|
-
|
|
198
|
-
if (!Array.isArray(values)) {
|
|
199
|
-
return new Error("`".concat(propName, "` in `").concat(componentName, "` must be an array."));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (values.length < 2) {
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
var comparisonConstructor = getConstructor(values[0]);
|
|
207
|
-
|
|
208
|
-
var typeMismatchedValue = _find(values, function (value) {
|
|
209
|
-
return comparisonConstructor !== getConstructor(value);
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
if (typeMismatchedValue) {
|
|
213
|
-
var constructorName = getConstructorName(values[0]);
|
|
214
|
-
var otherConstructorName = getConstructorName(typeMismatchedValue);
|
|
215
|
-
return new Error("Expected `".concat(propName, "` in `").concat(componentName, "` to be a ") + "homogeneous array, but found types `".concat(constructorName, "` and ") + "`".concat(otherConstructorName, "`."));
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return null;
|
|
219
|
-
});
|
|
220
|
-
/**
|
|
221
|
-
* Check that array prop length matches props.data.length
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
export var matchDataLength = makeChainable(function (props, propName) {
|
|
225
|
-
if (props[propName] && Array.isArray(props[propName]) && props[propName].length !== props.data.length) {
|
|
226
|
-
return new Error("Length of data and ".concat(propName, " arrays must match."));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return null;
|
|
230
|
-
});
|
|
231
|
-
/**
|
|
232
|
-
* Check that the value is a regular expression
|
|
233
|
-
*/
|
|
234
|
-
|
|
235
|
-
export var regExp = makeChainable(function (props, propName, componentName) {
|
|
236
|
-
if (props[propName] && !_isRegExp(props[propName])) {
|
|
237
|
-
return new Error("`".concat(propName, "` in `").concat(componentName, "` must be a regular expression."));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return null;
|
|
241
|
-
});
|