mario-education 2.4.174-level → 2.4.175-level
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 +104 -26
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +104 -26
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dist/index.modern.js
CHANGED
|
@@ -31209,20 +31209,25 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31209
31209
|
var chartHeight = isMobileScreen ? chartWidth / 1.5 : chartWidth / 3.12;
|
|
31210
31210
|
var colors = ["#C44140", "#81C935", "#0F9655", "#FFB04F", "#C44140"];
|
|
31211
31211
|
var data = [{
|
|
31212
|
-
label: "
|
|
31213
|
-
value: studentPressure.boreOutStudent
|
|
31212
|
+
label: "UNMOTIVATED",
|
|
31213
|
+
value: studentPressure.boreOutStudent,
|
|
31214
|
+
tooltip: "Not enough challenge, leading to boredom and lack of interest."
|
|
31214
31215
|
}, {
|
|
31215
31216
|
label: "COMFORT",
|
|
31216
|
-
value: studentPressure.comfortStudent
|
|
31217
|
+
value: studentPressure.comfortStudent,
|
|
31218
|
+
tooltip: "Calm and relaxed but not enough motivation to perform at my best."
|
|
31217
31219
|
}, {
|
|
31218
31220
|
label: "STRETCH",
|
|
31219
|
-
value: studentPressure.stretchStudent
|
|
31221
|
+
value: studentPressure.stretchStudent,
|
|
31222
|
+
tooltip: "Manageable levels of stress allowing me to perform at my best."
|
|
31220
31223
|
}, {
|
|
31221
31224
|
label: "STRAIN",
|
|
31222
|
-
value: studentPressure.strainStudent
|
|
31225
|
+
value: studentPressure.strainStudent,
|
|
31226
|
+
tooltip: "Manageable levels of stress allowing me to perform at my best."
|
|
31223
31227
|
}, {
|
|
31224
|
-
label: "
|
|
31225
|
-
value: studentPressure.burnoutStudent
|
|
31228
|
+
label: "OVERWHELMED",
|
|
31229
|
+
value: studentPressure.burnoutStudent,
|
|
31230
|
+
tooltip: "Too much pressure and really struggling to manage my workload."
|
|
31226
31231
|
}];
|
|
31227
31232
|
var xAxistLabels = ["Low", "Moderate", "High", "Very High"];
|
|
31228
31233
|
|
|
@@ -31230,30 +31235,61 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31230
31235
|
tooltipVisible = _useState[0],
|
|
31231
31236
|
setTooltipVisible = _useState[1];
|
|
31232
31237
|
|
|
31233
|
-
var _useState2 = useState(
|
|
31234
|
-
|
|
31235
|
-
|
|
31238
|
+
var _useState2 = useState(false),
|
|
31239
|
+
isInfoTooltip = _useState2[0],
|
|
31240
|
+
setInfoTooltip = _useState2[1];
|
|
31236
31241
|
|
|
31237
31242
|
var _useState3 = useState(0),
|
|
31238
|
-
|
|
31239
|
-
|
|
31243
|
+
tooltipX = _useState3[0],
|
|
31244
|
+
setTooltipX = _useState3[1];
|
|
31240
31245
|
|
|
31241
|
-
var _useState4 = useState(
|
|
31242
|
-
|
|
31243
|
-
|
|
31246
|
+
var _useState4 = useState(0),
|
|
31247
|
+
tooltipY = _useState4[0],
|
|
31248
|
+
setTooltipY = _useState4[1];
|
|
31244
31249
|
|
|
31245
|
-
var _useState5 = useState(
|
|
31246
|
-
|
|
31247
|
-
|
|
31250
|
+
var _useState5 = useState([]),
|
|
31251
|
+
tooltipStudents = _useState5[0],
|
|
31252
|
+
setTooltipStudents = _useState5[1];
|
|
31253
|
+
|
|
31254
|
+
var _useState6 = useState(""),
|
|
31255
|
+
colorTooltip = _useState6[0],
|
|
31256
|
+
setColorTooltip = _useState6[1];
|
|
31257
|
+
|
|
31258
|
+
var getHeightFromText = function getHeightFromText(text, fontSize) {
|
|
31259
|
+
var dummyElement = document.createElement("span");
|
|
31260
|
+
dummyElement.style.visibility = "hidden";
|
|
31261
|
+
dummyElement.style.position = "absolute";
|
|
31262
|
+
dummyElement.style.whiteSpace = "wrap";
|
|
31263
|
+
dummyElement.style.fontSize = fontSize;
|
|
31264
|
+
dummyElement.style.width = "162px";
|
|
31265
|
+
dummyElement.style.padding = "5px 5px 5px 10px";
|
|
31266
|
+
dummyElement.innerHTML = text;
|
|
31267
|
+
document.body.appendChild(dummyElement);
|
|
31268
|
+
var height = dummyElement.offsetHeight;
|
|
31269
|
+
document.body.removeChild(dummyElement);
|
|
31270
|
+
return height;
|
|
31271
|
+
};
|
|
31248
31272
|
|
|
31249
31273
|
var handleDotHover = function handleDotHover(students, x, y, label, color) {
|
|
31250
31274
|
setTooltipStudents(Array.from(new Set(students)));
|
|
31251
|
-
setTooltipX(isMobileScreen && label == "
|
|
31275
|
+
setTooltipX(isMobileScreen && label == "OVERWHELMED" ? x - 45 : x);
|
|
31252
31276
|
setTooltipY(y);
|
|
31253
31277
|
setTooltipVisible(label);
|
|
31254
31278
|
setColorTooltip(color);
|
|
31255
31279
|
};
|
|
31256
31280
|
|
|
31281
|
+
var handleEnterInfoIcon = function handleEnterInfoIcon(x, y, tip) {
|
|
31282
|
+
setTooltipVisible(tip);
|
|
31283
|
+
setInfoTooltip(true);
|
|
31284
|
+
setTooltipX(x);
|
|
31285
|
+
setTooltipY(y);
|
|
31286
|
+
};
|
|
31287
|
+
|
|
31288
|
+
var handleLeaveInfoIcon = function handleLeaveInfoIcon() {
|
|
31289
|
+
setTooltipVisible("");
|
|
31290
|
+
setInfoTooltip(false);
|
|
31291
|
+
};
|
|
31292
|
+
|
|
31257
31293
|
var handleDotLeave = function handleDotLeave() {
|
|
31258
31294
|
setTooltipVisible("");
|
|
31259
31295
|
};
|
|
@@ -31266,7 +31302,7 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31266
31302
|
try {
|
|
31267
31303
|
var _ret = function () {
|
|
31268
31304
|
var styleElement = document.createElementNS("http://www.w3.org/2000/svg", "style");
|
|
31269
|
-
styleElement.textContent = "\n text {\n font-size: 12px;\n }";
|
|
31305
|
+
styleElement.textContent = "\n text {\n font-size: 12px;\n }\n .info-stress-icon:hover circle{\n stroke: #316CD9\n }\n .info-stress-icon:hover polyline{\n stroke: #316CD9\n }\n .tooltip-chart{\n content: \"\";\n display: block;\n width: 0; \n height: 0; \n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid #242424CC;\n }\n ";
|
|
31270
31306
|
svg.appendChild(styleElement);
|
|
31271
31307
|
var xAxis = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
31272
31308
|
xAxis.setAttribute("x1", "50");
|
|
@@ -31327,7 +31363,7 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31327
31363
|
var circleY = !isMobileScreen ? chartHeight - 30 : chartHeight - 24;
|
|
31328
31364
|
|
|
31329
31365
|
var _loop = function _loop(i) {
|
|
31330
|
-
var _data3, _data3$value, _data3$value$length, _data6;
|
|
31366
|
+
var _data3, _data3$value, _data3$value$length, _data6, _data7;
|
|
31331
31367
|
|
|
31332
31368
|
var circleX = circleSpacing * i + alignment;
|
|
31333
31369
|
var radius = !isMobileScreen ? 15 : 12;
|
|
@@ -31359,6 +31395,18 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31359
31395
|
});
|
|
31360
31396
|
svg.appendChild(text);
|
|
31361
31397
|
var label = (_data6 = data[i - 1]) === null || _data6 === void 0 ? void 0 : _data6.label;
|
|
31398
|
+
var tooltip = (_data7 = data[i - 1]) === null || _data7 === void 0 ? void 0 : _data7.tooltip;
|
|
31399
|
+
var infoIconContainer = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
|
|
31400
|
+
var infoIcon = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
31401
|
+
infoIcon.innerHTML = "<rect width=\"256\" height=\"256\" fill=\"none\"></rect><circle cx=\"128\" cy=\"128\" r=\"96\" fill=\"none\" stroke=\"#000\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"16\"></circle><polyline fill=\"none\" stroke=\"#000\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"16\" points=\"120 120 128 120 128 176 136 176\"></polyline><circle cx=\"128\" cy=\"84\" r=\"12\"></circle>";
|
|
31402
|
+
infoIcon.setAttribute("width", "16");
|
|
31403
|
+
infoIcon.setAttribute("height", "16");
|
|
31404
|
+
infoIcon.setAttribute("viewBox", "0 0 256 256");
|
|
31405
|
+
infoIconContainer.setAttribute("width", "16");
|
|
31406
|
+
infoIconContainer.setAttribute("height", "20");
|
|
31407
|
+
infoIconContainer.style.cursor = "pointer";
|
|
31408
|
+
infoIconContainer.classList.add("info-stress-icon");
|
|
31409
|
+
infoIconContainer.appendChild(infoIcon);
|
|
31362
31410
|
var labelText = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
31363
31411
|
labelText.setAttribute("x", "" + circleX);
|
|
31364
31412
|
labelText.setAttribute("y", "" + (circleY - radius - 12));
|
|
@@ -31373,6 +31421,14 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31373
31421
|
|
|
31374
31422
|
labelText.textContent = label;
|
|
31375
31423
|
svg.appendChild(labelText);
|
|
31424
|
+
infoIconContainer.setAttribute("x", "" + (circleX + 8 + labelText.getBoundingClientRect().width / 2));
|
|
31425
|
+
infoIconContainer.setAttribute("y", "" + (circleY - radius - 20 - labelText.getBoundingClientRect().height / 2));
|
|
31426
|
+
infoIconContainer.addEventListener("mouseenter", function () {
|
|
31427
|
+
return handleEnterInfoIcon(circleX + 8 + labelText.getBoundingClientRect().width / 2, circleY - radius - 16 - labelText.getBoundingClientRect().height / 2, tooltip);
|
|
31428
|
+
});
|
|
31429
|
+
infoIconContainer.addEventListener("mouseleave", handleLeaveInfoIcon);
|
|
31430
|
+
labelText.getBoundingClientRect();
|
|
31431
|
+
svg.appendChild(infoIconContainer);
|
|
31376
31432
|
};
|
|
31377
31433
|
|
|
31378
31434
|
for (var i = 1; i <= data.length; i++) {
|
|
@@ -31400,15 +31456,19 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31400
31456
|
var lineHeight = 20;
|
|
31401
31457
|
var tooltipHeight = tooltipStudents.length * lineHeight;
|
|
31402
31458
|
var maxHeightTooltip = tooltipHeight + 30 > chartHeight - 50 ? chartHeight - 50 : tooltipHeight + 30;
|
|
31459
|
+
var heightInfoTooltip = useMemo(function () {
|
|
31460
|
+
if (isInfoTooltip && tooltipVisible) return getHeightFromText(tooltipVisible, "12px");
|
|
31461
|
+
return 0;
|
|
31462
|
+
}, [isInfoTooltip, tooltipVisible]);
|
|
31403
31463
|
return React.createElement("svg", {
|
|
31404
31464
|
ref: svgRef,
|
|
31405
31465
|
width: chartWidth,
|
|
31406
31466
|
height: chartHeight + 50
|
|
31407
31467
|
}, !!tooltipVisible && React.createElement("g", {
|
|
31408
|
-
transform: "translate(" + (tooltipX - 100) + "," + Math.max(0, tooltipY - tooltipHeight -
|
|
31468
|
+
transform: "translate(" + (isInfoTooltip ? tooltipX - 81 : tooltipX - 100) + "," + Math.max(0, isInfoTooltip ? tooltipY - heightInfoTooltip - 30 : tooltipY - tooltipHeight - 100) + ")"
|
|
31409
31469
|
}, React.createElement("rect", {
|
|
31410
|
-
width:
|
|
31411
|
-
height: maxHeightTooltip + 10,
|
|
31470
|
+
width: isInfoTooltip ? 162 : 200,
|
|
31471
|
+
height: isInfoTooltip ? heightInfoTooltip + 10 : maxHeightTooltip + 10,
|
|
31412
31472
|
fill: "rgba(36, 36, 36, 0.8)",
|
|
31413
31473
|
rx: "5"
|
|
31414
31474
|
}), React.createElement("text", {
|
|
@@ -31417,7 +31477,18 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31417
31477
|
fill: "#fff",
|
|
31418
31478
|
fontSize: "12px",
|
|
31419
31479
|
textAnchor: "start"
|
|
31420
|
-
}, tooltipStudents.length + " students are " + tooltipVisible), React.createElement("foreignObject", {
|
|
31480
|
+
}, !isInfoTooltip && tooltipStudents.length + " students are " + tooltipVisible), isInfoTooltip && React.createElement("foreignObject", {
|
|
31481
|
+
x: "0",
|
|
31482
|
+
y: "10",
|
|
31483
|
+
width: isInfoTooltip ? 162 : 200,
|
|
31484
|
+
height: heightInfoTooltip
|
|
31485
|
+
}, React.createElement("div", {
|
|
31486
|
+
style: {
|
|
31487
|
+
padding: "0px 5px 5px 10px",
|
|
31488
|
+
color: "#fff",
|
|
31489
|
+
fontSize: "12px"
|
|
31490
|
+
}
|
|
31491
|
+
}, tooltipVisible)), !isInfoTooltip && React.createElement("foreignObject", {
|
|
31421
31492
|
x: "0",
|
|
31422
31493
|
y: "30",
|
|
31423
31494
|
width: "200",
|
|
@@ -31443,7 +31514,14 @@ var StudentPressureChart = function StudentPressureChart(_ref) {
|
|
|
31443
31514
|
marginRight: "10px"
|
|
31444
31515
|
}
|
|
31445
31516
|
}), React.createElement("span", null, label));
|
|
31446
|
-
})))
|
|
31517
|
+
}))), React.createElement("foreignObject", {
|
|
31518
|
+
y: isInfoTooltip ? heightInfoTooltip + 10 : tooltipHeight + 40,
|
|
31519
|
+
x: isInfoTooltip ? 82 : 94,
|
|
31520
|
+
width: 10,
|
|
31521
|
+
height: 10
|
|
31522
|
+
}, React.createElement("div", {
|
|
31523
|
+
className: "tooltip-chart"
|
|
31524
|
+
}))));
|
|
31447
31525
|
};
|
|
31448
31526
|
|
|
31449
31527
|
var headerLogo = "../images/main-logo-blue.png";
|