cr-ui-lib 1.0.13 → 1.0.15
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 +66 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1082,7 +1082,6 @@ var MultiLineGraph = ({
|
|
|
1082
1082
|
if (!tooltipEl) {
|
|
1083
1083
|
tooltipEl = document.createElement("div");
|
|
1084
1084
|
tooltipEl.id = "chartjs-tooltip";
|
|
1085
|
-
tooltipEl.innerHTML = "<div></div>";
|
|
1086
1085
|
document.body.appendChild(tooltipEl);
|
|
1087
1086
|
}
|
|
1088
1087
|
const tooltipModel = context.tooltip;
|
|
@@ -1092,81 +1091,82 @@ var MultiLineGraph = ({
|
|
|
1092
1091
|
return;
|
|
1093
1092
|
}
|
|
1094
1093
|
const dataPoints = tooltipModel.dataPoints || [];
|
|
1094
|
+
if (dataPoints.length === 0) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1095
1097
|
const label = (_a = dataPoints[0]) == null ? void 0 : _a.label;
|
|
1096
|
-
const arrowSize = 8;
|
|
1097
|
-
const position = context.chart.canvas.getBoundingClientRect();
|
|
1098
|
-
tooltipEl.style.position = "absolute";
|
|
1099
|
-
tooltipEl.style.left = "0px";
|
|
1100
|
-
tooltipEl.style.top = "0px";
|
|
1101
|
-
tooltipEl.style.opacity = "1";
|
|
1102
|
-
tooltipEl.style.pointerEvents = "none";
|
|
1103
1098
|
const dataPointsHtml = dataPoints.map(
|
|
1104
1099
|
(point, index) => `
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1100
|
+
<div style="display: flex; align-items: center; gap: 8px; margin: ${index > 0 ? "4px" : "0"} 0;">
|
|
1101
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1102
|
+
<path d="M10.0833 0.75H1.91667C1.275 0.75 0.755833 1.275 0.755833 1.91667L0.75 10.0833C0.75 10.725 1.275 11.25 1.91667 11.25H10.0833C10.725 11.25 11.25 10.725 11.25 10.0833V1.91667C11.25 1.275 10.725 0.75 10.0833 0.75ZM10.0833 10.0833H1.91667V1.91667H10.0833V10.0833ZM5.125 8.91667H6.875V6.875H8.91667V5.125H6.875V3.08333H5.125V5.125H3.08333V6.875H5.125V8.91667Z" fill="#4683B4"/>
|
|
1103
|
+
</svg>
|
|
1104
|
+
<span style="font-weight: bold; color: #757575; margin-top: 1px;">
|
|
1105
|
+
${point.dataset.label}: <span style="color:#131414; padding-top: 1px;">${point.parsed.y}</span>
|
|
1106
|
+
</span>
|
|
1107
|
+
</div>
|
|
1108
|
+
`
|
|
1114
1109
|
).join("");
|
|
1110
|
+
const arrowSize = 8;
|
|
1111
|
+
const outerArrowSize = 6;
|
|
1112
|
+
const innerArrowSize = 5;
|
|
1113
|
+
const innerHtml = `
|
|
1114
|
+
<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;">
|
|
1115
|
+
<div id="tooltip-arrow-border" style="
|
|
1116
|
+
position: absolute;
|
|
1117
|
+
top: 100%;
|
|
1118
|
+
left: 50%;
|
|
1119
|
+
transform: translateX(-50%);
|
|
1120
|
+
width: 0;
|
|
1121
|
+
height: 0;
|
|
1122
|
+
border-left: ${outerArrowSize}px solid transparent;
|
|
1123
|
+
border-right: ${outerArrowSize}px solid transparent;
|
|
1124
|
+
border-top: ${outerArrowSize}px solid rgba(16, 30, 115, 0.1);
|
|
1125
|
+
"></div>
|
|
1126
|
+
<div id="tooltip-arrow" style="
|
|
1127
|
+
position: absolute;
|
|
1128
|
+
top: 100%;
|
|
1129
|
+
left: 50%;
|
|
1130
|
+
transform: translateX(-50%) translateY(-1px);
|
|
1131
|
+
width: 0;
|
|
1132
|
+
height: 0;
|
|
1133
|
+
border-left: ${innerArrowSize}px solid transparent;
|
|
1134
|
+
border-right: ${innerArrowSize}px solid transparent;
|
|
1135
|
+
border-top: ${innerArrowSize}px solid white;
|
|
1136
|
+
"></div>
|
|
1137
|
+
<div>
|
|
1138
|
+
<p style="color:#757575; margin: 0 0 8px 0;"><strong>${label}</strong></p>
|
|
1139
|
+
${dataPointsHtml}
|
|
1140
|
+
</div>
|
|
1141
|
+
</div>
|
|
1142
|
+
`;
|
|
1143
|
+
tooltipEl.innerHTML = innerHtml;
|
|
1115
1144
|
const tooltipWidth = tooltipEl.offsetWidth;
|
|
1116
1145
|
const tooltipHeight = tooltipEl.offsetHeight;
|
|
1146
|
+
const position = context.chart.canvas.getBoundingClientRect();
|
|
1117
1147
|
const pointX = position.left + window.pageXOffset + tooltipModel.caretX;
|
|
1118
1148
|
const pointY = position.top + window.pageYOffset + tooltipModel.caretY;
|
|
1119
|
-
|
|
1120
|
-
const tooltipLeftEdge = pointX - tooltipWidth / 2;
|
|
1121
|
-
const tooltipRightEdge = pointX + tooltipWidth / 2;
|
|
1122
|
-
let arrowLeftPercent = 50;
|
|
1123
|
-
let xAdjustment = 0;
|
|
1124
|
-
if (tooltipLeftEdge < 10) {
|
|
1125
|
-
xAdjustment = 10 - tooltipLeftEdge;
|
|
1126
|
-
} else if (tooltipRightEdge > windowWidth - 10) {
|
|
1127
|
-
xAdjustment = windowWidth - 10 - tooltipRightEdge;
|
|
1128
|
-
}
|
|
1129
|
-
const xPosition = tooltipLeftEdge + xAdjustment;
|
|
1149
|
+
let xPosition = pointX - tooltipWidth / 2;
|
|
1130
1150
|
const yPosition = pointY - tooltipHeight - arrowSize - 5;
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
"></div>
|
|
1148
|
-
|
|
1149
|
-
<div style="
|
|
1150
|
-
position: absolute;
|
|
1151
|
-
top: 100%;
|
|
1152
|
-
left: ${arrowLeftPercent}%;
|
|
1153
|
-
transform: translateX(-50%) translateY(-1px);
|
|
1154
|
-
width: 0;
|
|
1155
|
-
height: 0;
|
|
1156
|
-
border-left: ${innerArrowSize}px solid transparent;
|
|
1157
|
-
border-right: ${innerArrowSize}px solid transparent;
|
|
1158
|
-
border-top: ${innerArrowSize}px solid white;
|
|
1159
|
-
"></div>
|
|
1160
|
-
|
|
1161
|
-
<div>
|
|
1162
|
-
<p style="color:#757575; margin: 0 0 8px 0;"><strong>${label}</strong></p>
|
|
1163
|
-
${dataPointsHtml}
|
|
1164
|
-
</div>
|
|
1165
|
-
</div>
|
|
1166
|
-
`;
|
|
1167
|
-
tooltipEl.innerHTML = innerHtml;
|
|
1151
|
+
if (xPosition < 10) {
|
|
1152
|
+
xPosition = 10;
|
|
1153
|
+
} else if (xPosition + tooltipWidth > window.innerWidth - 10) {
|
|
1154
|
+
xPosition = window.innerWidth - 10 - tooltipWidth;
|
|
1155
|
+
}
|
|
1156
|
+
const arrowBorder = tooltipEl.querySelector(
|
|
1157
|
+
"#tooltip-arrow-border"
|
|
1158
|
+
);
|
|
1159
|
+
const arrow = tooltipEl.querySelector("#tooltip-arrow");
|
|
1160
|
+
if (arrow && arrowBorder) {
|
|
1161
|
+
const arrowLeftOffset = pointX - xPosition;
|
|
1162
|
+
arrow.style.left = `${arrowLeftOffset}px`;
|
|
1163
|
+
arrowBorder.style.left = `${arrowLeftOffset}px`;
|
|
1164
|
+
}
|
|
1165
|
+
tooltipEl.style.opacity = "1";
|
|
1166
|
+
tooltipEl.style.position = "absolute";
|
|
1168
1167
|
tooltipEl.style.left = xPosition + "px";
|
|
1169
1168
|
tooltipEl.style.top = yPosition + "px";
|
|
1169
|
+
tooltipEl.style.pointerEvents = "none";
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
1172
|
},
|
|
@@ -3383,7 +3383,7 @@ function SingleSelectDropdown({
|
|
|
3383
3383
|
"div",
|
|
3384
3384
|
{
|
|
3385
3385
|
className: (0, import_tailwind_merge17.twMerge)(
|
|
3386
|
-
`h-[40px] px-2 py-2 my-1 text-sm cursor-pointer select-none ${opt.id === value && hoveredId == null ? "text-[#
|
|
3386
|
+
`h-[40px] px-2 py-2 my-1 text-sm cursor-pointer select-none ${opt.id === value && hoveredId == null ? "bg-[#ECF3F7] text-[#131414] font-semibold" : opt.id === value && hoveredId != null ? "text-[#131414] font-semibold" : "text-[#131414]"}`,
|
|
3387
3387
|
displayItemClass
|
|
3388
3388
|
),
|
|
3389
3389
|
onClick: () => {
|