@adsgency_npm/adsgency-ads-ui 0.1.0-alpha.27 → 0.1.0-alpha.29

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/dist/index.cjs CHANGED
@@ -6023,6 +6023,13 @@ function getSafeHeight(height) {
6023
6023
  function getSafeValue(value) {
6024
6024
  return typeof value === "number" && Number.isFinite(value) ? Math.max(value, 0) : 0;
6025
6025
  }
6026
+ function getChartMargin(height, plotHeight) {
6027
+ if (!Number.isFinite(plotHeight) || !plotHeight || plotHeight >= height) {
6028
+ return { bottom: 1, left: 1, right: 1, top: 1 };
6029
+ }
6030
+ const verticalMargin = (height - Math.max(plotHeight, 1)) / 2;
6031
+ return { bottom: verticalMargin, left: 1, right: 1, top: verticalMargin };
6032
+ }
6026
6033
  function AdsSparklineChart({
6027
6034
  ariaLabel,
6028
6035
  className,
@@ -6030,6 +6037,7 @@ function AdsSparklineChart({
6030
6037
  data,
6031
6038
  dataKey,
6032
6039
  height,
6040
+ plotHeight,
6033
6041
  showTooltip = true,
6034
6042
  xKey
6035
6043
  }) {
@@ -6039,6 +6047,7 @@ function AdsSparklineChart({
6039
6047
  [dataKey]: getSafeValue(datum[dataKey])
6040
6048
  }));
6041
6049
  const safeHeight = getSafeHeight(height);
6050
+ const chartMargin = getChartMargin(safeHeight, plotHeight);
6042
6051
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
6043
6052
  "div",
6044
6053
  {
@@ -6054,7 +6063,7 @@ function AdsSparklineChart({
6054
6063
  className: "h-full",
6055
6064
  config: { value: { color } },
6056
6065
  height: "100%",
6057
- children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_recharts3.LineChart, { data: chartData, margin: { bottom: 1, left: 1, right: 1, top: 1 }, children: [
6066
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_recharts3.LineChart, { data: chartData, margin: chartMargin, children: [
6058
6067
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_recharts3.XAxis, { dataKey: xKey, hide: true, type: "category" }),
6059
6068
  showTooltip && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_recharts3.Tooltip, { contentStyle: tooltipContentStyle2, cursor: false }),
6060
6069
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
@@ -6239,6 +6248,7 @@ function AdsBarChart({
6239
6248
  height,
6240
6249
  highlightColor,
6241
6250
  highlightIndex,
6251
+ hoverColor,
6242
6252
  showTooltip = true,
6243
6253
  xAxis,
6244
6254
  xKey,
@@ -6297,6 +6307,7 @@ function AdsBarChart({
6297
6307
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6298
6308
  import_recharts4.Bar,
6299
6309
  {
6310
+ activeBar: hoverColor ? { fill: hoverColor } : void 0,
6300
6311
  barSize,
6301
6312
  dataKey,
6302
6313
  fill: "var(--color-value)",