@embeddable.com/remarkable-ui 2.0.11 → 2.0.12
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/{KpiChart.module-KRTSMOWN.module.css → KpiChart.module-6XMWVNAY.module.css} +14 -8
- package/dist/{KpiChartChange.module-M7E4IU7A.module.css → KpiChartChange.module-B5X7SPME.module.css} +2 -0
- package/dist/index.d.ts +15 -14
- package/dist/index.js +114 -109
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1451,14 +1451,13 @@ var LineChart = ({ options = {}, data, onSegmentClick, ...props }) => {
|
|
|
1451
1451
|
};
|
|
1452
1452
|
|
|
1453
1453
|
// src/components/charts/kpis/KpiChart.tsx
|
|
1454
|
-
import
|
|
1455
|
-
import styles23 from "./KpiChart.module-KRTSMOWN.module.css";
|
|
1454
|
+
import styles23 from "./KpiChart.module-6XMWVNAY.module.css";
|
|
1456
1455
|
|
|
1457
1456
|
// src/components/charts/kpis/components/KpiChartChange.tsx
|
|
1458
|
-
import styles22 from "./KpiChartChange.module-
|
|
1457
|
+
import styles22 from "./KpiChartChange.module-B5X7SPME.module.css";
|
|
1459
1458
|
import clsx16 from "clsx";
|
|
1460
1459
|
import { IconTrendingDown, IconTrendingUp } from "@tabler/icons-react";
|
|
1461
|
-
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1460
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1462
1461
|
var getChangeClass = (isPositive, invertChangeColors) => {
|
|
1463
1462
|
if (isPositive) return invertChangeColors ? styles22.negative : styles22.positive;
|
|
1464
1463
|
return invertChangeColors ? styles22.positive : styles22.negative;
|
|
@@ -1472,6 +1471,7 @@ var KpiChartChange = ({
|
|
|
1472
1471
|
valueFormatter,
|
|
1473
1472
|
percentageDecimalPlaces = 1,
|
|
1474
1473
|
equalComparisonLabel,
|
|
1474
|
+
noPreviousDataLabel,
|
|
1475
1475
|
className
|
|
1476
1476
|
}) => {
|
|
1477
1477
|
const equalComparison = comparisonValue === value;
|
|
@@ -1479,18 +1479,21 @@ var KpiChartChange = ({
|
|
|
1479
1479
|
const isPositive = difference > 0;
|
|
1480
1480
|
let differenceLabel;
|
|
1481
1481
|
if (showChangeAsPercentage) {
|
|
1482
|
-
const percentage =
|
|
1482
|
+
const percentage = difference / comparisonValue * 100;
|
|
1483
1483
|
differenceLabel = `${percentage.toFixed(percentageDecimalPlaces)}%`;
|
|
1484
1484
|
} else {
|
|
1485
1485
|
differenceLabel = valueFormatter ? valueFormatter(difference) : difference.toString();
|
|
1486
1486
|
}
|
|
1487
1487
|
const displayValue = `${isPositive ? "+" : ""}${differenceLabel}`;
|
|
1488
1488
|
const Icon = isPositive ? IconTrendingUp : IconTrendingDown;
|
|
1489
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ jsx25("div", { className: clsx16(className, styles22.kpiChartChangeContainer), children: showChangeAsPercentage && Number(comparisonValue) === 0 ? /* @__PURE__ */ jsx25("span", { className: styles22.kpiComparisonLabel, children: noPreviousDataLabel }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
1490
1490
|
!equalComparison && /* @__PURE__ */ jsxs14(
|
|
1491
1491
|
"span",
|
|
1492
1492
|
{
|
|
1493
|
-
className: clsx16(
|
|
1493
|
+
className: clsx16(
|
|
1494
|
+
styles22.kpiChangeBadge,
|
|
1495
|
+
getChangeClass(isPositive, invertChangeColors)
|
|
1496
|
+
),
|
|
1494
1497
|
children: [
|
|
1495
1498
|
/* @__PURE__ */ jsx25(Icon, {}),
|
|
1496
1499
|
/* @__PURE__ */ jsx25("span", { children: displayValue })
|
|
@@ -1498,70 +1501,72 @@ var KpiChartChange = ({
|
|
|
1498
1501
|
}
|
|
1499
1502
|
),
|
|
1500
1503
|
/* @__PURE__ */ jsx25("span", { className: styles22.kpiComparisonLabel, children: equalComparison ? equalComparisonLabel ?? comparisonLabel : comparisonLabel })
|
|
1501
|
-
] });
|
|
1504
|
+
] }) });
|
|
1502
1505
|
};
|
|
1503
1506
|
|
|
1504
1507
|
// src/components/charts/kpis/KpiChart.tsx
|
|
1505
|
-
import {
|
|
1508
|
+
import { AutoTextSize } from "auto-text-size";
|
|
1509
|
+
|
|
1510
|
+
// src/components/shared/ConditionalWrapper/ConditionalWrapper.tsx
|
|
1511
|
+
import { Fragment as Fragment5, jsx as jsx26 } from "react/jsx-runtime";
|
|
1512
|
+
var ConditionalWrapper = ({ condition, wrapper, children }) => condition ? wrapper(children) : /* @__PURE__ */ jsx26(Fragment5, { children });
|
|
1513
|
+
var ConditionalWrapper_default = ConditionalWrapper;
|
|
1514
|
+
|
|
1515
|
+
// src/components/charts/kpis/KpiChart.tsx
|
|
1516
|
+
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1506
1517
|
var KpiChart = ({
|
|
1507
1518
|
value,
|
|
1508
1519
|
valueFontSize,
|
|
1509
|
-
|
|
1520
|
+
trendFontSize,
|
|
1510
1521
|
comparisonValue,
|
|
1511
1522
|
comparisonLabel,
|
|
1512
1523
|
invertChangeColors,
|
|
1513
1524
|
showChangeAsPercentage,
|
|
1514
1525
|
percentageDecimalPlaces = 1,
|
|
1515
1526
|
equalComparisonLabel = "No change",
|
|
1527
|
+
noPreviousDataLabel = "No previous data",
|
|
1516
1528
|
valueFormatter
|
|
1517
1529
|
}) => {
|
|
1518
|
-
const containerRef = useRef6(null);
|
|
1519
|
-
const [fontSize, setFontSize] = useState3(20);
|
|
1520
|
-
useEffect5(() => {
|
|
1521
|
-
const container = containerRef.current;
|
|
1522
|
-
const updateFont = () => {
|
|
1523
|
-
const w = container.offsetWidth;
|
|
1524
|
-
const h = container.offsetHeight;
|
|
1525
|
-
const newSize = Math.min(w, h) * 0.3;
|
|
1526
|
-
setFontSize(newSize);
|
|
1527
|
-
};
|
|
1528
|
-
const observer = new ResizeObserver(updateFont);
|
|
1529
|
-
observer.observe(container);
|
|
1530
|
-
updateFont();
|
|
1531
|
-
return () => observer.disconnect();
|
|
1532
|
-
}, []);
|
|
1533
1530
|
const hasComparisonValue = comparisonValue !== void 0;
|
|
1534
1531
|
const displayValue = value === void 0 ? "" : valueFormatter ? valueFormatter(value) : value;
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1532
|
+
const autoResizeValueFontSize = !valueFontSize;
|
|
1533
|
+
return /* @__PURE__ */ jsxs15("div", { className: styles23.kpiChartContainer, children: [
|
|
1534
|
+
/* @__PURE__ */ jsx27("div", { className: styles23.kpiChartValueContainer, children: /* @__PURE__ */ jsx27(
|
|
1535
|
+
ConditionalWrapper_default,
|
|
1538
1536
|
{
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1537
|
+
condition: autoResizeValueFontSize,
|
|
1538
|
+
wrapper: (children) => /* @__PURE__ */ jsx27(AutoTextSize, { mode: "boxoneline", minFontSizePx: 1, maxFontSizePx: 999, children }),
|
|
1539
|
+
children: /* @__PURE__ */ jsx27(
|
|
1540
|
+
"h2",
|
|
1541
|
+
{
|
|
1542
|
+
title: displayValue.toString(),
|
|
1543
|
+
style: {
|
|
1544
|
+
fontSize: valueFontSize
|
|
1545
|
+
},
|
|
1546
|
+
children: displayValue
|
|
1547
|
+
}
|
|
1548
|
+
)
|
|
1544
1549
|
}
|
|
1545
|
-
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1550
|
+
) }),
|
|
1551
|
+
/* @__PURE__ */ jsx27("div", { className: styles23.kpiComparisonContainer, style: { fontSize: trendFontSize }, children: hasComparisonValue && /* @__PURE__ */ jsx27(
|
|
1547
1552
|
KpiChartChange,
|
|
1548
1553
|
{
|
|
1549
1554
|
equalComparisonLabel,
|
|
1550
|
-
changeFontSize,
|
|
1551
1555
|
comparisonLabel,
|
|
1552
1556
|
comparisonValue,
|
|
1553
1557
|
invertChangeColors,
|
|
1554
1558
|
percentageDecimalPlaces,
|
|
1555
1559
|
showChangeAsPercentage,
|
|
1556
1560
|
value,
|
|
1557
|
-
valueFormatter
|
|
1561
|
+
valueFormatter,
|
|
1562
|
+
noPreviousDataLabel
|
|
1558
1563
|
}
|
|
1559
1564
|
) })
|
|
1560
|
-
] })
|
|
1565
|
+
] });
|
|
1561
1566
|
};
|
|
1562
1567
|
|
|
1563
1568
|
// src/components/charts/pies/DonutChart/DonutChart.tsx
|
|
1564
|
-
import { useRef as
|
|
1569
|
+
import { useRef as useRef7 } from "react";
|
|
1565
1570
|
import { Pie } from "react-chartjs-2";
|
|
1566
1571
|
import { ArcElement, Chart as ChartJS3, Legend as Legend3, Tooltip as Tooltip3 } from "chart.js";
|
|
1567
1572
|
import ChartDataLabels3 from "chartjs-plugin-datalabels";
|
|
@@ -1643,10 +1648,10 @@ import { mergician as mergician7 } from "mergician";
|
|
|
1643
1648
|
import styles24 from "./charts.module-YNKCWRLU.module.css";
|
|
1644
1649
|
|
|
1645
1650
|
// src/hooks/useResizeObserver.hook.ts
|
|
1646
|
-
import { useLayoutEffect, useRef as
|
|
1651
|
+
import { useLayoutEffect, useRef as useRef6, useState as useState3 } from "react";
|
|
1647
1652
|
var useResizeObserver = (elRef, timeout = 100) => {
|
|
1648
|
-
const [size, setSize] =
|
|
1649
|
-
const timeoutRef =
|
|
1653
|
+
const [size, setSize] = useState3({ width: 0, height: 0 });
|
|
1654
|
+
const timeoutRef = useRef6(void 0);
|
|
1650
1655
|
useLayoutEffect(() => {
|
|
1651
1656
|
const el = elRef.current;
|
|
1652
1657
|
if (!el) return;
|
|
@@ -1677,7 +1682,7 @@ var useResizeObserver = (elRef, timeout = 100) => {
|
|
|
1677
1682
|
};
|
|
1678
1683
|
|
|
1679
1684
|
// src/components/charts/pies/DonutChart/DonutChart.tsx
|
|
1680
|
-
import { jsx as
|
|
1685
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1681
1686
|
var MIN_WIDTH_HEIGHT_TO_SHOW_CHART = 10;
|
|
1682
1687
|
ChartJS3.register(ArcElement, Tooltip3, Legend3, ChartDataLabels3, AnnotationPlugin2);
|
|
1683
1688
|
var DonutChart = ({
|
|
@@ -1690,8 +1695,8 @@ var DonutChart = ({
|
|
|
1690
1695
|
showTooltips = true,
|
|
1691
1696
|
showValueLabels = true
|
|
1692
1697
|
}) => {
|
|
1693
|
-
const containerRef =
|
|
1694
|
-
const chartRef =
|
|
1698
|
+
const containerRef = useRef7(null);
|
|
1699
|
+
const chartRef = useRef7(null);
|
|
1695
1700
|
const donutLabelOptions = mergician7(
|
|
1696
1701
|
getDonutChartOptions({ showLegend, showTooltips, showValueLabels, label, subLabel }),
|
|
1697
1702
|
options
|
|
@@ -1702,7 +1707,7 @@ var DonutChart = ({
|
|
|
1702
1707
|
};
|
|
1703
1708
|
const { height, width } = useResizeObserver(containerRef, 0);
|
|
1704
1709
|
const hideChart = height < MIN_WIDTH_HEIGHT_TO_SHOW_CHART || width < MIN_WIDTH_HEIGHT_TO_SHOW_CHART;
|
|
1705
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ jsx28("div", { className: styles24.chartContainer, ref: containerRef, children: hideChart ? null : /* @__PURE__ */ jsx28(
|
|
1706
1711
|
Pie,
|
|
1707
1712
|
{
|
|
1708
1713
|
ref: chartRef,
|
|
@@ -1714,14 +1719,14 @@ var DonutChart = ({
|
|
|
1714
1719
|
};
|
|
1715
1720
|
|
|
1716
1721
|
// src/components/charts/pies/PieChart/PieChart.tsx
|
|
1717
|
-
import { useRef as
|
|
1722
|
+
import { useRef as useRef8 } from "react";
|
|
1718
1723
|
import { Pie as Pie2 } from "react-chartjs-2";
|
|
1719
1724
|
import { ArcElement as ArcElement2, Chart as ChartJS4, Legend as Legend4, Tooltip as Tooltip4 } from "chart.js";
|
|
1720
1725
|
import ChartDataLabels4 from "chartjs-plugin-datalabels";
|
|
1721
1726
|
import { mergician as mergician8 } from "mergician";
|
|
1722
1727
|
import styles25 from "./charts.module-YNKCWRLU.module.css";
|
|
1723
1728
|
import AnnotationPlugin3 from "chartjs-plugin-annotation";
|
|
1724
|
-
import { jsx as
|
|
1729
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1725
1730
|
ChartJS4.register(ArcElement2, Tooltip4, Legend4, ChartDataLabels4, AnnotationPlugin3);
|
|
1726
1731
|
var PieChart = ({
|
|
1727
1732
|
data,
|
|
@@ -1731,7 +1736,7 @@ var PieChart = ({
|
|
|
1731
1736
|
showTooltips = true,
|
|
1732
1737
|
showValueLabels = true
|
|
1733
1738
|
}) => {
|
|
1734
|
-
const chartRef =
|
|
1739
|
+
const chartRef = useRef8(null);
|
|
1735
1740
|
const pieOptions = mergician8(
|
|
1736
1741
|
getPieChartOptions({
|
|
1737
1742
|
showLegend,
|
|
@@ -1744,7 +1749,7 @@ var PieChart = ({
|
|
|
1744
1749
|
const indexClicked = getSegmentIndexClicked(event, chartRef);
|
|
1745
1750
|
onSegmentClick?.(indexClicked);
|
|
1746
1751
|
};
|
|
1747
|
-
return /* @__PURE__ */
|
|
1752
|
+
return /* @__PURE__ */ jsx29("div", { className: styles25.chartContainer, children: /* @__PURE__ */ jsx29(
|
|
1748
1753
|
Pie2,
|
|
1749
1754
|
{
|
|
1750
1755
|
ref: chartRef,
|
|
@@ -1768,8 +1773,8 @@ import {
|
|
|
1768
1773
|
IconChevronsRight
|
|
1769
1774
|
} from "@tabler/icons-react";
|
|
1770
1775
|
import styles26 from "./TablePagination.module-VGIQ7VN7.module.css";
|
|
1771
|
-
import { useEffect as
|
|
1772
|
-
import { jsx as
|
|
1776
|
+
import { useEffect as useEffect5 } from "react";
|
|
1777
|
+
import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1773
1778
|
var getTableTotalPages = (total, pageSize) => {
|
|
1774
1779
|
return total ? Math.ceil(total / pageSize) : void 0;
|
|
1775
1780
|
};
|
|
@@ -1783,14 +1788,14 @@ var TablePagination = ({
|
|
|
1783
1788
|
const totalPages = getTableTotalPages(total, pageSize);
|
|
1784
1789
|
const disabledPrev = page <= 0;
|
|
1785
1790
|
const disabledNext = !totalPages || page >= totalPages - 1;
|
|
1786
|
-
|
|
1791
|
+
useEffect5(() => {
|
|
1787
1792
|
if (totalPages && page >= totalPages) {
|
|
1788
1793
|
onPageChange(0);
|
|
1789
1794
|
}
|
|
1790
1795
|
}, [totalPages, page]);
|
|
1791
|
-
return /* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ jsx30("div", { className: styles26.tablePagination, "aria-label": "Table pagination controls", children: /* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentral, children: [
|
|
1792
1797
|
/* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentralButtons, children: [
|
|
1793
|
-
/* @__PURE__ */
|
|
1798
|
+
/* @__PURE__ */ jsx30(
|
|
1794
1799
|
ActionIcon,
|
|
1795
1800
|
{
|
|
1796
1801
|
icon: IconChevronsLeft,
|
|
@@ -1801,7 +1806,7 @@ var TablePagination = ({
|
|
|
1801
1806
|
"aria-label": "First page"
|
|
1802
1807
|
}
|
|
1803
1808
|
),
|
|
1804
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ jsx30(
|
|
1805
1810
|
ActionIcon,
|
|
1806
1811
|
{
|
|
1807
1812
|
icon: IconChevronLeft,
|
|
@@ -1813,9 +1818,9 @@ var TablePagination = ({
|
|
|
1813
1818
|
}
|
|
1814
1819
|
)
|
|
1815
1820
|
] }),
|
|
1816
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsx30("span", { children: paginationLabel ?? `Page ${page + 1} of ${totalPages ?? "?"}` }),
|
|
1817
1822
|
/* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentralButtons, children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ jsx30(
|
|
1819
1824
|
ActionIcon,
|
|
1820
1825
|
{
|
|
1821
1826
|
icon: IconChevronRight,
|
|
@@ -1826,7 +1831,7 @@ var TablePagination = ({
|
|
|
1826
1831
|
"aria-label": "Next page"
|
|
1827
1832
|
}
|
|
1828
1833
|
),
|
|
1829
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ jsx30(
|
|
1830
1835
|
ActionIcon,
|
|
1831
1836
|
{
|
|
1832
1837
|
icon: IconChevronsRight,
|
|
@@ -1857,7 +1862,7 @@ var TableHeaderAlign = {
|
|
|
1857
1862
|
// src/components/charts/tables/Table/components/TableHeader/TableHeader.tsx
|
|
1858
1863
|
import tableStyles from "./tables.module-GNDYDW3Z.module.css";
|
|
1859
1864
|
import clsx17 from "clsx";
|
|
1860
|
-
import { jsx as
|
|
1865
|
+
import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1861
1866
|
var getHeaderAriaSort = (sort, header) => {
|
|
1862
1867
|
return sort?.id === header.id ? sort.direction === "asc" ? "ascending" : "descending" : "none";
|
|
1863
1868
|
};
|
|
@@ -1871,15 +1876,15 @@ var TableHeader = ({
|
|
|
1871
1876
|
onSortChange
|
|
1872
1877
|
}) => {
|
|
1873
1878
|
const getSortIcon = (header) => {
|
|
1874
|
-
if (!sort) return /* @__PURE__ */
|
|
1879
|
+
if (!sort) return /* @__PURE__ */ jsx31(IconCaretUpDownFilled, {});
|
|
1875
1880
|
if (sort.id === header.id) {
|
|
1876
1881
|
if (sort.direction === TableSortDirection.ASC) {
|
|
1877
|
-
return /* @__PURE__ */
|
|
1882
|
+
return /* @__PURE__ */ jsx31(IconCaretUpFilled, {});
|
|
1878
1883
|
} else if (sort.direction === TableSortDirection.DESC) {
|
|
1879
|
-
return /* @__PURE__ */
|
|
1884
|
+
return /* @__PURE__ */ jsx31(IconCaretDownFilled2, {});
|
|
1880
1885
|
}
|
|
1881
1886
|
}
|
|
1882
|
-
return /* @__PURE__ */
|
|
1887
|
+
return /* @__PURE__ */ jsx31(IconCaretUpDownFilled, {});
|
|
1883
1888
|
};
|
|
1884
1889
|
const handleSort = (id) => {
|
|
1885
1890
|
if (!onSortChange) return;
|
|
@@ -1897,9 +1902,9 @@ var TableHeader = ({
|
|
|
1897
1902
|
}
|
|
1898
1903
|
}
|
|
1899
1904
|
};
|
|
1900
|
-
return /* @__PURE__ */
|
|
1901
|
-
showIndex && /* @__PURE__ */
|
|
1902
|
-
headers.map((header) => /* @__PURE__ */
|
|
1905
|
+
return /* @__PURE__ */ jsx31("thead", { className: styles27.tableHeader, children: /* @__PURE__ */ jsxs17("tr", { children: [
|
|
1906
|
+
showIndex && /* @__PURE__ */ jsx31("th", { className: clsx17(tableStyles.mutedCell, tableStyles.stickyFirstColumn), children: "#" }),
|
|
1907
|
+
headers.map((header) => /* @__PURE__ */ jsx31(
|
|
1903
1908
|
"th",
|
|
1904
1909
|
{
|
|
1905
1910
|
className: styles27.tableHeaderCell,
|
|
@@ -1927,9 +1932,9 @@ var TableHeader = ({
|
|
|
1927
1932
|
import styles28 from "./TableBody.module-ARNVVKDL.module.css";
|
|
1928
1933
|
import clsx18 from "clsx";
|
|
1929
1934
|
import { IconCopy, IconCopyCheckFilled } from "@tabler/icons-react";
|
|
1930
|
-
import { useState as
|
|
1935
|
+
import { useState as useState4 } from "react";
|
|
1931
1936
|
import tableStyles2 from "./tables.module-GNDYDW3Z.module.css";
|
|
1932
|
-
import { jsx as
|
|
1937
|
+
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1933
1938
|
var TableBody = ({
|
|
1934
1939
|
headers,
|
|
1935
1940
|
rows,
|
|
@@ -1938,14 +1943,14 @@ var TableBody = ({
|
|
|
1938
1943
|
showIndex,
|
|
1939
1944
|
onRowIndexClick
|
|
1940
1945
|
}) => {
|
|
1941
|
-
return /* @__PURE__ */
|
|
1946
|
+
return /* @__PURE__ */ jsx32("tbody", { className: styles28.tableBody, children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxs18(
|
|
1942
1947
|
"tr",
|
|
1943
1948
|
{
|
|
1944
1949
|
onClick: () => onRowIndexClick?.(rowIndex),
|
|
1945
1950
|
className: clsx18(rowIndex === rows.length - 1 && tableStyles2.tableLastRow),
|
|
1946
1951
|
children: [
|
|
1947
|
-
showIndex && /* @__PURE__ */
|
|
1948
|
-
headers.map((header, cellIndex) => /* @__PURE__ */
|
|
1952
|
+
showIndex && /* @__PURE__ */ jsx32("td", { className: clsx18(tableStyles2.mutedCell, tableStyles2.stickyFirstColumn), children: pageSize * page + rowIndex + 1 }),
|
|
1953
|
+
headers.map((header, cellIndex) => /* @__PURE__ */ jsx32(
|
|
1949
1954
|
TableBodyCell,
|
|
1950
1955
|
{
|
|
1951
1956
|
header,
|
|
@@ -1961,7 +1966,7 @@ var TableBody = ({
|
|
|
1961
1966
|
)) });
|
|
1962
1967
|
};
|
|
1963
1968
|
var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
1964
|
-
const [isPressedCopy, setIsPressedCopy] =
|
|
1969
|
+
const [isPressedCopy, setIsPressedCopy] = useState4(false);
|
|
1965
1970
|
const value = header.accessor !== void 0 ? header.accessor(row) : header.id !== void 0 ? (
|
|
1966
1971
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1967
1972
|
row[header.id]
|
|
@@ -1982,7 +1987,7 @@ var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
|
1982
1987
|
style: { textAlign: header.align },
|
|
1983
1988
|
onMouseLeave: () => setIsPressedCopy(false),
|
|
1984
1989
|
children: [
|
|
1985
|
-
/* @__PURE__ */
|
|
1990
|
+
/* @__PURE__ */ jsx32(
|
|
1986
1991
|
ActionIcon,
|
|
1987
1992
|
{
|
|
1988
1993
|
title: `Copy: ${String(value)}`,
|
|
@@ -2003,7 +2008,7 @@ var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
|
2003
2008
|
};
|
|
2004
2009
|
|
|
2005
2010
|
// src/components/charts/tables/Table/TablePaginated.tsx
|
|
2006
|
-
import { jsx as
|
|
2011
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2007
2012
|
var TablePaginated = React2.forwardRef(
|
|
2008
2013
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2009
2014
|
(props, ref) => {
|
|
@@ -2022,8 +2027,8 @@ var TablePaginated = React2.forwardRef(
|
|
|
2022
2027
|
onSortChange
|
|
2023
2028
|
} = props;
|
|
2024
2029
|
return /* @__PURE__ */ jsxs19("div", { ref, className: clsx19(styles29.tableContainer, className), children: [
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2030
|
+
/* @__PURE__ */ jsx33("div", { className: styles29.tableContainerScroll, children: /* @__PURE__ */ jsxs19("table", { className: styles29.table, children: [
|
|
2031
|
+
/* @__PURE__ */ jsx33(
|
|
2027
2032
|
TableHeader,
|
|
2028
2033
|
{
|
|
2029
2034
|
showIndex,
|
|
@@ -2032,7 +2037,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2032
2037
|
onSortChange
|
|
2033
2038
|
}
|
|
2034
2039
|
),
|
|
2035
|
-
/* @__PURE__ */
|
|
2040
|
+
/* @__PURE__ */ jsx33(
|
|
2036
2041
|
TableBody,
|
|
2037
2042
|
{
|
|
2038
2043
|
onRowIndexClick,
|
|
@@ -2044,7 +2049,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2044
2049
|
}
|
|
2045
2050
|
)
|
|
2046
2051
|
] }) }),
|
|
2047
|
-
/* @__PURE__ */
|
|
2052
|
+
/* @__PURE__ */ jsx33(
|
|
2048
2053
|
TablePagination,
|
|
2049
2054
|
{
|
|
2050
2055
|
page,
|
|
@@ -2060,7 +2065,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2060
2065
|
TablePaginated.displayName = "TablePaginated";
|
|
2061
2066
|
|
|
2062
2067
|
// src/components/charts/tables/PivotTable/PivotTable.tsx
|
|
2063
|
-
import { useEffect as
|
|
2068
|
+
import { useEffect as useEffect6, useMemo as useMemo3, useState as useState5 } from "react";
|
|
2064
2069
|
import tableStyles3 from "./tables.module-GNDYDW3Z.module.css";
|
|
2065
2070
|
import clsx20 from "clsx";
|
|
2066
2071
|
|
|
@@ -2074,7 +2079,7 @@ var getTableCellWidthStyle = (width) => {
|
|
|
2074
2079
|
};
|
|
2075
2080
|
|
|
2076
2081
|
// src/components/charts/tables/PivotTable/PivotTable.tsx
|
|
2077
|
-
import { jsx as
|
|
2082
|
+
import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2078
2083
|
var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
|
|
2079
2084
|
var getPercentageDisplay = (percentage, percentageDecimalPlaces) => {
|
|
2080
2085
|
return `${percentage.toFixed(percentageDecimalPlaces)}%`;
|
|
@@ -2166,10 +2171,10 @@ var PivotTable = ({
|
|
|
2166
2171
|
}
|
|
2167
2172
|
return { colTotals: cTotals, rowTotals: rTotals, grandTotals: gTotals };
|
|
2168
2173
|
}, [data, measures, rowDimension.key, columnDimension.key, columnValues, rowValues]);
|
|
2169
|
-
const [visibleCount, setVisibleCount] =
|
|
2174
|
+
const [visibleCount, setVisibleCount] = useState5(
|
|
2170
2175
|
() => progressive ? Math.min(batchSize, rowValues.length) : rowValues.length
|
|
2171
2176
|
);
|
|
2172
|
-
|
|
2177
|
+
useEffect6(() => {
|
|
2173
2178
|
if (!progressive) {
|
|
2174
2179
|
setVisibleCount(rowValues.length);
|
|
2175
2180
|
return;
|
|
@@ -2193,7 +2198,7 @@ var PivotTable = ({
|
|
|
2193
2198
|
};
|
|
2194
2199
|
}, [progressive, batchSize, batchDelayMs, rowValues.length, data]);
|
|
2195
2200
|
const visibleRows = progressive ? rowValues.slice(0, visibleCount) : rowValues;
|
|
2196
|
-
return /* @__PURE__ */
|
|
2201
|
+
return /* @__PURE__ */ jsx34("div", { className: clsx20(tableStyles3.tableFullContainer, className), children: /* @__PURE__ */ jsx34(
|
|
2197
2202
|
"div",
|
|
2198
2203
|
{
|
|
2199
2204
|
className: clsx20(
|
|
@@ -2208,7 +2213,7 @@ var PivotTable = ({
|
|
|
2208
2213
|
children: [
|
|
2209
2214
|
/* @__PURE__ */ jsxs20("thead", { children: [
|
|
2210
2215
|
/* @__PURE__ */ jsxs20("tr", { children: [
|
|
2211
|
-
/* @__PURE__ */
|
|
2216
|
+
/* @__PURE__ */ jsx34(
|
|
2212
2217
|
"th",
|
|
2213
2218
|
{
|
|
2214
2219
|
scope: "col",
|
|
@@ -2220,7 +2225,7 @@ var PivotTable = ({
|
|
|
2220
2225
|
),
|
|
2221
2226
|
columnValues.map((columnValue) => {
|
|
2222
2227
|
const columnValueDisplay = columnDimension.formatValue ? columnDimension.formatValue(columnValue) : columnValue;
|
|
2223
|
-
return /* @__PURE__ */
|
|
2228
|
+
return /* @__PURE__ */ jsx34(
|
|
2224
2229
|
"th",
|
|
2225
2230
|
{
|
|
2226
2231
|
scope: "colgroup",
|
|
@@ -2231,7 +2236,7 @@ var PivotTable = ({
|
|
|
2231
2236
|
`col-${columnValue}`
|
|
2232
2237
|
);
|
|
2233
2238
|
}),
|
|
2234
|
-
hasRowTotals && /* @__PURE__ */
|
|
2239
|
+
hasRowTotals && /* @__PURE__ */ jsx34(
|
|
2235
2240
|
"th",
|
|
2236
2241
|
{
|
|
2237
2242
|
scope: "colgroup",
|
|
@@ -2244,7 +2249,7 @@ var PivotTable = ({
|
|
|
2244
2249
|
)
|
|
2245
2250
|
] }),
|
|
2246
2251
|
/* @__PURE__ */ jsxs20("tr", { children: [
|
|
2247
|
-
/* @__PURE__ */
|
|
2252
|
+
/* @__PURE__ */ jsx34(
|
|
2248
2253
|
"th",
|
|
2249
2254
|
{
|
|
2250
2255
|
scope: "col",
|
|
@@ -2256,7 +2261,7 @@ var PivotTable = ({
|
|
|
2256
2261
|
}
|
|
2257
2262
|
),
|
|
2258
2263
|
columnValues.flatMap(
|
|
2259
|
-
(col) => measures.map((measure, idx) => /* @__PURE__ */
|
|
2264
|
+
(col) => measures.map((measure, idx) => /* @__PURE__ */ jsx34(
|
|
2260
2265
|
"th",
|
|
2261
2266
|
{
|
|
2262
2267
|
scope: "col",
|
|
@@ -2267,7 +2272,7 @@ var PivotTable = ({
|
|
|
2267
2272
|
`sub-${String(col)}-${measure.key}-${idx}`
|
|
2268
2273
|
))
|
|
2269
2274
|
),
|
|
2270
|
-
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => /* @__PURE__ */
|
|
2275
|
+
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => /* @__PURE__ */ jsx34(
|
|
2271
2276
|
"th",
|
|
2272
2277
|
{
|
|
2273
2278
|
scope: "col",
|
|
@@ -2284,7 +2289,7 @@ var PivotTable = ({
|
|
|
2284
2289
|
visibleRows.map((row) => {
|
|
2285
2290
|
const rowDimensionValue = rowDimension.formatValue ? rowDimension.formatValue(row) : row;
|
|
2286
2291
|
return /* @__PURE__ */ jsxs20("tr", { children: [
|
|
2287
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx34(
|
|
2288
2293
|
"th",
|
|
2289
2294
|
{
|
|
2290
2295
|
scope: "row",
|
|
@@ -2312,7 +2317,7 @@ var PivotTable = ({
|
|
|
2312
2317
|
return measure.accessor ? measure.accessor(object) : value;
|
|
2313
2318
|
};
|
|
2314
2319
|
const columnValueDisplay = getDisplayValue();
|
|
2315
|
-
return /* @__PURE__ */
|
|
2320
|
+
return /* @__PURE__ */ jsx34("td", { title: columnValueDisplay, children: columnValueDisplay }, key);
|
|
2316
2321
|
})
|
|
2317
2322
|
),
|
|
2318
2323
|
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
|
|
@@ -2329,12 +2334,12 @@ var PivotTable = ({
|
|
|
2329
2334
|
} else if (measure.accessor) {
|
|
2330
2335
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2331
2336
|
}
|
|
2332
|
-
return /* @__PURE__ */
|
|
2337
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: displayValue, children: displayValue }, key);
|
|
2333
2338
|
})
|
|
2334
2339
|
] }, `row-${row}`);
|
|
2335
2340
|
}),
|
|
2336
2341
|
hasColumnTotals && /* @__PURE__ */ jsxs20("tr", { className: tableStyles3.stickyLastRow, children: [
|
|
2337
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ jsx34(
|
|
2338
2343
|
"th",
|
|
2339
2344
|
{
|
|
2340
2345
|
scope: "row",
|
|
@@ -2360,7 +2365,7 @@ var PivotTable = ({
|
|
|
2360
2365
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2361
2366
|
}
|
|
2362
2367
|
const columnValueDisplay = show ? displayValue : "";
|
|
2363
|
-
return /* @__PURE__ */
|
|
2368
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: columnValueDisplay, children: columnValueDisplay }, key);
|
|
2364
2369
|
})
|
|
2365
2370
|
),
|
|
2366
2371
|
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
|
|
@@ -2376,7 +2381,7 @@ var PivotTable = ({
|
|
|
2376
2381
|
} else if (measure.accessor) {
|
|
2377
2382
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2378
2383
|
}
|
|
2379
|
-
return /* @__PURE__ */
|
|
2384
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: displayValue, children: displayValue }, key);
|
|
2380
2385
|
})
|
|
2381
2386
|
] }, "totals-row")
|
|
2382
2387
|
] })
|
|
@@ -2537,7 +2542,7 @@ var createColorForValue = ({
|
|
|
2537
2542
|
};
|
|
2538
2543
|
|
|
2539
2544
|
// src/components/charts/tables/HeatMap/HeatMap.tsx
|
|
2540
|
-
import { jsx as
|
|
2545
|
+
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2541
2546
|
var HeatMap = ({
|
|
2542
2547
|
data,
|
|
2543
2548
|
showValues = false,
|
|
@@ -2612,7 +2617,7 @@ var HeatMap = ({
|
|
|
2612
2617
|
},
|
|
2613
2618
|
[domainMin, domainMax, rawMin, rawMax, minColor, midColor, maxColor]
|
|
2614
2619
|
);
|
|
2615
|
-
return /* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ jsx35("div", { className: clsx21(tableStyles4.tableFullContainer, className), children: /* @__PURE__ */ jsx35(
|
|
2616
2621
|
"div",
|
|
2617
2622
|
{
|
|
2618
2623
|
className: clsx21(
|
|
@@ -2620,8 +2625,8 @@ var HeatMap = ({
|
|
|
2620
2625
|
(!columnWidth || !firstColumnWidth) && tableStyles4.fullWidth
|
|
2621
2626
|
),
|
|
2622
2627
|
children: /* @__PURE__ */ jsxs21("table", { className: tableStyles4.table, "aria-label": "Heat map", children: [
|
|
2623
|
-
/* @__PURE__ */
|
|
2624
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsx35("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
|
|
2629
|
+
/* @__PURE__ */ jsx35(
|
|
2625
2630
|
"th",
|
|
2626
2631
|
{
|
|
2627
2632
|
className: tableStyles4.stickyFirstColumn,
|
|
@@ -2629,10 +2634,10 @@ var HeatMap = ({
|
|
|
2629
2634
|
children: measure.label
|
|
2630
2635
|
}
|
|
2631
2636
|
),
|
|
2632
|
-
columnValues.map((cv, index) => /* @__PURE__ */
|
|
2637
|
+
columnValues.map((cv, index) => /* @__PURE__ */ jsx35("th", { style: getTableCellWidthStyle(columnWidth), children: columnDimension.format ? columnDimension.format(cv) : cv }, `col-${cv}-${index}`))
|
|
2633
2638
|
] }) }),
|
|
2634
|
-
/* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx35("tbody", { children: rowValues.map((rv) => /* @__PURE__ */ jsxs21("tr", { children: [
|
|
2640
|
+
/* @__PURE__ */ jsx35(
|
|
2636
2641
|
"th",
|
|
2637
2642
|
{
|
|
2638
2643
|
scope: "row",
|
|
@@ -2646,7 +2651,7 @@ var HeatMap = ({
|
|
|
2646
2651
|
const value = getCellValue(obj?.[measure.key], displayNullAs);
|
|
2647
2652
|
const background = getCellBackground(value, colorForValue);
|
|
2648
2653
|
const color = getCellColor(background);
|
|
2649
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsx35(
|
|
2650
2655
|
"td",
|
|
2651
2656
|
{
|
|
2652
2657
|
style: {
|
|
@@ -2682,11 +2687,11 @@ var useTableGetRowsPerPage = ({
|
|
|
2682
2687
|
}, [availableHeight, headerHeight, rowHeight, footerHeight]);
|
|
2683
2688
|
|
|
2684
2689
|
// src/hooks/useDebounce.hook.ts
|
|
2685
|
-
import { useRef as
|
|
2690
|
+
import { useRef as useRef9, useEffect as useEffect7, useCallback as useCallback2 } from "react";
|
|
2686
2691
|
function useDebounce(fn, delay = 300) {
|
|
2687
|
-
const timerRef =
|
|
2688
|
-
const fnRef =
|
|
2689
|
-
|
|
2692
|
+
const timerRef = useRef9(null);
|
|
2693
|
+
const fnRef = useRef9(fn);
|
|
2694
|
+
useEffect7(() => {
|
|
2690
2695
|
fnRef.current = fn;
|
|
2691
2696
|
}, [fn]);
|
|
2692
2697
|
const debouncedFn = useCallback2(
|
|
@@ -2700,7 +2705,7 @@ function useDebounce(fn, delay = 300) {
|
|
|
2700
2705
|
},
|
|
2701
2706
|
[delay]
|
|
2702
2707
|
);
|
|
2703
|
-
|
|
2708
|
+
useEffect7(() => {
|
|
2704
2709
|
return () => {
|
|
2705
2710
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2706
2711
|
};
|