gifted-charts-core 0.0.48 → 0.0.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -17,6 +17,7 @@ interface IusePiePro {
17
17
  x: number;
18
18
  y: number;
19
19
  };
20
+ labelsPosition: LabelsPosition;
20
21
  }
21
22
  export declare const usePiePro: (props: PieChartPropsType) => IusePiePro;
22
23
  export {};
@@ -1,20 +1,3 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- import { useEffect, useState } from 'react';
18
1
  import { defaultAnimationDuration } from '../utils/constants';
19
2
  export var usePiePro = function (props) {
20
3
  var _a, _b;
@@ -22,13 +5,6 @@ export var usePiePro = function (props) {
22
5
  var endAngle = (_a = props.endAngle) !== null && _a !== void 0 ? _a : startAngle + Math.PI * (semiCircle ? 1 : 2);
23
6
  var total = data.reduce(function (acc, item) { return acc + item.value; }, 0);
24
7
  var animationDuration = (_b = props.animationDuration) !== null && _b !== void 0 ? _b : defaultAnimationDuration;
25
- var _h = __read(useState(isAnimated), 2), isAnimating = _h[0], setIsAnimating = _h[1];
26
- useEffect(function () {
27
- if (isAnimated) {
28
- setIsAnimating(true);
29
- setTimeout(function () { return setIsAnimating(false); }, animationDuration);
30
- }
31
- }, []);
32
8
  var endAngleLocal = 0;
33
9
  var addValues = function (index) {
34
10
  if (index < 0)
@@ -170,9 +146,9 @@ export var usePiePro = function (props) {
170
146
  initial: initial,
171
147
  dInitial: dInitial,
172
148
  dFinal: dFinal,
173
- isAnimating: isAnimating,
174
149
  getStartCaps: getStartCaps,
175
150
  getEndCaps: getEndCaps,
176
- getTextCoordinates: getTextCoordinates
151
+ getTextCoordinates: getTextCoordinates,
152
+ labelsPosition: labelsPosition
177
153
  };
178
154
  };
@@ -20,6 +20,7 @@ interface IusePiePro {
20
20
  index: number,
21
21
  labelPos?: LabelsPosition
22
22
  ) => { x: number; y: number }
23
+ labelsPosition: LabelsPosition
23
24
  }
24
25
 
25
26
  export const usePiePro = (props: PieChartPropsType): IusePiePro => {
@@ -38,15 +39,6 @@ export const usePiePro = (props: PieChartPropsType): IusePiePro => {
38
39
  const total = data.reduce((acc, item) => acc + item.value, 0)
39
40
  const animationDuration = props.animationDuration ?? defaultAnimationDuration
40
41
 
41
- const [isAnimating, setIsAnimating] = useState(isAnimated)
42
-
43
- useEffect(() => {
44
- if (isAnimated) {
45
- setIsAnimating(true)
46
- setTimeout(() => setIsAnimating(false), animationDuration)
47
- }
48
- }, [])
49
-
50
42
  let endAngleLocal = 0
51
43
 
52
44
  const addValues = (index: number) => {
@@ -253,9 +245,9 @@ export const usePiePro = (props: PieChartPropsType): IusePiePro => {
253
245
  initial,
254
246
  dInitial,
255
247
  dFinal,
256
- isAnimating,
257
248
  getStartCaps,
258
249
  getEndCaps,
259
- getTextCoordinates
250
+ getTextCoordinates,
251
+ labelsPosition
260
252
  }
261
253
  }