victory-stack 36.7.0 → 36.8.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.
@@ -70,13 +70,6 @@ export declare const VictoryStack: React.NamedExoticComponent<VictoryStackProps>
70
70
  standalone?: React.Validator<boolean | null | undefined> | undefined;
71
71
  width?: React.Validator<number | null | undefined> | undefined;
72
72
  };
73
- defaultProps: {
74
- containerComponent: JSX.Element;
75
- groupComponent: JSX.Element;
76
- standalone: boolean;
77
- theme: import("victory-core").VictoryThemeDefinition;
78
- fillInMissingData: boolean;
79
- };
80
73
  };
81
74
  } & VictoryComponentConfiguration<VictoryStackProps>;
82
75
  //# sourceMappingURL=victory-stack.d.ts.map
@@ -19,17 +19,26 @@ var fallbackProps = {
19
19
  height: 300,
20
20
  padding: 50
21
21
  };
22
+ var defaultProps = {
23
+ containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
24
+ groupComponent: /*#__PURE__*/React.createElement("g", null),
25
+ standalone: true,
26
+ theme: VictoryTheme.grayscale,
27
+ fillInMissingData: true
28
+ };
22
29
 
23
30
  var VictoryStackBase = function (initialProps) {
24
- // eslint-disable-next-line no-use-before-define
25
31
  var role = VictoryStack.role;
32
+ var propsWithDefaults = React.useMemo(function () {
33
+ return _objectSpread(_objectSpread({}, defaultProps), initialProps);
34
+ }, [initialProps]);
26
35
 
27
36
  var _Hooks$useAnimationSt = Hooks.useAnimationState(),
28
37
  setAnimationState = _Hooks$useAnimationSt.setAnimationState,
29
38
  getAnimationProps = _Hooks$useAnimationSt.getAnimationProps,
30
39
  getProps = _Hooks$useAnimationSt.getProps;
31
40
 
32
- var props = getProps(initialProps);
41
+ var props = getProps(propsWithDefaults);
33
42
  var modifiedProps = Helpers.modifyProps(props, fallbackProps, role);
34
43
  var eventKey = modifiedProps.eventKey,
35
44
  containerComponent = modifiedProps.containerComponent,
@@ -83,8 +92,8 @@ var VictoryStackBase = function (initialProps) {
83
92
  return {};
84
93
  }, [standalone, domain, scale, width, height, theme, style, horizontal, polar, name]);
85
94
  var userProps = React.useMemo(function () {
86
- return UserProps.getSafeUserProps(initialProps);
87
- }, [initialProps]);
95
+ return UserProps.getSafeUserProps(propsWithDefaults);
96
+ }, [propsWithDefaults]);
88
97
  var container = React.useMemo(function () {
89
98
  if (standalone) {
90
99
  var defaultContainerProps = _defaults({}, containerComponent.props, containerProps, userProps);
@@ -97,15 +106,15 @@ var VictoryStackBase = function (initialProps) {
97
106
  var events = React.useMemo(function () {
98
107
  return Wrapper.getAllEvents(props);
99
108
  }, [props]);
100
- var previousProps = Hooks.usePreviousProps(initialProps);
109
+ var previousProps = Hooks.usePreviousProps(propsWithDefaults);
101
110
  React.useEffect(function () {
102
111
  // This is called before dismount to keep state in sync
103
112
  return function () {
104
- if (initialProps.animate) {
105
- setAnimationState(previousProps, initialProps);
113
+ if (propsWithDefaults.animate) {
114
+ setAnimationState(previousProps, propsWithDefaults);
106
115
  }
107
116
  };
108
- }, [setAnimationState, previousProps, initialProps]);
117
+ }, [setAnimationState, previousProps, propsWithDefaults]);
109
118
 
110
119
  if (!_isEmpty(events)) {
111
120
  return /*#__PURE__*/React.createElement(VictorySharedEvents, {
@@ -138,13 +147,6 @@ VictoryStackBase.propTypes = _objectSpread(_objectSpread({}, CommonProps.basePro
138
147
  }),
139
148
  xOffset: PropTypes.number
140
149
  });
141
- VictoryStackBase.defaultProps = {
142
- containerComponent: /*#__PURE__*/React.createElement(VictoryContainer, null),
143
- groupComponent: /*#__PURE__*/React.createElement("g", null),
144
- standalone: true,
145
- theme: VictoryTheme.grayscale,
146
- fillInMissingData: true
147
- };
148
150
  var componentConfig = {
149
151
  role: "stack",
150
152
  expectedComponents: ["groupComponent", "containerComponent", "labelComponent"],
@@ -70,13 +70,6 @@ export declare const VictoryStack: React.NamedExoticComponent<VictoryStackProps>
70
70
  standalone?: React.Validator<boolean | null | undefined> | undefined;
71
71
  width?: React.Validator<number | null | undefined> | undefined;
72
72
  };
73
- defaultProps: {
74
- containerComponent: JSX.Element;
75
- groupComponent: JSX.Element;
76
- standalone: boolean;
77
- theme: import("victory-core").VictoryThemeDefinition;
78
- fillInMissingData: boolean;
79
- };
80
73
  };
81
74
  } & VictoryComponentConfiguration<VictoryStackProps>;
82
75
  //# sourceMappingURL=victory-stack.d.ts.map
@@ -36,17 +36,27 @@ var fallbackProps = {
36
36
  height: 300,
37
37
  padding: 50
38
38
  };
39
+ var defaultProps = {
40
+ containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
41
+ groupComponent: /*#__PURE__*/_react.default.createElement("g", null),
42
+ standalone: true,
43
+ theme: _victoryCore.VictoryTheme.grayscale,
44
+ fillInMissingData: true
45
+ };
39
46
 
40
47
  var VictoryStackBase = function (initialProps) {
41
- // eslint-disable-next-line no-use-before-define
42
48
  var role = VictoryStack.role;
43
49
 
50
+ var propsWithDefaults = _react.default.useMemo(function () {
51
+ return _objectSpread(_objectSpread({}, defaultProps), initialProps);
52
+ }, [initialProps]);
53
+
44
54
  var _Hooks$useAnimationSt = _victoryCore.Hooks.useAnimationState(),
45
55
  setAnimationState = _Hooks$useAnimationSt.setAnimationState,
46
56
  getAnimationProps = _Hooks$useAnimationSt.getAnimationProps,
47
57
  getProps = _Hooks$useAnimationSt.getProps;
48
58
 
49
- var props = getProps(initialProps);
59
+ var props = getProps(propsWithDefaults);
50
60
 
51
61
  var modifiedProps = _victoryCore.Helpers.modifyProps(props, fallbackProps, role);
52
62
 
@@ -106,8 +116,8 @@ var VictoryStackBase = function (initialProps) {
106
116
  }, [standalone, domain, scale, width, height, theme, style, horizontal, polar, name]);
107
117
 
108
118
  var userProps = _react.default.useMemo(function () {
109
- return _victoryCore.UserProps.getSafeUserProps(initialProps);
110
- }, [initialProps]);
119
+ return _victoryCore.UserProps.getSafeUserProps(propsWithDefaults);
120
+ }, [propsWithDefaults]);
111
121
 
112
122
  var container = _react.default.useMemo(function () {
113
123
  if (standalone) {
@@ -122,16 +132,16 @@ var VictoryStackBase = function (initialProps) {
122
132
  return _victoryCore.Wrapper.getAllEvents(props);
123
133
  }, [props]);
124
134
 
125
- var previousProps = _victoryCore.Hooks.usePreviousProps(initialProps);
135
+ var previousProps = _victoryCore.Hooks.usePreviousProps(propsWithDefaults);
126
136
 
127
137
  _react.default.useEffect(function () {
128
138
  // This is called before dismount to keep state in sync
129
139
  return function () {
130
- if (initialProps.animate) {
131
- setAnimationState(previousProps, initialProps);
140
+ if (propsWithDefaults.animate) {
141
+ setAnimationState(previousProps, propsWithDefaults);
132
142
  }
133
143
  };
134
- }, [setAnimationState, previousProps, initialProps]);
144
+ }, [setAnimationState, previousProps, propsWithDefaults]);
135
145
 
136
146
  if (!(0, _isEmpty2.default)(events)) {
137
147
  return /*#__PURE__*/_react.default.createElement(_victorySharedEvents.VictorySharedEvents, {
@@ -164,13 +174,6 @@ VictoryStackBase.propTypes = _objectSpread(_objectSpread({}, _victoryCore.Common
164
174
  }),
165
175
  xOffset: _propTypes.default.number
166
176
  });
167
- VictoryStackBase.defaultProps = {
168
- containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
169
- groupComponent: /*#__PURE__*/_react.default.createElement("g", null),
170
- standalone: true,
171
- theme: _victoryCore.VictoryTheme.grayscale,
172
- fillInMissingData: true
173
- };
174
177
  var componentConfig = {
175
178
  role: "stack",
176
179
  expectedComponents: ["groupComponent", "containerComponent", "labelComponent"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-stack",
3
- "version": "36.7.0",
3
+ "version": "36.8.2",
4
4
  "description": "Stack Layout Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -23,8 +23,8 @@
23
23
  "lodash": "^4.17.19",
24
24
  "prop-types": "^15.8.1",
25
25
  "react-fast-compare": "^3.2.0",
26
- "victory-core": "^36.7.0",
27
- "victory-shared-events": "^36.7.0"
26
+ "victory-core": "^36.8.2",
27
+ "victory-shared-events": "^36.8.2"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=16.6.0"
@@ -52,13 +52,24 @@ export interface VictoryStackProps
52
52
  xOffset?: number;
53
53
  }
54
54
 
55
+ const defaultProps = {
56
+ containerComponent: <VictoryContainer />,
57
+ groupComponent: <g />,
58
+ standalone: true,
59
+ theme: VictoryTheme.grayscale,
60
+ fillInMissingData: true,
61
+ };
62
+
55
63
  const VictoryStackBase = (initialProps: VictoryStackProps) => {
56
- // eslint-disable-next-line no-use-before-define
57
64
  const { role } = VictoryStack;
65
+ const propsWithDefaults = React.useMemo(
66
+ () => ({ ...defaultProps, ...initialProps }),
67
+ [initialProps],
68
+ );
58
69
  const { setAnimationState, getAnimationProps, getProps } =
59
70
  Hooks.useAnimationState();
60
71
 
61
- const props = getProps(initialProps);
72
+ const props = getProps(propsWithDefaults);
62
73
 
63
74
  const modifiedProps = Helpers.modifyProps(props, fallbackProps, role);
64
75
  const {
@@ -125,8 +136,8 @@ const VictoryStackBase = (initialProps: VictoryStackProps) => {
125
136
  name,
126
137
  ]);
127
138
  const userProps = React.useMemo(
128
- () => UserProps.getSafeUserProps(initialProps),
129
- [initialProps],
139
+ () => UserProps.getSafeUserProps(propsWithDefaults),
140
+ [propsWithDefaults],
130
141
  );
131
142
 
132
143
  const container = React.useMemo(() => {
@@ -152,16 +163,16 @@ const VictoryStackBase = (initialProps: VictoryStackProps) => {
152
163
  return Wrapper.getAllEvents(props);
153
164
  }, [props]);
154
165
 
155
- const previousProps = Hooks.usePreviousProps(initialProps);
166
+ const previousProps = Hooks.usePreviousProps(propsWithDefaults);
156
167
 
157
168
  React.useEffect(() => {
158
169
  // This is called before dismount to keep state in sync
159
170
  return () => {
160
- if (initialProps.animate) {
161
- setAnimationState(previousProps, initialProps);
171
+ if (propsWithDefaults.animate) {
172
+ setAnimationState(previousProps, propsWithDefaults);
162
173
  }
163
174
  };
164
- }, [setAnimationState, previousProps, initialProps]);
175
+ }, [setAnimationState, previousProps, propsWithDefaults]);
165
176
 
166
177
  if (!isEmpty(events)) {
167
178
  return (
@@ -226,14 +237,6 @@ VictoryStackBase.propTypes = {
226
237
  xOffset: PropTypes.number,
227
238
  };
228
239
 
229
- VictoryStackBase.defaultProps = {
230
- containerComponent: <VictoryContainer />,
231
- groupComponent: <g />,
232
- standalone: true,
233
- theme: VictoryTheme.grayscale,
234
- fillInMissingData: true,
235
- };
236
-
237
240
  const componentConfig: VictoryComponentConfiguration<VictoryStackProps> = {
238
241
  role: "stack",
239
242
  expectedComponents: [