cr-ui-lib 1.1.15 → 1.1.17

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
@@ -549,7 +549,7 @@ var GraphedCard = ({
549
549
  isCustomTitle ? customTitle : /* @__PURE__ */ jsxRuntime.jsx(
550
550
  "span",
551
551
  {
552
- className: "font-medium",
552
+ className: "font-semibold",
553
553
  style: { letterSpacing: "0.5px" },
554
554
  children: title
555
555
  }
@@ -810,7 +810,7 @@ var SimpleCard = ({
810
810
  isCustomTitle ? customTitle : /* @__PURE__ */ jsxRuntime.jsx(
811
811
  "span",
812
812
  {
813
- className: "font-medium",
813
+ className: "font-semibold",
814
814
  style: { letterSpacing: "0.5px" },
815
815
  children: title
816
816
  }
@@ -887,23 +887,23 @@ var Label = ({ title, classNames }) => {
887
887
  return /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge("text-[14px] font-semibold ", classNames), children: title });
888
888
  };
889
889
  var Label_default = Label;
890
+ chart_js.Chart.register(
891
+ chart_js.CategoryScale,
892
+ chart_js.LinearScale,
893
+ chart_js.PointElement,
894
+ chart_js.LineElement,
895
+ chart_js.Title,
896
+ chart_js.Tooltip,
897
+ chart_js.Filler,
898
+ chart_js.Legend
899
+ );
890
900
  var MultiLineGraph = ({
891
901
  datasets,
892
902
  xAxisLabels,
893
903
  className = ""
894
904
  }) => {
895
- chart_js.Chart.register(
896
- chart_js.CategoryScale,
897
- chart_js.LinearScale,
898
- chart_js.PointElement,
899
- chart_js.LineElement,
900
- chart_js.Title,
901
- chart_js.Tooltip,
902
- chart_js.Filler,
903
- chart_js.Legend
904
- );
905
905
  const chartRef = React.useRef(null);
906
- const [chartKey, setChartKey] = React.useState(0);
906
+ const [chartKey, setChartKey] = React.useState(`chart-${Date.now()}`);
907
907
  const defaultColors = [
908
908
  { line: "#17CA43", point: "#17CA43" },
909
909
  { line: "#FF6B6B", point: "#FF4757" },
@@ -914,7 +914,7 @@ var MultiLineGraph = ({
914
914
  ];
915
915
  React.useEffect(() => {
916
916
  const handleResize = () => {
917
- setChartKey((prevKey) => prevKey + 1);
917
+ setChartKey(`chart-${Date.now()}`);
918
918
  };
919
919
  window.addEventListener("resize", handleResize);
920
920
  return () => {
@@ -943,6 +943,7 @@ var MultiLineGraph = ({
943
943
  },
944
944
  y: {
945
945
  display: true,
946
+ // Set to `false` if you want to hide the y-axis labels
946
947
  border: {
947
948
  display: false
948
949
  },
@@ -997,27 +998,11 @@ var MultiLineGraph = ({
997
998
  const innerHtml = `
998
999
  <div style="position: relative; background: white; border: 1px solid rgba(16, 30, 115, 0.1); padding: 10px; border-radius: 4px; font-size: 12px; color: #333; min-width: 120px;">
999
1000
  <div id="tooltip-arrow-border" style="
1000
- position: absolute;
1001
- top: 100%;
1002
- left: 50%;
1003
- transform: translateX(-50%);
1004
- width: 0;
1005
- height: 0;
1006
- border-left: ${outerArrowSize}px solid transparent;
1007
- border-right: ${outerArrowSize}px solid transparent;
1008
- border-top: ${outerArrowSize}px solid rgba(16, 30, 115, 0.1);
1009
- "></div>
1001
+ position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: ${outerArrowSize}px solid transparent; border-right: ${outerArrowSize}px solid transparent; border-top: ${outerArrowSize}px solid rgba(16, 30, 115, 0.1);">
1002
+ </div>
1010
1003
  <div id="tooltip-arrow" style="
1011
- position: absolute;
1012
- top: 100%;
1013
- left: 50%;
1014
- transform: translateX(-50%) translateY(-1px);
1015
- width: 0;
1016
- height: 0;
1017
- border-left: ${innerArrowSize}px solid transparent;
1018
- border-right: ${innerArrowSize}px solid transparent;
1019
- border-top: ${innerArrowSize}px solid white;
1020
- "></div>
1004
+ position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(-1px); width: 0; height: 0; border-left: ${innerArrowSize}px solid transparent; border-right: ${innerArrowSize}px solid transparent; border-top: ${innerArrowSize}px solid white;">
1005
+ </div>
1021
1006
  <div>
1022
1007
  <p style="color:#757575; margin: 0 0 8px 0;"><strong>${label}</strong></p>
1023
1008
  ${dataPointsHtml}
@@ -1076,10 +1061,9 @@ var MultiLineGraph = ({
1076
1061
  () => ({
1077
1062
  id: "verticalLine",
1078
1063
  beforeDatasetsDraw: (chart) => {
1079
- var _a;
1080
- const tooltip = chart.tooltip;
1081
- if ((_a = tooltip == null ? void 0 : tooltip._active) == null ? void 0 : _a.length) {
1082
- const activePoint = chart.tooltip._active[0];
1064
+ var _a, _b;
1065
+ if ((_b = (_a = chart.tooltip) == null ? void 0 : _a.getActiveElements()) == null ? void 0 : _b.length) {
1066
+ const activePoint = chart.tooltip.getActiveElements()[0];
1083
1067
  const ctx = chart.ctx;
1084
1068
  const x = activePoint.element.x;
1085
1069
  const topY = chart.scales.y.top;
@@ -1098,6 +1082,32 @@ var MultiLineGraph = ({
1098
1082
  }),
1099
1083
  []
1100
1084
  );
1085
+ const dashedGridPlugin = React.useMemo(
1086
+ () => ({
1087
+ id: "customGridAndLabels",
1088
+ afterDraw(chart) {
1089
+ const ctx = chart.ctx;
1090
+ const yAxis = chart.scales.y;
1091
+ if (!yAxis) return;
1092
+ const { left, right } = chart.chartArea;
1093
+ ctx.save();
1094
+ ctx.setLineDash([4, 4]);
1095
+ ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
1096
+ ctx.lineWidth = 1;
1097
+ const ticks = yAxis.ticks || [];
1098
+ ticks.forEach((tick, index) => {
1099
+ if (index === 0) return;
1100
+ const yPos = yAxis.getPixelForValue(tick.value);
1101
+ ctx.beginPath();
1102
+ ctx.moveTo(left, yPos);
1103
+ ctx.lineTo(right, yPos);
1104
+ ctx.stroke();
1105
+ });
1106
+ ctx.restore();
1107
+ }
1108
+ }),
1109
+ []
1110
+ );
1101
1111
  const lineData = React.useMemo(
1102
1112
  () => ({
1103
1113
  labels: xAxisLabels,
@@ -1119,29 +1129,6 @@ var MultiLineGraph = ({
1119
1129
  }),
1120
1130
  [datasets, xAxisLabels]
1121
1131
  );
1122
- const dashedGridPlugin = {
1123
- id: "customGridAndLabels",
1124
- afterDraw(chart) {
1125
- const ctx = chart.ctx;
1126
- const yAxis = chart.scales.y;
1127
- if (!yAxis) return;
1128
- const { left, right } = chart.chartArea;
1129
- ctx.save();
1130
- ctx.setLineDash([4, 4]);
1131
- ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
1132
- ctx.lineWidth = 1;
1133
- const ticks = yAxis.ticks || [];
1134
- ticks.forEach((tick, index) => {
1135
- if (index === 0) return;
1136
- const yPos = yAxis.getPixelForValue(tick.value);
1137
- ctx.beginPath();
1138
- ctx.moveTo(left, yPos);
1139
- ctx.lineTo(right, yPos);
1140
- ctx.stroke();
1141
- });
1142
- ctx.restore();
1143
- }
1144
- };
1145
1132
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge(" w-full h-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(
1146
1133
  reactChartjs2.Line,
1147
1134
  {
@@ -1154,6 +1141,16 @@ var MultiLineGraph = ({
1154
1141
  ) });
1155
1142
  };
1156
1143
  var MultiLineGraph_default = MultiLineGraph;
1144
+ chart_js.Chart.register(
1145
+ chart_js.CategoryScale,
1146
+ chart_js.LinearScale,
1147
+ chart_js.PointElement,
1148
+ chart_js.LineElement,
1149
+ chart_js.Title,
1150
+ chart_js.Tooltip,
1151
+ chart_js.Filler,
1152
+ chart_js.Legend
1153
+ );
1157
1154
  var SingleLineGraph = ({
1158
1155
  data,
1159
1156
  label,
@@ -1164,21 +1161,11 @@ var SingleLineGraph = ({
1164
1161
  labelPopupTitle = "Requests Completed",
1165
1162
  className = ""
1166
1163
  }) => {
1167
- chart_js.Chart.register(
1168
- chart_js.CategoryScale,
1169
- chart_js.LinearScale,
1170
- chart_js.PointElement,
1171
- chart_js.LineElement,
1172
- chart_js.Title,
1173
- chart_js.Tooltip,
1174
- chart_js.Filler,
1175
- chart_js.Legend
1176
- );
1177
1164
  const chartRef = React.useRef(null);
1178
- const [chartKey, setChartKey] = React.useState(0);
1165
+ const [chartKey, setChartKey] = React.useState(`chart-${Date.now()}`);
1179
1166
  React.useEffect(() => {
1180
1167
  const handleResize = () => {
1181
- setChartKey((prevKey) => prevKey + 1);
1168
+ setChartKey(`chart-${Date.now()}`);
1182
1169
  };
1183
1170
  window.addEventListener("resize", handleResize);
1184
1171
  return () => {