@embeddable.com/remarkable-ui 2.0.39 → 2.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  styles
3
- } from "./chunk-3SAVZAMC.js";
3
+ } from "./chunk-54RMM3OQ.js";
4
4
 
5
5
  // src/components/charts/bars/BarChart.tsx
6
6
  import { useRef } from "react";
@@ -924,7 +924,7 @@ var PieChart = ({
924
924
 
925
925
  // src/components/charts/tables/HeatMap/HeatMap.tsx
926
926
  import { useMemo, useCallback } from "react";
927
- import tableStyles from "./tables.module-6DZDKDSH.module.css";
927
+ import tableStyles from "./tables.module-6REGLCSQ.module.css";
928
928
  import clsx2 from "clsx";
929
929
 
930
930
  // src/components/charts/tables/HeatMap/HeatMap.utils.ts
@@ -1212,71 +1212,89 @@ var HeatMap = ({
1212
1212
  };
1213
1213
 
1214
1214
  // src/components/charts/tables/PivotTable/PivotTable.tsx
1215
- import { useEffect, useMemo as useMemo2, useState as useState2 } from "react";
1216
- import tableStyles2 from "./tables.module-6DZDKDSH.module.css";
1215
+ import { Fragment as Fragment3, useMemo as useMemo3, useState as useState3 } from "react";
1216
+ import tableStyles2 from "./tables.module-6REGLCSQ.module.css";
1217
1217
  import clsx3 from "clsx";
1218
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1218
+ import { IconLoader2, IconChevronDown, IconChevronRight } from "@tabler/icons-react";
1219
+
1220
+ // src/components/charts/tables/PivotTable/PivotTable.utils.ts
1221
+ import { useEffect, useMemo as useMemo2, useState as useState2 } from "react";
1219
1222
  var isNumber = (v) => typeof v === "number" && !Number.isNaN(v);
1220
1223
  var getPercentageDisplay = (percentage, percentageDecimalPlaces) => {
1221
1224
  return `${percentage.toFixed(percentageDecimalPlaces)}%`;
1222
1225
  };
1223
- var PivotTable = ({
1224
- columnWidth,
1225
- firstColumnWidth,
1226
- data,
1227
- measures,
1228
- rowDimension,
1229
- columnDimension,
1230
- progressive = true,
1231
- batchSize = 100,
1232
- batchDelayMs = 0,
1233
- rowTotalsFor = [],
1234
- columnTotalsFor = [],
1235
- totalLabel = "Total",
1236
- className
1237
- }) => {
1238
- const rowValues = useMemo2(() => {
1239
- const s = /* @__PURE__ */ new Set();
1240
- for (const d of data) {
1241
- const rowValue = d[rowDimension.key];
1242
- if (rowValue != null) s.add(rowValue);
1243
- }
1244
- return Array.from(s);
1245
- }, [data, rowDimension.key]);
1246
- const columnValues = useMemo2(() => {
1247
- const s = /* @__PURE__ */ new Set();
1248
- for (const d of data) {
1249
- const columnValue = d[columnDimension.key];
1250
- if (columnValue != null) s.add(columnValue);
1226
+ var getCellDisplayValue2 = (value, measure, dataObject, denominatorTotal) => {
1227
+ if (measure.showAsPercentage) {
1228
+ if (isNumber(Number(value)) && isNumber(denominatorTotal) && denominatorTotal > 0) {
1229
+ return getPercentageDisplay(
1230
+ value / denominatorTotal * 100,
1231
+ measure.percentageDecimalPlaces ?? 0
1232
+ );
1251
1233
  }
1252
- return Array.from(s);
1253
- }, [data, columnDimension.key]);
1254
- const cellMap = useMemo2(() => {
1255
- const map = /* @__PURE__ */ new Map();
1256
- for (const d of data) {
1257
- const r = String(d[rowDimension.key]);
1258
- const c = String(d[columnDimension.key]);
1259
- if (!map.has(r)) map.set(r, /* @__PURE__ */ new Map());
1260
- map.get(r).set(c, d);
1234
+ }
1235
+ return measure.accessor ? measure.accessor(dataObject) : value;
1236
+ };
1237
+ var buildCellMap = (rows, rowKey, colKey) => {
1238
+ const map = /* @__PURE__ */ new Map();
1239
+ for (const d of rows) {
1240
+ const r = String(d[rowKey]);
1241
+ const c = String(d[colKey]);
1242
+ if (!map.has(r)) map.set(r, /* @__PURE__ */ new Map());
1243
+ map.get(r).set(c, d);
1244
+ }
1245
+ return map;
1246
+ };
1247
+ var getMeasureTotal = (totalsMap, key, measureIndex, measuresCount) => {
1248
+ const totals = totalsMap.get(key) ?? Array(measuresCount).fill(0);
1249
+ return measureIndex >= 0 ? totals[measureIndex] ?? 0 : 0;
1250
+ };
1251
+ var computeSubRowTotal = (cellMap, rowKey, columnValues, measureKey) => {
1252
+ let total = 0;
1253
+ for (const columnValue of columnValues) {
1254
+ const data = cellMap.get(rowKey)?.get(String(columnValue)) ?? {};
1255
+ const val = Number(data?.[measureKey]);
1256
+ if (!Number.isNaN(val)) total += val;
1257
+ }
1258
+ return total;
1259
+ };
1260
+ var useProgressiveRows = (rowValues, options) => {
1261
+ const { progressive, batchSize, batchDelayMs } = options;
1262
+ const [visibleCount, setVisibleCount] = useState2(
1263
+ () => progressive ? Math.min(batchSize, rowValues.length) : rowValues.length
1264
+ );
1265
+ useEffect(() => {
1266
+ if (!progressive) {
1267
+ setVisibleCount(rowValues.length);
1268
+ return;
1261
1269
  }
1262
- return map;
1263
- }, [data, rowDimension.key, columnDimension.key]);
1264
- const rowTotalsSet = useMemo2(() => new Set(rowTotalsFor), [rowTotalsFor]);
1265
- const columnTotalsSet = useMemo2(() => new Set(columnTotalsFor), [columnTotalsFor]);
1266
- const hasRowTotals = rowTotalsSet.size > 0;
1267
- const hasColumnTotals = columnTotalsSet.size > 0;
1268
- const measureIndexByKey = useMemo2(() => {
1269
- const map = /* @__PURE__ */ new Map();
1270
- measures.forEach((m, i) => map.set(String(m.key), i));
1271
- return map;
1272
- }, [measures]);
1273
- const { colTotals, rowTotals, grandTotals } = useMemo2(() => {
1270
+ let cancelled = false;
1271
+ let t = null;
1272
+ setVisibleCount(Math.min(batchSize, rowValues.length));
1273
+ const tick = () => {
1274
+ setVisibleCount((prev) => {
1275
+ const next = Math.min(prev + batchSize, rowValues.length);
1276
+ if (next < rowValues.length && !cancelled) {
1277
+ t = window.setTimeout(tick, batchDelayMs);
1278
+ }
1279
+ return next;
1280
+ });
1281
+ };
1282
+ t = window.setTimeout(tick, batchDelayMs);
1283
+ return () => {
1284
+ cancelled = true;
1285
+ if (t !== null) window.clearTimeout(t);
1286
+ };
1287
+ }, [progressive, batchSize, batchDelayMs, rowValues.length]);
1288
+ return progressive ? rowValues.slice(0, visibleCount) : rowValues;
1289
+ };
1290
+ var usePivotTotals = (data, measures, rowDimensionKey, columnDimensionKey, columnValues, rowValues) => {
1291
+ return useMemo2(() => {
1274
1292
  const cTotals = /* @__PURE__ */ new Map();
1275
1293
  const rTotals = /* @__PURE__ */ new Map();
1276
1294
  const gTotals = measures.map(() => 0);
1277
1295
  for (const d of data) {
1278
- const r = String(d[rowDimension.key]);
1279
- const c = String(d[columnDimension.key]);
1296
+ const r = String(d[rowDimensionKey]);
1297
+ const c = String(d[columnDimensionKey]);
1280
1298
  const cArr = cTotals.get(c) ?? measures.map(() => 0);
1281
1299
  const rArr = rTotals.get(r) ?? measures.map(() => 0);
1282
1300
  measures.forEach((m, i) => {
@@ -1306,34 +1324,146 @@ var PivotTable = ({
1306
1324
  );
1307
1325
  }
1308
1326
  return { colTotals: cTotals, rowTotals: rTotals, grandTotals: gTotals };
1309
- }, [data, measures, rowDimension.key, columnDimension.key, columnValues, rowValues]);
1310
- const [visibleCount, setVisibleCount] = useState2(
1311
- () => progressive ? Math.min(batchSize, rowValues.length) : rowValues.length
1312
- );
1313
- useEffect(() => {
1314
- if (!progressive) {
1315
- setVisibleCount(rowValues.length);
1316
- return;
1327
+ }, [data, measures, rowDimensionKey, columnDimensionKey, columnValues, rowValues]);
1328
+ };
1329
+
1330
+ // src/components/charts/tables/PivotTable/PivotTable.tsx
1331
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1332
+ var PivotTable = ({
1333
+ columnWidth,
1334
+ firstColumnWidth,
1335
+ data,
1336
+ measures,
1337
+ rowDimension,
1338
+ columnDimension,
1339
+ progressive = true,
1340
+ batchSize = 100,
1341
+ batchDelayMs = 0,
1342
+ rowTotalsFor = [],
1343
+ columnTotalsFor = [],
1344
+ totalLabel = "Total",
1345
+ className,
1346
+ expandableRows = false,
1347
+ subRowsByRow,
1348
+ loadingRows,
1349
+ onRowExpand,
1350
+ subRowDimension
1351
+ }) => {
1352
+ const effectiveSubRowDimension = subRowDimension ?? rowDimension;
1353
+ const rowValues = useMemo3(() => {
1354
+ const s = /* @__PURE__ */ new Set();
1355
+ for (const d of data) {
1356
+ const rowValue = d[rowDimension.key];
1357
+ if (rowValue != null) s.add(rowValue);
1317
1358
  }
1318
- let cancelled = false;
1319
- let t = null;
1320
- setVisibleCount(0);
1321
- const tick = () => {
1322
- setVisibleCount((prev) => {
1323
- const next = Math.min(prev + batchSize, rowValues.length);
1324
- if (next < rowValues.length && !cancelled) {
1325
- t = window.setTimeout(tick, batchDelayMs);
1359
+ return Array.from(s);
1360
+ }, [data, rowDimension.key]);
1361
+ const columnValues = useMemo3(() => {
1362
+ const s = /* @__PURE__ */ new Set();
1363
+ for (const d of data) {
1364
+ const columnValue = d[columnDimension.key];
1365
+ if (columnValue != null) s.add(columnValue);
1366
+ }
1367
+ return Array.from(s);
1368
+ }, [data, columnDimension.key]);
1369
+ const cellMap = useMemo3(
1370
+ () => buildCellMap(data, rowDimension.key, columnDimension.key),
1371
+ [data, rowDimension.key, columnDimension.key]
1372
+ );
1373
+ const rowTotalsSet = useMemo3(() => new Set(rowTotalsFor), [rowTotalsFor]);
1374
+ const columnTotalsSet = useMemo3(() => new Set(columnTotalsFor), [columnTotalsFor]);
1375
+ const hasRowTotals = rowTotalsSet.size > 0;
1376
+ const hasColumnTotals = columnTotalsSet.size > 0;
1377
+ const measureIndexByKey = useMemo3(() => {
1378
+ const map = /* @__PURE__ */ new Map();
1379
+ measures.forEach((m, i) => map.set(String(m.key), i));
1380
+ return map;
1381
+ }, [measures]);
1382
+ const { colTotals, rowTotals, grandTotals } = usePivotTotals(
1383
+ data,
1384
+ measures,
1385
+ rowDimension.key,
1386
+ columnDimension.key,
1387
+ columnValues,
1388
+ rowValues
1389
+ );
1390
+ const [expandedRows, setExpandedRows] = useState3(() => /* @__PURE__ */ new Set());
1391
+ const handleRowExpand = (rowKey) => {
1392
+ setExpandedRows((prev) => {
1393
+ const next = new Set(prev);
1394
+ const wasExpanded = next.has(rowKey);
1395
+ if (wasExpanded) {
1396
+ next.delete(rowKey);
1397
+ } else {
1398
+ next.add(rowKey);
1399
+ if (!subRowsByRow?.has(rowKey)) {
1400
+ onRowExpand?.(rowKey);
1326
1401
  }
1327
- return next;
1328
- });
1329
- };
1330
- t = window.setTimeout(tick, batchDelayMs);
1331
- return () => {
1332
- cancelled = true;
1333
- if (t !== null) window.clearTimeout(t);
1334
- };
1335
- }, [progressive, batchSize, batchDelayMs, rowValues.length, data]);
1336
- const visibleRows = progressive ? rowValues.slice(0, visibleCount) : rowValues;
1402
+ }
1403
+ return next;
1404
+ });
1405
+ };
1406
+ const visibleRows = useProgressiveRows(rowValues, {
1407
+ progressive,
1408
+ batchSize,
1409
+ batchDelayMs
1410
+ });
1411
+ const renderMeasureCells = (rowCellMap, rowKey, keyPrefix) => columnValues.flatMap(
1412
+ (columnValue) => measures.map((measure, idx) => {
1413
+ const object = rowCellMap.get(rowKey)?.get(String(columnValue)) ?? {};
1414
+ const value = object?.[measure.key];
1415
+ const key = `${keyPrefix}-${columnValue}-${measure.key}-${idx}`;
1416
+ const mi = measureIndexByKey.get(String(measure.key)) ?? -1;
1417
+ const colTotal = getMeasureTotal(colTotals, String(columnValue), mi, measures.length);
1418
+ const displayValue = getCellDisplayValue2(value, measure, object, colTotal);
1419
+ return /* @__PURE__ */ jsx9("td", { title: displayValue, children: displayValue }, key);
1420
+ })
1421
+ );
1422
+ const renderRowTotalCells = (getTotalValue, keyPrefix) => {
1423
+ if (!hasRowTotals) return null;
1424
+ return measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
1425
+ const measureIndex = measureIndexByKey.get(measure.key) ?? -1;
1426
+ const key = `${keyPrefix}-${measure.key}-${idx}`;
1427
+ const value = getTotalValue(measure.key, measureIndex);
1428
+ const displayValue = getCellDisplayValue2(
1429
+ value,
1430
+ measure,
1431
+ { [measure.key]: value },
1432
+ grandTotals[measureIndex] || 1
1433
+ );
1434
+ return /* @__PURE__ */ jsx9("td", { className: tableStyles2.boltCell, title: displayValue, children: displayValue }, key);
1435
+ });
1436
+ };
1437
+ const renderSubRows = (rowKey, subRows) => {
1438
+ const subRowValues = Array.from(
1439
+ new Set(subRows.map((sr) => sr[effectiveSubRowDimension.key]).filter((v) => v != null))
1440
+ );
1441
+ const subRowCellMap = buildCellMap(subRows, effectiveSubRowDimension.key, columnDimension.key);
1442
+ return subRowValues.map((subRowValue, subRowIdx) => {
1443
+ const subRowDimensionValue = effectiveSubRowDimension.formatValue ? effectiveSubRowDimension.formatValue(subRowValue) : subRowValue;
1444
+ return /* @__PURE__ */ jsxs4("tr", { className: tableStyles2.subRow, children: [
1445
+ /* @__PURE__ */ jsx9(
1446
+ "th",
1447
+ {
1448
+ scope: "row",
1449
+ className: clsx3(tableStyles2.stickyFirstColumn, tableStyles2.subRowFirstColumn),
1450
+ style: getTableCellWidthStyle(firstColumnWidth),
1451
+ title: subRowDimensionValue,
1452
+ children: /* @__PURE__ */ jsx9("span", { children: subRowDimensionValue })
1453
+ }
1454
+ ),
1455
+ renderMeasureCells(
1456
+ subRowCellMap,
1457
+ String(subRowValue),
1458
+ `sub-cell-${rowKey}-${subRowIdx}`
1459
+ ),
1460
+ renderRowTotalCells(
1461
+ (key) => computeSubRowTotal(subRowCellMap, String(subRowValue), columnValues, key),
1462
+ `sub-total-${rowKey}-${subRowIdx}`
1463
+ )
1464
+ ] }, `sub-${rowKey}-${subRowIdx}`);
1465
+ });
1466
+ };
1337
1467
  return /* @__PURE__ */ jsx9("div", { className: clsx3(tableStyles2.tableFullContainer, className), children: /* @__PURE__ */ jsx9(
1338
1468
  "div",
1339
1469
  {
@@ -1356,6 +1486,7 @@ var PivotTable = ({
1356
1486
  rowSpan: 1,
1357
1487
  title: columnDimension.label,
1358
1488
  className: tableStyles2.stickyFirstColumn,
1489
+ style: getTableCellWidthStyle(firstColumnWidth),
1359
1490
  children: columnDimension.label
1360
1491
  }
1361
1492
  ),
@@ -1423,56 +1554,58 @@ var PivotTable = ({
1423
1554
  ] }),
1424
1555
  /* @__PURE__ */ jsxs4("tbody", { children: [
1425
1556
  visibleRows.map((row) => {
1557
+ const rowKey = String(row);
1558
+ const isExpanded = expandedRows.has(rowKey);
1559
+ const isLoading = loadingRows?.has(rowKey) ?? false;
1560
+ const subRows = subRowsByRow?.get(rowKey) ?? [];
1561
+ const hasLoadedSubRows = subRows.length > 0;
1426
1562
  const rowDimensionValue = rowDimension.formatValue ? rowDimension.formatValue(row) : row;
1427
- return /* @__PURE__ */ jsxs4("tr", { children: [
1428
- /* @__PURE__ */ jsx9(
1429
- "th",
1563
+ const ariaLabel = expandableRows ? isLoading ? "Loading" : isExpanded ? `Collapse ${rowDimensionValue}` : `Expand ${rowDimensionValue}` : "";
1564
+ const showSubRows = isExpanded && !isLoading && hasLoadedSubRows;
1565
+ return /* @__PURE__ */ jsxs4(Fragment3, { children: [
1566
+ /* @__PURE__ */ jsxs4(
1567
+ "tr",
1430
1568
  {
1431
- scope: "row",
1569
+ className: clsx3(isExpanded && tableStyles2.expandedRow),
1432
1570
  title: rowDimensionValue,
1433
- className: tableStyles2.stickyFirstColumn,
1434
- children: rowDimensionValue
1435
- }
1436
- ),
1437
- columnValues.flatMap(
1438
- (columnValue) => measures.map((measure, idx) => {
1439
- const object = cellMap.get(String(row))?.get(String(columnValue)) ?? {};
1440
- const value = object?.[measure.key];
1441
- const key = `cell-${row}-${columnValue}-${measure.key}-${idx}`;
1442
- const getDisplayValue = () => {
1443
- if (measure.showAsPercentage) {
1444
- const mi = measureIndexByKey.get(String(measure.key)) ?? -1;
1445
- const totalsForCol = colTotals.get(String(columnValue)) ?? measures.map(() => 0);
1446
- const colTotal = mi >= 0 ? totalsForCol[mi] ?? 0 : 0;
1447
- const shouldShowPct = measure.showAsPercentage && isNumber(Number(value)) && isNumber(colTotal) && colTotal > 0;
1448
- if (shouldShowPct) {
1449
- const percentage = value / colTotal * 100;
1450
- return `${percentage.toFixed(measure.percentageDecimalPlaces ?? 0)}%`;
1571
+ children: [
1572
+ /* @__PURE__ */ jsx9(
1573
+ "th",
1574
+ {
1575
+ scope: "row",
1576
+ title: rowDimensionValue,
1577
+ className: clsx3(
1578
+ tableStyles2.stickyFirstColumn,
1579
+ expandableRows && tableStyles2.expandableRowCell
1580
+ ),
1581
+ onClick: () => expandableRows && handleRowExpand(rowKey),
1582
+ onKeyDown: (e) => {
1583
+ if (expandableRows && (e.key === "Enter" || e.key === " ")) {
1584
+ e.preventDefault();
1585
+ handleRowExpand(rowKey);
1586
+ }
1587
+ },
1588
+ tabIndex: expandableRows ? 0 : void 0,
1589
+ role: expandableRows ? "button" : void 0,
1590
+ "aria-expanded": expandableRows ? isExpanded : void 0,
1591
+ style: getTableCellWidthStyle(firstColumnWidth),
1592
+ "aria-label": ariaLabel,
1593
+ children: /* @__PURE__ */ jsxs4("span", { className: tableStyles2.firstColumnCell, children: [
1594
+ expandableRows && /* @__PURE__ */ jsx9(Fragment4, { children: isLoading ? /* @__PURE__ */ jsx9(IconLoader2, { className: tableStyles2.subRowLoading }) : isExpanded ? /* @__PURE__ */ jsx9(IconChevronDown, {}) : /* @__PURE__ */ jsx9(IconChevronRight, {}) }),
1595
+ /* @__PURE__ */ jsx9("span", { children: rowDimensionValue })
1596
+ ] })
1451
1597
  }
1452
- }
1453
- return measure.accessor ? measure.accessor(object) : value;
1454
- };
1455
- const columnValueDisplay = getDisplayValue();
1456
- return /* @__PURE__ */ jsx9("td", { title: columnValueDisplay, children: columnValueDisplay }, key);
1457
- })
1458
- ),
1459
- hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
1460
- const totalsForRow = rowTotals.get(String(row)) ?? measures.map(() => 0);
1461
- const measureIndex = measureIndexByKey.get(measure.key) ?? -1;
1462
- const key = `row-total-${String(row)}-${measure.key}-${idx}`;
1463
- const value = measureIndex >= 0 ? totalsForRow[measureIndex] ?? 0 : 0;
1464
- let displayValue = value;
1465
- if (measure.showAsPercentage) {
1466
- displayValue = getPercentageDisplay(
1467
- value / (grandTotals[measureIndex] || 1) * 100,
1468
- measure.percentageDecimalPlaces ?? 0
1469
- );
1470
- } else if (measure.accessor) {
1471
- displayValue = measure.accessor({ [measure.key]: value });
1598
+ ),
1599
+ renderMeasureCells(cellMap, String(row), `cell-${row}`),
1600
+ renderRowTotalCells(
1601
+ (_key, mi) => getMeasureTotal(rowTotals, String(row), mi, measures.length),
1602
+ `row-total-${String(row)}`
1603
+ )
1604
+ ]
1472
1605
  }
1473
- return /* @__PURE__ */ jsx9("td", { className: tableStyles2.boltCell, title: displayValue, children: displayValue }, key);
1474
- })
1475
- ] }, `row-${row}`);
1606
+ ),
1607
+ showSubRows && renderSubRows(rowKey, subRows)
1608
+ ] }, `row-group-${rowKey}`);
1476
1609
  }),
1477
1610
  hasColumnTotals && /* @__PURE__ */ jsxs4("tr", { className: tableStyles2.stickyLastRow, children: [
1478
1611
  /* @__PURE__ */ jsx9(
@@ -1481,16 +1614,21 @@ var PivotTable = ({
1481
1614
  scope: "row",
1482
1615
  className: clsx3(tableStyles2.stickyFirstColumn, tableStyles2.boltCell),
1483
1616
  title: totalLabel,
1617
+ style: getTableCellWidthStyle(firstColumnWidth),
1484
1618
  children: totalLabel
1485
1619
  }
1486
1620
  ),
1487
1621
  columnValues.flatMap(
1488
1622
  (columnValue) => measures.map((measure, idx) => {
1489
1623
  const show = columnTotalsSet.has(String(measure.key));
1490
- const totalsForCol = colTotals.get(String(columnValue)) ?? measures.map(() => 0);
1491
- const mi = measures.findIndex((mm) => String(mm.key) === String(measure.key));
1624
+ const mi = measureIndexByKey.get(String(measure.key)) ?? -1;
1492
1625
  const key = `col-total-${String(columnValue)}-${measure.key}-${idx}`;
1493
- const value = totalsForCol[mi] ?? 0;
1626
+ const value = getMeasureTotal(
1627
+ colTotals,
1628
+ String(columnValue),
1629
+ mi,
1630
+ measures.length
1631
+ );
1494
1632
  let displayValue = value;
1495
1633
  if (measure.showAsPercentage) {
1496
1634
  displayValue = getPercentageDisplay(
@@ -1505,7 +1643,7 @@ var PivotTable = ({
1505
1643
  })
1506
1644
  ),
1507
1645
  hasRowTotals && measures.filter((measure) => rowTotalsSet.has(measure.key)).map((measure, idx) => {
1508
- const measureIndex = measures.findIndex((m) => String(m.key) === measure.key);
1646
+ const measureIndex = measureIndexByKey.get(measure.key) ?? -1;
1509
1647
  const key = `grand-total-${measure.key}-${idx}`;
1510
1648
  const value = grandTotals[measureIndex] ?? 0;
1511
1649
  let displayValue = value;
@@ -1530,7 +1668,7 @@ var PivotTable = ({
1530
1668
 
1531
1669
  // src/components/charts/tables/Table/TablePaginated/TablePaginated.tsx
1532
1670
  import * as React from "react";
1533
- import styles11 from "./tables.module-6DZDKDSH.module.css";
1671
+ import styles11 from "./tables.module-6REGLCSQ.module.css";
1534
1672
  import clsx7 from "clsx";
1535
1673
 
1536
1674
  // src/components/charts/tables/Table/components/TableHeader/TableHeader.tsx
@@ -1549,9 +1687,9 @@ var TableHeaderAlign = {
1549
1687
  };
1550
1688
 
1551
1689
  // src/components/charts/tables/Table/components/TableHeader/TableHeader.tsx
1552
- import tableStyles3 from "./tables.module-6DZDKDSH.module.css";
1690
+ import tableStyles3 from "./tables.module-6REGLCSQ.module.css";
1553
1691
  import clsx4 from "clsx";
1554
- import { useEffect as useEffect3, useState as useState3 } from "react";
1692
+ import { useEffect as useEffect3, useState as useState4 } from "react";
1555
1693
 
1556
1694
  // src/hooks/useDebounce.hook.ts
1557
1695
  import { useRef as useRef6, useEffect as useEffect2, useCallback as useCallback2 } from "react";
@@ -1594,7 +1732,7 @@ var TableHeader = ({
1594
1732
  showIndex,
1595
1733
  onSortChange
1596
1734
  }) => {
1597
- const [currentSort, setCurrentSort] = useState3(sort);
1735
+ const [currentSort, setCurrentSort] = useState4(sort);
1598
1736
  const debouncedUpdateState = useDebounce((value) => {
1599
1737
  if (value === void 0 && value === sort) {
1600
1738
  return;
@@ -1660,7 +1798,7 @@ import clsx6 from "clsx";
1660
1798
 
1661
1799
  // src/components/shared/ActionIcon/ActionIcon.tsx
1662
1800
  import clsx5 from "clsx";
1663
- import styles9 from "./ActionIcon.module-UMIOEH5M.module.css";
1801
+ import styles9 from "./ActionIcon.module-NQH2HPCG.module.css";
1664
1802
  import { jsx as jsx11 } from "react/jsx-runtime";
1665
1803
  var ActionIcon = ({ icon: Icon, className, ...props }) => {
1666
1804
  return /* @__PURE__ */ jsx11("button", { className: clsx5(styles9.actionIcon, className), ...props, children: /* @__PURE__ */ jsx11(Icon, { className: styles9.icon }) });
@@ -1668,8 +1806,8 @@ var ActionIcon = ({ icon: Icon, className, ...props }) => {
1668
1806
 
1669
1807
  // src/components/charts/tables/Table/components/TableBody/TableBody.tsx
1670
1808
  import { IconCopy, IconCopyCheckFilled } from "@tabler/icons-react";
1671
- import { useState as useState4 } from "react";
1672
- import tableStyles4 from "./tables.module-6DZDKDSH.module.css";
1809
+ import { useState as useState5 } from "react";
1810
+ import tableStyles4 from "./tables.module-6REGLCSQ.module.css";
1673
1811
  import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1674
1812
  var TableBody = ({
1675
1813
  headers,
@@ -1726,7 +1864,7 @@ var TableBodyCellWithCopy = ({
1726
1864
  children,
1727
1865
  style
1728
1866
  }) => {
1729
- const [isPressedCopy, setIsPressedCopy] = useState4(false);
1867
+ const [isPressedCopy, setIsPressedCopy] = useState5(false);
1730
1868
  const handleCopy = () => {
1731
1869
  setIsPressedCopy(true);
1732
1870
  if (value !== void 0) {
@@ -1762,7 +1900,7 @@ var TableBodyCellWithCopy = ({
1762
1900
  // src/components/charts/tables/Table/components/TablePagination/TablePagination.tsx
1763
1901
  import {
1764
1902
  IconChevronLeft,
1765
- IconChevronRight,
1903
+ IconChevronRight as IconChevronRight2,
1766
1904
  IconChevronsLeft,
1767
1905
  IconChevronsRight
1768
1906
  } from "@tabler/icons-react";
@@ -1817,7 +1955,7 @@ var TablePagination = ({
1817
1955
  /* @__PURE__ */ jsx13(
1818
1956
  ActionIcon,
1819
1957
  {
1820
- icon: IconChevronRight,
1958
+ icon: IconChevronRight2,
1821
1959
  onClick: () => {
1822
1960
  onPageChange(page + 1);
1823
1961
  },
@@ -1896,13 +2034,13 @@ var TablePaginated = React.forwardRef(
1896
2034
  TablePaginated.displayName = "TablePaginated";
1897
2035
 
1898
2036
  // src/components/charts/tables/Table/TablePaginated/TablePaginated.hooks.ts
1899
- import { useMemo as useMemo3 } from "react";
2037
+ import { useMemo as useMemo4 } from "react";
1900
2038
  var useTableGetRowsPerPage = ({
1901
2039
  availableHeight,
1902
2040
  headerHeight,
1903
2041
  rowHeight,
1904
2042
  footerHeight = 0
1905
- }) => useMemo3(() => {
2043
+ }) => useMemo4(() => {
1906
2044
  const h = availableHeight;
1907
2045
  if (!h) return 0;
1908
2046
  let available = h - headerHeight - footerHeight;
@@ -1913,7 +2051,7 @@ var useTableGetRowsPerPage = ({
1913
2051
 
1914
2052
  // src/components/charts/tables/Table/TableScrollable/TableScrollable.tsx
1915
2053
  import clsx8 from "clsx";
1916
- import tableStyles5 from "./tables.module-6DZDKDSH.module.css";
2054
+ import tableStyles5 from "./tables.module-6REGLCSQ.module.css";
1917
2055
 
1918
2056
  // src/components/charts/tables/Table/TableScrollable/TableScrollable.hooks.ts
1919
2057
  import { useEffect as useEffect5, useRef as useRef7 } from "react";
@@ -2028,13 +2166,13 @@ var TableScrollable = forwardRef2(
2028
2166
  TableScrollable.displayName = "TableScrollable";
2029
2167
 
2030
2168
  // src/components/editors/dates/DateRangePicker/DateRangePicker.tsx
2031
- import { useState as useState5 } from "react";
2169
+ import { useState as useState6 } from "react";
2032
2170
  import { DayPicker } from "react-day-picker";
2033
2171
  import "./DateRangePicker-PLOUUN7Q.css";
2034
2172
 
2035
2173
  // src/components/editors/dates/DateRangePicker/DateRangePickerChevron.tsx
2036
- import { IconCaretDownFilled as IconCaretDownFilled2 } from "@tabler/icons-react";
2037
- import styles12 from "./DateRangePickerChevron.module-ABYY5R7C.module.css";
2174
+ import { IconCaretLeftFilled } from "@tabler/icons-react";
2175
+ import styles12 from "./DateRangePickerChevron.module-U3RB6ZHO.module.css";
2038
2176
  import clsx9 from "clsx";
2039
2177
  import { jsx as jsx16 } from "react/jsx-runtime";
2040
2178
  var SMALL_SIZE = 18;
@@ -2042,7 +2180,7 @@ var DateRangePickerChevron = ({
2042
2180
  orientation,
2043
2181
  size
2044
2182
  }) => {
2045
- const rotation = orientation === "left" ? "rotate(90deg)" : orientation === "right" ? "rotate(-90deg)" : void 0;
2183
+ const rotation = orientation === "left" ? void 0 : "rotate(180deg)";
2046
2184
  const isSmallChevron = size === SMALL_SIZE;
2047
2185
  return /* @__PURE__ */ jsx16(
2048
2186
  "button",
@@ -2051,7 +2189,7 @@ var DateRangePickerChevron = ({
2051
2189
  style: {
2052
2190
  transform: rotation
2053
2191
  },
2054
- children: /* @__PURE__ */ jsx16(IconCaretDownFilled2, {})
2192
+ children: /* @__PURE__ */ jsx16(IconCaretLeftFilled, {})
2055
2193
  }
2056
2194
  );
2057
2195
  };
@@ -2074,7 +2212,7 @@ var DateRangePicker = ({
2074
2212
  locale = "en",
2075
2213
  onChange
2076
2214
  }) => {
2077
- const [month, setMonth] = useState5(value?.from ?? /* @__PURE__ */ new Date());
2215
+ const [month, setMonth] = useState6(value?.from ?? /* @__PURE__ */ new Date());
2078
2216
  const handleChange = (range) => {
2079
2217
  if (range?.to) {
2080
2218
  range.to = endOfDayUTC(range.to);
@@ -2105,7 +2243,7 @@ var DateRangePicker = ({
2105
2243
  };
2106
2244
 
2107
2245
  // src/components/editors/dates/DateRangePickerField/DateRangePickerField.tsx
2108
- import { useState as useState6 } from "react";
2246
+ import { useState as useState7 } from "react";
2109
2247
 
2110
2248
  // src/components/shared/Field/FieldHeader.tsx
2111
2249
  import clsx10 from "clsx";
@@ -2156,14 +2294,14 @@ var Dropdown = ({
2156
2294
 
2157
2295
  // src/components/editors/selects/shared/SelectFieldTrigger/SelectFieldTrigger.tsx
2158
2296
  import styles15 from "./SelectFieldTrigger.module-M6BRE7IY.module.css";
2159
- import { IconCaretDownFilled as IconCaretDownFilled3, IconLoader2, IconX } from "@tabler/icons-react";
2297
+ import { IconCaretDownFilled as IconCaretDownFilled2, IconLoader2 as IconLoader22, IconX } from "@tabler/icons-react";
2160
2298
  import clsx12 from "clsx";
2161
2299
  import { forwardRef as forwardRef3 } from "react";
2162
2300
 
2163
2301
  // src/components/shared/GhostButton/GhostButton.tsx
2164
2302
  import React3 from "react";
2165
2303
  import clsx11 from "clsx";
2166
- import styles14 from "./GhostButton.module-43KOFC6W.module.css";
2304
+ import styles14 from "./GhostButton.module-JZ7YOOU5.module.css";
2167
2305
  import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
2168
2306
  var GhostButton = React3.forwardRef(
2169
2307
  ({ startIcon: StartIcon, endIcon: EndIcon, children, className, ...props }, ref) => {
@@ -2198,7 +2336,7 @@ var SelectFieldTrigger = forwardRef3(
2198
2336
  onClear?.();
2199
2337
  };
2200
2338
  if (variant === "ghost") {
2201
- return /* @__PURE__ */ jsxs13(GhostButton, { ref, endIcon: isLoading ? IconLoader2 : IconCaretDownFilled3, ...props, children: [
2339
+ return /* @__PURE__ */ jsxs13(GhostButton, { ref, endIcon: isLoading ? IconLoader22 : IconCaretDownFilled2, ...props, children: [
2202
2340
  displayValue,
2203
2341
  showClearButton && /* @__PURE__ */ jsx21(IconX, { onPointerDown: handleClear })
2204
2342
  ] });
@@ -2217,7 +2355,7 @@ var SelectFieldTrigger = forwardRef3(
2217
2355
  StartIcon && /* @__PURE__ */ jsx21(StartIcon, {}),
2218
2356
  /* @__PURE__ */ jsx21("span", { children: displayValue }),
2219
2357
  showClearButton && /* @__PURE__ */ jsx21(IconX, { onPointerDown: handleClear }),
2220
- isLoading ? /* @__PURE__ */ jsx21(IconLoader2, { className: styles15.loading }) : /* @__PURE__ */ jsx21(IconCaretDownFilled3, {})
2358
+ isLoading ? /* @__PURE__ */ jsx21(IconLoader22, { className: styles15.loading }) : /* @__PURE__ */ jsx21(IconCaretDownFilled2, {})
2221
2359
  ]
2222
2360
  }
2223
2361
  );
@@ -2307,7 +2445,7 @@ var FieldFeedback = ({ message, variant, className }) => {
2307
2445
  };
2308
2446
 
2309
2447
  // src/components/shared/Button/Button.tsx
2310
- import styles18 from "./Button.module-GOXSST7L.module.css";
2448
+ import styles18 from "./Button.module-LD3OBJVA.module.css";
2311
2449
  import clsx15 from "clsx";
2312
2450
  import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
2313
2451
  var Button = ({
@@ -2353,8 +2491,8 @@ var DateRangePickerField = ({
2353
2491
  avoidCollisions,
2354
2492
  onChange
2355
2493
  }) => {
2356
- const [isOpen, setIsOpen] = useState6(false);
2357
- const [currentDateRange, setCurrentDateRange] = useState6(value);
2494
+ const [isOpen, setIsOpen] = useState7(false);
2495
+ const [currentDateRange, setCurrentDateRange] = useState7(value);
2358
2496
  const valueLabel = getDateRangePickerLabel(value, displayValue);
2359
2497
  const hasError = error || !!errorMessage;
2360
2498
  const handleChange = () => {
@@ -2528,10 +2666,10 @@ NumberField.displayName = "NumberField";
2528
2666
 
2529
2667
  // src/components/editors/inputs/TextField/TextField.tsx
2530
2668
  import { forwardRef as forwardRef6 } from "react";
2531
- import { Fragment as Fragment3, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
2669
+ import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
2532
2670
  var TextField = forwardRef6(
2533
2671
  ({ value = "", placeholder = "Enter text", maxLength, error, errorMessage, ...props }, ref) => {
2534
- return /* @__PURE__ */ jsxs17(Fragment3, { children: [
2672
+ return /* @__PURE__ */ jsxs17(Fragment5, { children: [
2535
2673
  /* @__PURE__ */ jsx28(
2536
2674
  InputField,
2537
2675
  {
@@ -2552,7 +2690,7 @@ var TextField = forwardRef6(
2552
2690
  TextField.displayName = "TextField";
2553
2691
 
2554
2692
  // src/components/editors/selects/MultiSelectField/MultiSelectField.tsx
2555
- import { Fragment as Fragment4, useEffect as useEffect8, useMemo as useMemo4, useRef as useRef10, useState as useState7 } from "react";
2693
+ import { Fragment as Fragment6, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef10, useState as useState8 } from "react";
2556
2694
 
2557
2695
  // src/components/editors/selects/shared/SelectFieldContent/SelectFieldOptions/SelectFieldOption/SelectFieldOption.tsx
2558
2696
  import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
@@ -2663,10 +2801,10 @@ var MultiSelectField = ({
2663
2801
  error = false,
2664
2802
  errorMessage
2665
2803
  }) => {
2666
- const [isOpen, setIsOpen] = useState7(false);
2667
- const [searchValue, setSearchValue] = useState7("");
2668
- const [preValues, setPreValues] = useState7(values);
2669
- const [selectedLabel, setSelectedLabel] = useState7("");
2804
+ const [isOpen, setIsOpen] = useState8(false);
2805
+ const [searchValue, setSearchValue] = useState8("");
2806
+ const [preValues, setPreValues] = useState8(values);
2807
+ const [selectedLabel, setSelectedLabel] = useState8("");
2670
2808
  const searchFieldRef = useRef10(null);
2671
2809
  useSelectSearchFocus(isOpen, searchFieldRef);
2672
2810
  useEffect8(() => {
@@ -2688,9 +2826,9 @@ var MultiSelectField = ({
2688
2826
  setSelectedLabel(`(${selectedOptions.length}) ${newLabel}`);
2689
2827
  }
2690
2828
  }, [values, options, isLoading]);
2691
- const debouncedSearch = useMemo4(() => onSearch ? debounce(onSearch) : void 0, [onSearch]);
2829
+ const debouncedSearch = useMemo5(() => onSearch ? debounce(onSearch) : void 0, [onSearch]);
2692
2830
  const displayOptions = isSearchable && !onSearch ? options.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase())) : options;
2693
- const groupedOptions = useMemo4(() => groupOptionsByCategory(displayOptions), [displayOptions]);
2831
+ const groupedOptions = useMemo5(() => groupOptionsByCategory(displayOptions), [displayOptions]);
2694
2832
  const isSubmitDisabled = preValues.every((preValue) => values.includes(preValue)) && values.every((value) => preValues.includes(value));
2695
2833
  const handleSelectOption = (e, newValue) => {
2696
2834
  e.preventDefault();
@@ -2756,7 +2894,7 @@ var MultiSelectField = ({
2756
2894
  }
2757
2895
  ),
2758
2896
  /* @__PURE__ */ jsxs19(SelectFieldContentList, { disabled: isLoading, children: [
2759
- groupedOptions ? Object.entries(groupedOptions).map(([category, categoryOptions]) => /* @__PURE__ */ jsxs19(Fragment4, { children: [
2897
+ groupedOptions ? Object.entries(groupedOptions).map(([category, categoryOptions]) => /* @__PURE__ */ jsxs19(Fragment6, { children: [
2760
2898
  /* @__PURE__ */ jsx31(SelectFieldCategory, { label: category }),
2761
2899
  categoryOptions.map((option) => /* @__PURE__ */ jsx31(
2762
2900
  SelectListOption,
@@ -2798,7 +2936,7 @@ var MultiSelectField = ({
2798
2936
  };
2799
2937
 
2800
2938
  // src/components/editors/selects/SingleSelectField/SingleSelectField.tsx
2801
- import { Fragment as Fragment5, useEffect as useEffect9, useMemo as useMemo5, useRef as useRef11, useState as useState8 } from "react";
2939
+ import { Fragment as Fragment7, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef11, useState as useState9 } from "react";
2802
2940
  import { IconSearch as IconSearch2 } from "@tabler/icons-react";
2803
2941
  import styles24 from "./selects.module-MRJADSDF.module.css";
2804
2942
  import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
@@ -2823,9 +2961,9 @@ var SingleSelectField = ({
2823
2961
  align,
2824
2962
  variant
2825
2963
  }) => {
2826
- const [isOpen, setIsOpen] = useState8(false);
2827
- const [searchValue, setSearchValue] = useState8("");
2828
- const [selectedLabel, setSelectedLabel] = useState8(value);
2964
+ const [isOpen, setIsOpen] = useState9(false);
2965
+ const [searchValue, setSearchValue] = useState9("");
2966
+ const [selectedLabel, setSelectedLabel] = useState9(value);
2829
2967
  const searchFieldRef = useRef11(null);
2830
2968
  useSelectSearchFocus(isOpen, searchFieldRef);
2831
2969
  useEffect9(() => {
@@ -2838,9 +2976,9 @@ var SingleSelectField = ({
2838
2976
  setSelectedLabel(option.label);
2839
2977
  }
2840
2978
  }, [value, options]);
2841
- const debouncedSearch = useMemo5(() => onSearch ? debounce(onSearch) : void 0, [onSearch]);
2979
+ const debouncedSearch = useMemo6(() => onSearch ? debounce(onSearch) : void 0, [onSearch]);
2842
2980
  const displayOptions = searchable && !onSearch ? options.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase())) : options;
2843
- const groupedOptions = useMemo5(() => groupOptionsByCategory(displayOptions), [displayOptions]);
2981
+ const groupedOptions = useMemo6(() => groupOptionsByCategory(displayOptions), [displayOptions]);
2844
2982
  const handleChange = (newValue) => {
2845
2983
  setSearchValue("");
2846
2984
  onChange(newValue ?? "");
@@ -2899,7 +3037,7 @@ var SingleSelectField = ({
2899
3037
  }
2900
3038
  ),
2901
3039
  /* @__PURE__ */ jsxs20(SelectFieldContentList, { disabled: isLoading, children: [
2902
- groupedOptions ? Object.entries(groupedOptions).map(([category, categoryOptions]) => /* @__PURE__ */ jsxs20(Fragment5, { children: [
3040
+ groupedOptions ? Object.entries(groupedOptions).map(([category, categoryOptions]) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
2903
3041
  /* @__PURE__ */ jsx32(SelectFieldCategory, { label: category }),
2904
3042
  categoryOptions.map((option) => /* @__PURE__ */ jsx32(
2905
3043
  SelectListOption,
@@ -2982,7 +3120,7 @@ var Switch = ({
2982
3120
 
2983
3121
  // src/components/shared/ButtonIcon/ButtonIcon.tsx
2984
3122
  import clsx19 from "clsx";
2985
- import styles26 from "./ButtonIcon.module-JHFZQSMJ.module.css";
3123
+ import styles26 from "./ButtonIcon.module-Y74WWGDY.module.css";
2986
3124
  import { jsx as jsx34 } from "react/jsx-runtime";
2987
3125
  var ButtonIcon = ({
2988
3126
  icon: Icon,
@@ -3003,7 +3141,7 @@ var ButtonIcon = ({
3003
3141
 
3004
3142
  // src/components/shared/Card/Card.tsx
3005
3143
  import React4 from "react";
3006
- import styles27 from "./Card.module-AAOKM6DN.module.css";
3144
+ import styles27 from "./Card.module-YBJG5NGD.module.css";
3007
3145
  import clsx20 from "clsx";
3008
3146
  import { IconInfoCircle } from "@tabler/icons-react";
3009
3147
 
@@ -3144,6 +3282,32 @@ function Typography({
3144
3282
  return /* @__PURE__ */ jsx40(Component, { title, className: clsx23(styles31.typography, className), style, children });
3145
3283
  }
3146
3284
 
3285
+ // src/components/shared/Divider/Divider.tsx
3286
+ import clsx24 from "clsx";
3287
+ import styles32 from "./Divider.module-2BOWHKT3.module.css";
3288
+ import { jsx as jsx41 } from "react/jsx-runtime";
3289
+ var getStyle2 = (color, thickness, vertical) => {
3290
+ const style = {};
3291
+ if (color) style.backgroundColor = color;
3292
+ if (thickness) {
3293
+ if (vertical) {
3294
+ style.width = thickness;
3295
+ } else {
3296
+ style.height = thickness;
3297
+ }
3298
+ }
3299
+ return style;
3300
+ };
3301
+ var Divider = ({ color, thickness, vertical, className }) => {
3302
+ return /* @__PURE__ */ jsx41(
3303
+ "div",
3304
+ {
3305
+ className: clsx24(styles32.divider, vertical && styles32.vertical, className),
3306
+ style: getStyle2(color, thickness, vertical)
3307
+ }
3308
+ );
3309
+ };
3310
+
3147
3311
  // src/utils/object.utils.ts
3148
3312
  var shallowEqual = (object1, object2) => {
3149
3313
  const keys1 = Object.keys(object1 ?? {});
@@ -3169,6 +3333,7 @@ export {
3169
3333
  CardHeader,
3170
3334
  DateRangePicker,
3171
3335
  DateRangePickerField,
3336
+ Divider,
3172
3337
  DonutChart,
3173
3338
  Dropdown,
3174
3339
  FieldFeedback,