victory-core 36.8.4 → 36.8.5

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 (66) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/victory-core.js +684 -1046
  3. package/dist/victory-core.min.js +1 -1
  4. package/es/victory-clip-container/victory-clip-container.js +3 -6
  5. package/es/victory-container/victory-container.js +5 -13
  6. package/es/victory-label/victory-label.js +6 -7
  7. package/es/victory-primitives/arc.js +2 -4
  8. package/es/victory-primitives/background.js +1 -3
  9. package/es/victory-primitives/border.js +2 -4
  10. package/es/victory-primitives/line-segment.js +2 -4
  11. package/es/victory-primitives/point.js +1 -3
  12. package/es/victory-primitives/whisker.js +3 -5
  13. package/es/victory-theme/grayscale.js +24 -27
  14. package/es/victory-theme/material.js +27 -30
  15. package/es/victory-util/add-events.js +1 -2
  16. package/es/victory-util/axis.js +3 -6
  17. package/es/victory-util/data.js +5 -10
  18. package/es/victory-util/events.js +13 -14
  19. package/es/victory-util/helpers.d.ts +11 -0
  20. package/es/victory-util/helpers.js +34 -5
  21. package/es/victory-util/point-path-helpers.js +3 -3
  22. package/es/victory-util/textsize.js +1 -2
  23. package/es/victory-util/transitions.js +14 -20
  24. package/es/victory-util/wrapper.js +7 -10
  25. package/lib/victory-clip-container/victory-clip-container.js +3 -5
  26. package/lib/victory-container/victory-container.js +5 -7
  27. package/lib/victory-label/victory-label.js +6 -8
  28. package/lib/victory-primitives/arc.js +2 -4
  29. package/lib/victory-primitives/background.js +1 -3
  30. package/lib/victory-primitives/border.js +2 -4
  31. package/lib/victory-primitives/line-segment.js +2 -4
  32. package/lib/victory-primitives/point.js +1 -3
  33. package/lib/victory-primitives/whisker.js +3 -5
  34. package/lib/victory-theme/grayscale.js +24 -29
  35. package/lib/victory-theme/material.js +27 -32
  36. package/lib/victory-util/add-events.js +1 -3
  37. package/lib/victory-util/axis.js +3 -7
  38. package/lib/victory-util/data.js +5 -9
  39. package/lib/victory-util/events.js +13 -15
  40. package/lib/victory-util/helpers.d.ts +11 -0
  41. package/lib/victory-util/helpers.js +36 -4
  42. package/lib/victory-util/point-path-helpers.js +6 -3
  43. package/lib/victory-util/textsize.js +1 -3
  44. package/lib/victory-util/transitions.js +14 -16
  45. package/lib/victory-util/wrapper.js +7 -9
  46. package/package.json +2 -2
  47. package/src/victory-clip-container/victory-clip-container.tsx +4 -4
  48. package/src/victory-container/victory-container.tsx +6 -6
  49. package/src/victory-label/victory-label.tsx +7 -7
  50. package/src/victory-primitives/arc.tsx +2 -3
  51. package/src/victory-primitives/background.tsx +1 -2
  52. package/src/victory-primitives/border.tsx +2 -3
  53. package/src/victory-primitives/line-segment.tsx +2 -3
  54. package/src/victory-primitives/point.tsx +1 -2
  55. package/src/victory-primitives/whisker.tsx +3 -4
  56. package/src/victory-theme/grayscale.tsx +30 -25
  57. package/src/victory-theme/material.tsx +33 -28
  58. package/src/victory-util/add-events.tsx +1 -2
  59. package/src/victory-util/axis.tsx +3 -5
  60. package/src/victory-util/data.ts +7 -7
  61. package/src/victory-util/events.ts +23 -16
  62. package/src/victory-util/helpers.ts +34 -3
  63. package/src/victory-util/point-path-helpers.ts +3 -2
  64. package/src/victory-util/textsize.ts +2 -2
  65. package/src/victory-util/transitions.ts +22 -15
  66. package/src/victory-util/wrapper.tsx +11 -8
@@ -1,4 +1,3 @@
1
- import { assign } from "lodash";
2
1
  import { VictoryThemeDefinition } from "./types";
3
2
 
4
3
  // *
@@ -43,7 +42,10 @@ const baseLabelStyles = {
43
42
  stroke: "transparent",
44
43
  };
45
44
 
46
- const centeredLabelStyles = assign({ textAnchor: "middle" }, baseLabelStyles);
45
+ const centeredLabelStyles = Object.assign(
46
+ { textAnchor: "middle" },
47
+ baseLabelStyles,
48
+ );
47
49
  // *
48
50
  // * Strokes
49
51
  // *
@@ -51,7 +53,7 @@ const strokeLinecap = "round";
51
53
  const strokeLinejoin = "round";
52
54
 
53
55
  export const grayscale: VictoryThemeDefinition = {
54
- area: assign(
56
+ area: Object.assign(
55
57
  {
56
58
  style: {
57
59
  data: {
@@ -62,7 +64,7 @@ export const grayscale: VictoryThemeDefinition = {
62
64
  },
63
65
  baseProps,
64
66
  ),
65
- axis: assign(
67
+ axis: Object.assign(
66
68
  {
67
69
  style: {
68
70
  axis: {
@@ -72,7 +74,7 @@ export const grayscale: VictoryThemeDefinition = {
72
74
  strokeLinecap,
73
75
  strokeLinejoin,
74
76
  },
75
- axisLabel: assign({}, centeredLabelStyles, {
77
+ axisLabel: Object.assign({}, centeredLabelStyles, {
76
78
  padding: 25,
77
79
  }),
78
80
  grid: {
@@ -90,7 +92,7 @@ export const grayscale: VictoryThemeDefinition = {
90
92
  },
91
93
  baseProps,
92
94
  ),
93
- bar: assign(
95
+ bar: Object.assign(
94
96
  {
95
97
  style: {
96
98
  data: {
@@ -103,32 +105,32 @@ export const grayscale: VictoryThemeDefinition = {
103
105
  },
104
106
  baseProps,
105
107
  ),
106
- boxplot: assign(
108
+ boxplot: Object.assign(
107
109
  {
108
110
  style: {
109
111
  max: { padding: 8, stroke: charcoal, strokeWidth: 1 },
110
- maxLabels: assign({}, baseLabelStyles, { padding: 3 }),
112
+ maxLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
111
113
  median: { padding: 8, stroke: charcoal, strokeWidth: 1 },
112
- medianLabels: assign({}, baseLabelStyles, { padding: 3 }),
114
+ medianLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
113
115
  min: { padding: 8, stroke: charcoal, strokeWidth: 1 },
114
- minLabels: assign({}, baseLabelStyles, { padding: 3 }),
116
+ minLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
115
117
  q1: { padding: 8, fill: grey },
116
- q1Labels: assign({}, baseLabelStyles, { padding: 3 }),
118
+ q1Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
117
119
  q3: { padding: 8, fill: grey },
118
- q3Labels: assign({}, baseLabelStyles, { padding: 3 }),
120
+ q3Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
119
121
  },
120
122
  boxWidth: 20,
121
123
  },
122
124
  baseProps,
123
125
  ),
124
- candlestick: assign(
126
+ candlestick: Object.assign(
125
127
  {
126
128
  style: {
127
129
  data: {
128
130
  stroke: charcoal,
129
131
  strokeWidth: 1,
130
132
  },
131
- labels: assign({}, baseLabelStyles, { padding: 5 }),
133
+ labels: Object.assign({}, baseLabelStyles, { padding: 5 }),
132
134
  },
133
135
  candleColors: {
134
136
  positive: "#ffffff",
@@ -138,7 +140,7 @@ export const grayscale: VictoryThemeDefinition = {
138
140
  baseProps,
139
141
  ),
140
142
  chart: baseProps,
141
- errorbar: assign(
143
+ errorbar: Object.assign(
142
144
  {
143
145
  borderWidth: 8,
144
146
  style: {
@@ -152,13 +154,13 @@ export const grayscale: VictoryThemeDefinition = {
152
154
  },
153
155
  baseProps,
154
156
  ),
155
- group: assign(
157
+ group: Object.assign(
156
158
  {
157
159
  colorScale: colors,
158
160
  },
159
161
  baseProps,
160
162
  ),
161
- histogram: assign(
163
+ histogram: Object.assign(
162
164
  {
163
165
  style: {
164
166
  data: {
@@ -181,10 +183,10 @@ export const grayscale: VictoryThemeDefinition = {
181
183
  type: "circle",
182
184
  },
183
185
  labels: baseLabelStyles,
184
- title: assign({}, baseLabelStyles, { padding: 5 }),
186
+ title: Object.assign({}, baseLabelStyles, { padding: 5 }),
185
187
  },
186
188
  },
187
- line: assign(
189
+ line: Object.assign(
188
190
  {
189
191
  style: {
190
192
  data: {
@@ -204,14 +206,14 @@ export const grayscale: VictoryThemeDefinition = {
204
206
  stroke: "transparent",
205
207
  strokeWidth: 1,
206
208
  },
207
- labels: assign({}, baseLabelStyles, { padding: 20 }),
209
+ labels: Object.assign({}, baseLabelStyles, { padding: 20 }),
208
210
  },
209
211
  colorScale: colors,
210
212
  width: 400,
211
213
  height: 400,
212
214
  padding: 50,
213
215
  },
214
- scatter: assign(
216
+ scatter: Object.assign(
215
217
  {
216
218
  style: {
217
219
  data: {
@@ -224,14 +226,17 @@ export const grayscale: VictoryThemeDefinition = {
224
226
  },
225
227
  baseProps,
226
228
  ),
227
- stack: assign(
229
+ stack: Object.assign(
228
230
  {
229
231
  colorScale: colors,
230
232
  },
231
233
  baseProps,
232
234
  ),
233
235
  tooltip: {
234
- style: assign({}, baseLabelStyles, { padding: 0, pointerEvents: "none" }),
236
+ style: Object.assign({}, baseLabelStyles, {
237
+ padding: 0,
238
+ pointerEvents: "none",
239
+ }),
235
240
  flyoutStyle: {
236
241
  stroke: charcoal,
237
242
  strokeWidth: 1,
@@ -242,7 +247,7 @@ export const grayscale: VictoryThemeDefinition = {
242
247
  cornerRadius: 5,
243
248
  pointerLength: 10,
244
249
  },
245
- voronoi: assign(
250
+ voronoi: Object.assign(
246
251
  {
247
252
  style: {
248
253
  data: {
@@ -250,7 +255,7 @@ export const grayscale: VictoryThemeDefinition = {
250
255
  stroke: "transparent",
251
256
  strokeWidth: 0,
252
257
  },
253
- labels: assign({}, baseLabelStyles, {
258
+ labels: Object.assign({}, baseLabelStyles, {
254
259
  padding: 5,
255
260
  pointerEvents: "none",
256
261
  }),
@@ -1,4 +1,3 @@
1
- import { assign } from "lodash";
2
1
  import { VictoryThemeDefinition } from "./types";
3
2
 
4
3
  // *
@@ -50,7 +49,10 @@ const baseLabelStyles = {
50
49
  strokeWidth: 0,
51
50
  };
52
51
 
53
- const centeredLabelStyles = assign({ textAnchor: "middle" }, baseLabelStyles);
52
+ const centeredLabelStyles = Object.assign(
53
+ { textAnchor: "middle" },
54
+ baseLabelStyles,
55
+ );
54
56
  // *
55
57
  // * Strokes
56
58
  // *
@@ -59,7 +61,7 @@ const strokeLinecap = "round";
59
61
  const strokeLinejoin = "round";
60
62
 
61
63
  export const material: VictoryThemeDefinition = {
62
- area: assign(
64
+ area: Object.assign(
63
65
  {
64
66
  style: {
65
67
  data: {
@@ -70,7 +72,7 @@ export const material: VictoryThemeDefinition = {
70
72
  },
71
73
  baseProps,
72
74
  ),
73
- axis: assign(
75
+ axis: Object.assign(
74
76
  {
75
77
  style: {
76
78
  axis: {
@@ -80,7 +82,7 @@ export const material: VictoryThemeDefinition = {
80
82
  strokeLinecap,
81
83
  strokeLinejoin,
82
84
  },
83
- axisLabel: assign({}, centeredLabelStyles, {
85
+ axisLabel: Object.assign({}, centeredLabelStyles, {
84
86
  padding,
85
87
  stroke: "transparent",
86
88
  }),
@@ -100,14 +102,14 @@ export const material: VictoryThemeDefinition = {
100
102
  strokeLinecap,
101
103
  strokeLinejoin,
102
104
  },
103
- tickLabels: assign({}, baseLabelStyles, {
105
+ tickLabels: Object.assign({}, baseLabelStyles, {
104
106
  fill: blueGrey700,
105
107
  }),
106
108
  },
107
109
  },
108
110
  baseProps,
109
111
  ),
110
- polarDependentAxis: assign({
112
+ polarDependentAxis: Object.assign({
111
113
  style: {
112
114
  ticks: {
113
115
  fill: "transparent",
@@ -116,7 +118,7 @@ export const material: VictoryThemeDefinition = {
116
118
  },
117
119
  },
118
120
  }),
119
- bar: assign(
121
+ bar: Object.assign(
120
122
  {
121
123
  style: {
122
124
  data: {
@@ -129,31 +131,31 @@ export const material: VictoryThemeDefinition = {
129
131
  },
130
132
  baseProps,
131
133
  ),
132
- boxplot: assign(
134
+ boxplot: Object.assign(
133
135
  {
134
136
  style: {
135
137
  max: { padding, stroke: blueGrey700, strokeWidth: 1 },
136
- maxLabels: assign({}, baseLabelStyles, { padding: 3 }),
138
+ maxLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
137
139
  median: { padding, stroke: blueGrey700, strokeWidth: 1 },
138
- medianLabels: assign({}, baseLabelStyles, { padding: 3 }),
140
+ medianLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
139
141
  min: { padding, stroke: blueGrey700, strokeWidth: 1 },
140
- minLabels: assign({}, baseLabelStyles, { padding: 3 }),
142
+ minLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
141
143
  q1: { padding, fill: blueGrey700 },
142
- q1Labels: assign({}, baseLabelStyles, { padding: 3 }),
144
+ q1Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
143
145
  q3: { padding, fill: blueGrey700 },
144
- q3Labels: assign({}, baseLabelStyles, { padding: 3 }),
146
+ q3Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
145
147
  },
146
148
  boxWidth: 20,
147
149
  },
148
150
  baseProps,
149
151
  ),
150
- candlestick: assign(
152
+ candlestick: Object.assign(
151
153
  {
152
154
  style: {
153
155
  data: {
154
156
  stroke: blueGrey700,
155
157
  },
156
- labels: assign({}, baseLabelStyles, { padding: 5 }),
158
+ labels: Object.assign({}, baseLabelStyles, { padding: 5 }),
157
159
  },
158
160
  candleColors: {
159
161
  positive: "#ffffff",
@@ -163,7 +165,7 @@ export const material: VictoryThemeDefinition = {
163
165
  baseProps,
164
166
  ),
165
167
  chart: baseProps,
166
- errorbar: assign(
168
+ errorbar: Object.assign(
167
169
  {
168
170
  borderWidth: 8,
169
171
  style: {
@@ -178,13 +180,13 @@ export const material: VictoryThemeDefinition = {
178
180
  },
179
181
  baseProps,
180
182
  ),
181
- group: assign(
183
+ group: Object.assign(
182
184
  {
183
185
  colorScale: colors,
184
186
  },
185
187
  baseProps,
186
188
  ),
187
- histogram: assign(
189
+ histogram: Object.assign(
188
190
  {
189
191
  style: {
190
192
  data: {
@@ -207,10 +209,10 @@ export const material: VictoryThemeDefinition = {
207
209
  type: "circle",
208
210
  },
209
211
  labels: baseLabelStyles,
210
- title: assign({}, baseLabelStyles, { padding: 5 }),
212
+ title: Object.assign({}, baseLabelStyles, { padding: 5 }),
211
213
  },
212
214
  },
213
- line: assign(
215
+ line: Object.assign(
214
216
  {
215
217
  style: {
216
218
  data: {
@@ -224,7 +226,7 @@ export const material: VictoryThemeDefinition = {
224
226
  },
225
227
  baseProps,
226
228
  ),
227
- pie: assign(
229
+ pie: Object.assign(
228
230
  {
229
231
  colorScale: colors,
230
232
  style: {
@@ -233,12 +235,12 @@ export const material: VictoryThemeDefinition = {
233
235
  stroke: blueGrey50,
234
236
  strokeWidth: 1,
235
237
  },
236
- labels: assign({}, baseLabelStyles, { padding: 20 }),
238
+ labels: Object.assign({}, baseLabelStyles, { padding: 20 }),
237
239
  },
238
240
  },
239
241
  baseProps,
240
242
  ),
241
- scatter: assign(
243
+ scatter: Object.assign(
242
244
  {
243
245
  style: {
244
246
  data: {
@@ -252,14 +254,17 @@ export const material: VictoryThemeDefinition = {
252
254
  },
253
255
  baseProps,
254
256
  ),
255
- stack: assign(
257
+ stack: Object.assign(
256
258
  {
257
259
  colorScale: colors,
258
260
  },
259
261
  baseProps,
260
262
  ),
261
263
  tooltip: {
262
- style: assign({}, baseLabelStyles, { padding: 0, pointerEvents: "none" }),
264
+ style: Object.assign({}, baseLabelStyles, {
265
+ padding: 0,
266
+ pointerEvents: "none",
267
+ }),
263
268
  flyoutStyle: {
264
269
  stroke: grey900,
265
270
  strokeWidth: 1,
@@ -270,7 +275,7 @@ export const material: VictoryThemeDefinition = {
270
275
  cornerRadius: 5,
271
276
  pointerLength: 10,
272
277
  },
273
- voronoi: assign(
278
+ voronoi: Object.assign(
274
279
  {
275
280
  style: {
276
281
  data: {
@@ -278,7 +283,7 @@ export const material: VictoryThemeDefinition = {
278
283
  stroke: "transparent",
279
284
  strokeWidth: 0,
280
285
  },
281
- labels: assign({}, baseLabelStyles, {
286
+ labels: Object.assign({}, baseLabelStyles, {
282
287
  padding: 5,
283
288
  pointerEvents: "none",
284
289
  }),
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import {
3
- assign,
4
3
  defaults,
5
4
  difference,
6
5
  isEmpty,
@@ -389,7 +388,7 @@ export function addEvents<
389
388
  componentProps.events,
390
389
  );
391
390
 
392
- return assign({}, componentProps, { events });
391
+ return Object.assign({}, componentProps, { events });
393
392
  }
394
393
 
395
394
  return defaults({ index, key: id }, currentProps, baseProps, { id });
@@ -1,13 +1,11 @@
1
1
  import React from "react";
2
2
  import {
3
- assign,
4
3
  defaults,
5
4
  identity,
6
5
  isFunction,
7
6
  isObject,
8
7
  invert,
9
8
  uniq,
10
- range,
11
9
  orderBy,
12
10
  values,
13
11
  includes,
@@ -208,7 +206,7 @@ function getTickArray(props) {
208
206
  if (tickValues && Collection.containsStrings(tickValues)) {
209
207
  ticks = stringMap
210
208
  ? tickValues.map((tick) => stringMap[tick])
211
- : range(1, tickValues.length + 1);
209
+ : Helpers.range(1, tickValues.length + 1);
212
210
  }
213
211
  const tickArray = ticks ? uniq(ticks) : getTicksFromFormat();
214
212
  const buildTickArray = (arr: number[]) => {
@@ -393,9 +391,9 @@ export function modifyProps(props, fallbackProps) {
393
391
  return Helpers.modifyProps(props, fallbackProps, "axis");
394
392
  }
395
393
  const axisTheme = defaults({}, props.theme[role], props.theme.axis);
396
- const theme = assign({}, props.theme, { axis: axisTheme });
394
+ const theme = Object.assign({}, props.theme, { axis: axisTheme });
397
395
  return Helpers.modifyProps(
398
- assign({}, props, { theme }),
396
+ Object.assign({}, props, { theme }),
399
397
  fallbackProps,
400
398
  "axis",
401
399
  );
@@ -1,9 +1,7 @@
1
1
  /* eslint-disable no-use-before-define */
2
2
  import React from "react";
3
3
  import {
4
- assign,
5
4
  uniq,
6
- range,
7
5
  last,
8
6
  isFunction,
9
7
  isPlainObject,
@@ -47,7 +45,7 @@ function generateDataArray(props, axis) {
47
45
  const domainMax = Math.max(...domain);
48
46
  const domainMin = Math.min(...domain);
49
47
  const step = (domainMax - domainMin) / samples;
50
- const values = range(domainMin, domainMax, step);
48
+ const values = Helpers.range(domainMin, domainMax, step);
51
49
  return last(values) === domainMax ? values : values.concat(domainMax);
52
50
  }
53
51
 
@@ -84,7 +82,7 @@ function cleanData(dataset, props) {
84
82
  const _x = rules(datum, "x") ? datum._x : smallNumber;
85
83
  const _y = rules(datum, "y") ? datum._y : smallNumber;
86
84
  const _y0 = rules(datum, "y0") ? datum._y0 : smallNumber;
87
- return assign({}, datum, { _x, _y, _y0 });
85
+ return Object.assign({}, datum, { _x, _y, _y0 });
88
86
  };
89
87
 
90
88
  return dataset.map((datum) => {
@@ -117,7 +115,9 @@ function addEventKeys(props, data) {
117
115
  return datum;
118
116
  } else if (hasEventKeyAccessor) {
119
117
  const eventKey = eventKeyAccessor(datum, index);
120
- return eventKey !== undefined ? assign({ eventKey }, datum) : datum;
118
+ return eventKey !== undefined
119
+ ? Object.assign({ eventKey }, datum)
120
+ : datum;
121
121
  }
122
122
  return datum;
123
123
  });
@@ -170,7 +170,7 @@ export function formatDataFromDomain(dataset, domain, defaultBaseline?) {
170
170
  // baseline and value with only baseline above max, set baseline to maxDomainY
171
171
  if (isOverMaxY(baseline) && !isOverMaxY(value)) _y0 = maxDomainY;
172
172
 
173
- return assign({}, datum, omitBy({ _x, _y, _y0, _y1 }, isUndefined));
173
+ return Object.assign({}, datum, omitBy({ _x, _y, _y0, _y1 }, isUndefined));
174
174
  });
175
175
  }
176
176
 
@@ -304,7 +304,7 @@ export function formatData(
304
304
  return memo;
305
305
  }, {});
306
306
 
307
- const formattedDatum = assign({}, processedValues, parsedDatum);
307
+ const formattedDatum = Object.assign({}, processedValues, parsedDatum);
308
308
  if (!isEmpty(formattedDatum)) {
309
309
  dataArr.push(formattedDatum);
310
310
  }
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable no-use-before-define */
2
2
  import {
3
- assign,
4
3
  isEmpty,
5
4
  isFunction,
6
5
  without,
@@ -82,7 +81,7 @@ export function getEvents(
82
81
  return (
83
82
  Array.isArray(selectedEvents) &&
84
83
  selectedEvents.reduce((memo, event) => {
85
- return event ? assign(memo, event.eventHandlers) : memo;
84
+ return event ? Object.assign(memo, event.eventHandlers) : memo;
86
85
  }, {} as ComponentEvent["eventHandlers"])
87
86
  );
88
87
  };
@@ -115,7 +114,7 @@ export function getEvents(
115
114
  const sharedEvents =
116
115
  props.sharedEvents.events &&
117
116
  getSharedEvents(getEventsByTarget(props.sharedEvents.events), target);
118
- return assign({}, sharedEvents, ownEvents);
117
+ return Object.assign({}, sharedEvents, ownEvents);
119
118
  }
120
119
 
121
120
  /* Returns a modified events object where each event handler is replaced by a new
@@ -194,7 +193,7 @@ export function getScopedEvents(
194
193
  "state",
195
194
  );
196
195
  const mutatedProps = eventReturn.mutation(
197
- assign({}, mutationTargetProps, mutationTargetState),
196
+ Object.assign({}, mutationTargetProps, mutationTargetState),
198
197
  newBaseProps,
199
198
  );
200
199
  const childState = baseState[childName] || {};
@@ -211,9 +210,13 @@ export function getScopedEvents(
211
210
 
212
211
  const extendState = (state) => {
213
212
  return target === "parent"
214
- ? assign(state, { [key]: assign(state[key], mutatedProps) })
215
- : assign(state, {
216
- [key]: assign(state[key], { [target]: mutatedProps }),
213
+ ? Object.assign(state, {
214
+ [key]: Object.assign(state[key] || {}, mutatedProps),
215
+ })
216
+ : Object.assign(state, {
217
+ [key]: Object.assign(state[key] || {}, {
218
+ [target]: mutatedProps,
219
+ }),
217
220
  });
218
221
  };
219
222
 
@@ -222,7 +225,7 @@ export function getScopedEvents(
222
225
  };
223
226
 
224
227
  return childName !== undefined && childName !== null
225
- ? assign(baseState, { [childName]: updateState(childState) })
228
+ ? Object.assign(baseState, { [childName]: updateState(childState) })
226
229
  : updateState(baseState);
227
230
  };
228
231
 
@@ -231,7 +234,7 @@ export function getScopedEvents(
231
234
  const mutationKeys = getKeys(childName);
232
235
  return Array.isArray(mutationKeys)
233
236
  ? mutationKeys.reduce((memo, key) => {
234
- return assign(memo, getMutationObject(key, childName));
237
+ return Object.assign(memo, getMutationObject(key, childName));
235
238
  }, {})
236
239
  : getMutationObject(mutationKeys, childName);
237
240
  };
@@ -241,7 +244,7 @@ export function getScopedEvents(
241
244
  childNames === "all" ? without(keys(newBaseProps), "parent") : childNames;
242
245
  return Array.isArray(allChildNames)
243
246
  ? allChildNames.reduce((memo, childName) => {
244
- return assign(memo, getReturnByChild(childName));
247
+ return Object.assign(memo, getReturnByChild(childName));
245
248
  }, {})
246
249
  : getReturnByChild(allChildNames);
247
250
  };
@@ -250,7 +253,7 @@ export function getScopedEvents(
250
253
  const parseEventReturn = (eventReturn, eventKey) => {
251
254
  return Array.isArray(eventReturn)
252
255
  ? eventReturn.reduce(
253
- (memo, props) => assign({}, memo, parseEvent(props, eventKey)),
256
+ (memo, props) => Object.assign({}, memo, parseEvent(props, eventKey)),
254
257
  {},
255
258
  )
256
259
  : parseEvent(eventReturn, eventKey);
@@ -394,7 +397,9 @@ export function getExternalMutations(
394
397
  identifier,
395
398
  );
396
399
  memo[eventKey] =
397
- mutation !== undefined ? assign({}, keyState, mutation) : keyState;
400
+ mutation !== undefined
401
+ ? Object.assign({}, keyState, mutation)
402
+ : keyState;
398
403
  } else {
399
404
  // use keys from both state and props so that elements not intially included in baseProps
400
405
  // will be used. (i.e. labels)
@@ -409,7 +414,7 @@ export function getExternalMutations(
409
414
  );
410
415
  m[target] =
411
416
  mutation !== undefined
412
- ? assign({}, keyState[target], mutation)
417
+ ? Object.assign({}, keyState[target], mutation)
413
418
  : keyState[target];
414
419
  return pickBy(m, (v) => !isEmpty(v));
415
420
  }, {});
@@ -466,8 +471,10 @@ export function getExternalMutation(
466
471
  return keyMutations.reduce((memo, curr) => {
467
472
  const mutationFunction =
468
473
  curr && isFunction(curr.mutation) ? curr.mutation : () => undefined;
469
- const currentMutation = mutationFunction(assign({}, baseProps, baseState));
470
- return assign({}, memo, currentMutation);
474
+ const currentMutation = mutationFunction(
475
+ Object.assign({}, baseProps, baseState),
476
+ );
477
+ return Object.assign({}, memo, currentMutation);
471
478
  }, {});
472
479
  }
473
480
 
@@ -503,4 +510,4 @@ export const omitGlobalEvents = (events) =>
503
510
  omitBy(events, (_, key) => GLOBAL_EVENT_REGEX.test(key));
504
511
 
505
512
  export const emulateReactEvent = (event) =>
506
- assign(event, { nativeEvent: event });
513
+ Object.assign(event, { nativeEvent: event });
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-use-before-define */
2
2
  import React, { isValidElement } from "react";
3
- import { defaults, isFunction, property, pick, assign, keys } from "lodash";
3
+ import { defaults, isFunction, property, pick, keys } from "lodash";
4
4
  import { CallbackArgs } from "../types/callbacks";
5
5
  import { ValueOrAccessor } from "../types/prop-types";
6
6
 
@@ -217,6 +217,37 @@ export function getCurrentAxis(axis, horizontal) {
217
217
  return horizontal ? otherAxis : axis;
218
218
  }
219
219
 
220
+ /**
221
+ * Creates an array of numbers (positive and/or negative) progressing
222
+ * from start up to, but not including, end.
223
+ * A step of -1 is used if a negative start is specified without an end or step.
224
+ * If end is not specified, it's set to start with start then set to 0.
225
+ *
226
+ * @param start The length of the array to create, or the start value
227
+ * @param end [The end value] If this is defined, start is the start value
228
+ * @returns An array of the given length
229
+ */
230
+ export function range(start: number, end?: number, increment?: number) {
231
+ // when the end index is not given, start from 0
232
+ const startIndex = end ? start : 0;
233
+
234
+ // when the end index is not given, the end of the range is the start index
235
+ let endIndex = end ? end : start;
236
+
237
+ // ensure endIndex is not a falsy value
238
+ if (!endIndex) endIndex = 0;
239
+
240
+ const k = endIndex - startIndex; // the value range
241
+ const length = Math.abs(k); // the length of the range
242
+ const sign = k / length || 1; // the sign of the range (negative or positive)
243
+ const inc = increment || 1; // the step size of each increment
244
+
245
+ // normalize the array length when dealing with floating point values
246
+ const arrayLength = Math.max(Math.ceil(length / inc), 0);
247
+
248
+ return Array.from(Array(arrayLength), (_, i) => startIndex + i * sign * inc);
249
+ }
250
+
220
251
  /**
221
252
  * @param {Array} children: an array of child components
222
253
  * @param {Function} iteratee: a function with arguments "child", "childName", and "parent"
@@ -262,7 +293,7 @@ export function reduceChildren<
262
293
  const childRole = child.type && child.type.role;
263
294
  const childName = child.props.name || `${childRole}-${names[index]}`;
264
295
  if (child.props && child.props.children) {
265
- const childProps = assign(
296
+ const childProps = Object.assign(
266
297
  {},
267
298
  child.props,
268
299
  pick(parentProps, sharedProps),
@@ -278,7 +309,7 @@ export function reduceChildren<
278
309
  child.props.children,
279
310
  ) as Array<React.ReactElement>
280
311
  ).map((c) => {
281
- const nestedChildProps = assign(
312
+ const nestedChildProps = Object.assign(
282
313
  {},
283
314
  c.props,
284
315
  pick(childProps, sharedProps),
@@ -1,5 +1,6 @@
1
1
  /* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 2.5, 3] }]*/
2
- import { range } from "lodash";
2
+
3
+ import * as Helpers from "./helpers";
3
4
 
4
5
  export function circle(x: number, y: number, size: number) {
5
6
  return `M ${x}, ${y}
@@ -110,7 +111,7 @@ export function star(x: number, y: number, size: number) {
110
111
  const baseSize = 1.35 * size; // eslint-disable-line no-magic-numbers
111
112
  const angle = Math.PI / 5; // eslint-disable-line no-magic-numbers
112
113
  // eslint-disable-next-line no-magic-numbers
113
- const starCoords = range(10).map((index) => {
114
+ const starCoords = Helpers.range(10).map((index) => {
114
115
  const length = index % 2 === 0 ? baseSize : baseSize / 2;
115
116
  return `${length * Math.sin(angle * (index + 1)) + x},
116
117
  ${length * Math.cos(angle * (index + 1)) + y}`;