impaktapps-design 0.1.6 → 0.1.7

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.
@@ -11142,6 +11142,7 @@ const ToolTip = ({
11142
11142
  left: left2,
11143
11143
  children: /* @__PURE__ */ jsxs("div", {
11144
11144
  style: {
11145
+ minWidth: 60,
11145
11146
  textAlign: "center",
11146
11147
  background: "black",
11147
11148
  padding: "10px",
@@ -11686,11 +11687,7 @@ function DrawBarGraph({
11686
11687
  };
11687
11688
  return width < 10 ? null : /* @__PURE__ */ jsxs("div", {
11688
11689
  style: {},
11689
- children: [((_l = value == null ? void 0 : value.main) == null ? void 0 : _l.legendAvailable) && /* @__PURE__ */ jsx(Legend, {
11690
- dataKeyArray: keys2,
11691
- colorRange: [((_o = (_n2 = (_m = value.style) == null ? void 0 : _m.barStyle) == null ? void 0 : _n2.color) == null ? void 0 : _o.firstBarColor) || "#aeeef8", ((_r = (_q = (_p = value.style) == null ? void 0 : _p.barStyle) == null ? void 0 : _q.color) == null ? void 0 : _r.secondBarColor) || "#e5fd3d", ((_u = (_t2 = (_s = value.style) == null ? void 0 : _s.barStyle) == null ? void 0 : _t2.color) == null ? void 0 : _u.thirdBarColor) || "#9caff6"],
11692
- value
11693
- }), /* @__PURE__ */ jsxs("svg", {
11690
+ children: [/* @__PURE__ */ jsxs("svg", {
11694
11691
  ref: containerRef,
11695
11692
  width,
11696
11693
  height,
@@ -11708,7 +11705,7 @@ function DrawBarGraph({
11708
11705
  value,
11709
11706
  yScale: tempScale,
11710
11707
  parentWidth: width
11711
- }), ((_v = value == null ? void 0 : value.main) == null ? void 0 : _v.type) === "StackBarGraph" ? /* @__PURE__ */ jsx(BarStack, {
11708
+ }), ((_l = value == null ? void 0 : value.main) == null ? void 0 : _l.type) === "StackBarGraph" ? /* @__PURE__ */ jsx(BarStack, {
11712
11709
  data,
11713
11710
  keys: keys2,
11714
11711
  x: getDate,
@@ -11770,20 +11767,34 @@ function DrawBarGraph({
11770
11767
  xScale: dateScale,
11771
11768
  parentWidth: width
11772
11769
  })]
11770
+ }), ((_m = value == null ? void 0 : value.main) == null ? void 0 : _m.legendAvailable) && keys2.length > 1 && /* @__PURE__ */ jsx(Legend, {
11771
+ dataKeyArray: keys2,
11772
+ colorRange: [((_p = (_o = (_n2 = value.style) == null ? void 0 : _n2.barStyle) == null ? void 0 : _o.color) == null ? void 0 : _p.firstBarColor) || "#aeeef8", ((_s = (_r = (_q = value.style) == null ? void 0 : _q.barStyle) == null ? void 0 : _r.color) == null ? void 0 : _s.secondBarColor) || "#e5fd3d", ((_v = (_u = (_t2 = value.style) == null ? void 0 : _t2.barStyle) == null ? void 0 : _u.color) == null ? void 0 : _v.thirdBarColor) || "#9caff6"],
11773
+ value
11773
11774
  }), ((_w = value == null ? void 0 : value.main) == null ? void 0 : _w.type) === "StackBarGraph" ? tooltipOpen && tooltipData && /* @__PURE__ */ jsxs(TooltipInPortal, {
11774
11775
  top: tooltipTop,
11775
11776
  left: tooltipLeft,
11776
11777
  style: tooltipStyles,
11777
11778
  children: [/* @__PURE__ */ jsx("div", {
11778
11779
  style: {
11779
- color: tooltipData.color
11780
+ color: tooltipData.color,
11781
+ marginBottom: "10px",
11782
+ width: "100%",
11783
+ padding: "2px 1px",
11784
+ borderBottom: "1px solid gray"
11780
11785
  },
11781
11786
  children: /* @__PURE__ */ jsx("strong", {
11782
11787
  children: tooltipData.label
11783
11788
  })
11784
11789
  }), /* @__PURE__ */ jsx("div", {
11790
+ style: {
11791
+ padding: "1px 1px 5px 5px"
11792
+ },
11785
11793
  children: tooltipData.key
11786
11794
  }), /* @__PURE__ */ jsx("div", {
11795
+ style: {
11796
+ padding: "1px 1px 5px 5px"
11797
+ },
11787
11798
  children: /* @__PURE__ */ jsx("small", {
11788
11799
  children: tooltipData.value
11789
11800
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-design",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "dependencies": {
5
5
  "@babel/core": "^7.16.12",
6
6
  "@visx/visx": "^3.1.2",
@@ -104,15 +104,7 @@ const colorScale = scaleOrdinal<string, string>({
104
104
  };
105
105
  return width < 10 ? null : (
106
106
  <div style={{ }}>
107
- {value?.main?.legendAvailable &&
108
- <Legend
109
- dataKeyArray={keys}
110
- colorRange={[value.style?.barStyle?.color?.firstBarColor||"#aeeef8" ,
111
- value.style?.barStyle?.color?.secondBarColor||"#e5fd3d" ,
112
- value.style?.barStyle?.color?.thirdBarColor||"#9caff6" ]}
113
- value={value}
114
- />
115
- }
107
+
116
108
  <svg ref={containerRef} width={width} height={height}>
117
109
  <rect
118
110
  x={0}
@@ -204,23 +196,31 @@ const colorScale = scaleOrdinal<string, string>({
204
196
  />
205
197
 
206
198
  </svg>
199
+ {value?.main?.legendAvailable && keys.length >1 &&
200
+ <Legend
201
+ dataKeyArray={keys}
202
+ colorRange={[value.style?.barStyle?.color?.firstBarColor||"#aeeef8" ,
203
+ value.style?.barStyle?.color?.secondBarColor||"#e5fd3d" ,
204
+ value.style?.barStyle?.color?.thirdBarColor||"#9caff6" ]}
205
+ value={value}
206
+ />
207
+ }
207
208
  {
208
209
  value?.main?.type === "StackBarGraph"?
209
210
  tooltipOpen && tooltipData && (
210
-
211
211
  <TooltipInPortal
212
- top={tooltipTop}
213
- left={tooltipLeft}
214
- style={tooltipStyles}
215
- >
216
- <div style={{ color:tooltipData.color }}>
217
- <strong>{tooltipData.label}</strong>
218
- </div>
219
- <div>{tooltipData.key}</div>
220
- <div>
221
- <small>{tooltipData.value}</small>
222
- </div>
223
- </TooltipInPortal>
212
+ top={tooltipTop}
213
+ left={tooltipLeft}
214
+ style={tooltipStyles}
215
+ >
216
+ <div style={{ color:tooltipData.color,marginBottom:"10px",width:"100%",padding:"2px 1px",borderBottom:"1px solid gray" }}>
217
+ <strong>{tooltipData.label}</strong>
218
+ </div>
219
+ <div style={{padding:"1px 1px 5px 5px"}}>{tooltipData.key}</div>
220
+ <div style={{padding:"1px 1px 5px 5px"}}>
221
+ <small>{tooltipData.value}</small>
222
+ </div>
223
+ </TooltipInPortal>
224
224
  ):
225
225
  tooltipOpen &&
226
226
  <ToolTip
@@ -13,15 +13,13 @@ const ToolTip = ({ style, top, left, tooltipData }: tooltipProps) => {
13
13
  >
14
14
  <div
15
15
  style={{
16
- // height: "50px",
16
+ minWidth:60,
17
17
  textAlign:"center",
18
18
  background:"black",
19
19
  padding:"10px",
20
20
  boxShadow:"2px 2px 5px black",
21
21
  color:"#6c5efb",
22
22
  backgroundColor:"black",
23
- // padding:"5px",
24
- // backgroundColor:style?.tooltipbackground||"black",
25
23
  ...style?.tooltipStyle,
26
24
  margin:"-20px",
27
25
  }}