victory-stack 36.9.1 → 36.9.2-next.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.
@@ -4,81 +4,65 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VictoryStack = void 0;
7
-
8
7
  var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
9
-
10
8
  var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
11
-
12
9
  var _react = _interopRequireDefault(require("react"));
13
-
14
10
  var _victoryCore = require("victory-core");
15
-
16
11
  var _victorySharedEvents = require("victory-shared-events");
17
-
18
12
  var _helperMethods = require("./helper-methods");
19
-
20
13
  var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- 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; }
25
-
26
- 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; }
27
-
28
- 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; }
29
-
30
- var fallbackProps = {
15
+ const fallbackProps = {
31
16
  width: 450,
32
17
  height: 300,
33
18
  padding: 50
34
19
  };
35
- var defaultProps = {
20
+ const defaultProps = {
36
21
  containerComponent: /*#__PURE__*/_react.default.createElement(_victoryCore.VictoryContainer, null),
37
22
  groupComponent: /*#__PURE__*/_react.default.createElement("g", null),
38
23
  standalone: true,
39
24
  theme: _victoryCore.VictoryTheme.grayscale,
40
25
  fillInMissingData: true
41
26
  };
42
-
43
- var VictoryStackBase = function (initialProps) {
44
- var role = VictoryStack.role;
45
-
46
- var propsWithDefaults = _react.default.useMemo(function () {
47
- return _objectSpread(_objectSpread({}, defaultProps), initialProps);
48
- }, [initialProps]);
49
-
50
- var _Hooks$useAnimationSt = _victoryCore.Hooks.useAnimationState(),
51
- setAnimationState = _Hooks$useAnimationSt.setAnimationState,
52
- getAnimationProps = _Hooks$useAnimationSt.getAnimationProps,
53
- getProps = _Hooks$useAnimationSt.getProps;
54
-
55
- var props = getProps(propsWithDefaults);
56
-
57
- var modifiedProps = _victoryCore.Helpers.modifyProps(props, fallbackProps, role);
58
-
59
- var eventKey = modifiedProps.eventKey,
60
- containerComponent = modifiedProps.containerComponent,
61
- standalone = modifiedProps.standalone,
62
- groupComponent = modifiedProps.groupComponent,
63
- externalEventMutations = modifiedProps.externalEventMutations,
64
- width = modifiedProps.width,
65
- height = modifiedProps.height,
66
- theme = modifiedProps.theme,
67
- polar = modifiedProps.polar,
68
- horizontal = modifiedProps.horizontal,
69
- name = modifiedProps.name;
70
-
71
- var childComponents = _react.default.Children.toArray(modifiedProps.children);
72
-
73
- var calculatedProps = (0, _helperMethods.useMemoizedProps)(modifiedProps);
74
- var domain = calculatedProps.domain,
75
- scale = calculatedProps.scale,
76
- style = calculatedProps.style;
77
-
78
- var newChildren = _react.default.useMemo(function () {
79
- var children = (0, _helperMethods.getChildren)(props, childComponents, calculatedProps);
80
- var orderedChildren = children.map(function (child, index) {
81
- var childProps = Object.assign({
27
+ const VictoryStackBase = initialProps => {
28
+ const {
29
+ role
30
+ } = VictoryStack;
31
+ const propsWithDefaults = _react.default.useMemo(() => ({
32
+ ...defaultProps,
33
+ ...initialProps
34
+ }), [initialProps]);
35
+ const {
36
+ setAnimationState,
37
+ getAnimationProps,
38
+ getProps
39
+ } = _victoryCore.Hooks.useAnimationState();
40
+ const props = getProps(propsWithDefaults);
41
+ const modifiedProps = _victoryCore.Helpers.modifyProps(props, fallbackProps, role);
42
+ const {
43
+ eventKey,
44
+ containerComponent,
45
+ standalone,
46
+ groupComponent,
47
+ externalEventMutations,
48
+ width,
49
+ height,
50
+ theme,
51
+ polar,
52
+ horizontal,
53
+ name
54
+ } = modifiedProps;
55
+ const childComponents = _react.default.Children.toArray(modifiedProps.children);
56
+ const calculatedProps = (0, _helperMethods.useMemoizedProps)(modifiedProps);
57
+ const {
58
+ domain,
59
+ scale,
60
+ style
61
+ } = calculatedProps;
62
+ const newChildren = _react.default.useMemo(() => {
63
+ const children = (0, _helperMethods.getChildren)(props, childComponents, calculatedProps);
64
+ const orderedChildren = children.map((child, index) => {
65
+ const childProps = Object.assign({
82
66
  animate: getAnimationProps(props, child, index)
83
67
  }, child.props);
84
68
  return /*#__PURE__*/_react.default.cloneElement(child, childProps);
@@ -88,57 +72,45 @@ var VictoryStackBase = function (initialProps) {
88
72
  are rendered behind lower children. This looks nicer for stacked bars with cornerRadius, and
89
73
  areas with strokes
90
74
  */
91
-
92
75
  return orderedChildren.reverse();
93
76
  }, [props, childComponents, calculatedProps, getAnimationProps]);
94
-
95
- var containerProps = _react.default.useMemo(function () {
77
+ const containerProps = _react.default.useMemo(() => {
96
78
  if (standalone) {
97
79
  return {
98
- domain: domain,
99
- scale: scale,
100
- width: width,
101
- height: height,
102
- standalone: standalone,
103
- theme: theme,
80
+ domain,
81
+ scale,
82
+ width,
83
+ height,
84
+ standalone,
85
+ theme,
104
86
  style: style.parent,
105
- horizontal: horizontal,
106
- polar: polar,
107
- name: name
87
+ horizontal,
88
+ polar,
89
+ name
108
90
  };
109
91
  }
110
-
111
92
  return {};
112
93
  }, [standalone, domain, scale, width, height, theme, style, horizontal, polar, name]);
113
-
114
- var userProps = _react.default.useMemo(function () {
115
- return _victoryCore.UserProps.getSafeUserProps(propsWithDefaults);
116
- }, [propsWithDefaults]);
117
-
118
- var container = _react.default.useMemo(function () {
94
+ const userProps = _react.default.useMemo(() => _victoryCore.UserProps.getSafeUserProps(propsWithDefaults), [propsWithDefaults]);
95
+ const container = _react.default.useMemo(() => {
119
96
  if (standalone) {
120
- var defaultContainerProps = (0, _defaults2.default)({}, containerComponent.props, containerProps, userProps);
97
+ const defaultContainerProps = (0, _defaults2.default)({}, containerComponent.props, containerProps, userProps);
121
98
  return /*#__PURE__*/_react.default.cloneElement(containerComponent, defaultContainerProps);
122
99
  }
123
-
124
100
  return /*#__PURE__*/_react.default.cloneElement(groupComponent, userProps);
125
101
  }, [groupComponent, standalone, containerComponent, containerProps, userProps]);
126
-
127
- var events = _react.default.useMemo(function () {
102
+ const events = _react.default.useMemo(() => {
128
103
  return _victoryCore.Wrapper.getAllEvents(props);
129
104
  }, [props]);
130
-
131
- var previousProps = _victoryCore.Hooks.usePreviousProps(propsWithDefaults);
132
-
133
- _react.default.useEffect(function () {
105
+ const previousProps = _victoryCore.Hooks.usePreviousProps(propsWithDefaults);
106
+ _react.default.useEffect(() => {
134
107
  // This is called before dismount to keep state in sync
135
- return function () {
108
+ return () => {
136
109
  if (propsWithDefaults.animate) {
137
110
  setAnimationState(previousProps, propsWithDefaults);
138
111
  }
139
112
  };
140
113
  }, [setAnimationState, previousProps, propsWithDefaults]);
141
-
142
114
  if (!(0, _isEmpty2.default)(events)) {
143
115
  return /*#__PURE__*/_react.default.createElement(_victorySharedEvents.VictorySharedEvents, {
144
116
  container: container,
@@ -147,15 +119,12 @@ var VictoryStackBase = function (initialProps) {
147
119
  externalEventMutations: externalEventMutations
148
120
  }, newChildren);
149
121
  }
150
-
151
122
  return /*#__PURE__*/_react.default.cloneElement(container, container.props, newChildren);
152
123
  };
153
-
154
- var componentConfig = {
124
+ const componentConfig = {
155
125
  role: "stack",
156
126
  expectedComponents: ["groupComponent", "containerComponent", "labelComponent"],
157
127
  getChildren: _helperMethods.getChildren
158
128
  };
159
- var VictoryStack = Object.assign( /*#__PURE__*/_react.default.memo(VictoryStackBase, _reactFastCompare.default), componentConfig);
160
- exports.VictoryStack = VictoryStack;
129
+ const VictoryStack = exports.VictoryStack = Object.assign( /*#__PURE__*/_react.default.memo(VictoryStackBase, _reactFastCompare.default), componentConfig);
161
130
  VictoryStack.displayName = "VictoryStack";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "victory-stack",
3
- "version": "36.9.1",
3
+ "version": "36.9.2-next.0",
4
4
  "description": "Stack Layout Component for Victory",
5
5
  "keywords": [
6
6
  "data visualization",
@@ -22,19 +22,15 @@
22
22
  "dependencies": {
23
23
  "lodash": "^4.17.19",
24
24
  "react-fast-compare": "^3.2.0",
25
- "victory-core": "^36.9.1",
26
- "victory-shared-events": "^36.9.1"
25
+ "victory-core": "^36.9.2-next.0",
26
+ "victory-shared-events": "^36.9.2-next.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": ">=16.6.0"
30
30
  },
31
31
  "devDependencies": {
32
- "victory-bar": "*",
33
- "victory-histogram": "*",
34
- "victory-stack": "*"
35
- },
36
- "publishConfig": {
37
- "provenance": true
32
+ "victory-bar": "36.9.2-next.0",
33
+ "victory-histogram": "36.9.2-next.0"
38
34
  },
39
35
  "wireit": {
40
36
  "### THESE WIREIT CONFIGS ARE GENERATED ####": {},
@@ -262,7 +258,7 @@
262
258
  ]
263
259
  },
264
260
  "jest": {
265
- "command": "nps jest:pkg",
261
+ "command": "jest --passWithNoTests",
266
262
  "files": [
267
263
  "src/**/*.test.*",
268
264
  "../../.babelrc.js",
@@ -271,11 +267,12 @@
271
267
  ],
272
268
  "output": [],
273
269
  "dependencies": [
274
- "build:lib:cjs",
275
- "../victory-bar:build:lib:cjs",
276
- "../victory-histogram:build:lib:cjs",
277
- "../victory-vendor:build:lib:cjs",
278
- "../victory-voronoi:build:lib:cjs"
270
+ "../victory-core:build",
271
+ "../victory-shared-events:build",
272
+ "../victory-bar:build",
273
+ "../victory-histogram:build",
274
+ "../victory-vendor:build",
275
+ "../victory-voronoi:build"
279
276
  ],
280
277
  "packageLocks": [
281
278
  "pnpm-lock.yaml"