react-native-gifted-charts 1.4.21 → 1.4.23

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 (63) hide show
  1. package/dist/BarChart/Animated2DWithGradient.d.ts +3 -0
  2. package/dist/BarChart/Animated2DWithGradient.js +113 -1
  3. package/dist/BarChart/RenderBars.d.ts +3 -0
  4. package/dist/BarChart/RenderBars.js +264 -1
  5. package/dist/BarChart/RenderStackBars.d.ts +3 -0
  6. package/dist/BarChart/RenderStackBars.js +174 -1
  7. package/dist/BarChart/index.d.ts +2 -0
  8. package/dist/BarChart/index.js +236 -1
  9. package/dist/BarChart/styles.d.ts +45 -0
  10. package/dist/BarChart/styles.js +46 -1
  11. package/dist/Components/AnimatedThreeDBar/index.d.ts +3 -0
  12. package/dist/Components/AnimatedThreeDBar/index.js +129 -1
  13. package/dist/Components/AnimatedThreeDBar/styles.d.ts +10 -0
  14. package/dist/Components/AnimatedThreeDBar/styles.js +13 -1
  15. package/dist/Components/BarAndLineChartsWrapper/index.d.ts +3 -0
  16. package/dist/Components/BarAndLineChartsWrapper/index.js +128 -1
  17. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.d.ts +2 -0
  18. package/dist/Components/BarAndLineChartsWrapper/renderHorizSections.js +322 -1
  19. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.d.ts +3 -0
  20. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/index.js +76 -1
  21. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.d.ts +2 -0
  22. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderDataPoints.js +50 -1
  23. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.d.ts +1 -0
  24. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificDataPoints.js +25 -1
  25. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.d.ts +1 -0
  26. package/dist/Components/BarAndLineChartsWrapper/renderLineInBarChart/renderSpecificVerticalLines.js +20 -1
  27. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.d.ts +2 -0
  28. package/dist/Components/BarAndLineChartsWrapper/renderVerticalLines.js +94 -1
  29. package/dist/Components/BarSpecificComponents/barBackgroundPattern.d.ts +2 -0
  30. package/dist/Components/BarSpecificComponents/barBackgroundPattern.js +9 -1
  31. package/dist/Components/BarSpecificComponents/cap.d.ts +2 -0
  32. package/dist/Components/BarSpecificComponents/cap.js +16 -1
  33. package/dist/Components/BarSpecificComponents/tooltip.d.ts +15 -0
  34. package/dist/Components/BarSpecificComponents/tooltip.js +40 -1
  35. package/dist/Components/common/LinearGradient.d.ts +16 -0
  36. package/dist/Components/common/LinearGradient.js +15 -1
  37. package/dist/Components/common/Pointer.d.ts +1 -0
  38. package/dist/Components/common/Pointer.js +16 -1
  39. package/dist/Components/common/StripAndLabel.d.ts +2 -0
  40. package/dist/Components/common/StripAndLabel.js +43 -1
  41. package/dist/Components/lineSvg.d.ts +14 -0
  42. package/dist/Components/lineSvg.js +22 -1
  43. package/dist/LineChart/LineChartBicolor.d.ts +2 -0
  44. package/dist/LineChart/LineChartBicolor.js +294 -1
  45. package/dist/LineChart/index.d.ts +2 -0
  46. package/dist/LineChart/index.js +1110 -1
  47. package/dist/LineChart/previous.d.ts +2 -0
  48. package/dist/LineChart/previous.js +9 -0
  49. package/dist/LineChart/styles.d.ts +43 -0
  50. package/dist/LineChart/styles.js +46 -1
  51. package/dist/PieChart/index.d.ts +2 -0
  52. package/dist/PieChart/index.js +99 -1
  53. package/dist/PieChart/main.d.ts +2 -0
  54. package/dist/PieChart/main.js +182 -1
  55. package/dist/PieChartPro/index.d.ts +2 -0
  56. package/dist/PieChartPro/index.js +124 -1
  57. package/dist/PopulationPyramid/index.d.ts +2 -0
  58. package/dist/PopulationPyramid/index.js +130 -1
  59. package/dist/index.d.ts +7 -0
  60. package/dist/index.js +7 -1
  61. package/dist/utils/index.d.ts +3 -0
  62. package/dist/utils/index.js +20 -1
  63. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ import { Animated2DWithGradientPropsType } from 'gifted-charts-core';
2
+ declare const Animated2DWithGradient: (props: Animated2DWithGradientPropsType) => import("react/jsx-runtime").JSX.Element;
3
+ export default Animated2DWithGradient;
@@ -1 +1,113 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _cap=_interopRequireDefault(require("../Components/BarSpecificComponents/cap"));var _LinearGradient=_interopRequireDefault(require("../Components/common/LinearGradient"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/BarChart/Animated2DWithGradient.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}if(_reactNative.Platform.OS==='android'){_reactNative.UIManager.setLayoutAnimationEnabledExperimental&&_reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);}var Animated2DWithGradient=function Animated2DWithGradient(props){var barBackgroundPattern=props.barBackgroundPattern,patternId=props.patternId,barWidth=props.barWidth,barStyle=props.barStyle,item=props.item,index=props.index,opacity=props.opacity,animationDuration=props.animationDuration,noGradient=props.noGradient,noAnimation=props.noAnimation,barMarginBottom=props.barMarginBottom,barInnerComponent=props.barInnerComponent,intactTopLabel=props.intactTopLabel,showValuesAsTopLabel=props.showValuesAsTopLabel,topLabelContainerStyle=props.topLabelContainerStyle,topLabelTextStyle=props.topLabelTextStyle,commonStyleForBar=props.commonStyleForBar,barStyleWithBackground=props.barStyleWithBackground,yAxisOffset=props.yAxisOffset;var _useState=(0,_react.useState)(noAnimation?props.height:0.2),_useState2=(0,_slicedToArray2.default)(_useState,2),height=_useState2[0],setHeight=_useState2[1];var _useState3=(0,_react.useState)(noAnimation?false:true),_useState4=(0,_slicedToArray2.default)(_useState3,2),initialRender=_useState4[0],setInitialRender=_useState4[1];(0,_react.useEffect)(function(){if(!noAnimation){if(initialRender){setTimeout(function(){return layoutAppear();},20);}else{elevate();}}else{setHeight(props.height);}},[props.height]);var elevate=function elevate(){_reactNative.LayoutAnimation.configureNext({duration:animationDuration,update:{type:'linear',property:'scaleXY'}});setHeight(props.height);};var layoutAppear=function layoutAppear(){_reactNative.LayoutAnimation.configureNext({duration:_reactNative.Platform.OS=='ios'?animationDuration:20,create:{type:'linear',property:'opacity'},update:{type:'linear',property:'scaleXY'}});setInitialRender(false);setTimeout(function(){return elevate();},_reactNative.Platform.OS=='ios'?10:100);};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[!initialRender&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',bottom:0,width:'100%',overflow:'hidden',height:(noAnimation?Math.max(props.minHeight,Math.abs(height)):height)-(barMarginBottom||0)},children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[{width:'100%',height:(noAnimation?Math.max(props.minHeight,Math.abs(height)):height)-(barMarginBottom||0)},item.barStyle||barStyle],children:[noGradient?(0,_jsxRuntime.jsx)(_reactNative.View,{style:barStyleWithBackground,children:props.cappedBars&&item.value?(0,_jsxRuntime.jsx)(_cap.default,{capThicknessFromItem:item.capThickness,capThicknessFromProps:props.capThickness,capColorFromItem:item.capColor,capColorFromProps:props.capColor,capRadiusFromItem:item.capRadius,capRadiusFromProps:props.capRadius}):null}):(0,_jsxRuntime.jsx)(_LinearGradient.default,{style:commonStyleForBar,start:{x:0,y:0},end:{x:1,y:1},colors:[item.gradientColor||props.gradientColor||'white',item.frontColor||props.frontColor||'black'],children:props.cappedBars&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:'absolute',width:'100%',height:item.capThickness===0?0:item.capThickness||props.capThickness||6,backgroundColor:item.capColor||props.capColor||'black',borderTopLeftRadius:item.capRadius===0?0:item.capRadius||props.capRadius||0,borderTopRightRadius:item.capRadius===0?0:item.capRadius||props.capRadius||0}})}),(item.barBackgroundPattern||barBackgroundPattern)&&(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{children:[(0,_jsxRuntime.jsx)(_reactNativeSvg.Defs,{children:item.barBackgroundPattern?item.barBackgroundPattern():barBackgroundPattern==null?void 0:barBackgroundPattern()}),(0,_jsxRuntime.jsx)(_reactNativeSvg.Rect,{stroke:"transparent",x:"1",y:"1",width:item.barWidth||props.barWidth||30,height:noAnimation?Math.abs(height):height,fill:`url(#${item.patternId||patternId})`})]}),barInnerComponent?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:'100%',width:'100%'},children:barInnerComponent(item,index)}):null]})}),item.topLabelComponent||showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{position:'absolute',top:(item.barWidth||barWidth||30)*-1,height:item.barWidth||barWidth||30,width:item.barWidth||barWidth||30,justifyContent:props.horizontal&&!intactTopLabel||item.value<0?'center':'flex-end',alignItems:'center',opacity:opacity},item.value<0&&{transform:[{rotate:'180deg'}]},props.horizontal&&!intactTopLabel&&{transform:[{rotate:'270deg'}]},topLabelContainerStyle!=null?topLabelContainerStyle:item.topLabelContainerStyle],children:showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:topLabelTextStyle,children:item.value+yAxisOffset}):item.topLabelComponent==null?void 0:item.topLabelComponent()}):null]});};var _default=exports.default=Animated2DWithGradient;
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 { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { useEffect, useState } from 'react';
19
+ import { View, LayoutAnimation, Platform, UIManager, Text } from 'react-native';
20
+ import Svg, { Defs, Rect } from 'react-native-svg';
21
+ import Cap from '../Components/BarSpecificComponents/cap';
22
+ import LinearGradient from '../Components/common/LinearGradient';
23
+ if (Platform.OS === 'android') {
24
+ UIManager.setLayoutAnimationEnabledExperimental &&
25
+ UIManager.setLayoutAnimationEnabledExperimental(true);
26
+ }
27
+ var Animated2DWithGradient = function (props) {
28
+ var _a;
29
+ var barBackgroundPattern = props.barBackgroundPattern, patternId = props.patternId, barWidth = props.barWidth, barStyle = props.barStyle, item = props.item, index = props.index, opacity = props.opacity, animationDuration = props.animationDuration, noGradient = props.noGradient, noAnimation = props.noAnimation, barMarginBottom = props.barMarginBottom, barInnerComponent = props.barInnerComponent, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, commonStyleForBar = props.commonStyleForBar, barStyleWithBackground = props.barStyleWithBackground, yAxisOffset = props.yAxisOffset;
30
+ var _b = __read(useState(noAnimation ? props.height : 0.2), 2), height = _b[0], setHeight = _b[1];
31
+ var _c = __read(useState(!noAnimation), 2), initialRender = _c[0], setInitialRender = _c[1];
32
+ useEffect(function () {
33
+ if (!noAnimation) {
34
+ if (initialRender) {
35
+ setTimeout(function () { return layoutAppear(); }, 20);
36
+ }
37
+ else {
38
+ elevate();
39
+ }
40
+ }
41
+ else {
42
+ setHeight(props.height);
43
+ }
44
+ }, [props.height]);
45
+ var elevate = function () {
46
+ LayoutAnimation.configureNext({
47
+ duration: animationDuration,
48
+ update: { type: 'linear', property: 'scaleXY' },
49
+ });
50
+ setHeight(props.height);
51
+ };
52
+ var layoutAppear = function () {
53
+ LayoutAnimation.configureNext({
54
+ duration: Platform.OS == 'ios' ? animationDuration : 20,
55
+ create: { type: 'linear', property: 'opacity' },
56
+ update: { type: 'linear', property: 'scaleXY' },
57
+ });
58
+ setInitialRender(false);
59
+ setTimeout(function () { return elevate(); }, Platform.OS == 'ios' ? 10 : 100);
60
+ };
61
+ return (_jsxs(_Fragment, { children: [!initialRender && (_jsx(View, { style: {
62
+ position: 'absolute',
63
+ bottom: 0,
64
+ width: '100%',
65
+ overflow: 'hidden',
66
+ height: (noAnimation
67
+ ? Math.max(props.minHeight, Math.abs(height))
68
+ : height) - (barMarginBottom || 0),
69
+ }, children: _jsxs(View, { style: [
70
+ {
71
+ width: '100%',
72
+ height: (noAnimation
73
+ ? Math.max(props.minHeight, Math.abs(height))
74
+ : height) - (barMarginBottom || 0),
75
+ },
76
+ item.barStyle || barStyle,
77
+ ], children: [noGradient ? (_jsx(View, { style: barStyleWithBackground, children: props.cappedBars && item.value ? (_jsx(Cap, { capThicknessFromItem: item.capThickness, capThicknessFromProps: props.capThickness, capColorFromItem: item.capColor, capColorFromProps: props.capColor, capRadiusFromItem: item.capRadius, capRadiusFromProps: props.capRadius })) : null })) : (_jsx(LinearGradient, { style: commonStyleForBar, start: { x: 0, y: 0 }, end: { x: 1, y: 1 }, colors: [
78
+ item.gradientColor || props.gradientColor || 'white',
79
+ item.frontColor || props.frontColor || 'black',
80
+ ], children: props.cappedBars && (_jsx(View, { style: {
81
+ position: 'absolute',
82
+ width: '100%',
83
+ height: item.capThickness === 0
84
+ ? 0
85
+ : item.capThickness || props.capThickness || 6,
86
+ backgroundColor: item.capColor || props.capColor || 'black',
87
+ borderTopLeftRadius: item.capRadius === 0
88
+ ? 0
89
+ : item.capRadius || props.capRadius || 0,
90
+ borderTopRightRadius: item.capRadius === 0
91
+ ? 0
92
+ : item.capRadius || props.capRadius || 0,
93
+ } })) })), (item.barBackgroundPattern || barBackgroundPattern) && (_jsxs(Svg, { children: [_jsx(Defs, { children: item.barBackgroundPattern
94
+ ? item.barBackgroundPattern()
95
+ : barBackgroundPattern === null || barBackgroundPattern === void 0 ? void 0 : barBackgroundPattern() }), _jsx(Rect, { stroke: "transparent", x: "1", y: "1", width: item.barWidth || props.barWidth || 30, height: noAnimation ? Math.abs(height) : height, fill: "url(#".concat(item.patternId || patternId, ")") })] })), barInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: barInnerComponent(item, index) })) : null] }) })), item.topLabelComponent || showValuesAsTopLabel ? (_jsx(View, { style: [
96
+ {
97
+ position: 'absolute',
98
+ top: (item.barWidth || barWidth || 30) * -1,
99
+ height: item.barWidth || barWidth || 30,
100
+ width: item.barWidth || barWidth || 30,
101
+ justifyContent: (props.horizontal && !intactTopLabel) || item.value < 0
102
+ ? 'center'
103
+ : 'flex-end',
104
+ alignItems: 'center',
105
+ opacity: opacity,
106
+ },
107
+ item.value < 0 && { transform: [{ rotate: '180deg' }] },
108
+ props.horizontal &&
109
+ !intactTopLabel && { transform: [{ rotate: '270deg' }] },
110
+ topLabelContainerStyle !== null && topLabelContainerStyle !== void 0 ? topLabelContainerStyle : item.topLabelContainerStyle,
111
+ ], children: showValuesAsTopLabel ? (_jsx(Text, { style: topLabelTextStyle, children: item.value + yAxisOffset })) : ((_a = item.topLabelComponent) === null || _a === void 0 ? void 0 : _a.call(item)) })) : null] }));
112
+ };
113
+ export default Animated2DWithGradient;
@@ -0,0 +1,3 @@
1
+ import { RenderBarsPropsType } from 'gifted-charts-core';
2
+ declare const RenderBars: (props: RenderBarsPropsType) => import("react/jsx-runtime").JSX.Element;
3
+ export default RenderBars;
@@ -1 +1,264 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _AnimatedThreeDBar=_interopRequireDefault(require("../Components/AnimatedThreeDBar"));var _Animated2DWithGradient=_interopRequireDefault(require("./Animated2DWithGradient"));var _cap=_interopRequireDefault(require("../Components/BarSpecificComponents/cap"));var _barBackgroundPattern=_interopRequireDefault(require("../Components/BarSpecificComponents/barBackgroundPattern"));var _LinearGradient=_interopRequireDefault(require("../Components/common/LinearGradient"));var _giftedChartsCore=require("gifted-charts-core");var _tooltip=_interopRequireDefault(require("../Components/BarSpecificComponents/tooltip"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/abhinandankushwaha/sites/projects/react-native-gifted-charts/src/BarChart/RenderBars.tsx";var RenderBars=function RenderBars(props){var _item$barInnerCompone,_focusedBarConfig$bar,_ref,_item$leftShiftForToo;var item=props.item,index=props.index,containerHeight=props.containerHeight,maxValue=props.maxValue,minHeight=props.minHeight,spacing=props.spacing,propSpacing=props.propSpacing,side=props.side,data=props.data,barBorderWidth=props.barBorderWidth,barBorderColor=props.barBorderColor,isThreeD=props.isThreeD,isAnimated=props.isAnimated,rotateLabel=props.rotateLabel,appearingOpacity=props.appearingOpacity,animationDuration=props.animationDuration,autoShiftLabels=props.autoShiftLabels,label=props.label,secondaryLabel=props.secondaryLabel,labelTextStyle=props.labelTextStyle,secondaryLabelTextStyle=props.secondaryLabelTextStyle,xAxisTextNumberOfLines=props.xAxisTextNumberOfLines,xAxisLabelsVerticalShift=props.xAxisLabelsVerticalShift,renderTooltip=props.renderTooltip,leftShiftForTooltip=props.leftShiftForTooltip,leftShiftForLastIndexTooltip=props.leftShiftForLastIndexTooltip,initialSpacing=props.initialSpacing,selectedIndex=props.selectedIndex,setSelectedIndex=props.setSelectedIndex,_props$xAxisThickness=props.xAxisThickness,xAxisThickness=_props$xAxisThickness===void 0?_giftedChartsCore.AxesAndRulesDefaults.xAxisThickness:_props$xAxisThickness,horizontal=props.horizontal,rtl=props.rtl,intactTopLabel=props.intactTopLabel,showValuesAsTopLabel=props.showValuesAsTopLabel,topLabelContainerStyle=props.topLabelContainerStyle,topLabelTextStyle=props.topLabelTextStyle,pointerConfig=props.pointerConfig,noOfSectionsBelowXAxis=props.noOfSectionsBelowXAxis,yAxisOffset=props.yAxisOffset,barWidth=props.barWidth,_props$labelsDistance=props.labelsDistanceFromXaxis,labelsDistanceFromXaxis=_props$labelsDistance===void 0?0:_props$labelsDistance,stepHeight=props.stepHeight,stepValue=props.stepValue,negativeStepHeight=props.negativeStepHeight,negativeStepValue=props.negativeStepValue,autoCenterTooltip=props.autoCenterTooltip,secondaryXAxis=props.secondaryXAxis;var heightFactor=item.value<0?negativeStepHeight/negativeStepValue:stepHeight/stepValue;var barHeight=Math.max(minHeight,Math.abs(item.value)*heightFactor-xAxisThickness);var _getPropsForAnimated=(0,_giftedChartsCore.getPropsForAnimated2DWithGradient)(Object.assign({},props,{barHeight:barHeight})),commonStyleForBar=_getPropsForAnimated.commonStyleForBar,barStyleWithBackground=_getPropsForAnimated.barStyleWithBackground,commonPropsFor2Dand3Dbars=_getPropsForAnimated.commonPropsFor2Dand3Dbars,isFocused=_getPropsForAnimated.isFocused,focusedBarConfig=_getPropsForAnimated.focusedBarConfig,localFrontColor=_getPropsForAnimated.localFrontColor;var itemOrPropsBarInnerComponent=(_item$barInnerCompone=item.barInnerComponent)!=null?_item$barInnerCompone:props.barInnerComponent;var localBarInnerComponent=isFocused?(_focusedBarConfig$bar=focusedBarConfig==null?void 0:focusedBarConfig.barInnerComponent)!=null?_focusedBarConfig$bar:itemOrPropsBarInnerComponent:itemOrPropsBarInnerComponent;var barMarginBottom=item.barMarginBottom===0?0:item.barMarginBottom||props.barMarginBottom||0;var renderLabel=function renderLabel(top,label,labelTextStyle,value){var _props$xAxisLabelsHei,_secondaryXAxis$label;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{width:(item.labelWidth||props.labelWidth||item.barWidth||barWidth)+spacing,left:spacing/-2,position:'absolute',height:(_props$xAxisLabelsHei=props.xAxisLabelsHeight)!=null?_props$xAxisLabelsHei:xAxisTextNumberOfLines*18,bottom:top?(containerHeight||200)+((_secondaryXAxis$label=secondaryXAxis==null?void 0:secondaryXAxis.labelsDistanceFromXaxis)!=null?_secondaryXAxis$label:15):(rotateLabel?-40:-6-xAxisTextNumberOfLines*18-xAxisLabelsVerticalShift)-barMarginBottom-labelsDistanceFromXaxis},rotateLabel?horizontal?{transform:[{rotate:'330deg'}]}:{transform:[{rotate:value<0?'240deg':'60deg'},{translateX:value<0?56:0},{translateY:value<0?32:0}]}:horizontal?{transform:[{rotate:'-90deg'}]}:value<0?{transform:[{rotate:'180deg'},{translateY:autoShiftLabels?0:16.5*xAxisTextNumberOfLines+14}]}:{}],children:top?item.secondaryLabelComponent?item.secondaryLabelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label}):item.labelComponent?item.labelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label})});};var renderAnimatedLabel=function renderAnimatedLabel(top,label,labelTextStyle,value){var _props$xAxisLabelsHei2,_secondaryXAxis$label2;return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[{width:(item.labelWidth||props.labelWidth||item.barWidth||barWidth)+spacing,left:spacing/-2,position:'absolute',height:(_props$xAxisLabelsHei2=props.xAxisLabelsHeight)!=null?_props$xAxisLabelsHei2:xAxisTextNumberOfLines*18,bottom:top?(containerHeight||200)+((_secondaryXAxis$label2=secondaryXAxis==null?void 0:secondaryXAxis.labelsDistanceFromXaxis)!=null?_secondaryXAxis$label2:15):(rotateLabel?-40:-6-xAxisTextNumberOfLines*18-xAxisLabelsVerticalShift)-barMarginBottom,opacity:appearingOpacity},value<0&&{transform:[{rotate:'180deg'}]},rotateLabel?horizontal?{transform:[{rotate:'330deg'}]}:{transform:[{rotate:'60deg'}]}:horizontal?{transform:[{rotate:'-90deg'}]}:value<0?{transform:[{rotate:'180deg'},{translateY:autoShiftLabels?0:16.5*xAxisTextNumberOfLines+14}]}:{}],children:top?item.secondaryLabelComponent?item.secondaryLabelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label}):item.labelComponent?item.labelComponent():(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{textAlign:'center'},rtl&&horizontal&&{transform:[{rotate:'180deg'}]},labelTextStyle],numberOfLines:xAxisTextNumberOfLines,children:label})});};var leftSpacing=initialSpacing;for(var i=0;i<index;i++){var _data$i$spacing;leftSpacing+=((_data$i$spacing=data[i].spacing)!=null?_data$i$spacing:propSpacing)+(data[i].barWidth||barWidth);}var static2DWithGradient=function static2DWithGradient(item){var _focusedBarConfig$gra;var localGradientColor=item.gradientColor||props.gradientColor||'white';return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_LinearGradient.default,{style:commonStyleForBar,start:{x:0,y:0},end:{x:0,y:1},colors:[isFocused?(_focusedBarConfig$gra=focusedBarConfig==null?void 0:focusedBarConfig.gradientColor)!=null?_focusedBarConfig$gra:localGradientColor:localGradientColor,localFrontColor],children:props.cappedBars&&item.value?(0,_jsxRuntime.jsx)(_cap.default,{capThicknessFromItem:item.capThickness,capThicknessFromProps:props.capThickness,capColorFromItem:item.capColor,capColorFromProps:props.capColor,capRadiusFromItem:item.capRadius,capRadiusFromProps:props.capRadius}):null}),(item.barBackgroundPattern||props.barBackgroundPattern)&&(0,_jsxRuntime.jsx)(_barBackgroundPattern.default,{barBackgroundPatternFromItem:item.barBackgroundPattern,barBackgroundPatternFromProps:props.barBackgroundPattern,patternIdFromItem:item.patternId,patternIdFromProps:props.patternId}),(item.topLabelComponent||showValuesAsTopLabel)&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[{position:'absolute',top:(item.barWidth||barWidth)*-1,height:item.barWidth||barWidth,width:item.barWidth||barWidth,justifyContent:horizontal&&!intactTopLabel||item.value<0?'center':'flex-end',alignItems:'center'},item.value<0&&{transform:[{rotate:'180deg'}]},horizontal&&!intactTopLabel&&{transform:[{rotate:'270deg'}]},topLabelContainerStyle!=null?topLabelContainerStyle:item.topLabelContainerStyle],children:showValuesAsTopLabel?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:topLabelTextStyle,children:item.value+yAxisOffset}):item.topLabelComponent==null?void 0:item.topLabelComponent()}),localBarInnerComponent?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:'100%',width:'100%'},children:localBarInnerComponent(item,index)}):null]});};var barWrapperStyle=[{marginBottom:60+barMarginBottom+xAxisLabelsVerticalShift-0.5,width:commonPropsFor2Dand3Dbars.barWidth,height:barHeight,marginRight:spacing},pointerConfig?{transform:[{translateY:(containerHeight||200)-(barHeight-10+xAxisLabelsVerticalShift)+(item.value<0?Math.abs(item.value)*heightFactor:0)}]}:item.value<0?{transform:[{translateY:Math.abs(item.value)*heightFactor},{rotateZ:'180deg'}]}:null,side!=='right'&&{zIndex:data.length-index}];var pressDisabled=item.disablePress||props.disablePress||pointerConfig&&pointerConfig.barTouchable!==true;var barContent=function barContent(){var isBarBelowXaxisAndInvisible=item.value<0&&!noOfSectionsBelowXAxis;var animated2DWithGradient=function animated2DWithGradient(noGradient,noAnimation){return(0,_jsxRuntime.jsx)(_Animated2DWithGradient.default,Object.assign({},commonPropsFor2Dand3Dbars,{animationDuration:animationDuration||800,roundedBottom:props.roundedBottom||false,roundedTop:props.roundedTop||false,noGradient:noGradient,noAnimation:noAnimation,containerHeight:containerHeight,maxValue:maxValue,minHeight:minHeight!=null?minHeight:0,barMarginBottom:barMarginBottom,cappedBars:props.cappedBars,capThickness:props.capThickness,capColor:props.capColor,capRadius:props.capRadius,horizontal:horizontal,barBorderWidth:barBorderWidth,barBorderColor:barBorderColor,commonStyleForBar:commonStyleForBar,barStyleWithBackground:barStyleWithBackground}));};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(props.showXAxisIndices||item.showXAxisIndex)&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{zIndex:2,position:'absolute',height:props.xAxisIndicesHeight,width:props.xAxisIndicesWidth,bottom:props.xAxisIndicesHeight/-2,left:((item.barWidth||barWidth)-props.xAxisIndicesWidth)/2,backgroundColor:props.xAxisIndicesColor}}),isBarBelowXaxisAndInvisible?null:isThreeD?(0,_jsxRuntime.jsx)(_AnimatedThreeDBar.default,Object.assign({},commonPropsFor2Dand3Dbars,{sideWidth:item.sideWidth||props.sideWidth||(item.barWidth||barWidth)/2,side:side||'left',sideColor:item.sideColor||props.sideColor||'',topColor:item.topColor||props.topColor||'',horizontal:horizontal,isAnimated:isAnimated,animationDuration:animationDuration||800,selectedIndex:selectedIndex})):item.showGradient||props.showGradient?isAnimated?animated2DWithGradient(false,false):static2DWithGradient(item):isAnimated?animated2DWithGradient(true,false):animated2DWithGradient(true,true),isAnimated?renderAnimatedLabel(false,label,labelTextStyle,item.value):renderLabel(false,label,labelTextStyle,item.value),secondaryXAxis?isAnimated?renderAnimatedLabel(true,secondaryLabel,secondaryLabelTextStyle,item.value):renderLabel(true,secondaryLabel,secondaryLabelTextStyle,item.value):null]});};var tooltipProps={barHeight:barHeight,barWidth:item.barWidth||barWidth,item:item,index:index,isLast:index===data.length-1,leftSpacing:leftSpacing,leftShiftForLastIndexTooltip:leftShiftForLastIndexTooltip,leftShiftForTooltip:(_ref=(_item$leftShiftForToo=item.leftShiftForTooltip)!=null?_item$leftShiftForToo:leftShiftForTooltip)!=null?_ref:0,renderTooltip:renderTooltip,autoCenterTooltip:autoCenterTooltip,horizontal:horizontal};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[pressDisabled?(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",style:barWrapperStyle,children:barContent()}):(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{activeOpacity:props.activeOpacity||0.2,onPress:function onPress(){if(renderTooltip||props.focusBarOnPress){if(props.focusedBarIndex===undefined||!props.onPress){setSelectedIndex(index);}}item.onPress?item.onPress():props.onPress?props.onPress(item,index):null;},onLongPress:function onLongPress(){item.onLongPress?item.onLongPress():props.onLongPress?props.onLongPress(item,index):null;},onPressOut:function onPressOut(){item.onPressOut?item.onPressOut():props.onPressOut?props.onPressOut(item,index):null;},style:barWrapperStyle,children:barContent()}),renderTooltip&&selectedIndex===index&&(0,_jsxRuntime.jsx)(_tooltip.default,Object.assign({},tooltipProps))]});};var _default=exports.default=RenderBars;
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { View, TouchableOpacity, Animated, Text } from 'react-native';
14
+ import AnimatedThreeDBar from '../Components/AnimatedThreeDBar';
15
+ import Animated2DWithGradient from './Animated2DWithGradient';
16
+ import Cap from '../Components/BarSpecificComponents/cap';
17
+ import BarBackgroundPattern from '../Components/BarSpecificComponents/barBackgroundPattern';
18
+ import LinearGradient from '../Components/common/LinearGradient';
19
+ import { getPropsForAnimated2DWithGradient, AxesAndRulesDefaults, } from 'gifted-charts-core';
20
+ import Tooltip from '../Components/BarSpecificComponents/tooltip';
21
+ var RenderBars = function (props) {
22
+ var _a, _b, _c, _d, _e;
23
+ var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, minHeight = props.minHeight, spacing = props.spacing, propSpacing = props.propSpacing, side = props.side, data = props.data, barBorderWidth = props.barBorderWidth, barBorderColor = props.barBorderColor, isThreeD = props.isThreeD, isAnimated = props.isAnimated, rotateLabel = props.rotateLabel, appearingOpacity = props.appearingOpacity, animationDuration = props.animationDuration, autoShiftLabels = props.autoShiftLabels, label = props.label, secondaryLabel = props.secondaryLabel, labelTextStyle = props.labelTextStyle, secondaryLabelTextStyle = props.secondaryLabelTextStyle, xAxisTextNumberOfLines = props.xAxisTextNumberOfLines, xAxisLabelsVerticalShift = props.xAxisLabelsVerticalShift, renderTooltip = props.renderTooltip, leftShiftForTooltip = props.leftShiftForTooltip, leftShiftForLastIndexTooltip = props.leftShiftForLastIndexTooltip, initialSpacing = props.initialSpacing, selectedIndex = props.selectedIndex, setSelectedIndex = props.setSelectedIndex, _f = props.xAxisThickness, xAxisThickness = _f === void 0 ? AxesAndRulesDefaults.xAxisThickness : _f, horizontal = props.horizontal, rtl = props.rtl, intactTopLabel = props.intactTopLabel, showValuesAsTopLabel = props.showValuesAsTopLabel, topLabelContainerStyle = props.topLabelContainerStyle, topLabelTextStyle = props.topLabelTextStyle, pointerConfig = props.pointerConfig, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, yAxisOffset = props.yAxisOffset, barWidth = props.barWidth, _g = props.labelsDistanceFromXaxis, labelsDistanceFromXaxis = _g === void 0 ? 0 : _g, stepHeight = props.stepHeight, stepValue = props.stepValue, negativeStepHeight = props.negativeStepHeight, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip, secondaryXAxis = props.secondaryXAxis;
24
+ var heightFactor = item.value < 0
25
+ ? negativeStepHeight / negativeStepValue
26
+ : stepHeight / stepValue;
27
+ var barHeight = Math.max(minHeight, Math.abs(item.value) * heightFactor - xAxisThickness);
28
+ var _h = getPropsForAnimated2DWithGradient(__assign(__assign({}, props), { barHeight: barHeight })), commonStyleForBar = _h.commonStyleForBar, barStyleWithBackground = _h.barStyleWithBackground, commonPropsFor2dAnd3dBars = _h.commonPropsFor2dAnd3dBars, isFocused = _h.isFocused, focusedBarConfig = _h.focusedBarConfig, localFrontColor = _h.localFrontColor;
29
+ var itemOrPropsBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
30
+ var localBarInnerComponent = isFocused
31
+ ? ((_b = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.barInnerComponent) !== null && _b !== void 0 ? _b : itemOrPropsBarInnerComponent)
32
+ : itemOrPropsBarInnerComponent;
33
+ var barMarginBottom = item.barMarginBottom === 0
34
+ ? 0
35
+ : item.barMarginBottom || props.barMarginBottom || 0;
36
+ var renderLabel = function (top, label, labelTextStyle, value) {
37
+ var _a, _b;
38
+ return (_jsx(View, { style: [
39
+ {
40
+ width: (item.labelWidth ||
41
+ props.labelWidth ||
42
+ item.barWidth ||
43
+ barWidth) + spacing,
44
+ left: spacing / -2,
45
+ position: 'absolute',
46
+ height: (_a = props.xAxisLabelsHeight) !== null && _a !== void 0 ? _a : xAxisTextNumberOfLines * 18,
47
+ bottom: top
48
+ ? (containerHeight || 200) +
49
+ ((_b = secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelsDistanceFromXaxis) !== null && _b !== void 0 ? _b : 15)
50
+ : (rotateLabel
51
+ ? -40
52
+ : -6 -
53
+ xAxisTextNumberOfLines * 18 -
54
+ xAxisLabelsVerticalShift) -
55
+ barMarginBottom -
56
+ labelsDistanceFromXaxis,
57
+ },
58
+ rotateLabel
59
+ ? horizontal
60
+ ? { transform: [{ rotate: '330deg' }] }
61
+ : {
62
+ transform: [
63
+ { rotate: value < 0 ? '240deg' : '60deg' },
64
+ { translateX: value < 0 ? 56 : 0 },
65
+ { translateY: value < 0 ? 32 : 0 },
66
+ ],
67
+ }
68
+ : horizontal
69
+ ? { transform: [{ rotate: '-90deg' }] }
70
+ : value < 0
71
+ ? {
72
+ transform: [
73
+ { rotate: '180deg' },
74
+ {
75
+ translateY: autoShiftLabels
76
+ ? 0
77
+ : 16.5 * xAxisTextNumberOfLines + 14,
78
+ },
79
+ ],
80
+ }
81
+ : {},
82
+ ], children: top ? (item.secondaryLabelComponent ? (item.secondaryLabelComponent()) : (_jsx(Text, { style: [
83
+ { textAlign: 'center' },
84
+ rtl && horizontal && { transform: [{ rotate: '180deg' }] },
85
+ labelTextStyle,
86
+ ], numberOfLines: xAxisTextNumberOfLines, children: label }))) : item.labelComponent ? (item.labelComponent()) : (_jsx(Text, { style: [
87
+ { textAlign: 'center' },
88
+ rtl && horizontal && { transform: [{ rotate: '180deg' }] },
89
+ labelTextStyle,
90
+ ], numberOfLines: xAxisTextNumberOfLines, children: label })) }));
91
+ };
92
+ var renderAnimatedLabel = function (top, label, labelTextStyle, value) {
93
+ var _a, _b;
94
+ return (_jsx(Animated.View, { style: [
95
+ {
96
+ width: (item.labelWidth ||
97
+ props.labelWidth ||
98
+ item.barWidth ||
99
+ barWidth) + spacing,
100
+ left: spacing / -2,
101
+ position: 'absolute',
102
+ height: (_a = props.xAxisLabelsHeight) !== null && _a !== void 0 ? _a : xAxisTextNumberOfLines * 18,
103
+ bottom: top
104
+ ? (containerHeight || 200) +
105
+ ((_b = secondaryXAxis === null || secondaryXAxis === void 0 ? void 0 : secondaryXAxis.labelsDistanceFromXaxis) !== null && _b !== void 0 ? _b : 15)
106
+ : (rotateLabel
107
+ ? -40
108
+ : -6 -
109
+ xAxisTextNumberOfLines * 18 -
110
+ xAxisLabelsVerticalShift) - barMarginBottom,
111
+ opacity: appearingOpacity,
112
+ },
113
+ value < 0 && { transform: [{ rotate: '180deg' }] },
114
+ rotateLabel
115
+ ? horizontal
116
+ ? { transform: [{ rotate: '330deg' }] }
117
+ : { transform: [{ rotate: '60deg' }] }
118
+ : horizontal
119
+ ? { transform: [{ rotate: '-90deg' }] }
120
+ : value < 0
121
+ ? {
122
+ transform: [
123
+ { rotate: '180deg' },
124
+ {
125
+ translateY: autoShiftLabels
126
+ ? 0
127
+ : 16.5 * xAxisTextNumberOfLines + 14,
128
+ },
129
+ ],
130
+ }
131
+ : {},
132
+ ], children: top ? (item.secondaryLabelComponent ? (item.secondaryLabelComponent()) : (_jsx(Text, { style: [
133
+ { textAlign: 'center' },
134
+ rtl && horizontal && { transform: [{ rotate: '180deg' }] },
135
+ labelTextStyle,
136
+ ], numberOfLines: xAxisTextNumberOfLines, children: label }))) : item.labelComponent ? (item.labelComponent()) : (_jsx(Text, { style: [
137
+ { textAlign: 'center' },
138
+ rtl && horizontal && { transform: [{ rotate: '180deg' }] },
139
+ labelTextStyle,
140
+ ], numberOfLines: xAxisTextNumberOfLines, children: label })) }));
141
+ };
142
+ var leftSpacing = initialSpacing;
143
+ for (var i = 0; i < index; i++) {
144
+ leftSpacing +=
145
+ ((_c = data[i].spacing) !== null && _c !== void 0 ? _c : propSpacing) + (data[i].barWidth || barWidth);
146
+ }
147
+ var static2DWithGradient = function (item) {
148
+ var _a, _b;
149
+ var localGradientColor = item.gradientColor || props.gradientColor || 'white';
150
+ return (_jsxs(_Fragment, { children: [_jsx(LinearGradient, { style: commonStyleForBar, start: { x: 0, y: 0 }, end: { x: 0, y: 1 }, colors: [
151
+ isFocused
152
+ ? ((_a = focusedBarConfig === null || focusedBarConfig === void 0 ? void 0 : focusedBarConfig.gradientColor) !== null && _a !== void 0 ? _a : localGradientColor)
153
+ : localGradientColor,
154
+ localFrontColor,
155
+ ], children: props.cappedBars && item.value ? (_jsx(Cap, { capThicknessFromItem: item.capThickness, capThicknessFromProps: props.capThickness, capColorFromItem: item.capColor, capColorFromProps: props.capColor, capRadiusFromItem: item.capRadius, capRadiusFromProps: props.capRadius })) : null }), (item.barBackgroundPattern || props.barBackgroundPattern) && (_jsx(BarBackgroundPattern, { barBackgroundPatternFromItem: item.barBackgroundPattern, barBackgroundPatternFromProps: props.barBackgroundPattern, patternIdFromItem: item.patternId, patternIdFromProps: props.patternId })), (item.topLabelComponent || showValuesAsTopLabel) && (_jsx(View, { style: [
156
+ {
157
+ position: 'absolute',
158
+ top: (item.barWidth || barWidth) * -1,
159
+ height: item.barWidth || barWidth,
160
+ width: item.barWidth || barWidth,
161
+ justifyContent: (horizontal && !intactTopLabel) || item.value < 0
162
+ ? 'center'
163
+ : 'flex-end',
164
+ alignItems: 'center',
165
+ },
166
+ item.value < 0 && { transform: [{ rotate: '180deg' }] },
167
+ horizontal &&
168
+ !intactTopLabel && { transform: [{ rotate: '270deg' }] },
169
+ topLabelContainerStyle !== null && topLabelContainerStyle !== void 0 ? topLabelContainerStyle : item.topLabelContainerStyle,
170
+ ], children: showValuesAsTopLabel ? (_jsx(Text, { style: topLabelTextStyle, children: item.value + yAxisOffset })) : ((_b = item.topLabelComponent) === null || _b === void 0 ? void 0 : _b.call(item)) })), localBarInnerComponent ? (_jsx(View, { style: { height: '100%', width: '100%' }, children: localBarInnerComponent(item, index) })) : null] }));
171
+ };
172
+ var barWrapperStyle = [
173
+ {
174
+ // overflow: 'visible',
175
+ marginBottom: 60 + barMarginBottom + xAxisLabelsVerticalShift - 0.5,
176
+ width: commonPropsFor2dAnd3dBars.barWidth,
177
+ height: barHeight,
178
+ marginRight: spacing,
179
+ },
180
+ pointerConfig
181
+ ? {
182
+ transform: [
183
+ {
184
+ translateY: (containerHeight || 200) -
185
+ (barHeight - 10 + xAxisLabelsVerticalShift) +
186
+ (item.value < 0 ? Math.abs(item.value) * heightFactor : 0),
187
+ },
188
+ ],
189
+ }
190
+ : item.value < 0
191
+ ? {
192
+ transform: [
193
+ {
194
+ translateY: Math.abs(item.value) * heightFactor,
195
+ },
196
+ { rotateZ: '180deg' },
197
+ ],
198
+ }
199
+ : null,
200
+ side !== 'right' && { zIndex: data.length - index },
201
+ ];
202
+ var pressDisabled = item.disablePress ||
203
+ props.disablePress ||
204
+ (pointerConfig && pointerConfig.barTouchable !== true);
205
+ var barContent = function () {
206
+ var isBarBelowXaxisAndInvisible = item.value < 0 && !noOfSectionsBelowXAxis;
207
+ var animated2DWithGradient = function (noGradient, noAnimation) { return (_jsx(Animated2DWithGradient, __assign({}, commonPropsFor2dAnd3dBars, { animationDuration: animationDuration || 800, roundedBottom: props.roundedBottom || false, roundedTop: props.roundedTop || false, noGradient: noGradient, noAnimation: noAnimation, containerHeight: containerHeight, maxValue: maxValue, minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : 0, barMarginBottom: barMarginBottom, cappedBars: props.cappedBars, capThickness: props.capThickness, capColor: props.capColor, capRadius: props.capRadius, horizontal: horizontal, barBorderWidth: barBorderWidth, barBorderColor: barBorderColor, commonStyleForBar: commonStyleForBar, barStyleWithBackground: barStyleWithBackground }))); };
208
+ return (_jsxs(_Fragment, { children: [(props.showXAxisIndices || item.showXAxisIndex) && (_jsx(View, { style: {
209
+ zIndex: 2,
210
+ position: 'absolute',
211
+ height: props.xAxisIndicesHeight,
212
+ width: props.xAxisIndicesWidth,
213
+ bottom: props.xAxisIndicesHeight / -2,
214
+ left: ((item.barWidth || barWidth) - props.xAxisIndicesWidth) / 2,
215
+ backgroundColor: props.xAxisIndicesColor,
216
+ } })), isBarBelowXaxisAndInvisible ? null : isThreeD ? (_jsx(AnimatedThreeDBar, __assign({}, commonPropsFor2dAnd3dBars, { sideWidth: item.sideWidth ||
217
+ props.sideWidth ||
218
+ (item.barWidth || barWidth) / 2, side: side || 'left', sideColor: item.sideColor || props.sideColor || '', topColor: item.topColor || props.topColor || '', horizontal: horizontal, isAnimated: isAnimated, animationDuration: animationDuration || 800, selectedIndex: selectedIndex }))) : item.showGradient || props.showGradient ? (isAnimated ? (animated2DWithGradient(false, false)) : (static2DWithGradient(item))) : isAnimated ? (animated2DWithGradient(true, false)) : (animated2DWithGradient(true, true)), isAnimated
219
+ ? renderAnimatedLabel(false, label, labelTextStyle, item.value)
220
+ : renderLabel(false, label, labelTextStyle, item.value), secondaryXAxis
221
+ ? isAnimated
222
+ ? renderAnimatedLabel(true, secondaryLabel, secondaryLabelTextStyle, item.value)
223
+ : renderLabel(true, secondaryLabel, secondaryLabelTextStyle, item.value)
224
+ : null] }));
225
+ };
226
+ var tooltipProps = {
227
+ barHeight: barHeight,
228
+ barWidth: item.barWidth || barWidth,
229
+ item: item,
230
+ index: index,
231
+ isLast: index === data.length - 1,
232
+ leftSpacing: leftSpacing,
233
+ leftShiftForLastIndexTooltip: leftShiftForLastIndexTooltip,
234
+ leftShiftForTooltip: (_e = (_d = item.leftShiftForTooltip) !== null && _d !== void 0 ? _d : leftShiftForTooltip) !== null && _e !== void 0 ? _e : 0,
235
+ renderTooltip: renderTooltip,
236
+ autoCenterTooltip: autoCenterTooltip,
237
+ horizontal: horizontal,
238
+ };
239
+ return (_jsxs(_Fragment, { children: [pressDisabled ? (_jsx(View, { pointerEvents: "none", style: barWrapperStyle, children: barContent() })) : (_jsx(TouchableOpacity, { activeOpacity: props.activeOpacity || 0.2, onPress: function () {
240
+ if (renderTooltip || props.focusBarOnPress) {
241
+ if (props.focusedBarIndex === undefined || !props.onPress) {
242
+ setSelectedIndex(index);
243
+ }
244
+ }
245
+ item.onPress
246
+ ? item.onPress()
247
+ : props.onPress
248
+ ? props.onPress(item, index)
249
+ : null;
250
+ }, onLongPress: function () {
251
+ item.onLongPress
252
+ ? item.onLongPress()
253
+ : props.onLongPress
254
+ ? props.onLongPress(item, index)
255
+ : null;
256
+ }, onPressOut: function () {
257
+ item.onPressOut
258
+ ? item.onPressOut()
259
+ : props.onPressOut
260
+ ? props.onPressOut(item, index)
261
+ : null;
262
+ }, style: barWrapperStyle, children: barContent() })), renderTooltip && selectedIndex === index && (_jsx(Tooltip, __assign({}, tooltipProps)))] }));
263
+ };
264
+ export default RenderBars;
@@ -0,0 +1,3 @@
1
+ import { StackedBarChartPropsType } from 'gifted-charts-core';
2
+ declare const RenderStackBars: (props: StackedBarChartPropsType) => import("react/jsx-runtime").JSX.Element;
3
+ export default RenderStackBars;