@embeddable.com/remarkable-ui 2.0.10 → 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 +21 -16
- package/dist/index.js +142 -128
- 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,66 +1501,68 @@ 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
|
|
@@ -1641,7 +1646,44 @@ var getDonutChartOptions = (options) => {
|
|
|
1641
1646
|
// src/components/charts/pies/DonutChart/DonutChart.tsx
|
|
1642
1647
|
import { mergician as mergician7 } from "mergician";
|
|
1643
1648
|
import styles24 from "./charts.module-YNKCWRLU.module.css";
|
|
1644
|
-
|
|
1649
|
+
|
|
1650
|
+
// src/hooks/useResizeObserver.hook.ts
|
|
1651
|
+
import { useLayoutEffect, useRef as useRef6, useState as useState3 } from "react";
|
|
1652
|
+
var useResizeObserver = (elRef, timeout = 100) => {
|
|
1653
|
+
const [size, setSize] = useState3({ width: 0, height: 0 });
|
|
1654
|
+
const timeoutRef = useRef6(void 0);
|
|
1655
|
+
useLayoutEffect(() => {
|
|
1656
|
+
const el = elRef.current;
|
|
1657
|
+
if (!el) return;
|
|
1658
|
+
const updateSize = (rect) => {
|
|
1659
|
+
setSize({
|
|
1660
|
+
width: Math.max(0, rect.width),
|
|
1661
|
+
height: Math.max(0, rect.height)
|
|
1662
|
+
});
|
|
1663
|
+
};
|
|
1664
|
+
const ro = new ResizeObserver((entries) => {
|
|
1665
|
+
const entry = entries[0];
|
|
1666
|
+
if (!entry) return;
|
|
1667
|
+
if (timeoutRef.current) {
|
|
1668
|
+
clearTimeout(timeoutRef.current);
|
|
1669
|
+
}
|
|
1670
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
1671
|
+
updateSize(entry.contentRect);
|
|
1672
|
+
}, timeout);
|
|
1673
|
+
});
|
|
1674
|
+
ro.observe(el);
|
|
1675
|
+
updateSize(el.getBoundingClientRect());
|
|
1676
|
+
return () => {
|
|
1677
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
1678
|
+
ro.disconnect();
|
|
1679
|
+
};
|
|
1680
|
+
}, [elRef, timeout]);
|
|
1681
|
+
return size;
|
|
1682
|
+
};
|
|
1683
|
+
|
|
1684
|
+
// src/components/charts/pies/DonutChart/DonutChart.tsx
|
|
1685
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1686
|
+
var MIN_WIDTH_HEIGHT_TO_SHOW_CHART = 10;
|
|
1645
1687
|
ChartJS3.register(ArcElement, Tooltip3, Legend3, ChartDataLabels3, AnnotationPlugin2);
|
|
1646
1688
|
var DonutChart = ({
|
|
1647
1689
|
label,
|
|
@@ -1653,6 +1695,7 @@ var DonutChart = ({
|
|
|
1653
1695
|
showTooltips = true,
|
|
1654
1696
|
showValueLabels = true
|
|
1655
1697
|
}) => {
|
|
1698
|
+
const containerRef = useRef7(null);
|
|
1656
1699
|
const chartRef = useRef7(null);
|
|
1657
1700
|
const donutLabelOptions = mergician7(
|
|
1658
1701
|
getDonutChartOptions({ showLegend, showTooltips, showValueLabels, label, subLabel }),
|
|
@@ -1662,7 +1705,9 @@ var DonutChart = ({
|
|
|
1662
1705
|
const indexClicked = getSegmentIndexClicked(event, chartRef);
|
|
1663
1706
|
onSegmentClick?.(indexClicked);
|
|
1664
1707
|
};
|
|
1665
|
-
|
|
1708
|
+
const { height, width } = useResizeObserver(containerRef, 0);
|
|
1709
|
+
const hideChart = height < MIN_WIDTH_HEIGHT_TO_SHOW_CHART || width < MIN_WIDTH_HEIGHT_TO_SHOW_CHART;
|
|
1710
|
+
return /* @__PURE__ */ jsx28("div", { className: styles24.chartContainer, ref: containerRef, children: hideChart ? null : /* @__PURE__ */ jsx28(
|
|
1666
1711
|
Pie,
|
|
1667
1712
|
{
|
|
1668
1713
|
ref: chartRef,
|
|
@@ -1681,7 +1726,7 @@ import ChartDataLabels4 from "chartjs-plugin-datalabels";
|
|
|
1681
1726
|
import { mergician as mergician8 } from "mergician";
|
|
1682
1727
|
import styles25 from "./charts.module-YNKCWRLU.module.css";
|
|
1683
1728
|
import AnnotationPlugin3 from "chartjs-plugin-annotation";
|
|
1684
|
-
import { jsx as
|
|
1729
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1685
1730
|
ChartJS4.register(ArcElement2, Tooltip4, Legend4, ChartDataLabels4, AnnotationPlugin3);
|
|
1686
1731
|
var PieChart = ({
|
|
1687
1732
|
data,
|
|
@@ -1704,7 +1749,7 @@ var PieChart = ({
|
|
|
1704
1749
|
const indexClicked = getSegmentIndexClicked(event, chartRef);
|
|
1705
1750
|
onSegmentClick?.(indexClicked);
|
|
1706
1751
|
};
|
|
1707
|
-
return /* @__PURE__ */
|
|
1752
|
+
return /* @__PURE__ */ jsx29("div", { className: styles25.chartContainer, children: /* @__PURE__ */ jsx29(
|
|
1708
1753
|
Pie2,
|
|
1709
1754
|
{
|
|
1710
1755
|
ref: chartRef,
|
|
@@ -1728,8 +1773,8 @@ import {
|
|
|
1728
1773
|
IconChevronsRight
|
|
1729
1774
|
} from "@tabler/icons-react";
|
|
1730
1775
|
import styles26 from "./TablePagination.module-VGIQ7VN7.module.css";
|
|
1731
|
-
import { useEffect as
|
|
1732
|
-
import { jsx as
|
|
1776
|
+
import { useEffect as useEffect5 } from "react";
|
|
1777
|
+
import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1733
1778
|
var getTableTotalPages = (total, pageSize) => {
|
|
1734
1779
|
return total ? Math.ceil(total / pageSize) : void 0;
|
|
1735
1780
|
};
|
|
@@ -1743,14 +1788,14 @@ var TablePagination = ({
|
|
|
1743
1788
|
const totalPages = getTableTotalPages(total, pageSize);
|
|
1744
1789
|
const disabledPrev = page <= 0;
|
|
1745
1790
|
const disabledNext = !totalPages || page >= totalPages - 1;
|
|
1746
|
-
|
|
1791
|
+
useEffect5(() => {
|
|
1747
1792
|
if (totalPages && page >= totalPages) {
|
|
1748
1793
|
onPageChange(0);
|
|
1749
1794
|
}
|
|
1750
1795
|
}, [totalPages, page]);
|
|
1751
|
-
return /* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ jsx30("div", { className: styles26.tablePagination, "aria-label": "Table pagination controls", children: /* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentral, children: [
|
|
1752
1797
|
/* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentralButtons, children: [
|
|
1753
|
-
/* @__PURE__ */
|
|
1798
|
+
/* @__PURE__ */ jsx30(
|
|
1754
1799
|
ActionIcon,
|
|
1755
1800
|
{
|
|
1756
1801
|
icon: IconChevronsLeft,
|
|
@@ -1761,7 +1806,7 @@ var TablePagination = ({
|
|
|
1761
1806
|
"aria-label": "First page"
|
|
1762
1807
|
}
|
|
1763
1808
|
),
|
|
1764
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ jsx30(
|
|
1765
1810
|
ActionIcon,
|
|
1766
1811
|
{
|
|
1767
1812
|
icon: IconChevronLeft,
|
|
@@ -1773,9 +1818,9 @@ var TablePagination = ({
|
|
|
1773
1818
|
}
|
|
1774
1819
|
)
|
|
1775
1820
|
] }),
|
|
1776
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsx30("span", { children: paginationLabel ?? `Page ${page + 1} of ${totalPages ?? "?"}` }),
|
|
1777
1822
|
/* @__PURE__ */ jsxs16("div", { className: styles26.tablePaginationCentralButtons, children: [
|
|
1778
|
-
/* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ jsx30(
|
|
1779
1824
|
ActionIcon,
|
|
1780
1825
|
{
|
|
1781
1826
|
icon: IconChevronRight,
|
|
@@ -1786,7 +1831,7 @@ var TablePagination = ({
|
|
|
1786
1831
|
"aria-label": "Next page"
|
|
1787
1832
|
}
|
|
1788
1833
|
),
|
|
1789
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ jsx30(
|
|
1790
1835
|
ActionIcon,
|
|
1791
1836
|
{
|
|
1792
1837
|
icon: IconChevronsRight,
|
|
@@ -1817,7 +1862,7 @@ var TableHeaderAlign = {
|
|
|
1817
1862
|
// src/components/charts/tables/Table/components/TableHeader/TableHeader.tsx
|
|
1818
1863
|
import tableStyles from "./tables.module-GNDYDW3Z.module.css";
|
|
1819
1864
|
import clsx17 from "clsx";
|
|
1820
|
-
import { jsx as
|
|
1865
|
+
import { jsx as jsx31, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1821
1866
|
var getHeaderAriaSort = (sort, header) => {
|
|
1822
1867
|
return sort?.id === header.id ? sort.direction === "asc" ? "ascending" : "descending" : "none";
|
|
1823
1868
|
};
|
|
@@ -1831,15 +1876,15 @@ var TableHeader = ({
|
|
|
1831
1876
|
onSortChange
|
|
1832
1877
|
}) => {
|
|
1833
1878
|
const getSortIcon = (header) => {
|
|
1834
|
-
if (!sort) return /* @__PURE__ */
|
|
1879
|
+
if (!sort) return /* @__PURE__ */ jsx31(IconCaretUpDownFilled, {});
|
|
1835
1880
|
if (sort.id === header.id) {
|
|
1836
1881
|
if (sort.direction === TableSortDirection.ASC) {
|
|
1837
|
-
return /* @__PURE__ */
|
|
1882
|
+
return /* @__PURE__ */ jsx31(IconCaretUpFilled, {});
|
|
1838
1883
|
} else if (sort.direction === TableSortDirection.DESC) {
|
|
1839
|
-
return /* @__PURE__ */
|
|
1884
|
+
return /* @__PURE__ */ jsx31(IconCaretDownFilled2, {});
|
|
1840
1885
|
}
|
|
1841
1886
|
}
|
|
1842
|
-
return /* @__PURE__ */
|
|
1887
|
+
return /* @__PURE__ */ jsx31(IconCaretUpDownFilled, {});
|
|
1843
1888
|
};
|
|
1844
1889
|
const handleSort = (id) => {
|
|
1845
1890
|
if (!onSortChange) return;
|
|
@@ -1857,9 +1902,9 @@ var TableHeader = ({
|
|
|
1857
1902
|
}
|
|
1858
1903
|
}
|
|
1859
1904
|
};
|
|
1860
|
-
return /* @__PURE__ */
|
|
1861
|
-
showIndex && /* @__PURE__ */
|
|
1862
|
-
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(
|
|
1863
1908
|
"th",
|
|
1864
1909
|
{
|
|
1865
1910
|
className: styles27.tableHeaderCell,
|
|
@@ -1889,7 +1934,7 @@ import clsx18 from "clsx";
|
|
|
1889
1934
|
import { IconCopy, IconCopyCheckFilled } from "@tabler/icons-react";
|
|
1890
1935
|
import { useState as useState4 } from "react";
|
|
1891
1936
|
import tableStyles2 from "./tables.module-GNDYDW3Z.module.css";
|
|
1892
|
-
import { jsx as
|
|
1937
|
+
import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1893
1938
|
var TableBody = ({
|
|
1894
1939
|
headers,
|
|
1895
1940
|
rows,
|
|
@@ -1898,14 +1943,14 @@ var TableBody = ({
|
|
|
1898
1943
|
showIndex,
|
|
1899
1944
|
onRowIndexClick
|
|
1900
1945
|
}) => {
|
|
1901
|
-
return /* @__PURE__ */
|
|
1946
|
+
return /* @__PURE__ */ jsx32("tbody", { className: styles28.tableBody, children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxs18(
|
|
1902
1947
|
"tr",
|
|
1903
1948
|
{
|
|
1904
1949
|
onClick: () => onRowIndexClick?.(rowIndex),
|
|
1905
1950
|
className: clsx18(rowIndex === rows.length - 1 && tableStyles2.tableLastRow),
|
|
1906
1951
|
children: [
|
|
1907
|
-
showIndex && /* @__PURE__ */
|
|
1908
|
-
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(
|
|
1909
1954
|
TableBodyCell,
|
|
1910
1955
|
{
|
|
1911
1956
|
header,
|
|
@@ -1942,7 +1987,7 @@ var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
|
1942
1987
|
style: { textAlign: header.align },
|
|
1943
1988
|
onMouseLeave: () => setIsPressedCopy(false),
|
|
1944
1989
|
children: [
|
|
1945
|
-
/* @__PURE__ */
|
|
1990
|
+
/* @__PURE__ */ jsx32(
|
|
1946
1991
|
ActionIcon,
|
|
1947
1992
|
{
|
|
1948
1993
|
title: `Copy: ${String(value)}`,
|
|
@@ -1963,7 +2008,7 @@ var TableBodyCell = ({ header, row, rowIndex, cellIndex }) => {
|
|
|
1963
2008
|
};
|
|
1964
2009
|
|
|
1965
2010
|
// src/components/charts/tables/Table/TablePaginated.tsx
|
|
1966
|
-
import { jsx as
|
|
2011
|
+
import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1967
2012
|
var TablePaginated = React2.forwardRef(
|
|
1968
2013
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1969
2014
|
(props, ref) => {
|
|
@@ -1982,8 +2027,8 @@ var TablePaginated = React2.forwardRef(
|
|
|
1982
2027
|
onSortChange
|
|
1983
2028
|
} = props;
|
|
1984
2029
|
return /* @__PURE__ */ jsxs19("div", { ref, className: clsx19(styles29.tableContainer, className), children: [
|
|
1985
|
-
/* @__PURE__ */
|
|
1986
|
-
/* @__PURE__ */
|
|
2030
|
+
/* @__PURE__ */ jsx33("div", { className: styles29.tableContainerScroll, children: /* @__PURE__ */ jsxs19("table", { className: styles29.table, children: [
|
|
2031
|
+
/* @__PURE__ */ jsx33(
|
|
1987
2032
|
TableHeader,
|
|
1988
2033
|
{
|
|
1989
2034
|
showIndex,
|
|
@@ -1992,7 +2037,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
1992
2037
|
onSortChange
|
|
1993
2038
|
}
|
|
1994
2039
|
),
|
|
1995
|
-
/* @__PURE__ */
|
|
2040
|
+
/* @__PURE__ */ jsx33(
|
|
1996
2041
|
TableBody,
|
|
1997
2042
|
{
|
|
1998
2043
|
onRowIndexClick,
|
|
@@ -2004,7 +2049,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2004
2049
|
}
|
|
2005
2050
|
)
|
|
2006
2051
|
] }) }),
|
|
2007
|
-
/* @__PURE__ */
|
|
2052
|
+
/* @__PURE__ */ jsx33(
|
|
2008
2053
|
TablePagination,
|
|
2009
2054
|
{
|
|
2010
2055
|
page,
|
|
@@ -2020,7 +2065,7 @@ var TablePaginated = React2.forwardRef(
|
|
|
2020
2065
|
TablePaginated.displayName = "TablePaginated";
|
|
2021
2066
|
|
|
2022
2067
|
// src/components/charts/tables/PivotTable/PivotTable.tsx
|
|
2023
|
-
import { useEffect as
|
|
2068
|
+
import { useEffect as useEffect6, useMemo as useMemo3, useState as useState5 } from "react";
|
|
2024
2069
|
import tableStyles3 from "./tables.module-GNDYDW3Z.module.css";
|
|
2025
2070
|
import clsx20 from "clsx";
|
|
2026
2071
|
|
|
@@ -2034,7 +2079,7 @@ var getTableCellWidthStyle = (width) => {
|
|
|
2034
2079
|
};
|
|
2035
2080
|
|
|
2036
2081
|
// src/components/charts/tables/PivotTable/PivotTable.tsx
|
|
2037
|
-
import { jsx as
|
|
2082
|
+
import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2038
2083
|
var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
|
|
2039
2084
|
var getPercentageDisplay = (percentage, percentageDecimalPlaces) => {
|
|
2040
2085
|
return `${percentage.toFixed(percentageDecimalPlaces)}%`;
|
|
@@ -2129,7 +2174,7 @@ var PivotTable = ({
|
|
|
2129
2174
|
const [visibleCount, setVisibleCount] = useState5(
|
|
2130
2175
|
() => progressive ? Math.min(batchSize, rowValues.length) : rowValues.length
|
|
2131
2176
|
);
|
|
2132
|
-
|
|
2177
|
+
useEffect6(() => {
|
|
2133
2178
|
if (!progressive) {
|
|
2134
2179
|
setVisibleCount(rowValues.length);
|
|
2135
2180
|
return;
|
|
@@ -2153,7 +2198,7 @@ var PivotTable = ({
|
|
|
2153
2198
|
};
|
|
2154
2199
|
}, [progressive, batchSize, batchDelayMs, rowValues.length, data]);
|
|
2155
2200
|
const visibleRows = progressive ? rowValues.slice(0, visibleCount) : rowValues;
|
|
2156
|
-
return /* @__PURE__ */
|
|
2201
|
+
return /* @__PURE__ */ jsx34("div", { className: clsx20(tableStyles3.tableFullContainer, className), children: /* @__PURE__ */ jsx34(
|
|
2157
2202
|
"div",
|
|
2158
2203
|
{
|
|
2159
2204
|
className: clsx20(
|
|
@@ -2168,7 +2213,7 @@ var PivotTable = ({
|
|
|
2168
2213
|
children: [
|
|
2169
2214
|
/* @__PURE__ */ jsxs20("thead", { children: [
|
|
2170
2215
|
/* @__PURE__ */ jsxs20("tr", { children: [
|
|
2171
|
-
/* @__PURE__ */
|
|
2216
|
+
/* @__PURE__ */ jsx34(
|
|
2172
2217
|
"th",
|
|
2173
2218
|
{
|
|
2174
2219
|
scope: "col",
|
|
@@ -2180,7 +2225,7 @@ var PivotTable = ({
|
|
|
2180
2225
|
),
|
|
2181
2226
|
columnValues.map((columnValue) => {
|
|
2182
2227
|
const columnValueDisplay = columnDimension.formatValue ? columnDimension.formatValue(columnValue) : columnValue;
|
|
2183
|
-
return /* @__PURE__ */
|
|
2228
|
+
return /* @__PURE__ */ jsx34(
|
|
2184
2229
|
"th",
|
|
2185
2230
|
{
|
|
2186
2231
|
scope: "colgroup",
|
|
@@ -2191,7 +2236,7 @@ var PivotTable = ({
|
|
|
2191
2236
|
`col-${columnValue}`
|
|
2192
2237
|
);
|
|
2193
2238
|
}),
|
|
2194
|
-
hasRowTotals && /* @__PURE__ */
|
|
2239
|
+
hasRowTotals && /* @__PURE__ */ jsx34(
|
|
2195
2240
|
"th",
|
|
2196
2241
|
{
|
|
2197
2242
|
scope: "colgroup",
|
|
@@ -2204,7 +2249,7 @@ var PivotTable = ({
|
|
|
2204
2249
|
)
|
|
2205
2250
|
] }),
|
|
2206
2251
|
/* @__PURE__ */ jsxs20("tr", { children: [
|
|
2207
|
-
/* @__PURE__ */
|
|
2252
|
+
/* @__PURE__ */ jsx34(
|
|
2208
2253
|
"th",
|
|
2209
2254
|
{
|
|
2210
2255
|
scope: "col",
|
|
@@ -2216,7 +2261,7 @@ var PivotTable = ({
|
|
|
2216
2261
|
}
|
|
2217
2262
|
),
|
|
2218
2263
|
columnValues.flatMap(
|
|
2219
|
-
(col) => measures.map((measure, idx) => /* @__PURE__ */
|
|
2264
|
+
(col) => measures.map((measure, idx) => /* @__PURE__ */ jsx34(
|
|
2220
2265
|
"th",
|
|
2221
2266
|
{
|
|
2222
2267
|
scope: "col",
|
|
@@ -2227,7 +2272,7 @@ var PivotTable = ({
|
|
|
2227
2272
|
`sub-${String(col)}-${measure.key}-${idx}`
|
|
2228
2273
|
))
|
|
2229
2274
|
),
|
|
2230
|
-
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(
|
|
2231
2276
|
"th",
|
|
2232
2277
|
{
|
|
2233
2278
|
scope: "col",
|
|
@@ -2244,7 +2289,7 @@ var PivotTable = ({
|
|
|
2244
2289
|
visibleRows.map((row) => {
|
|
2245
2290
|
const rowDimensionValue = rowDimension.formatValue ? rowDimension.formatValue(row) : row;
|
|
2246
2291
|
return /* @__PURE__ */ jsxs20("tr", { children: [
|
|
2247
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx34(
|
|
2248
2293
|
"th",
|
|
2249
2294
|
{
|
|
2250
2295
|
scope: "row",
|
|
@@ -2272,7 +2317,7 @@ var PivotTable = ({
|
|
|
2272
2317
|
return measure.accessor ? measure.accessor(object) : value;
|
|
2273
2318
|
};
|
|
2274
2319
|
const columnValueDisplay = getDisplayValue();
|
|
2275
|
-
return /* @__PURE__ */
|
|
2320
|
+
return /* @__PURE__ */ jsx34("td", { title: columnValueDisplay, children: columnValueDisplay }, key);
|
|
2276
2321
|
})
|
|
2277
2322
|
),
|
|
2278
2323
|
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
|
|
@@ -2289,12 +2334,12 @@ var PivotTable = ({
|
|
|
2289
2334
|
} else if (measure.accessor) {
|
|
2290
2335
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2291
2336
|
}
|
|
2292
|
-
return /* @__PURE__ */
|
|
2337
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: displayValue, children: displayValue }, key);
|
|
2293
2338
|
})
|
|
2294
2339
|
] }, `row-${row}`);
|
|
2295
2340
|
}),
|
|
2296
2341
|
hasColumnTotals && /* @__PURE__ */ jsxs20("tr", { className: tableStyles3.stickyLastRow, children: [
|
|
2297
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ jsx34(
|
|
2298
2343
|
"th",
|
|
2299
2344
|
{
|
|
2300
2345
|
scope: "row",
|
|
@@ -2320,7 +2365,7 @@ var PivotTable = ({
|
|
|
2320
2365
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2321
2366
|
}
|
|
2322
2367
|
const columnValueDisplay = show ? displayValue : "";
|
|
2323
|
-
return /* @__PURE__ */
|
|
2368
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: columnValueDisplay, children: columnValueDisplay }, key);
|
|
2324
2369
|
})
|
|
2325
2370
|
),
|
|
2326
2371
|
hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
|
|
@@ -2336,7 +2381,7 @@ var PivotTable = ({
|
|
|
2336
2381
|
} else if (measure.accessor) {
|
|
2337
2382
|
displayValue = measure.accessor({ [measure.key]: value });
|
|
2338
2383
|
}
|
|
2339
|
-
return /* @__PURE__ */
|
|
2384
|
+
return /* @__PURE__ */ jsx34("td", { className: tableStyles3.boltCell, title: displayValue, children: displayValue }, key);
|
|
2340
2385
|
})
|
|
2341
2386
|
] }, "totals-row")
|
|
2342
2387
|
] })
|
|
@@ -2497,7 +2542,7 @@ var createColorForValue = ({
|
|
|
2497
2542
|
};
|
|
2498
2543
|
|
|
2499
2544
|
// src/components/charts/tables/HeatMap/HeatMap.tsx
|
|
2500
|
-
import { jsx as
|
|
2545
|
+
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2501
2546
|
var HeatMap = ({
|
|
2502
2547
|
data,
|
|
2503
2548
|
showValues = false,
|
|
@@ -2572,7 +2617,7 @@ var HeatMap = ({
|
|
|
2572
2617
|
},
|
|
2573
2618
|
[domainMin, domainMax, rawMin, rawMax, minColor, midColor, maxColor]
|
|
2574
2619
|
);
|
|
2575
|
-
return /* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ jsx35("div", { className: clsx21(tableStyles4.tableFullContainer, className), children: /* @__PURE__ */ jsx35(
|
|
2576
2621
|
"div",
|
|
2577
2622
|
{
|
|
2578
2623
|
className: clsx21(
|
|
@@ -2580,8 +2625,8 @@ var HeatMap = ({
|
|
|
2580
2625
|
(!columnWidth || !firstColumnWidth) && tableStyles4.fullWidth
|
|
2581
2626
|
),
|
|
2582
2627
|
children: /* @__PURE__ */ jsxs21("table", { className: tableStyles4.table, "aria-label": "Heat map", children: [
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2628
|
+
/* @__PURE__ */ jsx35("thead", { children: /* @__PURE__ */ jsxs21("tr", { children: [
|
|
2629
|
+
/* @__PURE__ */ jsx35(
|
|
2585
2630
|
"th",
|
|
2586
2631
|
{
|
|
2587
2632
|
className: tableStyles4.stickyFirstColumn,
|
|
@@ -2589,10 +2634,10 @@ var HeatMap = ({
|
|
|
2589
2634
|
children: measure.label
|
|
2590
2635
|
}
|
|
2591
2636
|
),
|
|
2592
|
-
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}`))
|
|
2593
2638
|
] }) }),
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsx35("tbody", { children: rowValues.map((rv) => /* @__PURE__ */ jsxs21("tr", { children: [
|
|
2640
|
+
/* @__PURE__ */ jsx35(
|
|
2596
2641
|
"th",
|
|
2597
2642
|
{
|
|
2598
2643
|
scope: "row",
|
|
@@ -2606,7 +2651,7 @@ var HeatMap = ({
|
|
|
2606
2651
|
const value = getCellValue(obj?.[measure.key], displayNullAs);
|
|
2607
2652
|
const background = getCellBackground(value, colorForValue);
|
|
2608
2653
|
const color = getCellColor(background);
|
|
2609
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsx35(
|
|
2610
2655
|
"td",
|
|
2611
2656
|
{
|
|
2612
2657
|
style: {
|
|
@@ -2642,11 +2687,11 @@ var useTableGetRowsPerPage = ({
|
|
|
2642
2687
|
}, [availableHeight, headerHeight, rowHeight, footerHeight]);
|
|
2643
2688
|
|
|
2644
2689
|
// src/hooks/useDebounce.hook.ts
|
|
2645
|
-
import { useRef as useRef9, useEffect as
|
|
2690
|
+
import { useRef as useRef9, useEffect as useEffect7, useCallback as useCallback2 } from "react";
|
|
2646
2691
|
function useDebounce(fn, delay = 300) {
|
|
2647
2692
|
const timerRef = useRef9(null);
|
|
2648
2693
|
const fnRef = useRef9(fn);
|
|
2649
|
-
|
|
2694
|
+
useEffect7(() => {
|
|
2650
2695
|
fnRef.current = fn;
|
|
2651
2696
|
}, [fn]);
|
|
2652
2697
|
const debouncedFn = useCallback2(
|
|
@@ -2660,44 +2705,13 @@ function useDebounce(fn, delay = 300) {
|
|
|
2660
2705
|
},
|
|
2661
2706
|
[delay]
|
|
2662
2707
|
);
|
|
2663
|
-
|
|
2708
|
+
useEffect7(() => {
|
|
2664
2709
|
return () => {
|
|
2665
2710
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
2666
2711
|
};
|
|
2667
2712
|
}, []);
|
|
2668
2713
|
return debouncedFn;
|
|
2669
2714
|
}
|
|
2670
|
-
|
|
2671
|
-
// src/hooks/useObserverHeight.hook.ts
|
|
2672
|
-
import { useLayoutEffect, useRef as useRef10, useState as useState6 } from "react";
|
|
2673
|
-
var useObserverHeight = (elRef) => {
|
|
2674
|
-
const [height, setHeight] = useState6(0);
|
|
2675
|
-
const timeoutRef = useRef10(void 0);
|
|
2676
|
-
useLayoutEffect(() => {
|
|
2677
|
-
const el = elRef.current;
|
|
2678
|
-
if (!el) return;
|
|
2679
|
-
const updateHeight = (newHeight) => {
|
|
2680
|
-
setHeight(Math.max(0, newHeight));
|
|
2681
|
-
};
|
|
2682
|
-
const ro = new ResizeObserver((entries) => {
|
|
2683
|
-
const entry = entries[0];
|
|
2684
|
-
if (!entry) return;
|
|
2685
|
-
if (timeoutRef.current) {
|
|
2686
|
-
clearTimeout(timeoutRef.current);
|
|
2687
|
-
}
|
|
2688
|
-
timeoutRef.current = window.setTimeout(() => {
|
|
2689
|
-
updateHeight(entry.contentRect.height);
|
|
2690
|
-
}, 100);
|
|
2691
|
-
});
|
|
2692
|
-
ro.observe(el);
|
|
2693
|
-
updateHeight(el.getBoundingClientRect().height || 0);
|
|
2694
|
-
return () => {
|
|
2695
|
-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2696
|
-
ro.disconnect();
|
|
2697
|
-
};
|
|
2698
|
-
}, [elRef]);
|
|
2699
|
-
return height;
|
|
2700
|
-
};
|
|
2701
2715
|
export {
|
|
2702
2716
|
ActionIcon,
|
|
2703
2717
|
BarChart,
|
|
@@ -2755,7 +2769,7 @@ export {
|
|
|
2755
2769
|
getStyleNumber,
|
|
2756
2770
|
getTableTotalPages,
|
|
2757
2771
|
useDebounce,
|
|
2758
|
-
|
|
2772
|
+
useResizeObserver,
|
|
2759
2773
|
useTableGetRowsPerPage
|
|
2760
2774
|
};
|
|
2761
2775
|
//# sourceMappingURL=index.js.map
|