cr-ui-lib 1.1.93 → 1.1.94
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -121,8 +121,9 @@ interface MultiBarGraphProps {
|
|
|
121
121
|
/** The maximum value for the Y-axis. Defaults to undefined, allowing Chart.js to auto-calculate. */
|
|
122
122
|
yAxisMax?: number;
|
|
123
123
|
tab?: "Month" | "Week" | "Day" | "Hourly" | null;
|
|
124
|
+
percentage?: boolean;
|
|
124
125
|
}
|
|
125
|
-
declare const MultiBarGraph: ({ datasets, xAxisLabels, className, tooltipPosition, yAxisMax, tab, }: MultiBarGraphProps) => JSX.Element;
|
|
126
|
+
declare const MultiBarGraph: ({ datasets, xAxisLabels, className, tooltipPosition, yAxisMax, tab, percentage }: MultiBarGraphProps) => JSX.Element;
|
|
126
127
|
|
|
127
128
|
interface CommonInputProps extends React$1.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {
|
|
128
129
|
label?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -121,8 +121,9 @@ interface MultiBarGraphProps {
|
|
|
121
121
|
/** The maximum value for the Y-axis. Defaults to undefined, allowing Chart.js to auto-calculate. */
|
|
122
122
|
yAxisMax?: number;
|
|
123
123
|
tab?: "Month" | "Week" | "Day" | "Hourly" | null;
|
|
124
|
+
percentage?: boolean;
|
|
124
125
|
}
|
|
125
|
-
declare const MultiBarGraph: ({ datasets, xAxisLabels, className, tooltipPosition, yAxisMax, tab, }: MultiBarGraphProps) => JSX.Element;
|
|
126
|
+
declare const MultiBarGraph: ({ datasets, xAxisLabels, className, tooltipPosition, yAxisMax, tab, percentage }: MultiBarGraphProps) => JSX.Element;
|
|
126
127
|
|
|
127
128
|
interface CommonInputProps extends React$1.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement> {
|
|
128
129
|
label?: string;
|
package/dist/index.js
CHANGED
|
@@ -1554,7 +1554,8 @@ var MultiBarGraph = ({
|
|
|
1554
1554
|
tooltipPosition = "top",
|
|
1555
1555
|
yAxisMax,
|
|
1556
1556
|
// CHANGED: Added yAxisMax prop
|
|
1557
|
-
tab = "Month"
|
|
1557
|
+
tab = "Month",
|
|
1558
|
+
percentage = false
|
|
1558
1559
|
}) => {
|
|
1559
1560
|
const chartRef = React.useRef(null);
|
|
1560
1561
|
const defaultColors = [
|
|
@@ -1592,7 +1593,15 @@ var MultiBarGraph = ({
|
|
|
1592
1593
|
max: yAxisMax,
|
|
1593
1594
|
// CHANGED: Use the dynamic yAxisMax prop
|
|
1594
1595
|
border: { display: false },
|
|
1595
|
-
grid: { drawOnChartArea: false }
|
|
1596
|
+
grid: { drawOnChartArea: false },
|
|
1597
|
+
ticks: {
|
|
1598
|
+
callback: function(value) {
|
|
1599
|
+
if (percentage) {
|
|
1600
|
+
return value + "%";
|
|
1601
|
+
}
|
|
1602
|
+
return value;
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1596
1605
|
}
|
|
1597
1606
|
},
|
|
1598
1607
|
plugins: {
|
|
@@ -1653,7 +1662,7 @@ var MultiBarGraph = ({
|
|
|
1653
1662
|
} catch {
|
|
1654
1663
|
formattedLabel = label;
|
|
1655
1664
|
}
|
|
1656
|
-
const
|
|
1665
|
+
const percentage2 = totalBarValue > 0 ? (segmentValue / totalBarValue * 100).toFixed(2) : 0;
|
|
1657
1666
|
const iconHtml = customSvgIcon || getDefaultSvgIcon();
|
|
1658
1667
|
tooltipEl.innerHTML = `
|
|
1659
1668
|
<div style="position: relative; background: white; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); padding: 10px; font-size: 12px; z-index: 999;">
|
|
@@ -1662,7 +1671,7 @@ var MultiBarGraph = ({
|
|
|
1662
1671
|
<div style="display: flex; align-items: center; gap: 8px;">
|
|
1663
1672
|
${iconHtml}
|
|
1664
1673
|
<span style="font-weight: bold; color: #757575;">
|
|
1665
|
-
${segmentLabel}: <span style="color:#131414;">${segmentValue} (${
|
|
1674
|
+
${segmentLabel}: <span style="color:#131414;">${segmentValue} (${percentage2}%)</span>
|
|
1666
1675
|
</span>
|
|
1667
1676
|
</div>
|
|
1668
1677
|
</div>`;
|