victory-core 36.9.2-next.1 → 36.9.2

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.
Files changed (163) hide show
  1. package/CHANGELOG.md +22 -9
  2. package/LICENSE.txt +30 -0
  3. package/README.md +1 -1
  4. package/dist/victory-core.js +686 -31464
  5. package/dist/victory-core.min.js +1 -2
  6. package/es/index.d.ts +17 -17
  7. package/es/types/callbacks.d.ts +36 -36
  8. package/es/types/prop-types.d.ts +129 -130
  9. package/es/victory-accessible-group/victory-accessible-group.d.ts +10 -10
  10. package/es/victory-animation/util.d.ts +66 -66
  11. package/es/victory-animation/victory-animation.d.ts +34 -34
  12. package/es/victory-clip-container/victory-clip-container.d.ts +46 -46
  13. package/es/victory-container/victory-container.d.ts +68 -64
  14. package/es/victory-container/victory-container.js +216 -164
  15. package/es/victory-label/victory-label.d.ts +58 -58
  16. package/es/victory-portal/portal-context.d.ts +11 -9
  17. package/es/victory-portal/portal-context.js +1 -1
  18. package/es/victory-portal/portal.d.ts +20 -9
  19. package/es/victory-portal/portal.js +77 -6
  20. package/es/victory-portal/victory-portal.d.ts +26 -9
  21. package/es/victory-portal/victory-portal.js +98 -24
  22. package/es/victory-primitives/arc.d.ts +14 -14
  23. package/es/victory-primitives/background.d.ts +13 -13
  24. package/es/victory-primitives/border.d.ts +10 -10
  25. package/es/victory-primitives/circle.d.ts +3 -3
  26. package/es/victory-primitives/clip-path.d.ts +7 -7
  27. package/es/victory-primitives/index.d.ts +14 -14
  28. package/es/victory-primitives/line-segment.d.ts +11 -11
  29. package/es/victory-primitives/line.d.ts +3 -3
  30. package/es/victory-primitives/path.d.ts +3 -3
  31. package/es/victory-primitives/point.d.ts +13 -13
  32. package/es/victory-primitives/rect.d.ts +3 -3
  33. package/es/victory-primitives/text.d.ts +8 -8
  34. package/es/victory-primitives/tspan.d.ts +3 -3
  35. package/es/victory-primitives/types.d.ts +7 -7
  36. package/es/victory-primitives/whisker.d.ts +15 -15
  37. package/es/victory-theme/grayscale.d.ts +2 -2
  38. package/es/victory-theme/material.d.ts +2 -2
  39. package/es/victory-theme/types.d.ts +238 -238
  40. package/es/victory-theme/victory-theme.d.ts +5 -5
  41. package/es/victory-transition/victory-transition.d.ts +53 -53
  42. package/es/victory-util/add-events.d.ts +126 -126
  43. package/es/victory-util/add-events.js +4 -8
  44. package/es/victory-util/axis.d.ts +50 -50
  45. package/es/victory-util/axis.js +13 -6
  46. package/es/victory-util/collection.d.ts +15 -8
  47. package/es/victory-util/collection.js +16 -0
  48. package/es/victory-util/common-props.d.ts +79 -79
  49. package/es/victory-util/data.d.ts +74 -74
  50. package/es/victory-util/default-transitions.d.ts +4 -4
  51. package/es/victory-util/domain.d.ts +90 -90
  52. package/es/victory-util/events.d.ts +64 -64
  53. package/es/victory-util/helpers.d.ts +96 -91
  54. package/es/victory-util/helpers.js +12 -1
  55. package/es/victory-util/hooks/index.d.ts +2 -2
  56. package/es/victory-util/hooks/use-animation-state.d.ts +21 -21
  57. package/es/victory-util/hooks/use-previous-props.d.ts +1 -1
  58. package/es/victory-util/immutable.d.ts +11 -11
  59. package/es/victory-util/index.d.ts +26 -27
  60. package/es/victory-util/index.js +0 -1
  61. package/es/victory-util/label-helpers.d.ts +26 -26
  62. package/es/victory-util/line-helpers.d.ts +4 -4
  63. package/es/victory-util/log.d.ts +1 -1
  64. package/es/victory-util/point-path-helpers.d.ts +9 -9
  65. package/es/victory-util/scale.d.ts +9 -9
  66. package/es/victory-util/selection.d.ts +28 -28
  67. package/es/victory-util/style.d.ts +18 -18
  68. package/es/victory-util/textsize.d.ts +35 -35
  69. package/es/victory-util/timer-context.d.ts +11 -11
  70. package/es/victory-util/timer.d.ts +16 -16
  71. package/es/victory-util/transitions.d.ts +48 -48
  72. package/es/victory-util/type-helpers.d.ts +9 -9
  73. package/es/victory-util/user-props.d.ts +26 -26
  74. package/es/victory-util/wrapper.d.ts +33 -37
  75. package/es/victory-util/wrapper.js +2 -2
  76. package/lib/index.d.ts +17 -17
  77. package/lib/types/callbacks.d.ts +36 -36
  78. package/lib/types/prop-types.d.ts +129 -130
  79. package/lib/victory-accessible-group/victory-accessible-group.d.ts +10 -10
  80. package/lib/victory-animation/util.d.ts +66 -66
  81. package/lib/victory-animation/victory-animation.d.ts +34 -34
  82. package/lib/victory-clip-container/victory-clip-container.d.ts +46 -46
  83. package/lib/victory-container/victory-container.d.ts +68 -64
  84. package/lib/victory-container/victory-container.js +221 -170
  85. package/lib/victory-label/victory-label.d.ts +58 -58
  86. package/lib/victory-portal/portal-context.d.ts +11 -9
  87. package/lib/victory-portal/portal-context.js +1 -1
  88. package/lib/victory-portal/portal.d.ts +20 -9
  89. package/lib/victory-portal/portal.js +78 -7
  90. package/lib/victory-portal/victory-portal.d.ts +26 -9
  91. package/lib/victory-portal/victory-portal.js +99 -27
  92. package/lib/victory-primitives/arc.d.ts +14 -14
  93. package/lib/victory-primitives/background.d.ts +13 -13
  94. package/lib/victory-primitives/border.d.ts +10 -10
  95. package/lib/victory-primitives/circle.d.ts +3 -3
  96. package/lib/victory-primitives/clip-path.d.ts +7 -7
  97. package/lib/victory-primitives/index.d.ts +14 -14
  98. package/lib/victory-primitives/line-segment.d.ts +11 -11
  99. package/lib/victory-primitives/line.d.ts +3 -3
  100. package/lib/victory-primitives/path.d.ts +3 -3
  101. package/lib/victory-primitives/point.d.ts +13 -13
  102. package/lib/victory-primitives/rect.d.ts +3 -3
  103. package/lib/victory-primitives/text.d.ts +8 -8
  104. package/lib/victory-primitives/tspan.d.ts +3 -3
  105. package/lib/victory-primitives/types.d.ts +7 -7
  106. package/lib/victory-primitives/whisker.d.ts +15 -15
  107. package/lib/victory-theme/grayscale.d.ts +2 -2
  108. package/lib/victory-theme/material.d.ts +2 -2
  109. package/lib/victory-theme/types.d.ts +238 -238
  110. package/lib/victory-theme/victory-theme.d.ts +5 -5
  111. package/lib/victory-transition/victory-transition.d.ts +53 -53
  112. package/lib/victory-util/add-events.d.ts +126 -126
  113. package/lib/victory-util/add-events.js +6 -6
  114. package/lib/victory-util/axis.d.ts +50 -50
  115. package/lib/victory-util/axis.js +13 -7
  116. package/lib/victory-util/collection.d.ts +15 -8
  117. package/lib/victory-util/collection.js +18 -0
  118. package/lib/victory-util/common-props.d.ts +79 -79
  119. package/lib/victory-util/data.d.ts +74 -74
  120. package/lib/victory-util/default-transitions.d.ts +4 -4
  121. package/lib/victory-util/domain.d.ts +90 -90
  122. package/lib/victory-util/events.d.ts +64 -64
  123. package/lib/victory-util/helpers.d.ts +96 -91
  124. package/lib/victory-util/helpers.js +13 -0
  125. package/lib/victory-util/hooks/index.d.ts +2 -2
  126. package/lib/victory-util/hooks/use-animation-state.d.ts +21 -21
  127. package/lib/victory-util/hooks/use-previous-props.d.ts +1 -1
  128. package/lib/victory-util/immutable.d.ts +11 -11
  129. package/lib/victory-util/index.d.ts +26 -27
  130. package/lib/victory-util/index.js +0 -14
  131. package/lib/victory-util/label-helpers.d.ts +26 -26
  132. package/lib/victory-util/line-helpers.d.ts +4 -4
  133. package/lib/victory-util/log.d.ts +1 -1
  134. package/lib/victory-util/point-path-helpers.d.ts +9 -9
  135. package/lib/victory-util/scale.d.ts +9 -9
  136. package/lib/victory-util/selection.d.ts +28 -28
  137. package/lib/victory-util/style.d.ts +18 -18
  138. package/lib/victory-util/textsize.d.ts +35 -35
  139. package/lib/victory-util/timer-context.d.ts +11 -11
  140. package/lib/victory-util/timer.d.ts +16 -16
  141. package/lib/victory-util/transitions.d.ts +48 -48
  142. package/lib/victory-util/type-helpers.d.ts +9 -9
  143. package/lib/victory-util/user-props.d.ts +26 -26
  144. package/lib/victory-util/wrapper.d.ts +33 -37
  145. package/lib/victory-util/wrapper.js +2 -2
  146. package/package.json +6 -3
  147. package/src/types/prop-types.ts +0 -7
  148. package/src/victory-container/victory-container.tsx +195 -173
  149. package/src/victory-portal/portal-context.ts +4 -5
  150. package/src/victory-portal/portal.tsx +42 -5
  151. package/src/victory-portal/victory-portal.tsx +71 -34
  152. package/src/victory-util/add-events.tsx +6 -4
  153. package/src/victory-util/axis.tsx +12 -3
  154. package/src/victory-util/collection.tsx +13 -0
  155. package/src/victory-util/helpers.ts +11 -0
  156. package/src/victory-util/index.ts +0 -1
  157. package/src/victory-util/wrapper.tsx +1 -0
  158. package/dist/victory-core.min.js.LICENSE.txt +0 -19
  159. package/es/victory-util/merge-refs.d.ts +0 -5
  160. package/es/victory-util/merge-refs.js +0 -11
  161. package/lib/victory-util/merge-refs.d.ts +0 -5
  162. package/lib/victory-util/merge-refs.js +0 -18
  163. package/src/victory-util/merge-refs.ts +0 -13
@@ -1,59 +1,59 @@
1
- import React from "react";
2
- import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
3
- import { ValueOrAccessor } from "../types/prop-types";
4
- import { PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
5
- export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
6
- export declare type OriginType = {
7
- x: number;
8
- y: number;
9
- };
10
- export declare type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
11
- export interface VictoryLabelProps {
12
- angle?: StringOrNumberOrCallback;
13
- ariaLabel?: StringOrCallback;
14
- backgroundComponent?: React.ReactElement;
15
- backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
16
- backgroundPadding?: PaddingProps | PaddingProps[];
17
- capHeight?: StringOrNumberOrCallback;
18
- children?: StringOrNumberOrCallback;
19
- className?: string;
20
- datum?: Record<string, any>;
21
- data?: any[];
22
- desc?: string;
23
- direction?: string;
24
- disableInlineStyles?: boolean;
25
- events?: React.DOMAttributes<any>;
26
- groupComponent?: React.ReactElement;
27
- id?: StringOrNumberOrCallback;
28
- inline?: boolean;
29
- labelPlacement?: LabelOrientationType;
30
- lineHeight?: StringOrNumberOrCallback | (string | number)[];
31
- origin?: OriginType;
32
- polar?: boolean;
33
- renderInPortal?: boolean;
34
- style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
35
- tabIndex?: NumberOrCallback;
36
- text?: string[] | StringOrNumberOrCallback;
37
- textComponent?: React.ReactElement;
38
- textAnchor?: ValueOrAccessor<TextAnchorType>;
39
- title?: string;
40
- transform?: ValueOrAccessor<string | object>;
41
- tspanComponent?: React.ReactElement;
42
- verticalAnchor?: ValueOrAccessor<VerticalAnchorType>;
43
- x?: number;
44
- y?: number;
45
- dx?: StringOrNumberOrCallback;
46
- dy?: StringOrNumberOrCallback;
47
- }
48
- declare const defaultStyles: {
49
- fill: string;
50
- fontSize: number;
51
- fontFamily: string;
52
- stroke: string;
53
- };
54
- export declare const VictoryLabel: {
55
- role: string;
56
- defaultStyles: typeof defaultStyles;
57
- } & React.FC<VictoryLabelProps>;
58
- export {};
1
+ import React from "react";
2
+ import { NumberOrCallback, StringOrCallback, StringOrNumberOrCallback } from "../types/callbacks";
3
+ import { ValueOrAccessor } from "../types/prop-types";
4
+ import { PaddingProps, VerticalAnchorType, VictoryLabelStyleObject } from "../victory-theme/victory-theme";
5
+ export declare type TextAnchorType = "start" | "middle" | "end" | "inherit";
6
+ export declare type OriginType = {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ export declare type LabelOrientationType = "parallel" | "perpendicular" | "vertical";
11
+ export interface VictoryLabelProps {
12
+ angle?: StringOrNumberOrCallback;
13
+ ariaLabel?: StringOrCallback;
14
+ backgroundComponent?: React.ReactElement;
15
+ backgroundStyle?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
16
+ backgroundPadding?: PaddingProps | PaddingProps[];
17
+ capHeight?: StringOrNumberOrCallback;
18
+ children?: StringOrNumberOrCallback;
19
+ className?: string;
20
+ datum?: Record<string, any>;
21
+ data?: any[];
22
+ desc?: string;
23
+ direction?: string;
24
+ disableInlineStyles?: boolean;
25
+ events?: React.DOMAttributes<any>;
26
+ groupComponent?: React.ReactElement;
27
+ id?: StringOrNumberOrCallback;
28
+ inline?: boolean;
29
+ labelPlacement?: LabelOrientationType;
30
+ lineHeight?: StringOrNumberOrCallback | (string | number)[];
31
+ origin?: OriginType;
32
+ polar?: boolean;
33
+ renderInPortal?: boolean;
34
+ style?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
35
+ tabIndex?: NumberOrCallback;
36
+ text?: string[] | StringOrNumberOrCallback;
37
+ textComponent?: React.ReactElement;
38
+ textAnchor?: ValueOrAccessor<TextAnchorType>;
39
+ title?: string;
40
+ transform?: ValueOrAccessor<string | object>;
41
+ tspanComponent?: React.ReactElement;
42
+ verticalAnchor?: ValueOrAccessor<VerticalAnchorType>;
43
+ x?: number;
44
+ y?: number;
45
+ dx?: StringOrNumberOrCallback;
46
+ dy?: StringOrNumberOrCallback;
47
+ }
48
+ declare const defaultStyles: {
49
+ fill: string;
50
+ fontSize: number;
51
+ fontFamily: string;
52
+ stroke: string;
53
+ };
54
+ export declare const VictoryLabel: {
55
+ role: string;
56
+ defaultStyles: typeof defaultStyles;
57
+ } & React.FC<VictoryLabelProps>;
58
+ export {};
59
59
  //# sourceMappingURL=victory-label.d.ts.map
@@ -1,10 +1,12 @@
1
- import React from "react";
2
- export interface PortalContextValue {
3
- portalElement: SVGSVGElement | undefined;
4
- }
5
- /**
6
- * The React context object consumers may use to access the context of the
7
- * portal.
8
- */
9
- export declare const PortalContext: React.Context<PortalContextValue | undefined>;
1
+ import React from "react";
2
+ export interface PortalContextValue {
3
+ portalRegister(): number;
4
+ portalUpdate(key: number, element: React.ReactElement): void;
5
+ portalDeregister(key: number): void;
6
+ }
7
+ /**
8
+ * The React context object consumers may use to access the context of the
9
+ * portal.
10
+ */
11
+ export declare const PortalContext: React.Context<PortalContextValue>;
10
12
  //# sourceMappingURL=portal-context.d.ts.map
@@ -4,5 +4,5 @@ import React from "react";
4
4
  * The React context object consumers may use to access the context of the
5
5
  * portal.
6
6
  */
7
- export var PortalContext = /*#__PURE__*/React.createContext(undefined);
7
+ export var PortalContext = /*#__PURE__*/React.createContext({});
8
8
  PortalContext.displayName = "PortalContext";
@@ -1,10 +1,21 @@
1
- import React from "react";
2
- export interface PortalProps {
3
- className?: string;
4
- height?: number;
5
- style?: React.CSSProperties;
6
- viewBox?: string;
7
- width?: number;
8
- }
9
- export declare const Portal: React.ForwardRefExoticComponent<PortalProps & React.RefAttributes<SVGSVGElement>>;
1
+ import React from "react";
2
+ import { PortalContextValue } from "./portal-context";
3
+ export interface PortalProps {
4
+ className?: string;
5
+ height?: number;
6
+ style?: React.CSSProperties;
7
+ viewBox?: string;
8
+ width?: number;
9
+ }
10
+ export declare class Portal extends React.Component<PortalProps> implements PortalContextValue {
11
+ static displayName: string;
12
+ private readonly map;
13
+ private index;
14
+ constructor(props: PortalProps);
15
+ portalRegister: () => number;
16
+ portalUpdate: (key: number, element: React.ReactElement) => void;
17
+ portalDeregister: (key: number) => void;
18
+ getChildren(): React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
19
+ render(): JSX.Element;
20
+ }
10
21
  //# sourceMappingURL=portal.d.ts.map
@@ -1,8 +1,79 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
+
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4
+
5
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
+
7
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
+
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
+
11
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+
13
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+
15
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
16
+
17
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
18
+
19
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
2
20
 
3
21
  import React from "react";
4
- export var Portal = /*#__PURE__*/React.forwardRef(function (props, ref) {
5
- return /*#__PURE__*/React.createElement("svg", _extends({
6
- ref: ref
7
- }, props));
8
- });
22
+ export var Portal = /*#__PURE__*/function (_ref) {
23
+ _inherits(Portal, _ref);
24
+
25
+ var _super = _createSuper(Portal);
26
+
27
+ function Portal(props) {
28
+ var _this;
29
+
30
+ _classCallCheck(this, Portal);
31
+
32
+ _this = _super.call(this, props);
33
+ _this.map = void 0;
34
+ _this.index = void 0;
35
+
36
+ _this.portalRegister = function () {
37
+ return ++_this.index;
38
+ };
39
+
40
+ _this.portalUpdate = function (key, element) {
41
+ _this.map[key] = element;
42
+
43
+ _this.forceUpdate();
44
+ };
45
+
46
+ _this.portalDeregister = function (key) {
47
+ delete _this.map[key];
48
+
49
+ _this.forceUpdate();
50
+ };
51
+
52
+ _this.map = {};
53
+ _this.index = 1;
54
+ return _this;
55
+ }
56
+
57
+ _createClass(Portal, [{
58
+ key: "getChildren",
59
+ value: function getChildren() {
60
+ var _this2 = this;
61
+
62
+ return Object.keys(this.map).map(function (key) {
63
+ var el = _this2.map[key];
64
+ return el ? /*#__PURE__*/React.cloneElement(el, {
65
+ key: key
66
+ }) : el;
67
+ });
68
+ } // Overridden in victory-core-native
69
+
70
+ }, {
71
+ key: "render",
72
+ value: function render() {
73
+ return /*#__PURE__*/React.createElement("svg", this.props, this.getChildren());
74
+ }
75
+ }]);
76
+
77
+ return Portal;
78
+ }(React.Component);
79
+ Portal.displayName = "Portal";
@@ -1,10 +1,27 @@
1
- import React from "react";
2
- export interface VictoryPortalProps {
3
- children?: React.ReactElement;
4
- groupComponent?: React.ReactElement;
5
- }
6
- export declare const VictoryPortal: {
7
- (initialProps: VictoryPortalProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
8
- role: string;
9
- };
1
+ import React from "react";
2
+ import { PortalContext } from "./portal-context";
3
+ export interface VictoryPortalProps {
4
+ children?: React.ReactElement;
5
+ groupComponent?: React.ReactElement;
6
+ }
7
+ export interface VictoryPortal {
8
+ context: React.ContextType<typeof PortalContext>;
9
+ }
10
+ export declare class VictoryPortal extends React.Component<VictoryPortalProps> {
11
+ static displayName: string;
12
+ static role: string;
13
+ static defaultProps: {
14
+ groupComponent: JSX.Element;
15
+ };
16
+ static contextType: React.Context<import("./portal-context").PortalContextValue>;
17
+ private checkedContext;
18
+ private portalKey;
19
+ renderInPlace: boolean;
20
+ element: React.ReactElement;
21
+ componentDidMount(): void;
22
+ componentDidUpdate(): void;
23
+ componentWillUnmount(): void;
24
+ renderPortal(child: React.ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
25
+ render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
26
+ }
10
27
  //# sourceMappingURL=victory-portal.d.ts.map
@@ -1,41 +1,115 @@
1
1
  import _defaults from "lodash/defaults";
2
2
 
3
- 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; }
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
4
 
5
- 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; }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
6
 
7
- 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; }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
+
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+
13
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
+
15
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
+
17
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
+
19
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
+
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
8
22
 
9
23
  import React from "react";
10
24
  import * as Log from "../victory-util/log";
11
25
  import * as Helpers from "../victory-util/helpers";
12
26
  import { PortalContext } from "./portal-context";
13
- import { createPortal } from "react-dom";
14
- var defaultProps = {
15
- groupComponent: /*#__PURE__*/React.createElement("g", null)
16
- };
17
- export var VictoryPortal = function (initialProps) {
18
- var props = _objectSpread(_objectSpread({}, defaultProps), initialProps);
27
+ export var VictoryPortal = /*#__PURE__*/function (_React$Component) {
28
+ _inherits(VictoryPortal, _React$Component);
19
29
 
20
- var portalContext = React.useContext(PortalContext);
30
+ var _super = _createSuper(VictoryPortal);
21
31
 
22
- if (!portalContext) {
23
- var msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
24
- Log.warn(msg);
32
+ function VictoryPortal() {
33
+ var _this;
34
+
35
+ _classCallCheck(this, VictoryPortal);
36
+
37
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38
+ args[_key] = arguments[_key];
39
+ }
40
+
41
+ _this = _super.call.apply(_super, [this].concat(args));
42
+ _this.checkedContext = void 0;
43
+ _this.portalKey = void 0;
44
+ _this.renderInPlace = void 0;
45
+ _this.element = void 0;
46
+ return _this;
25
47
  }
26
48
 
27
- var children = Array.isArray(props.children) ? props.children[0] : props.children;
28
- var groupComponent = props.groupComponent;
29
- var childProps = children && children.props || {};
30
- var standardProps = childProps.groupComponent ? {
31
- groupComponent: groupComponent,
32
- standalone: false
33
- } : {};
49
+ _createClass(VictoryPortal, [{
50
+ key: "componentDidMount",
51
+ value: function componentDidMount() {
52
+ if (!this.checkedContext) {
53
+ if (typeof this.context.portalUpdate !== "function") {
54
+ var msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
55
+ Log.warn(msg);
56
+ this.renderInPlace = true;
57
+ }
58
+
59
+ this.checkedContext = true;
60
+ }
34
61
 
35
- var newProps = _defaults(standardProps, childProps, Helpers.omit(props, ["children", "groupComponent"]));
62
+ this.forceUpdate();
63
+ }
64
+ }, {
65
+ key: "componentDidUpdate",
66
+ value: function componentDidUpdate() {
67
+ if (!this.renderInPlace) {
68
+ this.portalKey = this.portalKey || this.context.portalRegister();
69
+ this.context.portalUpdate(this.portalKey, this.element);
70
+ }
71
+ }
72
+ }, {
73
+ key: "componentWillUnmount",
74
+ value: function componentWillUnmount() {
75
+ if (this.context && this.context.portalDeregister) {
76
+ this.context.portalDeregister(this.portalKey);
77
+ }
78
+ } // Overridden in victory-core-native
36
79
 
37
- var child = children && /*#__PURE__*/React.cloneElement(children, newProps); // If there is no portal context, render the child in place
80
+ }, {
81
+ key: "renderPortal",
82
+ value: function renderPortal(child) {
83
+ if (this.renderInPlace) {
84
+ return child;
85
+ }
38
86
 
39
- return portalContext !== null && portalContext !== void 0 && portalContext.portalElement ? /*#__PURE__*/createPortal(child, portalContext.portalElement) : child;
87
+ this.element = child;
88
+ return null;
89
+ }
90
+ }, {
91
+ key: "render",
92
+ value: function render() {
93
+ var children = Array.isArray(this.props.children) ? this.props.children[0] : this.props.children;
94
+ var groupComponent = this.props.groupComponent;
95
+ var childProps = children && children.props || {};
96
+ var standardProps = childProps.groupComponent ? {
97
+ groupComponent: groupComponent,
98
+ standalone: false
99
+ } : {};
100
+
101
+ var newProps = _defaults(standardProps, childProps, Helpers.omit(this.props, ["children", "groupComponent"]));
102
+
103
+ var child = children && /*#__PURE__*/React.cloneElement(children, newProps);
104
+ return this.renderPortal(child);
105
+ }
106
+ }]);
107
+
108
+ return VictoryPortal;
109
+ }(React.Component);
110
+ VictoryPortal.displayName = "VictoryPortal";
111
+ VictoryPortal.role = "portal";
112
+ VictoryPortal.defaultProps = {
113
+ groupComponent: /*#__PURE__*/React.createElement("g", null)
40
114
  };
41
- VictoryPortal.role = "portal";
115
+ VictoryPortal.contextType = PortalContext;
@@ -1,15 +1,15 @@
1
- import React from "react";
2
- import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
- export interface ArcProps extends VictoryCommonPrimitiveProps {
4
- closedPath?: boolean;
5
- cx?: number;
6
- cy?: number;
7
- datum?: any;
8
- endAngle?: number;
9
- pathComponent?: React.ReactElement;
10
- r?: number;
11
- startAngle?: number;
12
- type?: string;
13
- }
14
- export declare const Arc: (initialProps: ArcProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
1
+ import React from "react";
2
+ import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
+ export interface ArcProps extends VictoryCommonPrimitiveProps {
4
+ closedPath?: boolean;
5
+ cx?: number;
6
+ cy?: number;
7
+ datum?: any;
8
+ endAngle?: number;
9
+ pathComponent?: React.ReactElement;
10
+ r?: number;
11
+ startAngle?: number;
12
+ type?: string;
13
+ }
14
+ export declare const Arc: (initialProps: ArcProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
15
15
  //# sourceMappingURL=arc.d.ts.map
@@ -1,14 +1,14 @@
1
- import React from "react";
2
- import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
- export interface BackgroundProps extends VictoryCommonPrimitiveProps {
4
- circleComponent?: React.ReactElement;
5
- height?: number;
6
- rectComponent?: React.ReactElement;
7
- rx?: number;
8
- ry?: number;
9
- width?: number;
10
- x?: number;
11
- y?: number;
12
- }
13
- export declare const Background: (initialProps: BackgroundProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
1
+ import React from "react";
2
+ import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
+ export interface BackgroundProps extends VictoryCommonPrimitiveProps {
4
+ circleComponent?: React.ReactElement;
5
+ height?: number;
6
+ rectComponent?: React.ReactElement;
7
+ rx?: number;
8
+ ry?: number;
9
+ width?: number;
10
+ x?: number;
11
+ y?: number;
12
+ }
13
+ export declare const Background: (initialProps: BackgroundProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
14
14
  //# sourceMappingURL=background.d.ts.map
@@ -1,11 +1,11 @@
1
- import React from "react";
2
- import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
- export interface BorderProps extends VictoryCommonPrimitiveProps {
4
- width?: number;
5
- height?: number;
6
- rectComponent?: React.ReactElement;
7
- x?: number;
8
- y?: number;
9
- }
10
- export declare const Border: (initialProps: BorderProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
1
+ import React from "react";
2
+ import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
+ export interface BorderProps extends VictoryCommonPrimitiveProps {
4
+ width?: number;
5
+ height?: number;
6
+ rectComponent?: React.ReactElement;
7
+ x?: number;
8
+ y?: number;
9
+ }
10
+ export declare const Border: (initialProps: BorderProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
11
11
  //# sourceMappingURL=border.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import { VictoryPrimitiveShapeProps } from "./types";
3
- export declare const Circle: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<SVGCircleElement>>;
1
+ import React from "react";
2
+ import { VictoryPrimitiveShapeProps } from "./types";
3
+ export declare const Circle: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<SVGCircleElement>>;
4
4
  //# sourceMappingURL=circle.d.ts.map
@@ -1,8 +1,8 @@
1
- import React from "react";
2
- import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
- export interface ClipPathProps extends VictoryCommonPrimitiveProps {
4
- children?: React.ReactNode[] | React.ReactNode;
5
- clipId?: number | string;
6
- }
7
- export declare const ClipPath: (props: ClipPathProps) => JSX.Element;
1
+ import React from "react";
2
+ import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
+ export interface ClipPathProps extends VictoryCommonPrimitiveProps {
4
+ children?: React.ReactNode[] | React.ReactNode;
5
+ clipId?: number | string;
6
+ }
7
+ export declare const ClipPath: (props: ClipPathProps) => JSX.Element;
8
8
  //# sourceMappingURL=clip-path.d.ts.map
@@ -1,15 +1,15 @@
1
- export * from "./arc";
2
- export * from "./background";
3
- export * from "./border";
4
- export * from "./circle";
5
- export * from "./clip-path";
6
- export * from "./line";
7
- export * from "./line-segment";
8
- export * from "./path";
9
- export * from "./point";
10
- export * from "./rect";
11
- export * from "./text";
12
- export * from "./tspan";
13
- export * from "./types";
14
- export * from "./whisker";
1
+ export * from "./arc";
2
+ export * from "./background";
3
+ export * from "./border";
4
+ export * from "./circle";
5
+ export * from "./clip-path";
6
+ export * from "./line";
7
+ export * from "./line-segment";
8
+ export * from "./path";
9
+ export * from "./point";
10
+ export * from "./rect";
11
+ export * from "./text";
12
+ export * from "./tspan";
13
+ export * from "./types";
14
+ export * from "./whisker";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,12 @@
1
- import React from "react";
2
- import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
- export interface LineSegmentProps extends VictoryCommonPrimitiveProps {
4
- datum?: any;
5
- lineComponent?: React.ReactElement;
6
- x1?: number;
7
- x2?: number;
8
- y1?: number;
9
- y2?: number;
10
- }
11
- export declare const LineSegment: (initialProps: LineSegmentProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
1
+ import React from "react";
2
+ import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
3
+ export interface LineSegmentProps extends VictoryCommonPrimitiveProps {
4
+ datum?: any;
5
+ lineComponent?: React.ReactElement;
6
+ x1?: number;
7
+ x2?: number;
8
+ y1?: number;
9
+ y2?: number;
10
+ }
11
+ export declare const LineSegment: (initialProps: LineSegmentProps) => React.DetailedReactHTMLElement<any, HTMLElement>;
12
12
  //# sourceMappingURL=line-segment.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import { VictoryPrimitiveShapeProps } from "./types";
3
- export declare const Line: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<SVGLineElement>>;
1
+ import React from "react";
2
+ import { VictoryPrimitiveShapeProps } from "./types";
3
+ export declare const Line: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<SVGLineElement>>;
4
4
  //# sourceMappingURL=line.d.ts.map
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import { VictoryPrimitiveShapeProps } from "./types";
3
- export declare const Path: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<SVGPathElement>>;
1
+ import React from "react";
2
+ import { VictoryPrimitiveShapeProps } from "./types";
3
+ export declare const Path: React.ForwardRefExoticComponent<VictoryPrimitiveShapeProps & React.RefAttributes<SVGPathElement>>;
4
4
  //# sourceMappingURL=path.d.ts.map