cr-ui-lib 1.1.6 → 1.1.8

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.js CHANGED
@@ -953,7 +953,6 @@ var MultiLineGraph = ({
953
953
  },
954
954
  ticks: {
955
955
  display: true
956
- // 👈 Add this to hide the number labels
957
956
  }
958
957
  }
959
958
  },
@@ -1057,7 +1056,6 @@ var MultiLineGraph = ({
1057
1056
  },
1058
1057
  interaction: {
1059
1058
  intersect: false,
1060
- // 👇 CHANGE THIS LINE
1061
1059
  mode: "nearest"
1062
1060
  },
1063
1061
  elements: {
@@ -1077,7 +1075,7 @@ var MultiLineGraph = ({
1077
1075
  const verticalHoverLine = React.useMemo(
1078
1076
  () => ({
1079
1077
  id: "verticalLine",
1080
- afterDraw: (chart) => {
1078
+ beforeDatasetsDraw: (chart) => {
1081
1079
  var _a;
1082
1080
  const tooltip = chart.tooltip;
1083
1081
  if ((_a = tooltip == null ? void 0 : tooltip._active) == null ? void 0 : _a.length) {
@@ -1114,7 +1112,6 @@ var MultiLineGraph = ({
1114
1112
  pointBackgroundColor: "#ffffff",
1115
1113
  pointBorderColor: dataset.pointLabelColor || colors.point,
1116
1114
  tension: 0.5,
1117
- // 👇 ADD THESE TWO LINES to make the line thicker on hover
1118
1115
  borderWidth: 2,
1119
1116
  hoverBorderWidth: 3.5
1120
1117
  };
@@ -1122,33 +1119,32 @@ var MultiLineGraph = ({
1122
1119
  }),
1123
1120
  [datasets, xAxisLabels]
1124
1121
  );
1125
- const dashedGridPlugin = React.useMemo(
1126
- () => ({
1127
- id: "customGridAndLabels",
1128
- afterDatasetsDraw: (chart) => {
1129
- const ctx = chart.ctx;
1130
- const yAxis = chart.scales.y;
1131
- const xAxis = chart.scales.x;
1132
- if (!yAxis || !xAxis) return;
1133
- ctx.save();
1122
+ const dashedGridPlugin = {
1123
+ id: "customGridAndLabels",
1124
+ afterDraw(chart) {
1125
+ var _a;
1126
+ const ctx = chart.ctx;
1127
+ const yAxis = chart.scales.y;
1128
+ const xAxis = chart.scales.x;
1129
+ if (!yAxis || !xAxis) return;
1130
+ ctx.save();
1131
+ ctx.setLineDash([4, 4]);
1132
+ ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
1133
+ ctx.lineWidth = 1;
1134
+ const ticks = yAxis.ticks || ((_a = yAxis.getTicks) == null ? void 0 : _a.call(yAxis)) || [];
1135
+ ticks.forEach((tick, index) => {
1136
+ var _a2;
1137
+ if (index === 0) return;
1138
+ const yValue = (_a2 = tick.value) != null ? _a2 : tick;
1139
+ const yPosition = yAxis.getPixelForValue(yValue);
1134
1140
  ctx.beginPath();
1135
- ctx.setLineDash([4, 4]);
1136
- ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
1137
- ctx.lineWidth = 1;
1138
- yAxis.getTicks().forEach((tick, index) => {
1139
- if (index === 0) {
1140
- return;
1141
- }
1142
- const yPosition = yAxis.getPixelForValue(tick.value);
1143
- ctx.moveTo(xAxis.left, yPosition);
1144
- ctx.lineTo(xAxis.right, yPosition);
1145
- });
1141
+ ctx.moveTo(xAxis.left, yPosition);
1142
+ ctx.lineTo(xAxis.right, yPosition);
1146
1143
  ctx.stroke();
1147
- ctx.restore();
1148
- }
1149
- }),
1150
- []
1151
- );
1144
+ });
1145
+ ctx.restore();
1146
+ }
1147
+ };
1152
1148
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge(" w-full h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
1153
1149
  reactChartjs2.Line,
1154
1150
  {
@@ -1412,33 +1408,32 @@ var SingleLineGraph = ({
1412
1408
  }),
1413
1409
  [months, values]
1414
1410
  );
1415
- const dashedGridPlugin = React.useMemo(
1416
- () => ({
1417
- id: "customGridAndLabels",
1418
- afterDatasetsDraw: (chart) => {
1419
- const ctx = chart.ctx;
1420
- const yAxis = chart.scales.y;
1421
- const xAxis = chart.scales.x;
1422
- if (!yAxis || !xAxis) return;
1423
- ctx.save();
1411
+ const dashedGridPlugin = {
1412
+ id: "customGridAndLabels",
1413
+ afterDraw(chart) {
1414
+ var _a;
1415
+ const ctx = chart.ctx;
1416
+ const yAxis = chart.scales.y;
1417
+ const xAxis = chart.scales.x;
1418
+ if (!yAxis || !xAxis) return;
1419
+ ctx.save();
1420
+ ctx.setLineDash([4, 4]);
1421
+ ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
1422
+ ctx.lineWidth = 1;
1423
+ const ticks = yAxis.ticks || ((_a = yAxis.getTicks) == null ? void 0 : _a.call(yAxis)) || [];
1424
+ ticks.forEach((tick, index) => {
1425
+ var _a2;
1426
+ if (index === 0) return;
1427
+ const yValue = (_a2 = tick.value) != null ? _a2 : tick;
1428
+ const yPosition = yAxis.getPixelForValue(yValue);
1424
1429
  ctx.beginPath();
1425
- ctx.setLineDash([4, 4]);
1426
- ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
1427
- ctx.lineWidth = 1;
1428
- yAxis.getTicks().forEach((tick, index) => {
1429
- if (index === 0) {
1430
- return;
1431
- }
1432
- const yPosition = yAxis.getPixelForValue(tick.value);
1433
- ctx.moveTo(xAxis.left, yPosition);
1434
- ctx.lineTo(xAxis.right, yPosition);
1435
- });
1430
+ ctx.moveTo(xAxis.left, yPosition);
1431
+ ctx.lineTo(xAxis.right, yPosition);
1436
1432
  ctx.stroke();
1437
- ctx.restore();
1438
- }
1439
- }),
1440
- []
1441
- );
1433
+ });
1434
+ ctx.restore();
1435
+ }
1436
+ };
1442
1437
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("w-full h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
1443
1438
  reactChartjs2.Line,
1444
1439
  {