impaktapps-design 0.2.993-alpha.235 → 0.2.993-alpha.237

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.
@@ -22161,6 +22161,8 @@ LinearGradient.propTypes = {
22161
22161
  children: _pt.node,
22162
22162
  vertical: _pt.bool
22163
22163
  };
22164
+ const PX_PER_CHAR$1 = 7;
22165
+ const LABEL_ROTATION$1 = Math.sin(40 * Math.PI / 180);
22164
22166
  const DrawAreaGraph = ({
22165
22167
  width: width2,
22166
22168
  height: height2,
@@ -22186,11 +22188,12 @@ const DrawAreaGraph = ({
22186
22188
  const legendLabels = (_g = areaValue.main) == null ? void 0 : _g.legendLabels;
22187
22189
  const colorMap = (_i = (_h = areaValue.style) == null ? void 0 : _h.areaStyle) == null ? void 0 : _i.colorMap;
22188
22190
  const defaultColour = (_k = (_j = theme.myTheme.palette) == null ? void 0 : _j.primary) == null ? void 0 : _k.main;
22189
- const muiTheme = useTheme$1();
22190
- const isSmallScreen = useMediaQuery(muiTheme.breakpoints.down("sm"));
22191
+ const isSmallScreen = width2 < 600;
22192
+ const longestLabelLength = useMemo(() => Math.max(...chartData.map((d2) => String(d2[xAxisValue]).length)), [chartData, xAxisValue]);
22193
+ const dynamicBottomMargin = Math.ceil(longestLabelLength * PX_PER_CHAR$1 * LABEL_ROTATION$1);
22191
22194
  const margin2 = {
22192
22195
  ...marginProp,
22193
- bottom: isSmallScreen ? Math.max(marginProp.bottom, 90) : marginProp.bottom
22196
+ bottom: isSmallScreen ? Math.max(marginProp.bottom, dynamicBottomMargin) : marginProp.bottom
22194
22197
  };
22195
22198
  const labelsArray = useMemo(() => {
22196
22199
  if (!chartData.length)
@@ -22283,18 +22286,26 @@ const DrawAreaGraph = ({
22283
22286
  tooltipTop: yScale(tooltipPoint[labelsArray[0]] || 0)
22284
22287
  });
22285
22288
  };
22286
- const tickLabelProps = () => isSmallScreen ? {
22289
+ const tickLabelProps = useCallback(() => isSmallScreen ? {
22287
22290
  fill: "#6B7280",
22288
- fontSize: 10,
22291
+ fontSize: 12,
22289
22292
  fontWeight: 600,
22290
22293
  textAnchor: "end",
22291
- angle: -40
22294
+ angle: -40,
22295
+ dx: "-0.2em",
22296
+ dy: "0.1em",
22297
+ style: {
22298
+ transition: "transform 0.2s ease"
22299
+ }
22292
22300
  } : {
22293
22301
  fill: "#6B7280",
22294
- fontSize: 10,
22295
- fontWeight: 600,
22296
- textAnchor: "middle"
22297
- };
22302
+ fontSize: 12,
22303
+ fontWeight: 500,
22304
+ textAnchor: "middle",
22305
+ style: {
22306
+ transition: "transform 0.2s ease"
22307
+ }
22308
+ }, [isSmallScreen]);
22298
22309
  return /* @__PURE__ */ jsxs("div", {
22299
22310
  style: {
22300
22311
  position: "relative"
@@ -22503,6 +22514,8 @@ const AreaGraph = ({
22503
22514
  });
22504
22515
  };
22505
22516
  const GROWTH_RATE_KEY = "growthRate";
22517
+ const PX_PER_CHAR = 7;
22518
+ const LABEL_ROTATION = Math.sin(40 * Math.PI / 180);
22506
22519
  const DrawStackBarLineGraph = ({
22507
22520
  width: width2,
22508
22521
  height: height2,
@@ -22528,11 +22541,12 @@ const DrawStackBarLineGraph = ({
22528
22541
  const yAxisTickCount = (_i = stackBarLineValue == null ? void 0 : stackBarLineValue.main) == null ? void 0 : _i.yAxisTickCount;
22529
22542
  const disableLeftLabel = (_j = stackBarLineValue.main) == null ? void 0 : _j.disableLeftLabel;
22530
22543
  const trendColor = (_k = colorMap == null ? void 0 : colorMap[GROWTH_RATE_KEY]) != null ? _k : "#E24B4A";
22531
- const muiTheme = useTheme$1();
22532
- const isSmallScreen = useMediaQuery(muiTheme.breakpoints.down("sm"));
22544
+ const isSmallScreen = width2 < 600;
22545
+ const longestLabelLength = useMemo(() => Math.max(...chartData.map((d2) => String(d2[xAxisValue]).length)), [chartData, xAxisValue]);
22546
+ const dynamicBottomMargin = Math.ceil(longestLabelLength * PX_PER_CHAR * LABEL_ROTATION);
22533
22547
  const margin2 = {
22534
22548
  ...marginProp,
22535
- bottom: isSmallScreen ? Math.max(marginProp.bottom, 80) : marginProp.bottom
22549
+ bottom: isSmallScreen ? Math.max(marginProp.bottom, dynamicBottomMargin) : marginProp.bottom
22536
22550
  };
22537
22551
  const labelsArray = useMemo(() => {
22538
22552
  if (!chartData.length)
@@ -22596,12 +22610,20 @@ const DrawStackBarLineGraph = ({
22596
22610
  fontSize: 12,
22597
22611
  fontWeight: 500,
22598
22612
  textAnchor: "end",
22599
- angle: -40
22613
+ angle: -40,
22614
+ dx: "-0.2em",
22615
+ dy: "0.1em",
22616
+ style: {
22617
+ transition: "transform 0.2s ease"
22618
+ }
22600
22619
  } : {
22601
22620
  fill: "#6B7280",
22602
22621
  fontSize: 12,
22603
22622
  fontWeight: 500,
22604
- textAnchor: "middle"
22623
+ textAnchor: "middle",
22624
+ style: {
22625
+ transition: "transform 0.2s ease"
22626
+ }
22605
22627
  }, [isSmallScreen]);
22606
22628
  return /* @__PURE__ */ jsxs("div", {
22607
22629
  style: {