victory-core 36.9.2-next.3 → 37.0.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 +28 -10
- package/README.md +1 -1
- package/dist/victory-core.js +4449 -6196
- package/dist/victory-core.min.js +1 -1
- package/es/index.d.ts +17 -17
- package/es/types/callbacks.d.ts +36 -36
- package/es/types/prop-types.d.ts +129 -129
- package/es/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/es/victory-accessible-group/victory-accessible-group.js +9 -15
- package/es/victory-animation/util.d.ts +66 -66
- package/es/victory-animation/util.js +28 -47
- package/es/victory-animation/victory-animation.d.ts +34 -34
- package/es/victory-animation/victory-animation.js +51 -67
- package/es/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/es/victory-clip-container/victory-clip-container.js +153 -229
- package/es/victory-container/victory-container.d.ts +68 -68
- package/es/victory-container/victory-container.js +157 -216
- package/es/victory-label/victory-label.d.ts +58 -58
- package/es/victory-label/victory-label.js +246 -323
- package/es/victory-portal/portal-context.d.ts +11 -11
- package/es/victory-portal/portal-context.js +1 -2
- package/es/victory-portal/portal.d.ts +20 -20
- package/es/victory-portal/portal.js +30 -76
- package/es/victory-portal/victory-portal.d.ts +26 -26
- package/es/victory-portal/victory-portal.js +47 -104
- package/es/victory-primitives/arc.d.ts +14 -14
- package/es/victory-primitives/arc.js +44 -47
- package/es/victory-primitives/background.d.ts +13 -13
- package/es/victory-primitives/background.js +14 -17
- package/es/victory-primitives/border.d.ts +10 -10
- package/es/victory-primitives/border.js +20 -24
- package/es/victory-primitives/circle.d.ts +3 -3
- package/es/victory-primitives/circle.js +13 -27
- package/es/victory-primitives/clip-path.d.ts +7 -7
- package/es/victory-primitives/clip-path.js +3 -7
- package/es/victory-primitives/index.d.ts +14 -14
- package/es/victory-primitives/line-segment.d.ts +11 -11
- package/es/victory-primitives/line-segment.js +20 -24
- package/es/victory-primitives/line.d.ts +3 -3
- package/es/victory-primitives/line.js +13 -27
- package/es/victory-primitives/path.d.ts +3 -3
- package/es/victory-primitives/path.js +13 -27
- package/es/victory-primitives/point.d.ts +13 -13
- package/es/victory-primitives/point.js +36 -40
- package/es/victory-primitives/rect.d.ts +3 -3
- package/es/victory-primitives/rect.js +13 -27
- package/es/victory-primitives/text.d.ts +8 -8
- package/es/victory-primitives/text.js +15 -28
- package/es/victory-primitives/tspan.d.ts +3 -3
- package/es/victory-primitives/tspan.js +13 -26
- package/es/victory-primitives/types.d.ts +7 -7
- package/es/victory-primitives/whisker.d.ts +15 -15
- package/es/victory-primitives/whisker.js +43 -47
- package/es/victory-theme/grayscale.d.ts +2 -2
- package/es/victory-theme/grayscale.js +22 -22
- package/es/victory-theme/material.d.ts +2 -2
- package/es/victory-theme/material.js +46 -46
- package/es/victory-theme/types.d.ts +238 -238
- package/es/victory-theme/victory-theme.d.ts +5 -5
- package/es/victory-theme/victory-theme.js +3 -3
- package/es/victory-transition/victory-transition.d.ts +53 -53
- package/es/victory-transition/victory-transition.js +126 -206
- package/es/victory-util/add-events.d.ts +126 -126
- package/es/victory-util/add-events.js +265 -380
- package/es/victory-util/axis.d.ts +50 -50
- package/es/victory-util/axis.js +133 -222
- package/es/victory-util/collection.d.ts +15 -8
- package/es/victory-util/collection.js +24 -36
- package/es/victory-util/common-props.d.ts +79 -79
- package/es/victory-util/data.d.ts +74 -74
- package/es/victory-util/data.js +159 -214
- package/es/victory-util/default-transitions.d.ts +4 -4
- package/es/victory-util/default-transitions.js +33 -51
- package/es/victory-util/domain.d.ts +90 -90
- package/es/victory-util/domain.js +122 -171
- package/es/victory-util/events.d.ts +64 -64
- package/es/victory-util/events.js +168 -258
- package/es/victory-util/helpers.d.ts +96 -91
- package/es/victory-util/helpers.js +162 -176
- package/es/victory-util/hooks/index.d.ts +2 -2
- package/es/victory-util/hooks/use-animation-state.d.ts +21 -21
- package/es/victory-util/hooks/use-animation-state.js +61 -99
- package/es/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/es/victory-util/hooks/use-previous-props.js +2 -2
- package/es/victory-util/immutable.d.ts +11 -11
- package/es/victory-util/immutable.js +6 -8
- package/es/victory-util/index.d.ts +26 -26
- package/es/victory-util/label-helpers.d.ts +26 -26
- package/es/victory-util/label-helpers.js +128 -130
- package/es/victory-util/line-helpers.d.ts +4 -4
- package/es/victory-util/line-helpers.js +29 -41
- package/es/victory-util/log.d.ts +1 -1
- package/es/victory-util/log.js +1 -1
- package/es/victory-util/point-path-helpers.d.ts +9 -9
- package/es/victory-util/point-path-helpers.js +89 -49
- package/es/victory-util/scale.d.ts +9 -9
- package/es/victory-util/scale.js +24 -42
- package/es/victory-util/selection.d.ts +28 -28
- package/es/victory-util/selection.js +39 -40
- package/es/victory-util/style.d.ts +18 -18
- package/es/victory-util/style.js +8 -13
- package/es/victory-util/textsize.d.ts +35 -35
- package/es/victory-util/textsize.js +80 -154
- package/es/victory-util/timer-context.d.ts +11 -11
- package/es/victory-util/timer-context.js +2 -2
- package/es/victory-util/timer.d.ts +16 -16
- package/es/victory-util/timer.js +40 -76
- package/es/victory-util/transitions.d.ts +48 -48
- package/es/victory-util/transitions.js +110 -150
- package/es/victory-util/type-helpers.d.ts +9 -9
- package/es/victory-util/type-helpers.js +2 -3
- package/es/victory-util/user-props.d.ts +26 -26
- package/es/victory-util/user-props.js +24 -49
- package/es/victory-util/wrapper.d.ts +33 -37
- package/es/victory-util/wrapper.js +182 -245
- package/lib/index.d.ts +17 -17
- package/lib/index.js +0 -30
- package/lib/types/callbacks.d.ts +36 -36
- package/lib/types/prop-types.d.ts +129 -129
- package/lib/victory-accessible-group/victory-accessible-group.d.ts +10 -10
- package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
- package/lib/victory-animation/util.d.ts +66 -66
- package/lib/victory-animation/util.js +28 -63
- package/lib/victory-animation/victory-animation.d.ts +34 -34
- package/lib/victory-animation/victory-animation.js +54 -83
- package/lib/victory-clip-container/victory-clip-container.d.ts +46 -46
- package/lib/victory-clip-container/victory-clip-container.js +156 -243
- package/lib/victory-container/victory-container.d.ts +68 -68
- package/lib/victory-container/victory-container.js +160 -232
- package/lib/victory-label/victory-label.d.ts +58 -58
- package/lib/victory-label/victory-label.js +248 -344
- package/lib/victory-portal/portal-context.d.ts +11 -11
- package/lib/victory-portal/portal-context.js +1 -6
- package/lib/victory-portal/portal.d.ts +20 -20
- package/lib/victory-portal/portal.js +31 -81
- package/lib/victory-portal/victory-portal.d.ts +26 -26
- package/lib/victory-portal/victory-portal.js +50 -116
- package/lib/victory-primitives/arc.d.ts +14 -14
- package/lib/victory-primitives/arc.js +48 -57
- package/lib/victory-primitives/background.d.ts +13 -13
- package/lib/victory-primitives/background.js +16 -28
- package/lib/victory-primitives/border.d.ts +10 -10
- package/lib/victory-primitives/border.js +22 -34
- package/lib/victory-primitives/circle.d.ts +3 -3
- package/lib/victory-primitives/circle.js +16 -36
- package/lib/victory-primitives/clip-path.d.ts +7 -7
- package/lib/victory-primitives/clip-path.js +3 -11
- package/lib/victory-primitives/index.d.ts +14 -14
- package/lib/victory-primitives/index.js +0 -28
- package/lib/victory-primitives/line-segment.d.ts +11 -11
- package/lib/victory-primitives/line-segment.js +22 -34
- package/lib/victory-primitives/line.d.ts +3 -3
- package/lib/victory-primitives/line.js +16 -36
- package/lib/victory-primitives/path.d.ts +3 -3
- package/lib/victory-primitives/path.js +16 -36
- package/lib/victory-primitives/point.d.ts +13 -13
- package/lib/victory-primitives/point.js +38 -52
- package/lib/victory-primitives/rect.d.ts +3 -3
- package/lib/victory-primitives/rect.js +16 -36
- package/lib/victory-primitives/text.d.ts +8 -8
- package/lib/victory-primitives/text.js +15 -33
- package/lib/victory-primitives/tspan.d.ts +3 -3
- package/lib/victory-primitives/tspan.js +13 -31
- package/lib/victory-primitives/types.d.ts +7 -7
- package/lib/victory-primitives/whisker.d.ts +15 -15
- package/lib/victory-primitives/whisker.js +45 -57
- package/lib/victory-theme/grayscale.d.ts +2 -2
- package/lib/victory-theme/grayscale.js +23 -24
- package/lib/victory-theme/material.d.ts +2 -2
- package/lib/victory-theme/material.js +47 -48
- package/lib/victory-theme/types.d.ts +238 -238
- package/lib/victory-theme/victory-theme.d.ts +5 -5
- package/lib/victory-theme/victory-theme.js +2 -7
- package/lib/victory-transition/victory-transition.d.ts +53 -53
- package/lib/victory-transition/victory-transition.js +129 -224
- package/lib/victory-util/add-events.d.ts +126 -126
- package/lib/victory-util/add-events.js +265 -382
- package/lib/victory-util/axis.d.ts +50 -50
- package/lib/victory-util/axis.js +135 -242
- package/lib/victory-util/collection.d.ts +15 -8
- package/lib/victory-util/collection.js +24 -43
- package/lib/victory-util/common-props.d.ts +79 -79
- package/lib/victory-util/data.d.ts +74 -74
- package/lib/victory-util/data.js +160 -239
- package/lib/victory-util/default-transitions.d.ts +4 -4
- package/lib/victory-util/default-transitions.js +33 -54
- package/lib/victory-util/domain.d.ts +90 -90
- package/lib/victory-util/domain.js +123 -193
- package/lib/victory-util/events.d.ts +64 -64
- package/lib/victory-util/events.js +167 -274
- package/lib/victory-util/helpers.d.ts +96 -91
- package/lib/victory-util/helpers.js +166 -204
- package/lib/victory-util/hooks/index.d.ts +2 -2
- package/lib/victory-util/hooks/index.js +0 -2
- package/lib/victory-util/hooks/use-animation-state.d.ts +21 -21
- package/lib/victory-util/hooks/use-animation-state.js +63 -113
- package/lib/victory-util/hooks/use-previous-props.d.ts +1 -1
- package/lib/victory-util/hooks/use-previous-props.js +2 -7
- package/lib/victory-util/immutable.d.ts +11 -11
- package/lib/victory-util/immutable.js +6 -18
- package/lib/victory-util/index.d.ts +26 -26
- package/lib/victory-util/index.js +2 -51
- package/lib/victory-util/label-helpers.d.ts +26 -26
- package/lib/victory-util/label-helpers.js +130 -141
- package/lib/victory-util/line-helpers.d.ts +4 -4
- package/lib/victory-util/line-helpers.js +31 -49
- package/lib/victory-util/log.d.ts +1 -1
- package/lib/victory-util/log.js +1 -2
- package/lib/victory-util/point-path-helpers.d.ts +9 -9
- package/lib/victory-util/point-path-helpers.js +91 -63
- package/lib/victory-util/scale.d.ts +9 -9
- package/lib/victory-util/scale.js +26 -57
- package/lib/victory-util/selection.d.ts +28 -28
- package/lib/victory-util/selection.js +41 -49
- package/lib/victory-util/style.d.ts +18 -18
- package/lib/victory-util/style.js +8 -16
- package/lib/victory-util/textsize.d.ts +35 -35
- package/lib/victory-util/textsize.js +80 -157
- package/lib/victory-util/timer-context.d.ts +11 -11
- package/lib/victory-util/timer-context.js +2 -8
- package/lib/victory-util/timer.d.ts +16 -16
- package/lib/victory-util/timer.js +40 -76
- package/lib/victory-util/transitions.d.ts +48 -48
- package/lib/victory-util/transitions.js +110 -152
- package/lib/victory-util/type-helpers.d.ts +9 -9
- package/lib/victory-util/type-helpers.js +2 -9
- package/lib/victory-util/user-props.d.ts +26 -26
- package/lib/victory-util/user-props.js +25 -59
- package/lib/victory-util/wrapper.d.ts +33 -37
- package/lib/victory-util/wrapper.js +184 -279
- package/package.json +6 -3
- package/src/types/prop-types.ts +0 -7
- package/src/victory-container/victory-container.tsx +195 -171
- package/src/victory-portal/portal-context.ts +4 -5
- package/src/victory-portal/portal.tsx +42 -5
- package/src/victory-portal/victory-portal.tsx +71 -34
- package/src/victory-util/add-events.tsx +6 -4
- package/src/victory-util/axis.tsx +12 -3
- package/src/victory-util/collection.tsx +13 -0
- package/src/victory-util/helpers.ts +11 -0
- package/src/victory-util/index.ts +0 -1
- package/src/victory-util/wrapper.tsx +1 -0
- package/src/victory-util/merge-refs.ts +0 -13
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
declare type SafeAttribute = string;
|
|
3
|
-
/**
|
|
4
|
-
* Asserts that value is not null or undefined, throwing an error if it is.
|
|
5
|
-
* @param value The value to assert
|
|
6
|
-
* @param message The error message to throw
|
|
7
|
-
*/
|
|
8
|
-
export declare function assert<T>(value: T, message?: string): asserts value is NonNullable<T>;
|
|
9
|
-
/**
|
|
10
|
-
* getSafeUserProps - function that takes in a props object and removes any
|
|
11
|
-
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
|
|
12
|
-
* object.
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} props: props to be filtered against USER_PROPS_SAFELIST
|
|
15
|
-
* @returns {Object}: object containing remaining acceptable props
|
|
16
|
-
*/
|
|
17
|
-
export declare const getSafeUserProps: <T>(props: T) => Record<SafeAttribute, string>;
|
|
18
|
-
/**
|
|
19
|
-
* Wraps a component and adds safe user props
|
|
20
|
-
*
|
|
21
|
-
* @param {ReactElement} component: parent component
|
|
22
|
-
* @param {Object} props: props to be filtered
|
|
23
|
-
* @returns {ReactElement} modified component
|
|
24
|
-
*/
|
|
25
|
-
export declare const withSafeUserProps: (component: React.ReactElement, props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
26
|
-
export {};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare type SafeAttribute = string;
|
|
3
|
+
/**
|
|
4
|
+
* Asserts that value is not null or undefined, throwing an error if it is.
|
|
5
|
+
* @param value The value to assert
|
|
6
|
+
* @param message The error message to throw
|
|
7
|
+
*/
|
|
8
|
+
export declare function assert<T>(value: T, message?: string): asserts value is NonNullable<T>;
|
|
9
|
+
/**
|
|
10
|
+
* getSafeUserProps - function that takes in a props object and removes any
|
|
11
|
+
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
|
|
12
|
+
* object.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} props: props to be filtered against USER_PROPS_SAFELIST
|
|
15
|
+
* @returns {Object}: object containing remaining acceptable props
|
|
16
|
+
*/
|
|
17
|
+
export declare const getSafeUserProps: <T>(props: T) => Record<SafeAttribute, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Wraps a component and adds safe user props
|
|
20
|
+
*
|
|
21
|
+
* @param {ReactElement} component: parent component
|
|
22
|
+
* @param {Object} props: props to be filtered
|
|
23
|
+
* @returns {ReactElement} modified component
|
|
24
|
+
*/
|
|
25
|
+
export declare const withSafeUserProps: (component: React.ReactElement, props: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
26
|
+
export {};
|
|
27
27
|
//# sourceMappingURL=user-props.d.ts.map
|
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
|
|
19
1
|
import * as React from "react";
|
|
20
2
|
import { evaluateProp } from "./helpers";
|
|
3
|
+
|
|
21
4
|
/*
|
|
22
5
|
USER_PROPS_SAFELIST is to contain any string deemed safe for user props.
|
|
23
6
|
The startsWidth array will contain the start of any accepted user-prop that
|
|
24
7
|
starts with these characters.
|
|
25
8
|
The exactMatch will contain a list of exact prop names that are accepted.
|
|
26
9
|
*/
|
|
27
|
-
|
|
28
|
-
var USER_PROPS_SAFELIST = {
|
|
10
|
+
const USER_PROPS_SAFELIST = {
|
|
29
11
|
startsWith: ["data-", "aria-"],
|
|
30
12
|
exactMatch: []
|
|
31
|
-
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Normally we'd use Template Literal Types, but we're avoiding it to maximize TS compatibility with TS < 4.1
|
|
32
16
|
|
|
33
17
|
// `data-${string}` | `aria-${string}`;
|
|
34
18
|
|
|
@@ -40,14 +24,15 @@ var USER_PROPS_SAFELIST = {
|
|
|
40
24
|
* @returns {Boolean}: returns true if the key starts with an option or false if
|
|
41
25
|
* otherwise
|
|
42
26
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
USER_PROPS_SAFELIST.startsWith.forEach(
|
|
46
|
-
|
|
27
|
+
const doesPropStartWith = key => {
|
|
28
|
+
let startsWith = false;
|
|
29
|
+
USER_PROPS_SAFELIST.startsWith.forEach(starterString => {
|
|
30
|
+
const regex = new RegExp(`\\b(${starterString})(\\w|-)+`, "g");
|
|
47
31
|
if (regex.test(key)) startsWith = true;
|
|
48
32
|
});
|
|
49
33
|
return startsWith;
|
|
50
34
|
};
|
|
35
|
+
|
|
51
36
|
/**
|
|
52
37
|
* isExactMatch: checks to see if the given key matches any of the 'exactMatch'
|
|
53
38
|
* items in the whitelist
|
|
@@ -56,34 +41,29 @@ var doesPropStartWith = function (key) {
|
|
|
56
41
|
* @returns {Boolean}: return true if whitelist contains that key, otherwise
|
|
57
42
|
* returns false.
|
|
58
43
|
*/
|
|
44
|
+
const isExactMatch = key => USER_PROPS_SAFELIST.exactMatch.includes(key);
|
|
59
45
|
|
|
60
|
-
|
|
61
|
-
var isExactMatch = function (key) {
|
|
62
|
-
return USER_PROPS_SAFELIST.exactMatch.includes(key);
|
|
63
|
-
};
|
|
64
46
|
/**
|
|
65
47
|
* testIfSafeProp: tests prop's key against both startsWith and exactMatch values
|
|
66
48
|
* @param {String} key: prop key to be tested against the whitelist
|
|
67
49
|
* @returns {Boolean}: returns true if found in whitelist, otherwise returns false
|
|
68
50
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var testIfSafeProp = function (key) {
|
|
51
|
+
const testIfSafeProp = key => {
|
|
72
52
|
if (doesPropStartWith(key) || isExactMatch(key)) return true;
|
|
73
53
|
return false;
|
|
74
54
|
};
|
|
55
|
+
|
|
75
56
|
/**
|
|
76
57
|
* Asserts that value is not null or undefined, throwing an error if it is.
|
|
77
58
|
* @param value The value to assert
|
|
78
59
|
* @param message The error message to throw
|
|
79
60
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
61
|
export function assert(value, message) {
|
|
83
62
|
if (value === undefined || value === null) {
|
|
84
63
|
throw new Error(message);
|
|
85
64
|
}
|
|
86
65
|
}
|
|
66
|
+
|
|
87
67
|
/**
|
|
88
68
|
* getSafeUserProps - function that takes in a props object and removes any
|
|
89
69
|
* key-value entries that do not match filter strings in the USER_PROPS_SAFELIST
|
|
@@ -92,23 +72,19 @@ export function assert(value, message) {
|
|
|
92
72
|
* @param {Object} props: props to be filtered against USER_PROPS_SAFELIST
|
|
93
73
|
* @returns {Object}: object containing remaining acceptable props
|
|
94
74
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return Object.fromEntries(Object.entries(propsToFilter).filter(
|
|
100
|
-
|
|
101
|
-
key = _ref2[0];
|
|
102
|
-
|
|
75
|
+
export const getSafeUserProps = props => {
|
|
76
|
+
const propsToFilter = {
|
|
77
|
+
...props
|
|
78
|
+
};
|
|
79
|
+
return Object.fromEntries(Object.entries(propsToFilter).filter(_ref => {
|
|
80
|
+
let [key] = _ref;
|
|
103
81
|
return testIfSafeProp(key);
|
|
104
|
-
}).map(
|
|
105
|
-
|
|
106
|
-
key = _ref4[0],
|
|
107
|
-
value = _ref4[1];
|
|
108
|
-
|
|
82
|
+
}).map(_ref2 => {
|
|
83
|
+
let [key, value] = _ref2;
|
|
109
84
|
return [key, evaluateProp(value, props)];
|
|
110
85
|
}));
|
|
111
86
|
};
|
|
87
|
+
|
|
112
88
|
/**
|
|
113
89
|
* Wraps a component and adds safe user props
|
|
114
90
|
*
|
|
@@ -116,7 +92,6 @@ export var getSafeUserProps = function (props) {
|
|
|
116
92
|
* @param {Object} props: props to be filtered
|
|
117
93
|
* @returns {ReactElement} modified component
|
|
118
94
|
*/
|
|
119
|
-
|
|
120
|
-
export var withSafeUserProps = function (component, props) {
|
|
95
|
+
export const withSafeUserProps = (component, props) => {
|
|
121
96
|
return /*#__PURE__*/React.cloneElement(component, getSafeUserProps(props));
|
|
122
97
|
};
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
export declare function addBinsToParentPropsIfHistogram({ children, props, childComponents, parentProps, }: {
|
|
2
|
-
children: any;
|
|
3
|
-
props: any;
|
|
4
|
-
childComponents: any;
|
|
5
|
-
parentProps: any;
|
|
6
|
-
}): any;
|
|
7
|
-
export declare function getDataFromChildren(props: any, childComponents: any): any[][];
|
|
8
|
-
export declare function getData(props: any, childComponents: any): any;
|
|
9
|
-
export declare function getWidth(props: any, groupLength?: any, seriesLength?: any): number;
|
|
10
|
-
export declare function getDefaultDomainPadding(props: any, axis: any, childComponents: any): {
|
|
11
|
-
x: number;
|
|
12
|
-
} | undefined;
|
|
13
|
-
export declare function getDomainFromChildren(props: any, axis: any, childComponents: any): (number | Date)[];
|
|
14
|
-
export declare function getDomain(props: any, axis: any, childComponents: any): any;
|
|
15
|
-
export declare function getScale(props: any, axis: any, childComponents?: any): import("..").D3Scale<any>;
|
|
16
|
-
export declare function getAllEvents(props: any): any;
|
|
17
|
-
export declare function getColor(calculatedProps: any, child: any, index: any): any;
|
|
18
|
-
export declare function getStyle(theme: any, style: any, role: any): any;
|
|
19
|
-
export declare function getChildStyle(child: any, index: any, calculatedProps: any): any
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export declare function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export declare function
|
|
31
|
-
x: any
|
|
32
|
-
y: any
|
|
33
|
-
};
|
|
34
|
-
export declare function getCategories(props: any, childComponents: any, allStrings?: any): {
|
|
35
|
-
x: any;
|
|
36
|
-
y: any;
|
|
37
|
-
};
|
|
1
|
+
export declare function addBinsToParentPropsIfHistogram({ children, props, childComponents, parentProps, }: {
|
|
2
|
+
children: any;
|
|
3
|
+
props: any;
|
|
4
|
+
childComponents: any;
|
|
5
|
+
parentProps: any;
|
|
6
|
+
}): any;
|
|
7
|
+
export declare function getDataFromChildren(props: any, childComponents: any): any[][];
|
|
8
|
+
export declare function getData(props: any, childComponents: any): any;
|
|
9
|
+
export declare function getWidth(props: any, groupLength?: any, seriesLength?: any): number;
|
|
10
|
+
export declare function getDefaultDomainPadding(props: any, axis: any, childComponents: any): {
|
|
11
|
+
x: number;
|
|
12
|
+
} | undefined;
|
|
13
|
+
export declare function getDomainFromChildren(props: any, axis: any, childComponents: any): (number | Date)[];
|
|
14
|
+
export declare function getDomain(props: any, axis: any, childComponents: any): any;
|
|
15
|
+
export declare function getScale(props: any, axis: any, childComponents?: any): import("..").D3Scale<any>;
|
|
16
|
+
export declare function getAllEvents(props: any): any;
|
|
17
|
+
export declare function getColor(calculatedProps: any, child: any, index: any): any;
|
|
18
|
+
export declare function getStyle(theme: any, style: any, role: any): any;
|
|
19
|
+
export declare function getChildStyle(child: any, index: any, calculatedProps: any): any;
|
|
20
|
+
export declare function getStringsFromCategories(childComponents: any, axis: any): any[];
|
|
21
|
+
export declare function getStringsFromData(childComponents: any): {
|
|
22
|
+
x: number[];
|
|
23
|
+
y: number[];
|
|
24
|
+
};
|
|
25
|
+
export declare function getCategoryAndAxisStringsFromChildren(props: any, axis: any, childComponents: any): any[];
|
|
26
|
+
export declare function getStringsFromChildren(props: any, childComponents: any): {
|
|
27
|
+
x: any[];
|
|
28
|
+
y: any[];
|
|
29
|
+
};
|
|
30
|
+
export declare function getCategories(props: any, childComponents: any, allStrings?: any): {
|
|
31
|
+
x: any;
|
|
32
|
+
y: any;
|
|
33
|
+
};
|
|
38
34
|
//# sourceMappingURL=wrapper.d.ts.map
|