@apexcura/ui-components 0.0.14-Beta125 → 0.0.14-Beta127

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.css CHANGED
@@ -350,8 +350,8 @@ video {
350
350
  .table {
351
351
  display: table;
352
352
  }
353
- .hidden {
354
- display: none;
353
+ .grid {
354
+ display: grid;
355
355
  }
356
356
  .h-5 {
357
357
  height: 1.25rem;
package/dist/index.d.mts CHANGED
@@ -122,11 +122,11 @@ declare const OtpElement: (props: ElementType) => React$1.JSX.Element;
122
122
 
123
123
  declare const CircleDonut: (props: ElementType) => React$1.JSX.Element;
124
124
 
125
- declare const SemiCircleDonut: (props: ElementType) => React$1.JSX.Element;
125
+ declare const SemiCircleDonut: () => React$1.JSX.Element;
126
126
 
127
127
  declare const HorizontalBarChart: (props: ElementType) => React$1.JSX.Element;
128
128
 
129
- declare const LineChart: React$1.FC;
129
+ declare const LineChart: (props: ElementType) => React$1.JSX.Element;
130
130
 
131
131
  declare const DoubleBarChart: React$1.FC;
132
132
 
package/dist/index.d.ts CHANGED
@@ -122,11 +122,11 @@ declare const OtpElement: (props: ElementType) => React$1.JSX.Element;
122
122
 
123
123
  declare const CircleDonut: (props: ElementType) => React$1.JSX.Element;
124
124
 
125
- declare const SemiCircleDonut: (props: ElementType) => React$1.JSX.Element;
125
+ declare const SemiCircleDonut: () => React$1.JSX.Element;
126
126
 
127
127
  declare const HorizontalBarChart: (props: ElementType) => React$1.JSX.Element;
128
128
 
129
- declare const LineChart: React$1.FC;
129
+ declare const LineChart: (props: ElementType) => React$1.JSX.Element;
130
130
 
131
131
  declare const DoubleBarChart: React$1.FC;
132
132
 
package/dist/index.js CHANGED
@@ -1101,29 +1101,38 @@ var import_chart = require("chart.js");
1101
1101
  import_chart.Chart.register(import_chart.DoughnutController, import_chart.ArcElement, import_chart.Tooltip, import_chart.Legend);
1102
1102
  var CircleDonut = (props) => {
1103
1103
  const data = {
1104
- labels: ["Registration", "Book Appointment", "Diagnostic Tests", "Hospital Facility", "Others, Prescriptions"],
1104
+ labels: [
1105
+ "Registration",
1106
+ "Book Appointment",
1107
+ "Diagnostic Tests",
1108
+ "Hospital Facility",
1109
+ "Others, Prescriptions"
1110
+ ],
1105
1111
  datasets: [
1106
1112
  {
1107
1113
  label: "Bot Conversation",
1108
- data: [30, 10, 27, 40, 12, 37],
1114
+ data: [30, 10, 27, 40, 12],
1109
1115
  backgroundColor: [
1110
1116
  "#FFCB8A",
1111
1117
  "#CADBBF",
1112
1118
  "#8AC1BB",
1113
1119
  "#FCB0CB",
1114
- "#CEB0FA",
1115
- "#AEA29F"
1116
- ]
1120
+ "#CEB0FA"
1121
+ ],
1122
+ borderWidth: 0
1117
1123
  }
1118
1124
  ]
1119
1125
  };
1120
1126
  const options = {
1121
1127
  responsive: true,
1122
- rotation: -360,
1128
+ cutout: "80%",
1123
1129
  plugins: {
1124
1130
  legend: {
1125
1131
  position: "left",
1126
1132
  labels: {
1133
+ font: {
1134
+ size: 10
1135
+ },
1127
1136
  boxWidth: 15,
1128
1137
  generateLabels: (chart) => {
1129
1138
  const dataset = chart.data.datasets[0];
@@ -1149,7 +1158,27 @@ var CircleDonut = (props) => {
1149
1158
  }
1150
1159
  }
1151
1160
  };
1152
- return /* @__PURE__ */ import_react31.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react31.default.createElement(import_react_chartjs_2.Doughnut, { data, options }));
1161
+ const centerTextPlugin = {
1162
+ id: "centerText",
1163
+ beforeDraw: (chart) => {
1164
+ const { ctx, chartArea: { left, right, top, bottom } } = chart;
1165
+ const width = right - left;
1166
+ const height = bottom - top;
1167
+ const centerX = left + width / 2;
1168
+ const centerY = top + height / 2;
1169
+ ctx.save();
1170
+ ctx.font = "10px Arial";
1171
+ ctx.fillStyle = "blue";
1172
+ ctx.textAlign = "center";
1173
+ ctx.textBaseline = "middle";
1174
+ ctx.fillText("Total Sessions", centerX, centerY - 10);
1175
+ ctx.font = "30px Arial";
1176
+ ctx.fillStyle = "black";
1177
+ ctx.fillText("85", centerX, centerY + 20);
1178
+ ctx.restore();
1179
+ }
1180
+ };
1181
+ return /* @__PURE__ */ import_react31.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react31.default.createElement(import_react_chartjs_2.Doughnut, { data, options, plugins: [centerTextPlugin] }));
1153
1182
  };
1154
1183
 
1155
1184
  // src/Components/SemiCircleDonut.tsx
@@ -1157,21 +1186,27 @@ var import_react32 = __toESM(require("react"));
1157
1186
  var import_react_chartjs_22 = require("react-chartjs-2");
1158
1187
  var import_chart2 = require("chart.js");
1159
1188
  import_chart2.Chart.register(import_chart2.DoughnutController, import_chart2.ArcElement, import_chart2.Tooltip, import_chart2.Legend);
1160
- var SemiCircleDonut = (props) => {
1189
+ var SemiCircleDonut = () => {
1161
1190
  const data = {
1162
- labels: ["Registration", "Book Appointment", "Diagnostic Tests", "Hospital Facility", "Others, Prescriptions"],
1191
+ labels: [
1192
+ "Registration",
1193
+ "Book Appointment",
1194
+ "Diagnostic Tests",
1195
+ "Hospital Facility",
1196
+ "Others, Prescriptions"
1197
+ ],
1163
1198
  datasets: [
1164
1199
  {
1165
1200
  label: "Bot Conversation",
1166
- data: [30, 10, 27, 40, 12, 37],
1201
+ data: [30, 10, 27, 40, 12],
1167
1202
  backgroundColor: [
1168
1203
  "#FFCB8A",
1169
1204
  "#CADBBF",
1170
1205
  "#8AC1BB",
1171
1206
  "#FCB0CB",
1172
- "#CEB0FA",
1173
- "#AEA29F"
1174
- ]
1207
+ "#CEB0FA"
1208
+ ],
1209
+ borderWidth: 0
1175
1210
  }
1176
1211
  ]
1177
1212
  };
@@ -1179,24 +1214,11 @@ var SemiCircleDonut = (props) => {
1179
1214
  responsive: true,
1180
1215
  circumference: 180,
1181
1216
  rotation: -90,
1217
+ cutout: "80%",
1182
1218
  plugins: {
1183
1219
  legend: {
1184
- position: "left",
1185
- labels: {
1186
- boxWidth: 15,
1187
- generateLabels: (chart) => {
1188
- const dataset = chart.data.datasets[0];
1189
- return chart.data.labels.map((label, index) => {
1190
- const value = dataset.data[index];
1191
- return {
1192
- text: `${label}: ${value}`,
1193
- fillStyle: dataset.backgroundColor[index],
1194
- hidden: isNaN(dataset.data[index]) || dataset.data[index] === null,
1195
- index
1196
- };
1197
- });
1198
- }
1199
- }
1220
+ display: false
1221
+ // Disable the legend
1200
1222
  },
1201
1223
  tooltip: {
1202
1224
  enabled: true,
@@ -1210,7 +1232,26 @@ var SemiCircleDonut = (props) => {
1210
1232
  }
1211
1233
  }
1212
1234
  };
1213
- return /* @__PURE__ */ import_react32.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react32.default.createElement(import_react_chartjs_22.Doughnut, { data, options }));
1235
+ const centerTextPlugin = {
1236
+ id: "centerText",
1237
+ beforeDraw: (chart) => {
1238
+ const { ctx, chartArea: { left, right, top, bottom } } = chart;
1239
+ const width = right - left;
1240
+ const height = bottom - top;
1241
+ const centerX = left + width / 2;
1242
+ const centerY = top + height / 1.5;
1243
+ ctx.save();
1244
+ ctx.font = "30px Arial";
1245
+ ctx.fillStyle = "black";
1246
+ ctx.textAlign = "center";
1247
+ ctx.textBaseline = "middle";
1248
+ ctx.fillText("High", centerX, centerY - 10);
1249
+ ctx.font = "13px Arial";
1250
+ ctx.fillText("Improve Chatbot Training Data", centerX, centerY + 20);
1251
+ ctx.restore();
1252
+ }
1253
+ };
1254
+ return /* @__PURE__ */ import_react32.default.createElement("div", { style: { width: "30%" } }, /* @__PURE__ */ import_react32.default.createElement(import_react_chartjs_22.Doughnut, { data, options, plugins: [centerTextPlugin] }));
1214
1255
  };
1215
1256
 
1216
1257
  // src/Components/HorizontalBarChart.tsx
@@ -1224,12 +1265,14 @@ var HorizontalBarChart = (props) => {
1224
1265
  datasets: [
1225
1266
  {
1226
1267
  data: [30, 10, 27, 40, 12, 24],
1227
- backgroundColor: "#6298D5"
1268
+ backgroundColor: "#6298D5",
1269
+ barThickness: 40
1228
1270
  }
1229
1271
  ]
1230
1272
  };
1231
1273
  const options = {
1232
1274
  responsive: true,
1275
+ indexAxis: "y",
1233
1276
  scales: {
1234
1277
  x: {
1235
1278
  beginAtZero: true,
@@ -1238,6 +1281,11 @@ var HorizontalBarChart = (props) => {
1238
1281
  return `${value}%`;
1239
1282
  }
1240
1283
  }
1284
+ },
1285
+ y: {
1286
+ grid: {
1287
+ display: false
1288
+ }
1241
1289
  }
1242
1290
  },
1243
1291
  plugins: {
@@ -1250,6 +1298,9 @@ var HorizontalBarChart = (props) => {
1250
1298
  return `${label}: ${value}`;
1251
1299
  }
1252
1300
  }
1301
+ },
1302
+ legend: {
1303
+ display: false
1253
1304
  }
1254
1305
  }
1255
1306
  };
@@ -1259,15 +1310,18 @@ var HorizontalBarChart = (props) => {
1259
1310
  // src/Components/LineChart.tsx
1260
1311
  var import_react34 = __toESM(require("react"));
1261
1312
  var import_auto = __toESM(require("chart.js/auto"));
1262
- var LineChart = () => {
1313
+ var LineChart = (props) => {
1263
1314
  const chartRef = (0, import_react34.useRef)(null);
1264
1315
  const chartInstance = (0, import_react34.useRef)(null);
1265
1316
  const data = [
1266
1317
  { label: "ROI", data: [10, 30, 50, 70, 90] },
1318
+ // Example data for ROI
1267
1319
  { label: "Engagement Rate", data: [20, 40, 60, 80, 100] },
1320
+ // Example data for Engagement Rate
1268
1321
  { label: "Conversion Rate", data: [30, 50, 70, 90, 110] }
1322
+ // Example data for Conversion Rate
1269
1323
  ];
1270
- const labels = ["Instagram", "Whatsapp", "Messages", "Facebook", "Linkedin"];
1324
+ const labels = ["Insta", "Whatsapp", "Messages", "Another", "Example"];
1271
1325
  (0, import_react34.useEffect)(() => {
1272
1326
  if (chartRef.current) {
1273
1327
  if (chartInstance.current) {
@@ -1280,8 +1334,12 @@ var LineChart = () => {
1280
1334
  datasets: data.map((dataset, index) => ({
1281
1335
  label: dataset.label,
1282
1336
  data: dataset.data,
1283
- borderColor: `rgb(${index * 100}, ${255 - index * 50}, ${index * 50})`,
1284
- // Example dynamic color generation
1337
+ borderColor: index === 0 ? "blue" : index === 1 ? "green" : "yellow",
1338
+ // Custom line colors
1339
+ backgroundColor: index === 0 ? "blue" : index === 1 ? "green" : "yellow",
1340
+ // Circle color in legend
1341
+ pointBackgroundColor: "white",
1342
+ // Circle background color in legend
1285
1343
  tension: 0.1,
1286
1344
  fill: false
1287
1345
  }))
@@ -1308,7 +1366,7 @@ var LineChart = () => {
1308
1366
  }
1309
1367
  };
1310
1368
  }, []);
1311
- return /* @__PURE__ */ import_react34.default.createElement("canvas", { ref: chartRef });
1369
+ return /* @__PURE__ */ import_react34.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react34.default.createElement("canvas", { ref: chartRef }));
1312
1370
  };
1313
1371
 
1314
1372
  // src/Components/DoubleBarChart.tsx
package/dist/index.mjs CHANGED
@@ -1041,29 +1041,38 @@ import {
1041
1041
  ChartJS.register(DoughnutController, ArcElement, Tooltip, Legend);
1042
1042
  var CircleDonut = (props) => {
1043
1043
  const data = {
1044
- labels: ["Registration", "Book Appointment", "Diagnostic Tests", "Hospital Facility", "Others, Prescriptions"],
1044
+ labels: [
1045
+ "Registration",
1046
+ "Book Appointment",
1047
+ "Diagnostic Tests",
1048
+ "Hospital Facility",
1049
+ "Others, Prescriptions"
1050
+ ],
1045
1051
  datasets: [
1046
1052
  {
1047
1053
  label: "Bot Conversation",
1048
- data: [30, 10, 27, 40, 12, 37],
1054
+ data: [30, 10, 27, 40, 12],
1049
1055
  backgroundColor: [
1050
1056
  "#FFCB8A",
1051
1057
  "#CADBBF",
1052
1058
  "#8AC1BB",
1053
1059
  "#FCB0CB",
1054
- "#CEB0FA",
1055
- "#AEA29F"
1056
- ]
1060
+ "#CEB0FA"
1061
+ ],
1062
+ borderWidth: 0
1057
1063
  }
1058
1064
  ]
1059
1065
  };
1060
1066
  const options = {
1061
1067
  responsive: true,
1062
- rotation: -360,
1068
+ cutout: "80%",
1063
1069
  plugins: {
1064
1070
  legend: {
1065
1071
  position: "left",
1066
1072
  labels: {
1073
+ font: {
1074
+ size: 10
1075
+ },
1067
1076
  boxWidth: 15,
1068
1077
  generateLabels: (chart) => {
1069
1078
  const dataset = chart.data.datasets[0];
@@ -1089,7 +1098,27 @@ var CircleDonut = (props) => {
1089
1098
  }
1090
1099
  }
1091
1100
  };
1092
- return /* @__PURE__ */ React31.createElement("div", { className: props.className }, /* @__PURE__ */ React31.createElement(Doughnut, { data, options }));
1101
+ const centerTextPlugin = {
1102
+ id: "centerText",
1103
+ beforeDraw: (chart) => {
1104
+ const { ctx, chartArea: { left, right, top, bottom } } = chart;
1105
+ const width = right - left;
1106
+ const height = bottom - top;
1107
+ const centerX = left + width / 2;
1108
+ const centerY = top + height / 2;
1109
+ ctx.save();
1110
+ ctx.font = "10px Arial";
1111
+ ctx.fillStyle = "blue";
1112
+ ctx.textAlign = "center";
1113
+ ctx.textBaseline = "middle";
1114
+ ctx.fillText("Total Sessions", centerX, centerY - 10);
1115
+ ctx.font = "30px Arial";
1116
+ ctx.fillStyle = "black";
1117
+ ctx.fillText("85", centerX, centerY + 20);
1118
+ ctx.restore();
1119
+ }
1120
+ };
1121
+ return /* @__PURE__ */ React31.createElement("div", { className: props.className }, /* @__PURE__ */ React31.createElement(Doughnut, { data, options, plugins: [centerTextPlugin] }));
1093
1122
  };
1094
1123
 
1095
1124
  // src/Components/SemiCircleDonut.tsx
@@ -1103,21 +1132,27 @@ import {
1103
1132
  Legend as Legend2
1104
1133
  } from "chart.js";
1105
1134
  ChartJS2.register(DoughnutController2, ArcElement2, Tooltip2, Legend2);
1106
- var SemiCircleDonut = (props) => {
1135
+ var SemiCircleDonut = () => {
1107
1136
  const data = {
1108
- labels: ["Registration", "Book Appointment", "Diagnostic Tests", "Hospital Facility", "Others, Prescriptions"],
1137
+ labels: [
1138
+ "Registration",
1139
+ "Book Appointment",
1140
+ "Diagnostic Tests",
1141
+ "Hospital Facility",
1142
+ "Others, Prescriptions"
1143
+ ],
1109
1144
  datasets: [
1110
1145
  {
1111
1146
  label: "Bot Conversation",
1112
- data: [30, 10, 27, 40, 12, 37],
1147
+ data: [30, 10, 27, 40, 12],
1113
1148
  backgroundColor: [
1114
1149
  "#FFCB8A",
1115
1150
  "#CADBBF",
1116
1151
  "#8AC1BB",
1117
1152
  "#FCB0CB",
1118
- "#CEB0FA",
1119
- "#AEA29F"
1120
- ]
1153
+ "#CEB0FA"
1154
+ ],
1155
+ borderWidth: 0
1121
1156
  }
1122
1157
  ]
1123
1158
  };
@@ -1125,24 +1160,11 @@ var SemiCircleDonut = (props) => {
1125
1160
  responsive: true,
1126
1161
  circumference: 180,
1127
1162
  rotation: -90,
1163
+ cutout: "80%",
1128
1164
  plugins: {
1129
1165
  legend: {
1130
- position: "left",
1131
- labels: {
1132
- boxWidth: 15,
1133
- generateLabels: (chart) => {
1134
- const dataset = chart.data.datasets[0];
1135
- return chart.data.labels.map((label, index) => {
1136
- const value = dataset.data[index];
1137
- return {
1138
- text: `${label}: ${value}`,
1139
- fillStyle: dataset.backgroundColor[index],
1140
- hidden: isNaN(dataset.data[index]) || dataset.data[index] === null,
1141
- index
1142
- };
1143
- });
1144
- }
1145
- }
1166
+ display: false
1167
+ // Disable the legend
1146
1168
  },
1147
1169
  tooltip: {
1148
1170
  enabled: true,
@@ -1156,7 +1178,26 @@ var SemiCircleDonut = (props) => {
1156
1178
  }
1157
1179
  }
1158
1180
  };
1159
- return /* @__PURE__ */ React32.createElement("div", { className: props.className }, /* @__PURE__ */ React32.createElement(Doughnut2, { data, options }));
1181
+ const centerTextPlugin = {
1182
+ id: "centerText",
1183
+ beforeDraw: (chart) => {
1184
+ const { ctx, chartArea: { left, right, top, bottom } } = chart;
1185
+ const width = right - left;
1186
+ const height = bottom - top;
1187
+ const centerX = left + width / 2;
1188
+ const centerY = top + height / 1.5;
1189
+ ctx.save();
1190
+ ctx.font = "30px Arial";
1191
+ ctx.fillStyle = "black";
1192
+ ctx.textAlign = "center";
1193
+ ctx.textBaseline = "middle";
1194
+ ctx.fillText("High", centerX, centerY - 10);
1195
+ ctx.font = "13px Arial";
1196
+ ctx.fillText("Improve Chatbot Training Data", centerX, centerY + 20);
1197
+ ctx.restore();
1198
+ }
1199
+ };
1200
+ return /* @__PURE__ */ React32.createElement("div", { style: { width: "30%" } }, /* @__PURE__ */ React32.createElement(Doughnut2, { data, options, plugins: [centerTextPlugin] }));
1160
1201
  };
1161
1202
 
1162
1203
  // src/Components/HorizontalBarChart.tsx
@@ -1176,12 +1217,14 @@ var HorizontalBarChart = (props) => {
1176
1217
  datasets: [
1177
1218
  {
1178
1219
  data: [30, 10, 27, 40, 12, 24],
1179
- backgroundColor: "#6298D5"
1220
+ backgroundColor: "#6298D5",
1221
+ barThickness: 40
1180
1222
  }
1181
1223
  ]
1182
1224
  };
1183
1225
  const options = {
1184
1226
  responsive: true,
1227
+ indexAxis: "y",
1185
1228
  scales: {
1186
1229
  x: {
1187
1230
  beginAtZero: true,
@@ -1190,6 +1233,11 @@ var HorizontalBarChart = (props) => {
1190
1233
  return `${value}%`;
1191
1234
  }
1192
1235
  }
1236
+ },
1237
+ y: {
1238
+ grid: {
1239
+ display: false
1240
+ }
1193
1241
  }
1194
1242
  },
1195
1243
  plugins: {
@@ -1202,6 +1250,9 @@ var HorizontalBarChart = (props) => {
1202
1250
  return `${label}: ${value}`;
1203
1251
  }
1204
1252
  }
1253
+ },
1254
+ legend: {
1255
+ display: false
1205
1256
  }
1206
1257
  }
1207
1258
  };
@@ -1211,15 +1262,18 @@ var HorizontalBarChart = (props) => {
1211
1262
  // src/Components/LineChart.tsx
1212
1263
  import React34, { useEffect as useEffect4, useRef as useRef2 } from "react";
1213
1264
  import Chart from "chart.js/auto";
1214
- var LineChart = () => {
1265
+ var LineChart = (props) => {
1215
1266
  const chartRef = useRef2(null);
1216
1267
  const chartInstance = useRef2(null);
1217
1268
  const data = [
1218
1269
  { label: "ROI", data: [10, 30, 50, 70, 90] },
1270
+ // Example data for ROI
1219
1271
  { label: "Engagement Rate", data: [20, 40, 60, 80, 100] },
1272
+ // Example data for Engagement Rate
1220
1273
  { label: "Conversion Rate", data: [30, 50, 70, 90, 110] }
1274
+ // Example data for Conversion Rate
1221
1275
  ];
1222
- const labels = ["Instagram", "Whatsapp", "Messages", "Facebook", "Linkedin"];
1276
+ const labels = ["Insta", "Whatsapp", "Messages", "Another", "Example"];
1223
1277
  useEffect4(() => {
1224
1278
  if (chartRef.current) {
1225
1279
  if (chartInstance.current) {
@@ -1232,8 +1286,12 @@ var LineChart = () => {
1232
1286
  datasets: data.map((dataset, index) => ({
1233
1287
  label: dataset.label,
1234
1288
  data: dataset.data,
1235
- borderColor: `rgb(${index * 100}, ${255 - index * 50}, ${index * 50})`,
1236
- // Example dynamic color generation
1289
+ borderColor: index === 0 ? "blue" : index === 1 ? "green" : "yellow",
1290
+ // Custom line colors
1291
+ backgroundColor: index === 0 ? "blue" : index === 1 ? "green" : "yellow",
1292
+ // Circle color in legend
1293
+ pointBackgroundColor: "white",
1294
+ // Circle background color in legend
1237
1295
  tension: 0.1,
1238
1296
  fill: false
1239
1297
  }))
@@ -1260,7 +1318,7 @@ var LineChart = () => {
1260
1318
  }
1261
1319
  };
1262
1320
  }, []);
1263
- return /* @__PURE__ */ React34.createElement("canvas", { ref: chartRef });
1321
+ return /* @__PURE__ */ React34.createElement("div", { className: props.className }, /* @__PURE__ */ React34.createElement("canvas", { ref: chartRef }));
1264
1322
  };
1265
1323
 
1266
1324
  // src/Components/DoubleBarChart.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.14-Beta125",
3
+ "version": "0.0.14-Beta127",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",