@embeddable.com/remarkable-ui 2.0.11 → 2.0.13
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-2LUIN66C.module.css} +15 -8
- package/dist/{KpiChartChange.module-M7E4IU7A.module.css → KpiChartChange.module-BAW7YCOW.module.css} +18 -3
- package/dist/{chunk-TBNFMVQR.js → chunk-7RY47BRM.js} +12 -12
- package/dist/chunk-7RY47BRM.js.map +1 -0
- package/dist/index.d.ts +15 -14
- package/dist/index.js +141 -121
- package/dist/index.js.map +1 -1
- package/dist/styles.js +1 -1
- package/package.json +4 -2
- package/dist/chunk-TBNFMVQR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-7RY47BRM.js";
|
|
2
2
|
|
|
3
3
|
// src/components/shared/Skeleton/Skeleton.tsx
|
|
4
4
|
import styles from "./Skeleton.module-ZN5S5VRF.module.css";
|
|
@@ -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-2LUIN66C.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-BAW7YCOW.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,96 +1471,117 @@ var KpiChartChange = ({
|
|
|
1472
1471
|
valueFormatter,
|
|
1473
1472
|
percentageDecimalPlaces = 1,
|
|
1474
1473
|
equalComparisonLabel,
|
|
1475
|
-
|
|
1474
|
+
noPreviousDataLabel
|
|
1476
1475
|
}) => {
|
|
1477
1476
|
const equalComparison = comparisonValue === value;
|
|
1478
1477
|
const difference = value - comparisonValue;
|
|
1479
1478
|
const isPositive = difference > 0;
|
|
1480
1479
|
let differenceLabel;
|
|
1481
1480
|
if (showChangeAsPercentage) {
|
|
1482
|
-
const percentage =
|
|
1481
|
+
const percentage = difference / comparisonValue * 100;
|
|
1483
1482
|
differenceLabel = `${percentage.toFixed(percentageDecimalPlaces)}%`;
|
|
1484
1483
|
} else {
|
|
1485
1484
|
differenceLabel = valueFormatter ? valueFormatter(difference) : difference.toString();
|
|
1486
1485
|
}
|
|
1487
1486
|
const displayValue = `${isPositive ? "+" : ""}${differenceLabel}`;
|
|
1488
1487
|
const Icon = isPositive ? IconTrendingUp : IconTrendingDown;
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1488
|
+
const showNoPreviousData = showChangeAsPercentage && Number(comparisonValue) === 0;
|
|
1489
|
+
return /* @__PURE__ */ jsxs14("div", { className: styles22.kpiChangeContainerSizeGuide, children: [
|
|
1490
|
+
/* @__PURE__ */ jsxs14("div", { className: clsx16(styles22.kpiChartChangeContainer, styles22.hidden), children: [
|
|
1491
|
+
/* @__PURE__ */ jsxs14(
|
|
1492
|
+
"span",
|
|
1493
|
+
{
|
|
1494
|
+
className: clsx16(styles22.kpiChangeBadge, getChangeClass(isPositive, invertChangeColors)),
|
|
1495
|
+
children: [
|
|
1496
|
+
/* @__PURE__ */ jsx25(Icon, {}),
|
|
1497
|
+
/* @__PURE__ */ jsx25("span", { children: displayValue })
|
|
1498
|
+
]
|
|
1499
|
+
}
|
|
1500
|
+
),
|
|
1501
|
+
/* @__PURE__ */ jsx25("span", { className: styles22.kpiComparisonLabel, children: comparisonLabel })
|
|
1502
|
+
] }),
|
|
1503
|
+
/* @__PURE__ */ jsx25("div", { className: styles22.kpiAbsoluteContainer, children: /* @__PURE__ */ jsx25("div", { className: styles22.kpiChartChangeContainer, children: showNoPreviousData ? /* @__PURE__ */ jsx25("span", { className: styles22.kpiComparisonLabel, children: noPreviousDataLabel }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
1504
|
+
!equalComparison && /* @__PURE__ */ jsxs14(
|
|
1505
|
+
"span",
|
|
1506
|
+
{
|
|
1507
|
+
className: clsx16(
|
|
1508
|
+
styles22.kpiChangeBadge,
|
|
1509
|
+
getChangeClass(isPositive, invertChangeColors)
|
|
1510
|
+
),
|
|
1511
|
+
children: [
|
|
1512
|
+
/* @__PURE__ */ jsx25(Icon, {}),
|
|
1513
|
+
/* @__PURE__ */ jsx25("span", { children: displayValue })
|
|
1514
|
+
]
|
|
1515
|
+
}
|
|
1516
|
+
),
|
|
1517
|
+
/* @__PURE__ */ jsx25("span", { className: styles22.kpiComparisonLabel, children: equalComparison ? equalComparisonLabel ?? comparisonLabel : comparisonLabel })
|
|
1518
|
+
] }) }) })
|
|
1501
1519
|
] });
|
|
1502
1520
|
};
|
|
1503
1521
|
|
|
1504
1522
|
// src/components/charts/kpis/KpiChart.tsx
|
|
1505
|
-
import {
|
|
1523
|
+
import { AutoTextSize } from "auto-text-size";
|
|
1524
|
+
|
|
1525
|
+
// src/components/shared/ConditionalWrapper/ConditionalWrapper.tsx
|
|
1526
|
+
import { Fragment as Fragment5, jsx as jsx26 } from "react/jsx-runtime";
|
|
1527
|
+
var ConditionalWrapper = ({ condition, wrapper, children }) => condition ? wrapper(children) : /* @__PURE__ */ jsx26(Fragment5, { children });
|
|
1528
|
+
var ConditionalWrapper_default = ConditionalWrapper;
|
|
1529
|
+
|
|
1530
|
+
// src/components/charts/kpis/KpiChart.tsx
|
|
1531
|
+
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1506
1532
|
var KpiChart = ({
|
|
1507
1533
|
value,
|
|
1508
1534
|
valueFontSize,
|
|
1509
|
-
|
|
1535
|
+
trendFontSize,
|
|
1510
1536
|
comparisonValue,
|
|
1511
1537
|
comparisonLabel,
|
|
1512
1538
|
invertChangeColors,
|
|
1513
1539
|
showChangeAsPercentage,
|
|
1514
1540
|
percentageDecimalPlaces = 1,
|
|
1515
1541
|
equalComparisonLabel = "No change",
|
|
1542
|
+
noPreviousDataLabel = "No previous data",
|
|
1516
1543
|
valueFormatter
|
|
1517
1544
|
}) => {
|
|
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
1545
|
const hasComparisonValue = comparisonValue !== void 0;
|
|
1534
1546
|
const displayValue = value === void 0 ? "" : valueFormatter ? valueFormatter(value) : value;
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1547
|
+
const autoResizeValueFontSize = !valueFontSize;
|
|
1548
|
+
return /* @__PURE__ */ jsxs15("div", { className: styles23.kpiChartContainer, children: [
|
|
1549
|
+
/* @__PURE__ */ jsx27("div", { className: styles23.kpiChartValueContainer, children: /* @__PURE__ */ jsx27(
|
|
1550
|
+
ConditionalWrapper_default,
|
|
1538
1551
|
{
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1552
|
+
condition: autoResizeValueFontSize,
|
|
1553
|
+
wrapper: (children) => /* @__PURE__ */ jsx27(AutoTextSize, { mode: "boxoneline", minFontSizePx: 1, maxFontSizePx: 999, children }),
|
|
1554
|
+
children: /* @__PURE__ */ jsx27(
|
|
1555
|
+
"h2",
|
|
1556
|
+
{
|
|
1557
|
+
title: displayValue.toString(),
|
|
1558
|
+
style: {
|
|
1559
|
+
fontSize: valueFontSize
|
|
1560
|
+
},
|
|
1561
|
+
children: displayValue
|
|
1562
|
+
}
|
|
1563
|
+
)
|
|
1544
1564
|
}
|
|
1545
|
-
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1565
|
+
) }),
|
|
1566
|
+
/* @__PURE__ */ jsx27("div", { className: styles23.kpiComparisonContainer, style: { fontSize: trendFontSize }, children: /* @__PURE__ */ jsx27("div", { style: { visibility: hasComparisonValue ? "visible" : "hidden" }, children: /* @__PURE__ */ jsx27(
|
|
1547
1567
|
KpiChartChange,
|
|
1548
1568
|
{
|
|
1549
1569
|
equalComparisonLabel,
|
|
1550
|
-
changeFontSize,
|
|
1551
1570
|
comparisonLabel,
|
|
1552
1571
|
comparisonValue,
|
|
1553
1572
|
invertChangeColors,
|
|
1554
1573
|
percentageDecimalPlaces,
|
|
1555
1574
|
showChangeAsPercentage,
|
|
1556
1575
|
value,
|
|
1557
|
-
valueFormatter
|
|
1576
|
+
valueFormatter,
|
|
1577
|
+
noPreviousDataLabel
|
|
1558
1578
|
}
|
|
1559
|
-
) })
|
|
1560
|
-
] })
|
|
1579
|
+
) }) })
|
|
1580
|
+
] });
|
|
1561
1581
|
};
|
|
1562
1582
|
|
|
1563
1583
|
// src/components/charts/pies/DonutChart/DonutChart.tsx
|
|
1564
|
-
import { useRef as
|
|
1584
|
+
import { useRef as useRef7 } from "react";
|
|
1565
1585
|
import { Pie } from "react-chartjs-2";
|
|
1566
1586
|
import { ArcElement, Chart as ChartJS3, Legend as Legend3, Tooltip as Tooltip3 } from "chart.js";
|
|
1567
1587
|
import ChartDataLabels3 from "chartjs-plugin-datalabels";
|
|
@@ -1643,10 +1663,10 @@ import { mergician as mergician7 } from "mergician";
|
|
|
1643
1663
|
import styles24 from "./charts.module-YNKCWRLU.module.css";
|
|
1644
1664
|
|
|
1645
1665
|
// src/hooks/useResizeObserver.hook.ts
|
|
1646
|
-
import { useLayoutEffect, useRef as
|
|
1666
|
+
import { useLayoutEffect, useRef as useRef6, useState as useState3 } from "react";
|
|
1647
1667
|
var useResizeObserver = (elRef, timeout = 100) => {
|
|
1648
|
-
const [size, setSize] =
|
|
1649
|
-
const timeoutRef =
|
|
1668
|
+
const [size, setSize] = useState3({ width: 0, height: 0 });
|
|
1669
|
+
const timeoutRef = useRef6(void 0);
|
|
1650
1670
|
useLayoutEffect(() => {
|
|
1651
1671
|
const el = elRef.current;
|
|
1652
1672
|
if (!el) return;
|
|
@@ -1677,7 +1697,7 @@ var useResizeObserver = (elRef, timeout = 100) => {
|
|
|
1677
1697
|
};
|
|
1678
1698
|
|
|
1679
1699
|
// src/components/charts/pies/DonutChart/DonutChart.tsx
|
|
1680
|
-
import { jsx as
|
|
1700
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1681
1701
|
var MIN_WIDTH_HEIGHT_TO_SHOW_CHART = 10;
|
|
1682
1702
|
ChartJS3.register(ArcElement, Tooltip3, Legend3, ChartDataLabels3, AnnotationPlugin2);
|
|
1683
1703
|
var DonutChart = ({
|
|
@@ -1690,8 +1710,8 @@ var DonutChart = ({
|
|
|
1690
1710
|
showTooltips = true,
|
|
1691
1711
|
showValueLabels = true
|
|
1692
1712
|
}) => {
|
|
1693
|
-
const containerRef =
|
|
1694
|
-
const chartRef =
|
|
1713
|
+
const containerRef = useRef7(null);
|
|
1714
|
+
const chartRef = useRef7(null);
|
|
1695
1715
|
const donutLabelOptions = mergician7(
|
|
1696
1716
|
getDonutChartOptions({ showLegend, showTooltips, showValueLabels, label, subLabel }),
|
|
1697
1717
|
options
|
|
@@ -1702,7 +1722,7 @@ var DonutChart = ({
|
|
|
1702
1722
|
};
|
|
1703
1723
|
const { height, width } = useResizeObserver(containerRef, 0);
|
|
1704
1724
|
const hideChart = height < MIN_WIDTH_HEIGHT_TO_SHOW_CHART || width < MIN_WIDTH_HEIGHT_TO_SHOW_CHART;
|
|
1705
|
-
return /* @__PURE__ */
|
|
1725
|
+
return /* @__PURE__ */ jsx28("div", { className: styles24.chartContainer, ref: containerRef, children: hideChart ? null : /* @__PURE__ */ jsx28(
|
|
1706
1726
|
Pie,
|
|
1707
1727
|
{
|
|
1708
1728
|
ref: chartRef,
|
|
@@ -1714,14 +1734,14 @@ var DonutChart = ({
|
|
|
1714
1734
|
};
|
|
1715
1735
|
|
|
1716
1736
|
// src/components/charts/pies/PieChart/PieChart.tsx
|
|
1717
|
-
import { useRef as
|
|
1737
|
+
import { useRef as useRef8 } from "react";
|
|
1718
1738
|
import { Pie as Pie2 } from "react-chartjs-2";
|
|
1719
1739
|
import { ArcElement as ArcElement2, Chart as ChartJS4, Legend as Legend4, Tooltip as Tooltip4 } from "chart.js";
|
|
1720
1740
|
import ChartDataLabels4 from "chartjs-plugin-datalabels";
|
|
1721
1741
|
import { mergician as mergician8 } from "mergician";
|
|
1722
1742
|
import styles25 from "./charts.module-YNKCWRLU.module.css";
|
|
1723
1743
|
import AnnotationPlugin3 from "chartjs-plugin-annotation";
|
|
1724
|
-
import { jsx as
|
|
1744
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1725
1745
|
ChartJS4.register(ArcElement2, Tooltip4, Legend4, ChartDataLabels4, AnnotationPlugin3);
|
|
1726
1746
|
var PieChart = ({
|
|
1727
1747
|
data,
|
|
@@ -1731,7 +1751,7 @@ var PieChart = ({
|
|
|
1731
1751
|
showTooltips = true,
|
|
1732
1752
|
showValueLabels = true
|
|
1733
1753
|
}) => {
|
|
1734
|
-
const chartRef =
|
|
1754
|
+
const chartRef = useRef8(null);
|
|
1735
1755
|
const pieOptions = mergician8(
|
|
1736
1756
|
getPieChartOptions({
|
|
1737
1757
|
showLegend,
|
|
@@ -1744,7 +1764,7 @@ var PieChart = ({
|
|
|
1744
1764
|
const indexClicked = getSegmentIndexClicked(event, chartRef);
|
|
1745
1765
|
onSegmentClick?.(indexClicked);
|
|
1746
1766
|
};
|
|
1747
|
-
return /* @__PURE__ */
|
|
1767
|
+
return /* @__PURE__ */ jsx29("div", { className: styles25.chartContainer, children: /* @__PURE__ */ jsx29(
|
|
1748
1768
|
Pie2,
|
|
1749
1769
|
{
|
|
1750
1770
|
ref: chartRef,
|
|
@@ -1768,8 +1788,8 @@ import {
|
|
|
1768
1788
|
IconChevronsRight
|
|
1769
1789
|
} from "@tabler/icons-react";
|
|
1770
1790
|
import styles26 from "./TablePagination.module-VGIQ7VN7.module.css";
|
|
1771
|
-
import { useEffect as
|
|
1772
|
-
import { jsx as
|
|
1791
|
+
import { useEffect as useEffect5 } from "react";
|
|
1792
|
+
import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1773
1793
|
var getTableTotalPages = (total, pageSize) => {
|
|
1774
1794
|
return total ? Math.ceil(total / pageSize) : void 0;
|
|
1775
1795
|
};
|
|
@@ -1783,14 +1803,14 @@ var TablePagination = ({
|
|
|
1783
1803
|
const totalPages = getTableTotalPages(total, pageSize);
|
|
1784
1804
|
const disabledPrev = page <= 0;
|
|
1785
1805
|
const disabledNext = !totalPages || page >= totalPages - 1;
|
|
1786
|
-
|
|
1806
|
+
useEffect5(() => {
|
|
1787
1807
|
if (totalPages && page >= totalPages) {
|
|
1788
1808
|
onPageChange(0);
|
|
1789
1809
|
}
|
|
1790
1810
|
}, [totalPages, page]);
|
|
1791
|
-
return /* @__PURE__ */
|
|
1811
|
+
return /* @__PURE__ */ jsx30("div", { className: styles26.tablePagination, "aria-label": "Table pagination controls", children: /* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentral, children: [
|
|
1792
1812
|
/* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentralButtons, children: [
|
|
1793
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsx30(
|
|
1794
1814
|
ActionIcon,
|
|
1795
1815
|
{
|
|
1796
1816
|
icon: IconChevronsLeft,
|
|
@@ -1801,7 +1821,7 @@ var TablePagination = ({
|
|
|
1801
1821
|
"aria-label": "First page"
|
|
1802
1822
|
}
|
|
1803
1823
|
),
|
|
1804
|
-
/* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ jsx30(
|
|
1805
1825
|
ActionIcon,
|
|
1806
1826
|
{
|
|
1807
1827
|
icon: IconChevronLeft,
|
|
@@ -1813,9 +1833,9 @@ var TablePagination = ({
|
|
|
1813
1833
|
}
|
|
1814
1834
|
)
|
|
1815
1835
|
] }),
|
|
1816
|
-
/* @__PURE__ */
|
|
1836
|
+
/* @__PURE__ */ jsx30("span", { children: paginationLabel ?? `Page ${page + 1} of ${totalPages ?? "?"}` }),
|
|
1817
1837
|
/* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentralButtons, children: [
|
|
1818
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsx30(
|
|
1819
1839
|
ActionIcon,
|
|
1820
1840
|
{
|
|
1821
1841
|
icon: IconChevronRight,
|
|
@@ -1826,7 +1846,7 @@ var TablePagination = ({
|
|
|
1826
1846
|
"aria-label": "Next page"
|
|
1827
1847
|
}
|
|
1828
1848
|
),
|
|
1829
|
-
/* @__PURE__ */
|
|
1849
|
+
/* @__PURE__ */ jsx30(
|
|
1830
1850
|
ActionIcon,
|
|
1831
1851
|
{
|
|
1832
1852
|
icon: IconChevronsRight,
|
|
@@ -1857,7 +1877,7 @@ var TableHeaderAlign = {
|
|
|
1857
1877
|
// src/components/charts/tables/Table/components/TableHeader/TableHeader.tsx
|
|
1858
1878
|
import tableStyles from "./tables.module-GNDYDW3Z.module.css";
|
|
1859
1879
|
import clsx17 from "clsx";
|
|
1860
|
-
import { jsx as
|
|
1880
|
+
import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1861
1881
|
var getHeaderAriaSort = (sort, header) => {
|
|
1862
1882
|
return sort?.id === header.id ? sort.direction === "asc" ? "ascending" : "descending" : "none";
|
|
1863
1883
|
};
|
|
@@ -1871,15 +1891,15 @@ var TableHeader = ({
|
|
|
1871
1891
|
onSortChange
|
|
1872
1892
|
}) => {
|
|
1873
1893
|
const getSortIcon = (header) => {
|
|
1874
|
-
if (!sort) return /* @__PURE__ */
|
|
1894
|
+
if (!sort) return /* @__PURE__ */ jsx31(IconCaretUpDownFilled, {});
|
|
1875
1895
|
if (sort.id === header.id) {
|
|
1876
1896
|
if (sort.direction === TableSortDirection.ASC) {
|
|
1877
|
-
return /* @__PURE__ */
|
|
1897
|
+
return /* @__PURE__ */ jsx31(IconCaretUpFilled, {});
|
|
1878
1898
|
} else if (sort.direction === TableSortDirection.DESC) {
|
|
1879
|
-
return /* @__PURE__ */
|
|
1899
|
+
return /* @__PURE__ */ jsx31(IconCaretDownFilled2, {});
|
|
1880
1900
|
}
|
|
1881
1901
|
}
|
|
1882
|
-
return /* @__PURE__ */
|
|
1902
|
+
return /* @__PURE__ */ jsx31(IconCaretUpDownFilled, {});
|
|
1883
1903
|
};
|
|
1884
1904
|
const handleSort = (id) => {
|
|
1885
1905
|
if (!onSortChange) return;
|
|
@@ -1897,9 +1917,9 @@ var TableHeader = ({
|
|
|
1897
1917
|
}
|
|
1898
1918
|
}
|
|
1899
1919
|
};
|
|
1900
|
-
return /* @__PURE__ */
|
|
1901
|
-
showIndex && /* @__PURE__ */
|
|
1902
|
-
headers.map((header) => /* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ jsx31("thead", { className: styles27.tableHeader, children: /* @__PURE__ */ jsxs17("tr", { children: [
|
|
1921
|
+
showIndex && /* @__PURE__ */ jsx31("th", { className: clsx17(tableStyles.mutedCell, tableStyles.stickyFirstColumn), children: "#" }),
|
|
1922
|
+
headers.map((header) => /* @__PURE__ */ jsx31(
|
|
1903
1923
|
"th",
|
|
1904
1924
|
{
|
|
1905
1925
|
className: styles27.tableHeaderCell,
|
|
@@ -1927,9 +1947,9 @@ var TableHeader = ({
|
|
|
1927
1947
|
import styles28 from "./TableBody.module-ARNVVKDL.module.css";
|
|
1928
1948
|
import clsx18 from "clsx";
|
|
1929
1949
|
import { IconCopy, IconCopyCheckFilled } from "@tabler/icons-react";
|
|
1930
|
-
import { useState as
|
|
1950
|
+
import { useState as useState4 } from "react";
|
|
1931
1951
|
import tableStyles2 from "./tables.module-GNDYDW3Z.module.css";
|
|
1932
|
-
import { jsx as
|
|
1952
|
+
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1933
1953
|
var TableBody = ({
|
|
1934
1954
|
headers,
|
|
1935
1955
|
rows,
|
|
@@ -1938,14 +1958,14 @@ var TableBody = ({
|
|
|
1938
1958
|
showIndex,
|
|
1939
1959
|
onRowIndexClick
|
|
1940
1960
|
}) => {
|
|
1941
|
-
return /* @__PURE__ */
|
|
1961
|
+
return /* @__PURE__ */ jsx32("tbody", { className: styles28.tableBody, children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxs18(
|
|
1942
1962
|
"tr",
|
|
1943
1963
|
{
|
|
1944
1964
|
onClick: () => onRowIndexClick?.(rowIndex),
|
|
1945
1965
|
className: clsx18(rowIndex === rows.length - 1 && tableStyles2.tableLastRow),
|
|
1946
1966
|
children: [
|
|
1947
|
-
showIndex && /* @__PURE__ */
|
|
1948
|
-
headers.map((header, cellIndex) => /* @__PURE__ */
|
|
1967
|
+
showIndex && /* @__PURE__ */ jsx32("td", { className: clsx18(tableStyles2.mutedCell, tableStyles2.stickyFirstColumn), children: pageSize * page + rowIndex + 1 }),
|
|
1968
|
+
headers.map((header, cellIndex) => /* @__PURE__ */ jsx32(
|
|
1949
1969
|
TableBodyCell,
|
|
1950
1970
|
{
|
|
1951
1971
|
header,
|
|
@@ -1961,7 +1981,7 @@ var TableBody = ({
|
|
|
1961
1981
|
)) });
|
|
1962
1982
|
};
|
|
1963
1983
|
var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
1964
|
-
const [isPressedCopy, setIsPressedCopy] =
|
|
1984
|
+
const [isPressedCopy, setIsPressedCopy] = useState4(false);
|
|
1965
1985
|
const value = header.accessor !== void 0 ? header.accessor(row) : header.id !== void 0 ? (
|
|
1966
1986
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1967
1987
|
row[header.id]
|
|
@@ -1982,7 +2002,7 @@ var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
|
1982
2002
|
style: { textAlign: header.align },
|
|
1983
2003
|
onMouseLeave: () => setIsPressedCopy(false),
|
|
1984
2004
|
children: [
|
|
1985
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ jsx32(
|
|
1986
2006
|
ActionIcon,
|
|
1987
2007
|
{
|
|
1988
2008
|
title: `Copy: ${String(value)}`,
|
|
@@ -2003,7 +2023,7 @@ var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
|
2003
2023
|
};
|
|
2004
2024
|
|
|
2005
2025
|
// src/components/charts/tables/Table/TablePaginated.tsx
|
|
2006
|
-
import { jsx as
|
|
2026
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2007
2027
|
var TablePaginated = React2.forwardRef(
|
|
2008
2028
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2009
2029
|
(props, ref) => {
|
|
@@ -2022,8 +2042,8 @@ var TablePaginated = React2.forwardRef(
|
|
|
2022
2042
|
onSortChange
|
|
2023
2043
|
} = props;
|
|
2024
2044
|
return /* @__PURE__ */ jsxs19("div", { ref, className: clsx19(styles29.tableContainer, className), children: [
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2045
|
+
/* @__PURE__ */ jsx33("div", { className: styles29.tableContainerScroll, children: /* @__PURE__ */ jsxs19("table", { className: styles29.table, children: [
|
|
2046
|
+
/* @__PURE__ */ jsx33(
|
|
2027
2047
|
TableHeader,
|
|
2028
2048
|
{
|
|
2029
2049
|
showIndex,
|
|
@@ -2032,7 +2052,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2032
2052
|
onSortChange
|
|
2033
2053
|
}
|
|
2034
2054
|
),
|
|
2035
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ jsx33(
|
|
2036
2056
|
TableBody,
|
|
2037
2057
|
{
|
|
2038
2058
|
onRowIndexClick,
|
|
@@ -2044,7 +2064,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2044
2064
|
}
|
|
2045
2065
|
)
|
|
2046
2066
|
] }) }),
|
|
2047
|
-
/* @__PURE__ */
|
|
2067
|
+
/* @__PURE__ */ jsx33(
|
|
2048
2068
|
TablePagination,
|
|
2049
2069
|
{
|
|
2050
2070
|
page,
|
|
@@ -2060,7 +2080,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2060
2080
|
TablePaginated.displayName = "TablePaginated";
|
|
2061
2081
|
|
|
2062
2082
|
// src/components/charts/tables/PivotTable/PivotTable.tsx
|
|
2063
|
-
import { useEffect as
|
|
2083
|
+
import { useEffect as useEffect6, useMemo as useMemo3, useState as useState5 } from "react";
|
|
2064
2084
|
import tableStyles3 from "./tables.module-GNDYDW3Z.module.css";
|
|
2065
2085
|
import clsx20 from "clsx";
|
|
2066
2086
|
|
|
@@ -2074,7 +2094,7 @@ var getTableCellWidthStyle = (width) => {
|
|
|
2074
2094
|
};
|
|
2075
2095
|
|
|
2076
2096
|
// src/components/charts/tables/PivotTable/PivotTable.tsx
|
|
2077
|
-
import { jsx as
|
|
2097
|
+
import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2078
2098
|
var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
|
|
2079
2099
|
var getPercentageDisplay = (percentage, percentageDecimalPlaces) => {
|
|
2080
2100
|
return `${percentage.toFixed(percentageDecimalPlaces)}%`;
|
|
@@ -2166,10 +2186,10 @@ var PivotTable = ({
|
|
|
2166
2186
|
}
|
|
2167
2187
|
return { colTotals: cTotals, rowTotals: rTotals, grandTotals: gTotals };
|
|
2168
2188
|
}, [data, measures, rowDimension.key, columnDimension.key, columnValues, rowValues]);
|
|
2169
|
-
const [visibleCount, setVisibleCount] =
|
|
2189
|
+
const [visibleCount, setVisibleCount] = useState5(
|
|
2170
2190
|
() => progressive ? Math.min(batchSize, rowValues.length) : rowValues.length
|
|
2171
2191
|
);
|
|
2172
|
-
|
|
2192
|
+
useEffect6(() => {
|
|
2173
2193
|
if (!progressive) {
|
|
2174
2194
|
setVisibleCount(rowValues.length);
|
|
2175
2195
|
return;
|
|
@@ -2193,7 +2213,7 @@ var PivotTable = ({
|
|
|
2193
2213
|
};
|
|
2194
2214
|
}, [progressive, batchSize, batchDelayMs, rowValues.length, data]);
|
|
2195
2215
|
const visibleRows = progressive ? rowValues.slice(0, visibleCount) : rowValues;
|
|
2196
|
-
return /* @__PURE__ */
|
|
2216
|
+
return /* @__PURE__ */ jsx34("div", { className: clsx20(tableStyles3.tableFullContainer, className), children: /* @__PURE__ */ jsx34(
|
|
2197
2217
|
"div",
|
|
2198
2218
|
{
|
|
2199
2219
|
className: clsx20(
|
|
@@ -2208,7 +2228,7 @@ var PivotTable = ({
|
|
|
2208
2228
|
children: [
|
|
2209
2229
|
/* @__PURE__ */ jsxs20("thead", { children: [
|
|
2210
2230
|
/* @__PURE__ */ jsxs20("tr", { children: [
|
|
2211
|
-
/* @__PURE__ */
|
|
2231
|
+
/* @__PURE__ */ jsx34(
|
|
2212
2232
|
"th",
|
|
2213
2233
|
{
|
|
2214
2234
|
scope: "col",
|
|
@@ -2220,7 +2240,7 @@ var PivotTable = ({
|
|
|
2220
2240
|
),
|
|
2221
2241
|
columnValues.map((columnValue) => {
|
|
2222
2242
|
const columnValueDisplay = columnDimension.formatValue ? columnDimension.formatValue(columnValue) : columnValue;
|
|
2223
|
-
return /* @__PURE__ */
|
|
2243
|
+
return /* @__PURE__ */ jsx34(
|
|
2224
2244
|
"th",
|
|
2225
2245
|
{
|
|
2226
2246
|
scope: "colgroup",
|
|
@@ -2231,7 +2251,7 @@ var PivotTable = ({
|
|
|
2231
2251
|
`col-${columnValue}`
|
|
2232
2252
|
);
|
|
2233
2253
|
}),
|
|
2234
|
-
hasRowTotals && /* @__PURE__ */
|
|
2254
|
+
hasRowTotals && /* @__PURE__ */ jsx34(
|
|
2235
2255
|
"th",
|
|
2236
2256
|
{
|
|
2237
2257
|
scope: "colgroup",
|
|
@@ -2244,7 +2264,7 @@ var PivotTable = ({
|
|
|
2244
2264
|
)
|
|
2245
2265
|
] }),
|
|
2246
2266
|
/* @__PURE__ */ jsxs20("tr", { children: [
|
|
2247
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ jsx34(
|
|
2248
2268
|
"th",
|
|
2249
2269
|
{
|
|
2250
2270
|
scope: "col",
|
|
@@ -2256,7 +2276,7 @@ var PivotTable = ({
|
|
|
2256
2276
|
}
|
|
2257
2277
|
),
|
|
2258
2278
|
columnValues.flatMap(
|
|
2259
|
-
(col) => measures.map((measure, idx) => /* @__PURE__ */
|
|
2279
|
+
(col) => measures.map((measure, idx) => /* @__PURE__ */ jsx34(
|
|
2260
2280
|
"th",
|
|
2261
2281
|
{
|
|
2262
2282
|
scope: "col",
|
|
@@ -2267,7 +2287,7 @@ var PivotTable = ({
|
|
|
2267
2287
|
`sub-${String(col)}-${measure.key}-${idx}`
|
|
2268
2288
|
))
|
|
2269
2289
|
),
|
|
2270
|
-
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => /* @__PURE__ */
|
|
2290
|
+
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => /* @__PURE__ */ jsx34(
|
|
2271
2291
|
"th",
|
|
2272
2292
|
{
|
|
2273
2293
|
scope: "col",
|
|
@@ -2284,7 +2304,7 @@ var PivotTable = ({
|
|
|
2284
2304
|
visibleRows.map((row) => {
|
|
2285
2305
|
const rowDimensionValue = rowDimension.formatValue ? rowDimension.formatValue(row) : row;
|
|
2286
2306
|
return /* @__PURE__ */ jsxs20("tr", { children: [
|
|
2287
|
-
/* @__PURE__ */
|
|
2307
|
+
/* @__PURE__ */ jsx34(
|
|
2288
2308
|
"th",
|
|
2289
2309
|
{
|
|
2290
2310
|
scope: "row",
|
|
@@ -2312,7 +2332,7 @@ var PivotTable = ({
|
|
|
2312
2332
|
return measure.accessor ? measure.accessor(object) : value;
|
|
2313
2333
|
};
|
|
2314
2334
|
const columnValueDisplay = getDisplayValue();
|
|
2315
|
-
return /* @__PURE__ */
|
|
2335
|
+
return /* @__PURE__ */ jsx34("td", { title: columnValueDisplay, children: columnValueDisplay }, key);
|
|
2316
2336
|
})
|
|
2317
2337
|
),
|
|
2318
2338
|
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
|
|
@@ -2329,12 +2349,12 @@ var PivotTable = ({
|
|
|
2329
2349
|
} else if (measure.accessor) {
|
|
2330
2350
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2331
2351
|
}
|
|
2332
|
-
return /* @__PURE__ */
|
|
2352
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: displayValue, children: displayValue }, key);
|
|
2333
2353
|
})
|
|
2334
2354
|
] }, `row-${row}`);
|
|
2335
2355
|
}),
|
|
2336
2356
|
hasColumnTotals && /* @__PURE__ */ jsxs20("tr", { className: tableStyles3.stickyLastRow, children: [
|
|
2337
|
-
/* @__PURE__ */
|
|
2357
|
+
/* @__PURE__ */ jsx34(
|
|
2338
2358
|
"th",
|
|
2339
2359
|
{
|
|
2340
2360
|
scope: "row",
|
|
@@ -2360,7 +2380,7 @@ var PivotTable = ({
|
|
|
2360
2380
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2361
2381
|
}
|
|
2362
2382
|
const columnValueDisplay = show ? displayValue : "";
|
|
2363
|
-
return /* @__PURE__ */
|
|
2383
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: columnValueDisplay, children: columnValueDisplay }, key);
|
|
2364
2384
|
})
|
|
2365
2385
|
),
|
|
2366
2386
|
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
|
|
@@ -2376,7 +2396,7 @@ var PivotTable = ({
|
|
|
2376
2396
|
} else if (measure.accessor) {
|
|
2377
2397
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2378
2398
|
}
|
|
2379
|
-
return /* @__PURE__ */
|
|
2399
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: displayValue, children: displayValue }, key);
|
|
2380
2400
|
})
|
|
2381
2401
|
] }, "totals-row")
|
|
2382
2402
|
] })
|
|
@@ -2537,7 +2557,7 @@ var createColorForValue = ({
|
|
|
2537
2557
|
};
|
|
2538
2558
|
|
|
2539
2559
|
// src/components/charts/tables/HeatMap/HeatMap.tsx
|
|
2540
|
-
import { jsx as
|
|
2560
|
+
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2541
2561
|
var HeatMap = ({
|
|
2542
2562
|
data,
|
|
2543
2563
|
showValues = false,
|
|
@@ -2612,7 +2632,7 @@ var HeatMap = ({
|
|
|
2612
2632
|
},
|
|
2613
2633
|
[domainMin, domainMax, rawMin, rawMax, minColor, midColor, maxColor]
|
|
2614
2634
|
);
|
|
2615
|
-
return /* @__PURE__ */
|
|
2635
|
+
return /* @__PURE__ */ jsx35("div", { className: clsx21(tableStyles4.tableFullContainer, className), children: /* @__PURE__ */ jsx35(
|
|
2616
2636
|
"div",
|
|
2617
2637
|
{
|
|
2618
2638
|
className: clsx21(
|
|
@@ -2620,8 +2640,8 @@ var HeatMap = ({
|
|
|
2620
2640
|
(!columnWidth || !firstColumnWidth) && tableStyles4.fullWidth
|
|
2621
2641
|
),
|
|
2622
2642
|
children: /* @__PURE__ */ jsxs21("table", { className: tableStyles4.table, "aria-label": "Heat map", children: [
|
|
2623
|
-
/* @__PURE__ */
|
|
2624
|
-
/* @__PURE__ */
|
|
2643
|
+
/* @__PURE__ */ jsx35("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
|
|
2644
|
+
/* @__PURE__ */ jsx35(
|
|
2625
2645
|
"th",
|
|
2626
2646
|
{
|
|
2627
2647
|
className: tableStyles4.stickyFirstColumn,
|
|
@@ -2629,10 +2649,10 @@ var HeatMap = ({
|
|
|
2629
2649
|
children: measure.label
|
|
2630
2650
|
}
|
|
2631
2651
|
),
|
|
2632
|
-
columnValues.map((cv, index) => /* @__PURE__ */
|
|
2652
|
+
columnValues.map((cv, index) => /* @__PURE__ */ jsx35("th", { style: getTableCellWidthStyle(columnWidth), children: columnDimension.format ? columnDimension.format(cv) : cv }, `col-${cv}-${index}`))
|
|
2633
2653
|
] }) }),
|
|
2634
|
-
/* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */
|
|
2654
|
+
/* @__PURE__ */ jsx35("tbody", { children: rowValues.map((rv) => /* @__PURE__ */ jsxs21("tr", { children: [
|
|
2655
|
+
/* @__PURE__ */ jsx35(
|
|
2636
2656
|
"th",
|
|
2637
2657
|
{
|
|
2638
2658
|
scope: "row",
|
|
@@ -2646,7 +2666,7 @@ var HeatMap = ({
|
|
|
2646
2666
|
const value = getCellValue(obj?.[measure.key], displayNullAs);
|
|
2647
2667
|
const background = getCellBackground(value, colorForValue);
|
|
2648
2668
|
const color = getCellColor(background);
|
|
2649
|
-
return /* @__PURE__ */
|
|
2669
|
+
return /* @__PURE__ */ jsx35(
|
|
2650
2670
|
"td",
|
|
2651
2671
|
{
|
|
2652
2672
|
style: {
|
|
@@ -2682,11 +2702,11 @@ var useTableGetRowsPerPage = ({
|
|
|
2682
2702
|
}, [availableHeight, headerHeight, rowHeight, footerHeight]);
|
|
2683
2703
|
|
|
2684
2704
|
// src/hooks/useDebounce.hook.ts
|
|
2685
|
-
import { useRef as
|
|
2705
|
+
import { useRef as useRef9, useEffect as useEffect7, useCallback as useCallback2 } from "react";
|
|
2686
2706
|
function useDebounce(fn, delay = 300) {
|
|
2687
|
-
const timerRef =
|
|
2688
|
-
const fnRef =
|
|
2689
|
-
|
|
2707
|
+
const timerRef = useRef9(null);
|
|
2708
|
+
const fnRef = useRef9(fn);
|
|
2709
|
+
useEffect7(() => {
|
|
2690
2710
|
fnRef.current = fn;
|
|
2691
2711
|
}, [fn]);
|
|
2692
2712
|
const debouncedFn = useCallback2(
|
|
@@ -2700,7 +2720,7 @@ function useDebounce(fn, delay = 300) {
|
|
|
2700
2720
|
},
|
|
2701
2721
|
[delay]
|
|
2702
2722
|
);
|
|
2703
|
-
|
|
2723
|
+
useEffect7(() => {
|
|
2704
2724
|
return () => {
|
|
2705
2725
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2706
2726
|
};
|