@gridkitjs/react 0.19.0 → 0.20.0

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
@@ -6,7 +6,7 @@ import {
6
6
  useId as useId2,
7
7
  useImperativeHandle as useImperativeHandle3,
8
8
  useMemo as useMemo5,
9
- useRef as useRef23,
9
+ useRef as useRef24,
10
10
  useState as useState19
11
11
  } from "react";
12
12
  import {
@@ -593,6 +593,27 @@ function createRowPropsResolver() {
593
593
  };
594
594
  }
595
595
 
596
+ // src/DataGrid/components/GridEmptyRow.tsx
597
+ import { jsx as jsx4 } from "react/jsx-runtime";
598
+ function GridEmptyRow({
599
+ columnCount,
600
+ viewportWidth,
601
+ children
602
+ }) {
603
+ const contentStyle = viewportWidth === null ? void 0 : {
604
+ "--gridkit-empty-width": `${String(viewportWidth)}px`
605
+ };
606
+ return /* @__PURE__ */ jsx4("tr", { role: "row", className: "gridkit-grid-empty-row", children: /* @__PURE__ */ jsx4(
607
+ "td",
608
+ {
609
+ role: "gridcell",
610
+ colSpan: columnCount,
611
+ className: "gridkit-grid-empty-cell",
612
+ children: /* @__PURE__ */ jsx4("div", { className: "gridkit-grid-empty-content", style: contentStyle, children })
613
+ }
614
+ ) });
615
+ }
616
+
596
617
  // src/DataGrid/components/GridGroupRow.tsx
597
618
  import { memo } from "react";
598
619
  import {
@@ -615,7 +636,7 @@ function renderAggregate(value, spec, column, rows, locale) {
615
636
  }
616
637
 
617
638
  // src/DataGrid/components/GridGroupRow.tsx
618
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
639
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
619
640
  function GridGroupRowComponent({
620
641
  columnCount,
621
642
  groupId,
@@ -637,7 +658,7 @@ function GridGroupRowComponent({
637
658
  cellMessages,
638
659
  ref
639
660
  }) {
640
- return /* @__PURE__ */ jsx4(
661
+ return /* @__PURE__ */ jsx5(
641
662
  "tr",
642
663
  {
643
664
  ref,
@@ -653,7 +674,7 @@ function GridGroupRowComponent({
653
674
  "gridkit-grid-group-row",
654
675
  `is-group-level-${String(level)}`
655
676
  ),
656
- children: /* @__PURE__ */ jsx4(
677
+ children: /* @__PURE__ */ jsx5(
657
678
  "td",
658
679
  {
659
680
  role: "gridcell",
@@ -667,7 +688,7 @@ function GridGroupRowComponent({
667
688
  className: "gridkit-grid-group-cell-content",
668
689
  style: { paddingInlineStart: `${String(level * 1.25 + 0.5)}rem` },
669
690
  children: [
670
- /* @__PURE__ */ jsx4(
691
+ /* @__PURE__ */ jsx5(
671
692
  "span",
672
693
  {
673
694
  className: classNames(
@@ -688,7 +709,7 @@ function GridGroupRowComponent({
688
709
  count,
689
710
  ")"
690
711
  ] }),
691
- aggregates.length > 0 && /* @__PURE__ */ jsx4("span", { className: "gridkit-group-aggregates", children: aggregates.map((spec) => {
712
+ aggregates.length > 0 && /* @__PURE__ */ jsx5("span", { className: "gridkit-group-aggregates", children: aggregates.map((spec) => {
692
713
  const key = spec.id ?? spec.columnId;
693
714
  const aggregateValue = results.get(key);
694
715
  const column = definitions.get(spec.columnId);
@@ -735,7 +756,7 @@ function textAlignFor(alignment) {
735
756
  }
736
757
 
737
758
  // src/DataGrid/components/GridGroupSummaryRow.tsx
738
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
759
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
739
760
  function GridGroupSummaryRowComponent({
740
761
  groupId,
741
762
  level,
@@ -747,7 +768,7 @@ function GridGroupSummaryRowComponent({
747
768
  locale,
748
769
  ref
749
770
  }) {
750
- return /* @__PURE__ */ jsx5(
771
+ return /* @__PURE__ */ jsx6(
751
772
  "tr",
752
773
  {
753
774
  ref,
@@ -777,7 +798,7 @@ function GridGroupSummaryRowComponent({
777
798
  ...pinnedCellStyle(entry)
778
799
  },
779
800
  children: [
780
- entry.id === columns[0]?.id && /* @__PURE__ */ jsx5(
801
+ entry.id === columns[0]?.id && /* @__PURE__ */ jsx6(
781
802
  "span",
782
803
  {
783
804
  className: "gridkit-grid-group-summary-indent",
@@ -815,7 +836,7 @@ import {
815
836
  formatCellValue
816
837
  } from "@gridkitjs/core";
817
838
  import { memo as memo3 } from "react";
818
- import { jsx as jsx6 } from "react/jsx-runtime";
839
+ import { jsx as jsx7 } from "react/jsx-runtime";
819
840
  function GridRowComponent({
820
841
  columns,
821
842
  rowId,
@@ -843,7 +864,7 @@ function GridRowComponent({
843
864
  cellsSelectable ? "Space Enter" : "",
844
865
  contextMenu ? "Shift+F10" : ""
845
866
  ].filter(Boolean).join(" ");
846
- return /* @__PURE__ */ jsx6(
867
+ return /* @__PURE__ */ jsx7(
847
868
  "tr",
848
869
  {
849
870
  ...rowAttributes,
@@ -865,7 +886,7 @@ function GridRowComponent({
865
886
  const { id, column, alignment } = entry;
866
887
  const value = accessDotted(row, column.field);
867
888
  const cellSelected = id === selectedColumnId;
868
- return /* @__PURE__ */ jsx6(
889
+ return /* @__PURE__ */ jsx7(
869
890
  "td",
870
891
  {
871
892
  role: "gridcell",
@@ -905,7 +926,7 @@ var GridRow = memo3(GridRowComponent);
905
926
  var GridRow_default = GridRow;
906
927
 
907
928
  // src/DataGrid/components/GridBody.tsx
908
- import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
929
+ import { Fragment, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
909
930
  function GridBody({
910
931
  columns,
911
932
  definitions,
@@ -919,6 +940,9 @@ function GridBody({
919
940
  virtualRange,
920
941
  infiniteScroll,
921
942
  sentinelRef,
943
+ empty,
944
+ emptyTemplate,
945
+ viewportWidth,
922
946
  locale,
923
947
  getRowProps,
924
948
  onRowClick,
@@ -1050,7 +1074,7 @@ function GridBody({
1050
1074
  // to give the browser's scrollbar the correct total height and thumb
1051
1075
  // position, the same way `GridFooter`'s `<tfoot>` isn't a "row" to
1052
1076
  // any of this grid's own row-counting logic.
1053
- /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx7(
1077
+ /* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
1054
1078
  "td",
1055
1079
  {
1056
1080
  style: {
@@ -1064,7 +1088,7 @@ function GridBody({
1064
1088
  switch (entry.kind) {
1065
1089
  case "data": {
1066
1090
  const rowProps = rowPropsOf(entry.rowId);
1067
- return /* @__PURE__ */ jsx7(
1091
+ return /* @__PURE__ */ jsx8(
1068
1092
  GridRow_default,
1069
1093
  {
1070
1094
  ref: virtualRange?.measureRow(entry.rowIndex),
@@ -1096,7 +1120,7 @@ function GridBody({
1096
1120
  );
1097
1121
  }
1098
1122
  case "group-summary":
1099
- return /* @__PURE__ */ jsx7(
1123
+ return /* @__PURE__ */ jsx8(
1100
1124
  GridGroupSummaryRow_default,
1101
1125
  {
1102
1126
  ref: virtualRange?.measureRow(entry.rowIndex),
@@ -1112,7 +1136,7 @@ function GridBody({
1112
1136
  `${entry.groupId}-summary`
1113
1137
  );
1114
1138
  case "group":
1115
- return /* @__PURE__ */ jsx7(
1139
+ return /* @__PURE__ */ jsx8(
1116
1140
  GridGroupRow_default,
1117
1141
  {
1118
1142
  ref: virtualRange?.measureRow(entry.rowIndex),
@@ -1141,7 +1165,15 @@ function GridBody({
1141
1165
  return entry;
1142
1166
  }
1143
1167
  }),
1144
- virtualRange !== null && virtualRange.offsetAfter > 0 && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx7(
1168
+ empty !== null && /* @__PURE__ */ jsx8(
1169
+ GridEmptyRow,
1170
+ {
1171
+ columnCount: columns.length,
1172
+ viewportWidth,
1173
+ children: emptyTemplate ? emptyTemplate(empty) : empty.filtered ? messages.noMatchingRows : messages.noRows
1174
+ }
1175
+ ),
1176
+ virtualRange !== null && virtualRange.offsetAfter > 0 && /* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
1145
1177
  "td",
1146
1178
  {
1147
1179
  style: {
@@ -1152,7 +1184,7 @@ function GridBody({
1152
1184
  }
1153
1185
  ) }),
1154
1186
  infiniteScroll?.hasMore && /* @__PURE__ */ jsxs5(Fragment, { children: [
1155
- infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", className: "gridkit-grid-loading-row", children: /* @__PURE__ */ jsx7(
1187
+ infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx8("tr", { "aria-hidden": "true", className: "gridkit-grid-loading-row", children: /* @__PURE__ */ jsx8(
1156
1188
  "td",
1157
1189
  {
1158
1190
  colSpan: columns.length,
@@ -1160,13 +1192,13 @@ function GridBody({
1160
1192
  children: infiniteScroll.loadingTemplate ? infiniteScroll.loadingTemplate() : messages.loadingMore
1161
1193
  }
1162
1194
  ) }),
1163
- /* @__PURE__ */ jsx7(
1195
+ /* @__PURE__ */ jsx8(
1164
1196
  "tr",
1165
1197
  {
1166
1198
  "aria-hidden": "true",
1167
1199
  ref: sentinelRef,
1168
1200
  className: "gridkit-grid-sentinel-row",
1169
- children: /* @__PURE__ */ jsx7(
1201
+ children: /* @__PURE__ */ jsx8(
1170
1202
  "td",
1171
1203
  {
1172
1204
  colSpan: columns.length,
@@ -1182,7 +1214,7 @@ function GridBody({
1182
1214
  }
1183
1215
 
1184
1216
  // src/DataGrid/components/GridFooter.tsx
1185
- import { jsx as jsx8 } from "react/jsx-runtime";
1217
+ import { jsx as jsx9 } from "react/jsx-runtime";
1186
1218
  function GridFooter({
1187
1219
  columns,
1188
1220
  aggregates,
@@ -1191,7 +1223,7 @@ function GridFooter({
1191
1223
  locale,
1192
1224
  ariaRowIndex
1193
1225
  }) {
1194
- return /* @__PURE__ */ jsx8("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx8(
1226
+ return /* @__PURE__ */ jsx9("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx9(
1195
1227
  "tr",
1196
1228
  {
1197
1229
  className: "gridkit-grid-footer",
@@ -1201,7 +1233,7 @@ function GridFooter({
1201
1233
  const specs = aggregates.filter(
1202
1234
  (candidate) => candidate.columnId === entry.id
1203
1235
  );
1204
- return /* @__PURE__ */ jsx8(
1236
+ return /* @__PURE__ */ jsx9(
1205
1237
  "td",
1206
1238
  {
1207
1239
  role: "gridcell",
@@ -1233,9 +1265,40 @@ function GridFooter({
1233
1265
  ) });
1234
1266
  }
1235
1267
 
1268
+ // src/DataGrid/components/GridLoadingOverlay.tsx
1269
+ import { jsx as jsx10 } from "react/jsx-runtime";
1270
+ function GridLoadingOverlay({
1271
+ empty,
1272
+ viewportWidth,
1273
+ children
1274
+ }) {
1275
+ const contentStyle = viewportWidth === null ? void 0 : {
1276
+ "--gridkit-loading-width": `${String(viewportWidth)}px`
1277
+ };
1278
+ return /* @__PURE__ */ jsx10(
1279
+ "div",
1280
+ {
1281
+ role: "row",
1282
+ className: classNames(
1283
+ "gridkit-grid-loading-overlay",
1284
+ empty && "is-empty"
1285
+ ),
1286
+ children: /* @__PURE__ */ jsx10(
1287
+ "div",
1288
+ {
1289
+ role: "gridcell",
1290
+ className: "gridkit-grid-loading-overlay-content",
1291
+ style: contentStyle,
1292
+ children
1293
+ }
1294
+ )
1295
+ }
1296
+ );
1297
+ }
1298
+
1236
1299
  // src/DataGrid/components/GridPager.tsx
1237
1300
  import { paginationWindow } from "@gridkitjs/core/renderer";
1238
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1301
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1239
1302
  function PagerNavButton({
1240
1303
  className,
1241
1304
  label,
@@ -1243,7 +1306,7 @@ function PagerNavButton({
1243
1306
  onClick,
1244
1307
  children
1245
1308
  }) {
1246
- return /* @__PURE__ */ jsx9(
1309
+ return /* @__PURE__ */ jsx11(
1247
1310
  "button",
1248
1311
  {
1249
1312
  type: "button",
@@ -1259,13 +1322,15 @@ function PagerNavButton({
1259
1322
  );
1260
1323
  }
1261
1324
  function GridPager({ pager, config, messages }) {
1262
- const { pagination, pageCount, currentPage } = pager;
1325
+ const { pagination } = pager;
1326
+ const pageCount = Math.max(1, pager.pageCount);
1327
+ const currentPage = Math.max(1, pager.currentPage);
1263
1328
  const variant = config?.variant ?? "compact";
1264
1329
  const sizeOptions = config?.sizeOptions;
1265
1330
  const atFirst = pagination.pageIndex <= 0;
1266
1331
  const atLast = pagination.pageIndex >= pageCount - 1;
1267
1332
  const barStyle = {
1268
- "--gridkit-pager-digits": String(String(Math.max(1, pageCount)).length)
1333
+ "--gridkit-pager-digits": String(String(pageCount).length)
1269
1334
  };
1270
1335
  return /* @__PURE__ */ jsxs6(
1271
1336
  "div",
@@ -1275,7 +1340,7 @@ function GridPager({ pager, config, messages }) {
1275
1340
  "aria-label": messages.pagerLabel,
1276
1341
  children: [
1277
1342
  /* @__PURE__ */ jsxs6("div", { className: "gridkit-grid-pager-bar", style: barStyle, children: [
1278
- /* @__PURE__ */ jsx9(
1343
+ /* @__PURE__ */ jsx11(
1279
1344
  PagerNavButton,
1280
1345
  {
1281
1346
  className: "gridkit-grid-pager-first",
@@ -1284,10 +1349,10 @@ function GridPager({ pager, config, messages }) {
1284
1349
  onClick: () => {
1285
1350
  pager.goToPage(0);
1286
1351
  },
1287
- children: /* @__PURE__ */ jsx9(ChevronsLeftIcon, {})
1352
+ children: /* @__PURE__ */ jsx11(ChevronsLeftIcon, {})
1288
1353
  }
1289
1354
  ),
1290
- /* @__PURE__ */ jsx9(
1355
+ /* @__PURE__ */ jsx11(
1291
1356
  PagerNavButton,
1292
1357
  {
1293
1358
  className: "gridkit-grid-pager-previous",
@@ -1296,14 +1361,14 @@ function GridPager({ pager, config, messages }) {
1296
1361
  onClick: () => {
1297
1362
  pager.previousPage();
1298
1363
  },
1299
- children: /* @__PURE__ */ jsx9(ChevronLeftIcon, {})
1364
+ children: /* @__PURE__ */ jsx11(ChevronLeftIcon, {})
1300
1365
  }
1301
1366
  ),
1302
1367
  variant === "numbered" ? paginationWindow(currentPage, pageCount, {
1303
1368
  boundaryCount: config?.boundaryCount,
1304
1369
  siblingCount: config?.siblingCount
1305
1370
  }).map(
1306
- (entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx9(
1371
+ (entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx11(
1307
1372
  "span",
1308
1373
  {
1309
1374
  className: "gridkit-grid-pager-ellipsis",
@@ -1311,7 +1376,7 @@ function GridPager({ pager, config, messages }) {
1311
1376
  children: "\u2026"
1312
1377
  },
1313
1378
  `ellipsis-${String(index)}`
1314
- ) : /* @__PURE__ */ jsx9(
1379
+ ) : /* @__PURE__ */ jsx11(
1315
1380
  "button",
1316
1381
  {
1317
1382
  type: "button",
@@ -1326,11 +1391,8 @@ function GridPager({ pager, config, messages }) {
1326
1391
  entry
1327
1392
  )
1328
1393
  ) : /* @__PURE__ */ jsxs6("span", { className: "gridkit-grid-pager-status-slot", children: [
1329
- /* @__PURE__ */ jsx9("span", { className: "gridkit-grid-pager-status", children: messages.pageStatus(
1330
- pageCount === 0 ? 0 : currentPage,
1331
- pageCount
1332
- ) }),
1333
- /* @__PURE__ */ jsx9(
1394
+ /* @__PURE__ */ jsx11("span", { className: "gridkit-grid-pager-status", children: messages.pageStatus(currentPage, pageCount) }),
1395
+ /* @__PURE__ */ jsx11(
1334
1396
  "span",
1335
1397
  {
1336
1398
  className: "gridkit-grid-pager-status-sizer",
@@ -1339,7 +1401,7 @@ function GridPager({ pager, config, messages }) {
1339
1401
  }
1340
1402
  )
1341
1403
  ] }),
1342
- /* @__PURE__ */ jsx9(
1404
+ /* @__PURE__ */ jsx11(
1343
1405
  PagerNavButton,
1344
1406
  {
1345
1407
  className: "gridkit-grid-pager-next",
@@ -1348,10 +1410,10 @@ function GridPager({ pager, config, messages }) {
1348
1410
  onClick: () => {
1349
1411
  pager.nextPage();
1350
1412
  },
1351
- children: /* @__PURE__ */ jsx9(ChevronRightIcon, {})
1413
+ children: /* @__PURE__ */ jsx11(ChevronRightIcon, {})
1352
1414
  }
1353
1415
  ),
1354
- /* @__PURE__ */ jsx9(
1416
+ /* @__PURE__ */ jsx11(
1355
1417
  PagerNavButton,
1356
1418
  {
1357
1419
  className: "gridkit-grid-pager-last",
@@ -1360,22 +1422,22 @@ function GridPager({ pager, config, messages }) {
1360
1422
  onClick: () => {
1361
1423
  pager.goToPage(pageCount - 1);
1362
1424
  },
1363
- children: /* @__PURE__ */ jsx9(ChevronsRightIcon, {})
1425
+ children: /* @__PURE__ */ jsx11(ChevronsRightIcon, {})
1364
1426
  }
1365
1427
  )
1366
1428
  ] }),
1367
1429
  sizeOptions !== void 0 && sizeOptions.length > 0 && /* @__PURE__ */ jsxs6("label", { className: "gridkit-grid-pager-page-size", children: [
1368
- /* @__PURE__ */ jsx9(
1430
+ /* @__PURE__ */ jsx11(
1369
1431
  "select",
1370
1432
  {
1371
1433
  value: pagination.pageSize,
1372
1434
  onChange: (event) => {
1373
1435
  pager.setPageSize(Number(event.target.value));
1374
1436
  },
1375
- children: sizeOptions.map((size) => /* @__PURE__ */ jsx9("option", { value: size, children: size }, size))
1437
+ children: sizeOptions.map((size) => /* @__PURE__ */ jsx11("option", { value: size, children: size }, size))
1376
1438
  }
1377
1439
  ),
1378
- /* @__PURE__ */ jsx9("span", { className: "gridkit-grid-pager-page-size-label", children: messages.pageSizeLabel })
1440
+ /* @__PURE__ */ jsx11("span", { className: "gridkit-grid-pager-page-size-label", children: messages.pageSizeLabel })
1379
1441
  ] })
1380
1442
  ]
1381
1443
  }
@@ -1507,7 +1569,7 @@ function useGroupByDrag({
1507
1569
  }
1508
1570
 
1509
1571
  // src/DataGrid/components/GroupByBar.tsx
1510
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
1572
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1511
1573
  function GroupByBar({
1512
1574
  columns,
1513
1575
  definitions,
@@ -1556,7 +1618,7 @@ function GroupByBar({
1556
1618
  role: "group",
1557
1619
  "aria-label": messages.groupByBarLabel,
1558
1620
  children: [
1559
- showPlaceholder && /* @__PURE__ */ jsx10("span", { className: "gridkit-group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
1621
+ showPlaceholder && /* @__PURE__ */ jsx12("span", { className: "gridkit-group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
1560
1622
  groupBy.map((entry, index) => {
1561
1623
  const dropBefore = activeDropTarget?.beforeColumnId === entry.columnId;
1562
1624
  const dropAfter = activeDropTarget?.beforeColumnId === null && index === groupBy.length - 1;
@@ -1592,8 +1654,8 @@ function GroupByBar({
1592
1654
  }
1593
1655
  },
1594
1656
  children: [
1595
- /* @__PURE__ */ jsx10("span", { className: "gridkit-group-by-chip-label", children: labelFor(entry.columnId) }),
1596
- /* @__PURE__ */ jsx10(
1657
+ /* @__PURE__ */ jsx12("span", { className: "gridkit-group-by-chip-label", children: labelFor(entry.columnId) }),
1658
+ /* @__PURE__ */ jsx12(
1597
1659
  "button",
1598
1660
  {
1599
1661
  type: "button",
@@ -1614,7 +1676,7 @@ function GroupByBar({
1614
1676
  );
1615
1677
  }),
1616
1678
  chipDrag.draggedColumnId !== null && chipDrag.ghostTransform !== null && createPortal2(
1617
- /* @__PURE__ */ jsx10(
1679
+ /* @__PURE__ */ jsx12(
1618
1680
  "span",
1619
1681
  {
1620
1682
  className: "gridkit-group-by-chip gridkit-drag-ghost",
@@ -1765,7 +1827,10 @@ function announcedCallbacks({
1765
1827
  onPaginationChange: (event) => {
1766
1828
  callbacks.onPaginationChange?.(event);
1767
1829
  announce(
1768
- messages.pageStatus(event.pagination.pageIndex + 1, event.pageCount)
1830
+ messages.pageStatus(
1831
+ event.pagination.pageIndex + 1,
1832
+ Math.max(1, event.pageCount)
1833
+ )
1769
1834
  );
1770
1835
  },
1771
1836
  /**
@@ -2058,7 +2123,7 @@ import {
2058
2123
  attachOverlay,
2059
2124
  writingDirection as writingDirection4
2060
2125
  } from "@gridkitjs/dom";
2061
- import { jsx as jsx11 } from "react/jsx-runtime";
2126
+ import { jsx as jsx13 } from "react/jsx-runtime";
2062
2127
  var ANCHOR_GAP = 4;
2063
2128
  function attachedFocus(focus) {
2064
2129
  return typeof focus === "object" && !(focus instanceof HTMLElement) ? focus.current ?? "first" : focus;
@@ -2126,7 +2191,7 @@ function Overlay({
2126
2191
  trapFocus
2127
2192
  ]);
2128
2193
  return createPortal3(
2129
- /* @__PURE__ */ jsx11(
2194
+ /* @__PURE__ */ jsx13(
2130
2195
  "div",
2131
2196
  {
2132
2197
  ref: panelRef,
@@ -2140,42 +2205,42 @@ function Overlay({
2140
2205
  }
2141
2206
 
2142
2207
  // src/DataGrid/menu/menuIcons.tsx
2143
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
2208
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
2144
2209
  var BUILT_IN_ICONS = {
2145
2210
  sortAscending: () => /* @__PURE__ */ jsxs8(Icon, { children: [
2146
- /* @__PURE__ */ jsx12("path", { d: "m3 8 4-4 4 4" }),
2147
- /* @__PURE__ */ jsx12("path", { d: "M7 4v16" }),
2148
- /* @__PURE__ */ jsx12("path", { d: "M11 12h4" }),
2149
- /* @__PURE__ */ jsx12("path", { d: "M11 16h7" }),
2150
- /* @__PURE__ */ jsx12("path", { d: "M11 20h10" })
2211
+ /* @__PURE__ */ jsx14("path", { d: "m3 8 4-4 4 4" }),
2212
+ /* @__PURE__ */ jsx14("path", { d: "M7 4v16" }),
2213
+ /* @__PURE__ */ jsx14("path", { d: "M11 12h4" }),
2214
+ /* @__PURE__ */ jsx14("path", { d: "M11 16h7" }),
2215
+ /* @__PURE__ */ jsx14("path", { d: "M11 20h10" })
2151
2216
  ] }),
2152
2217
  sortDescending: () => /* @__PURE__ */ jsxs8(Icon, { children: [
2153
- /* @__PURE__ */ jsx12("path", { d: "m3 16 4 4 4-4" }),
2154
- /* @__PURE__ */ jsx12("path", { d: "M7 20V4" }),
2155
- /* @__PURE__ */ jsx12("path", { d: "M11 4h10" }),
2156
- /* @__PURE__ */ jsx12("path", { d: "M11 8h7" }),
2157
- /* @__PURE__ */ jsx12("path", { d: "M11 12h4" })
2218
+ /* @__PURE__ */ jsx14("path", { d: "m3 16 4 4 4-4" }),
2219
+ /* @__PURE__ */ jsx14("path", { d: "M7 20V4" }),
2220
+ /* @__PURE__ */ jsx14("path", { d: "M11 4h10" }),
2221
+ /* @__PURE__ */ jsx14("path", { d: "M11 8h7" }),
2222
+ /* @__PURE__ */ jsx14("path", { d: "M11 12h4" })
2158
2223
  ] }),
2159
- group: () => /* @__PURE__ */ jsx12(GroupIcon, {}),
2224
+ group: () => /* @__PURE__ */ jsx14(GroupIcon, {}),
2160
2225
  hide: () => /* @__PURE__ */ jsxs8(Icon, { children: [
2161
- /* @__PURE__ */ jsx12("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
2162
- /* @__PURE__ */ jsx12("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }),
2163
- /* @__PURE__ */ jsx12("path", { d: "M6.61 6.61A13.53 13.53 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }),
2164
- /* @__PURE__ */ jsx12("path", { d: "m2 2 20 20" })
2226
+ /* @__PURE__ */ jsx14("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
2227
+ /* @__PURE__ */ jsx14("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }),
2228
+ /* @__PURE__ */ jsx14("path", { d: "M6.61 6.61A13.53 13.53 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }),
2229
+ /* @__PURE__ */ jsx14("path", { d: "m2 2 20 20" })
2165
2230
  ] }),
2166
2231
  autoFit: () => /* @__PURE__ */ jsxs8(Icon, { children: [
2167
- /* @__PURE__ */ jsx12("path", { d: "m18 8 4 4-4 4" }),
2168
- /* @__PURE__ */ jsx12("path", { d: "M2 12h20" }),
2169
- /* @__PURE__ */ jsx12("path", { d: "m6 8-4 4 4 4" })
2232
+ /* @__PURE__ */ jsx14("path", { d: "m18 8 4 4-4 4" }),
2233
+ /* @__PURE__ */ jsx14("path", { d: "M2 12h20" }),
2234
+ /* @__PURE__ */ jsx14("path", { d: "m6 8-4 4 4 4" })
2170
2235
  ] }),
2171
2236
  copy: () => /* @__PURE__ */ jsxs8(Icon, { children: [
2172
- /* @__PURE__ */ jsx12("rect", { x: "8", y: "8", width: "14", height: "14", rx: "2" }),
2173
- /* @__PURE__ */ jsx12("path", { d: "M4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2" })
2237
+ /* @__PURE__ */ jsx14("rect", { x: "8", y: "8", width: "14", height: "14", rx: "2" }),
2238
+ /* @__PURE__ */ jsx14("path", { d: "M4 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2" })
2174
2239
  ] }),
2175
2240
  print: () => /* @__PURE__ */ jsxs8(Icon, { children: [
2176
- /* @__PURE__ */ jsx12("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
2177
- /* @__PURE__ */ jsx12("path", { d: "M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6" }),
2178
- /* @__PURE__ */ jsx12("rect", { x: "6", y: "14", width: "12", height: "8", rx: "1" })
2241
+ /* @__PURE__ */ jsx14("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
2242
+ /* @__PURE__ */ jsx14("path", { d: "M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6" }),
2243
+ /* @__PURE__ */ jsx14("rect", { x: "6", y: "14", width: "12", height: "8", rx: "1" })
2179
2244
  ] })
2180
2245
  };
2181
2246
  var ICONS = new Map(Object.entries(BUILT_IN_ICONS));
@@ -2184,20 +2249,20 @@ function MenuIcon({ name }) {
2184
2249
  return draw === void 0 ? null : draw();
2185
2250
  }
2186
2251
  function CheckIcon() {
2187
- return /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" }) });
2252
+ return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "M20 6 9 17l-5-5" }) });
2188
2253
  }
2189
2254
  function ChevronDownIcon() {
2190
- return /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsx12("path", { d: "m6 9 6 6 6-6" }) });
2255
+ return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "m6 9 6 6 6-6" }) });
2191
2256
  }
2192
2257
  function ChevronLeftIcon2() {
2193
- return /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsx12("path", { d: "m15 18-6-6 6-6" }) });
2258
+ return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "m15 18-6-6 6-6" }) });
2194
2259
  }
2195
2260
  function ChevronRightIcon2() {
2196
- return /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsx12("path", { d: "m9 18 6-6-6-6" }) });
2261
+ return /* @__PURE__ */ jsx14(Icon, { children: /* @__PURE__ */ jsx14("path", { d: "m9 18 6-6-6-6" }) });
2197
2262
  }
2198
2263
 
2199
2264
  // src/DataGrid/menu/GridMenu.tsx
2200
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
2265
+ import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
2201
2266
  var CLOSED = { kind: "closed" };
2202
2267
  var ENTRY_GONE = { kind: "entryGone" };
2203
2268
  function itemElement(menu, id) {
@@ -2228,10 +2293,10 @@ function MenuItem({
2228
2293
  ...ariaAttr(!isItem2, "aria-haspopup", "menu"),
2229
2294
  ...ariaAttr(!isItem2, "aria-expanded", expanded),
2230
2295
  children: [
2231
- /* @__PURE__ */ jsx13("span", { className: "gridkit-menu-item-icon", "aria-hidden": "true", children: checked === true ? /* @__PURE__ */ jsx13(CheckIcon, {}) : /* @__PURE__ */ jsx13(MenuIcon, { name: entry.icon }) }),
2232
- /* @__PURE__ */ jsx13("span", { className: "gridkit-menu-item-label", children: entry.label }),
2233
- shortcut !== void 0 && /* @__PURE__ */ jsx13("span", { className: "gridkit-menu-item-shortcut", "aria-hidden": "true", children: shortcut }),
2234
- !isItem2 && /* @__PURE__ */ jsx13("span", { className: "gridkit-menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(ChevronRightIcon2, {}) })
2296
+ /* @__PURE__ */ jsx15("span", { className: "gridkit-menu-item-icon", "aria-hidden": "true", children: checked === true ? /* @__PURE__ */ jsx15(CheckIcon, {}) : /* @__PURE__ */ jsx15(MenuIcon, { name: entry.icon }) }),
2297
+ /* @__PURE__ */ jsx15("span", { className: "gridkit-menu-item-label", children: entry.label }),
2298
+ shortcut !== void 0 && /* @__PURE__ */ jsx15("span", { className: "gridkit-menu-item-shortcut", "aria-hidden": "true", children: shortcut }),
2299
+ !isItem2 && /* @__PURE__ */ jsx15("span", { className: "gridkit-menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx15(ChevronRightIcon2, {}) })
2235
2300
  ]
2236
2301
  }
2237
2302
  );
@@ -2326,7 +2391,7 @@ function GridMenu({
2326
2391
  setSubmenu(ENTRY_GONE);
2327
2392
  }
2328
2393
  return /* @__PURE__ */ jsxs9(Fragment2, { children: [
2329
- /* @__PURE__ */ jsx13(
2394
+ /* @__PURE__ */ jsx15(
2330
2395
  "div",
2331
2396
  {
2332
2397
  ref: menuRef,
@@ -2334,14 +2399,14 @@ function GridMenu({
2334
2399
  "aria-label": label,
2335
2400
  className: "gridkit-menu",
2336
2401
  children: entries.map(
2337
- (entry) => entry.type === "separator" ? /* @__PURE__ */ jsx13(
2402
+ (entry) => entry.type === "separator" ? /* @__PURE__ */ jsx15(
2338
2403
  "div",
2339
2404
  {
2340
2405
  role: "separator",
2341
2406
  className: "gridkit-menu-separator"
2342
2407
  },
2343
2408
  entry.key
2344
- ) : /* @__PURE__ */ jsx13(
2409
+ ) : /* @__PURE__ */ jsx15(
2345
2410
  MenuItem,
2346
2411
  {
2347
2412
  entry,
@@ -2352,7 +2417,7 @@ function GridMenu({
2352
2417
  )
2353
2418
  }
2354
2419
  ),
2355
- submenu.kind === "open" && openEntry !== void 0 && /* @__PURE__ */ jsx13(
2420
+ submenu.kind === "open" && openEntry !== void 0 && /* @__PURE__ */ jsx15(
2356
2421
  Overlay,
2357
2422
  {
2358
2423
  anchor: submenu.anchor,
@@ -2361,7 +2426,7 @@ function GridMenu({
2361
2426
  initialFocus: submenu.focus,
2362
2427
  scope,
2363
2428
  onDismiss: closeSubmenu,
2364
- children: /* @__PURE__ */ jsx13(
2429
+ children: /* @__PURE__ */ jsx15(
2365
2430
  GridMenu,
2366
2431
  {
2367
2432
  entries: openEntry.items,
@@ -2380,7 +2445,7 @@ function GridMenu({
2380
2445
  }
2381
2446
 
2382
2447
  // src/DataGrid/contextMenu/GridContextMenu.tsx
2383
- import { jsx as jsx14 } from "react/jsx-runtime";
2448
+ import { jsx as jsx16 } from "react/jsx-runtime";
2384
2449
  function GridContextMenu({
2385
2450
  contextMenu
2386
2451
  }) {
@@ -2388,7 +2453,7 @@ function GridContextMenu({
2388
2453
  if (menu === null) {
2389
2454
  return null;
2390
2455
  }
2391
- return /* @__PURE__ */ jsx14(
2456
+ return /* @__PURE__ */ jsx16(
2392
2457
  Overlay,
2393
2458
  {
2394
2459
  anchor: menu.anchor,
@@ -2397,7 +2462,7 @@ function GridContextMenu({
2397
2462
  returnFocusFallback,
2398
2463
  scope: menu.scope,
2399
2464
  onDismiss: close,
2400
- children: /* @__PURE__ */ jsx14(
2465
+ children: /* @__PURE__ */ jsx16(
2401
2466
  GridMenu,
2402
2467
  {
2403
2468
  entries: menu.entries,
@@ -2779,12 +2844,12 @@ function useGridOverlay({
2779
2844
  }
2780
2845
 
2781
2846
  // src/DataGrid/panels/GridPanels.tsx
2782
- import { useRef as useRef15 } from "react";
2847
+ import { useRef as useRef16 } from "react";
2783
2848
 
2784
2849
  // src/DataGrid/columnChooser/ColumnChooser.tsx
2785
2850
  import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState6 } from "react";
2786
2851
  import { resolveColumnChooser } from "@gridkitjs/core/renderer";
2787
- import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2852
+ import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
2788
2853
  function ColumnChooser({
2789
2854
  controller,
2790
2855
  messages
@@ -2815,7 +2880,7 @@ function ColumnChooser({
2815
2880
  "aria-label": messages.columnChooserLabel,
2816
2881
  className: "gridkit-column-chooser",
2817
2882
  children: [
2818
- /* @__PURE__ */ jsx15(
2883
+ /* @__PURE__ */ jsx17(
2819
2884
  "input",
2820
2885
  {
2821
2886
  type: "search",
@@ -2828,9 +2893,9 @@ function ColumnChooser({
2828
2893
  }
2829
2894
  }
2830
2895
  ),
2831
- entries.length === 0 ? /* @__PURE__ */ jsx15("p", { role: "status", className: "gridkit-column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
2896
+ entries.length === 0 ? /* @__PURE__ */ jsx17("p", { role: "status", className: "gridkit-column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
2832
2897
  /* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option gridkit-column-chooser-all", children: [
2833
- /* @__PURE__ */ jsx15(
2898
+ /* @__PURE__ */ jsx17(
2834
2899
  "input",
2835
2900
  {
2836
2901
  ref: showAllRef,
@@ -2846,8 +2911,8 @@ function ColumnChooser({
2846
2911
  ),
2847
2912
  messages.showAllColumns
2848
2913
  ] }),
2849
- /* @__PURE__ */ jsx15("ul", { className: "gridkit-column-chooser-list", children: entries.map((entry) => /* @__PURE__ */ jsx15("li", { children: /* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option", children: [
2850
- /* @__PURE__ */ jsx15(
2914
+ /* @__PURE__ */ jsx17("ul", { className: "gridkit-column-chooser-list", children: entries.map((entry) => /* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option", children: [
2915
+ /* @__PURE__ */ jsx17(
2851
2916
  "input",
2852
2917
  {
2853
2918
  type: "checkbox",
@@ -2977,7 +3042,7 @@ function useMenuButton({
2977
3042
  }
2978
3043
 
2979
3044
  // src/DataGrid/filterMenu/OperatorMenuButton.tsx
2980
- import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
3045
+ import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
2981
3046
  function gapBeside(button) {
2982
3047
  const dialog = button.closest('[role="dialog"]') ?? button;
2983
3048
  return dialog.getBoundingClientRect().right - button.getBoundingClientRect().right + ANCHOR_GAP;
@@ -3015,20 +3080,20 @@ function OperatorMenuButton({
3015
3080
  className: "gridkit-filter-menu-submenu",
3016
3081
  ...buttonProps,
3017
3082
  children: [
3018
- /* @__PURE__ */ jsx16("span", { className: "gridkit-filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx16(CheckIcon, {}) }),
3083
+ /* @__PURE__ */ jsx18("span", { className: "gridkit-filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx18(CheckIcon, {}) }),
3019
3084
  label,
3020
- /* @__PURE__ */ jsx16(
3085
+ /* @__PURE__ */ jsx18(
3021
3086
  "span",
3022
3087
  {
3023
3088
  className: "gridkit-filter-menu-submenu-indicator",
3024
3089
  "aria-hidden": "true",
3025
- children: /* @__PURE__ */ jsx16(ChevronRightIcon2, {})
3090
+ children: /* @__PURE__ */ jsx18(ChevronRightIcon2, {})
3026
3091
  }
3027
3092
  )
3028
3093
  ]
3029
3094
  }
3030
3095
  ),
3031
- state.kind === "open" && /* @__PURE__ */ jsx16(
3096
+ state.kind === "open" && /* @__PURE__ */ jsx18(
3032
3097
  Overlay,
3033
3098
  {
3034
3099
  anchor: state.anchor,
@@ -3037,7 +3102,7 @@ function OperatorMenuButton({
3037
3102
  returnFocusTo: state.anchor,
3038
3103
  scope: state.scope,
3039
3104
  onDismiss: close,
3040
- children: /* @__PURE__ */ jsx16(
3105
+ children: /* @__PURE__ */ jsx18(
3041
3106
  GridMenu,
3042
3107
  {
3043
3108
  entries,
@@ -3076,7 +3141,7 @@ import {
3076
3141
  filterOperandArity,
3077
3142
  parseFilterOperand
3078
3143
  } from "@gridkitjs/core/renderer";
3079
- import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
3144
+ import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
3080
3145
  function inputType(family, type) {
3081
3146
  switch (family) {
3082
3147
  case "text":
@@ -3110,12 +3175,12 @@ function OperandField({
3110
3175
  };
3111
3176
  if (family === "boolean") {
3112
3177
  return /* @__PURE__ */ jsxs12("select", { ...field, children: [
3113
- /* @__PURE__ */ jsx17("option", { value: "" }),
3114
- /* @__PURE__ */ jsx17("option", { value: "true", children: messages.booleanTrue }),
3115
- /* @__PURE__ */ jsx17("option", { value: "false", children: messages.booleanFalse })
3178
+ /* @__PURE__ */ jsx19("option", { value: "" }),
3179
+ /* @__PURE__ */ jsx19("option", { value: "true", children: messages.booleanTrue }),
3180
+ /* @__PURE__ */ jsx19("option", { value: "false", children: messages.booleanFalse })
3116
3181
  ] });
3117
3182
  }
3118
- return /* @__PURE__ */ jsx17("input", { ...field, type: inputType(family, type) });
3183
+ return /* @__PURE__ */ jsx19("input", { ...field, type: inputType(family, type) });
3119
3184
  }
3120
3185
  function ConditionRow({
3121
3186
  row,
@@ -3142,7 +3207,7 @@ function ConditionRow({
3142
3207
  "aria-label": messages.filterConditionLabel(position),
3143
3208
  className: "gridkit-filter-menu-condition",
3144
3209
  children: [
3145
- /* @__PURE__ */ jsx17(
3210
+ /* @__PURE__ */ jsx19(
3146
3211
  "select",
3147
3212
  {
3148
3213
  ref: arity === 0 ? focusRef : void 0,
@@ -3155,10 +3220,10 @@ function ConditionRow({
3155
3220
  onChange({ ...row, operator });
3156
3221
  }
3157
3222
  },
3158
- children: operators.map((operator) => /* @__PURE__ */ jsx17("option", { value: operator, children: messages.filterOperatorLabel(operator, menu.family) }, operator))
3223
+ children: operators.map((operator) => /* @__PURE__ */ jsx19("option", { value: operator, children: messages.filterOperatorLabel(operator, menu.family) }, operator))
3159
3224
  }
3160
3225
  ),
3161
- arity > 0 && /* @__PURE__ */ jsx17(
3226
+ arity > 0 && /* @__PURE__ */ jsx19(
3162
3227
  OperandField,
3163
3228
  {
3164
3229
  ...operand,
@@ -3171,7 +3236,7 @@ function ConditionRow({
3171
3236
  }
3172
3237
  }
3173
3238
  ),
3174
- arity === 2 && /* @__PURE__ */ jsx17(
3239
+ arity === 2 && /* @__PURE__ */ jsx19(
3175
3240
  OperandField,
3176
3241
  {
3177
3242
  ...operand,
@@ -3269,7 +3334,7 @@ function simpleEditorReducer(state, action) {
3269
3334
  }
3270
3335
 
3271
3336
  // src/DataGrid/filterMenu/SimpleFilterEditor.tsx
3272
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
3337
+ import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
3273
3338
  var COMBINATORS = ["and", "or"];
3274
3339
  function holdsUnreadable(row) {
3275
3340
  return Array.from(row?.querySelectorAll("input") ?? []).some(
@@ -3282,14 +3347,14 @@ function CombinatorChoice({
3282
3347
  messages,
3283
3348
  onChange
3284
3349
  }) {
3285
- return /* @__PURE__ */ jsx18(
3350
+ return /* @__PURE__ */ jsx20(
3286
3351
  "div",
3287
3352
  {
3288
3353
  role: "radiogroup",
3289
3354
  "aria-label": messages.filterCombinatorLabel,
3290
3355
  className: "gridkit-filter-menu-combinator",
3291
3356
  children: COMBINATORS.map((choice) => /* @__PURE__ */ jsxs13("label", { className: "gridkit-filter-menu-combinator-option", children: [
3292
- /* @__PURE__ */ jsx18(
3357
+ /* @__PURE__ */ jsx20(
3293
3358
  "input",
3294
3359
  {
3295
3360
  type: "radio",
@@ -3368,11 +3433,11 @@ function SimpleFilterEditor({
3368
3433
  }
3369
3434
  }, [invalid]);
3370
3435
  return /* @__PURE__ */ jsxs13("div", { className: "gridkit-filter-menu-conditions", children: [
3371
- opened.custom && /* @__PURE__ */ jsx18("p", { className: "gridkit-filter-menu-custom", children: messages.customFilter }),
3436
+ opened.custom && /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-custom", children: messages.customFilter }),
3372
3437
  draft.rows.map((row, index) => (
3373
3438
  // A row is its place: the first condition, or the second.
3374
3439
  /* @__PURE__ */ jsxs13(Fragment5, { children: [
3375
- index > 0 && /* @__PURE__ */ jsx18(
3440
+ index > 0 && /* @__PURE__ */ jsx20(
3376
3441
  CombinatorChoice,
3377
3442
  {
3378
3443
  name: combinatorName,
@@ -3383,7 +3448,7 @@ function SimpleFilterEditor({
3383
3448
  }
3384
3449
  }
3385
3450
  ),
3386
- /* @__PURE__ */ jsx18(
3451
+ /* @__PURE__ */ jsx20(
3387
3452
  ConditionRow,
3388
3453
  {
3389
3454
  ref: (element) => {
@@ -3403,7 +3468,7 @@ function SimpleFilterEditor({
3403
3468
  )
3404
3469
  ] }, index)
3405
3470
  )),
3406
- invalid.length > 0 && /* @__PURE__ */ jsx18("p", { id: invalidMessageId, className: "gridkit-filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
3471
+ invalid.length > 0 && /* @__PURE__ */ jsx20("p", { id: invalidMessageId, className: "gridkit-filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
3407
3472
  ] });
3408
3473
  }
3409
3474
 
@@ -3413,7 +3478,7 @@ import {
3413
3478
  attachChecklist,
3414
3479
  createRowVirtualizer
3415
3480
  } from "@gridkitjs/dom";
3416
- import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
3481
+ import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
3417
3482
  var ESTIMATED_ITEM_HEIGHT = 28;
3418
3483
  var OVERSCAN = 4;
3419
3484
  var NO_RANGE = {
@@ -3479,7 +3544,7 @@ function ValueChecklist({
3479
3544
  "aria-label": label,
3480
3545
  className: "gridkit-filter-menu-checklist",
3481
3546
  children: [
3482
- /* @__PURE__ */ jsx19("div", { role: "presentation", style: { height: range.offsetBefore } }),
3547
+ /* @__PURE__ */ jsx21("div", { role: "presentation", style: { height: range.offsetBefore } }),
3483
3548
  shown.map((item, offset) => {
3484
3549
  const index = range.startIndex + offset;
3485
3550
  return /* @__PURE__ */ jsxs14(
@@ -3494,32 +3559,32 @@ function ValueChecklist({
3494
3559
  "aria-posinset": index + 1,
3495
3560
  className: "gridkit-filter-menu-option",
3496
3561
  children: [
3497
- /* @__PURE__ */ jsx19(
3562
+ /* @__PURE__ */ jsx21(
3498
3563
  "span",
3499
3564
  {
3500
3565
  className: "gridkit-filter-menu-option-check",
3501
3566
  "aria-hidden": "true",
3502
- children: /* @__PURE__ */ jsx19(CheckIcon, {})
3567
+ children: /* @__PURE__ */ jsx21(CheckIcon, {})
3503
3568
  }
3504
3569
  ),
3505
- /* @__PURE__ */ jsx19("span", { className: "gridkit-filter-menu-option-label", children: item.label }),
3570
+ /* @__PURE__ */ jsx21("span", { className: "gridkit-filter-menu-option-label", children: item.label }),
3506
3571
  showCounts && /* @__PURE__ */ jsxs14(Fragment6, { children: [
3507
3572
  " ",
3508
- /* @__PURE__ */ jsx19("span", { className: "gridkit-filter-menu-option-count", children: String(item.count) })
3573
+ /* @__PURE__ */ jsx21("span", { className: "gridkit-filter-menu-option-count", children: String(item.count) })
3509
3574
  ] })
3510
3575
  ]
3511
3576
  },
3512
3577
  item.key
3513
3578
  );
3514
3579
  }),
3515
- /* @__PURE__ */ jsx19("div", { role: "presentation", style: { height: range.offsetAfter } })
3580
+ /* @__PURE__ */ jsx21("div", { role: "presentation", style: { height: range.offsetAfter } })
3516
3581
  ]
3517
3582
  }
3518
3583
  );
3519
3584
  }
3520
3585
 
3521
3586
  // src/DataGrid/filterMenu/ExcelFilterEditor.tsx
3522
- import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
3587
+ import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
3523
3588
  var OPENED_ON_VALUES = {
3524
3589
  kind: "values",
3525
3590
  focusOnMount: false
@@ -3596,12 +3661,12 @@ function ExcelFilterEditor({
3596
3661
  setMode({ kind: "values", focusOnMount: true });
3597
3662
  },
3598
3663
  children: [
3599
- /* @__PURE__ */ jsx20("span", { className: "gridkit-filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(ChevronLeftIcon2, {}) }),
3664
+ /* @__PURE__ */ jsx22("span", { className: "gridkit-filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx22(ChevronLeftIcon2, {}) }),
3600
3665
  messages.filterBackToValues
3601
3666
  ]
3602
3667
  }
3603
3668
  ),
3604
- /* @__PURE__ */ jsx20(
3669
+ /* @__PURE__ */ jsx22(
3605
3670
  SimpleFilterEditor,
3606
3671
  {
3607
3672
  ref: conditions,
@@ -3620,7 +3685,7 @@ function ExcelFilterEditor({
3620
3685
  }
3621
3686
  const { shape } = opened;
3622
3687
  return /* @__PURE__ */ jsxs15("div", { className: "gridkit-filter-menu-values", children: [
3623
- menu.operators.length > 0 && /* @__PURE__ */ jsx20(
3688
+ menu.operators.length > 0 && /* @__PURE__ */ jsx22(
3624
3689
  OperatorMenuButton,
3625
3690
  {
3626
3691
  ref: operatorButton,
@@ -3632,8 +3697,8 @@ function ExcelFilterEditor({
3632
3697
  }
3633
3698
  }
3634
3699
  ),
3635
- (shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
3636
- /* @__PURE__ */ jsx20(
3700
+ (shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx22("p", { className: "gridkit-filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
3701
+ /* @__PURE__ */ jsx22(
3637
3702
  "input",
3638
3703
  {
3639
3704
  ref: initialFocusRef,
@@ -3648,7 +3713,7 @@ function ExcelFilterEditor({
3648
3713
  }
3649
3714
  ),
3650
3715
  /* @__PURE__ */ jsxs15("label", { className: "gridkit-filter-menu-select-all", children: [
3651
- /* @__PURE__ */ jsx20(
3716
+ /* @__PURE__ */ jsx22(
3652
3717
  "input",
3653
3718
  {
3654
3719
  ref: selectAllRef,
@@ -3662,7 +3727,7 @@ function ExcelFilterEditor({
3662
3727
  ),
3663
3728
  messages.filterSelectAll
3664
3729
  ] }),
3665
- checklist.needsSearch ? /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx20(
3730
+ checklist.needsSearch ? /* @__PURE__ */ jsx22("p", { className: "gridkit-filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx22(
3666
3731
  ValueChecklist,
3667
3732
  {
3668
3733
  items: checklist.items,
@@ -3673,12 +3738,12 @@ function ExcelFilterEditor({
3673
3738
  }
3674
3739
  }
3675
3740
  ),
3676
- checklist.hiddenCount > 0 && /* @__PURE__ */ jsx20("p", { role: "status", className: "gridkit-filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
3741
+ checklist.hiddenCount > 0 && /* @__PURE__ */ jsx22("p", { role: "status", className: "gridkit-filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
3677
3742
  ] });
3678
3743
  }
3679
3744
 
3680
3745
  // src/DataGrid/filterMenu/FilterMenu.tsx
3681
- import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
3746
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
3682
3747
  var SORT_COMMANDS = [
3683
3748
  "sort.ascending",
3684
3749
  "sort.descending",
@@ -3735,7 +3800,7 @@ function FilterMenu({
3735
3800
  close();
3736
3801
  }
3737
3802
  }
3738
- return /* @__PURE__ */ jsx21(
3803
+ return /* @__PURE__ */ jsx23(
3739
3804
  "div",
3740
3805
  {
3741
3806
  role: "dialog",
@@ -3756,7 +3821,7 @@ function FilterMenu({
3756
3821
  }
3757
3822
  },
3758
3823
  children: [
3759
- sortItems.length > 0 && /* @__PURE__ */ jsx21("div", { className: "gridkit-filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
3824
+ sortItems.length > 0 && /* @__PURE__ */ jsx23("div", { className: "gridkit-filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
3760
3825
  "button",
3761
3826
  {
3762
3827
  type: "button",
@@ -3771,12 +3836,12 @@ function FilterMenu({
3771
3836
  run(item);
3772
3837
  },
3773
3838
  children: [
3774
- /* @__PURE__ */ jsx21(
3839
+ /* @__PURE__ */ jsx23(
3775
3840
  "span",
3776
3841
  {
3777
3842
  className: "gridkit-filter-menu-sort-icon",
3778
3843
  "aria-hidden": "true",
3779
- children: /* @__PURE__ */ jsx21(MenuIcon, { name: item.icon })
3844
+ children: /* @__PURE__ */ jsx23(MenuIcon, { name: item.icon })
3780
3845
  }
3781
3846
  ),
3782
3847
  item.label
@@ -3784,9 +3849,9 @@ function FilterMenu({
3784
3849
  },
3785
3850
  item.id
3786
3851
  )) }),
3787
- menu.ui === "excel" ? /* @__PURE__ */ jsx21(ExcelFilterEditor, { ...editorProps, columnValues }) : /* @__PURE__ */ jsx21(SimpleFilterEditor, { ...editorProps }),
3852
+ menu.ui === "excel" ? /* @__PURE__ */ jsx23(ExcelFilterEditor, { ...editorProps, columnValues }) : /* @__PURE__ */ jsx23(SimpleFilterEditor, { ...editorProps }),
3788
3853
  /* @__PURE__ */ jsxs16("div", { className: "gridkit-filter-menu-actions", children: [
3789
- clearItem !== void 0 && /* @__PURE__ */ jsx21(
3854
+ clearItem !== void 0 && /* @__PURE__ */ jsx23(
3790
3855
  "button",
3791
3856
  {
3792
3857
  type: "button",
@@ -3798,7 +3863,7 @@ function FilterMenu({
3798
3863
  children: clearItem.label
3799
3864
  }
3800
3865
  ),
3801
- /* @__PURE__ */ jsx21(
3866
+ /* @__PURE__ */ jsx23(
3802
3867
  "button",
3803
3868
  {
3804
3869
  type: "button",
@@ -3807,7 +3872,7 @@ function FilterMenu({
3807
3872
  children: messages.cancelFilter
3808
3873
  }
3809
3874
  ),
3810
- /* @__PURE__ */ jsx21("button", { type: "submit", className: "gridkit-filter-menu-apply", children: messages.applyFilter })
3875
+ /* @__PURE__ */ jsx23("button", { type: "submit", className: "gridkit-filter-menu-apply", children: messages.applyFilter })
3811
3876
  ] })
3812
3877
  ]
3813
3878
  }
@@ -3817,25 +3882,47 @@ function FilterMenu({
3817
3882
  }
3818
3883
 
3819
3884
  // src/DataGrid/useAnnounceWhenDrawn.ts
3820
- import { useEffect as useEffect5, useState as useState10 } from "react";
3821
- function useAnnounceWhenDrawn(announce) {
3885
+ import { useEffect as useEffect5, useRef as useRef15, useState as useState10 } from "react";
3886
+ function useAnnounceWhenDrawn(announce, controller) {
3822
3887
  const [requested, setRequested] = useState10(null);
3888
+ const settled = useRef15(null);
3889
+ const { dataMode, dataSource, loading = false } = controller.getOptions();
3823
3890
  useEffect5(() => {
3824
- if (requested?.drawn() === true) {
3825
- announce(requested.text());
3891
+ if (requested === null || settled.current === requested) {
3892
+ return;
3893
+ }
3894
+ const { announcement, rowsAsked } = requested;
3895
+ const awaitingRows = dataMode === "server" && (loading || dataSource === rowsAsked);
3896
+ const drawn = announcement.drawn();
3897
+ if (drawn && awaitingRows) {
3898
+ return;
3826
3899
  }
3827
- }, [requested, announce]);
3828
- return setRequested;
3900
+ settled.current = requested;
3901
+ if (drawn) {
3902
+ announce(announcement.text());
3903
+ }
3904
+ }, [requested, dataMode, dataSource, loading, announce]);
3905
+ return (announcement) => {
3906
+ setRequested({
3907
+ announcement,
3908
+ rowsAsked: controller.getOptions().dataSource
3909
+ });
3910
+ };
3911
+ }
3912
+ function resultCount(controller) {
3913
+ const { dataMode, rowCount } = controller.getOptions();
3914
+ const held = controller.getView().rows.length;
3915
+ return dataMode === "server" ? rowCount ?? held : held;
3829
3916
  }
3830
3917
 
3831
3918
  // src/DataGrid/filterMenu/useApplyFilter.ts
3832
3919
  function useApplyFilter(controller, messages, announce) {
3833
- const announceWhenDrawn = useAnnounceWhenDrawn(announce);
3920
+ const announceWhenDrawn = useAnnounceWhenDrawn(announce, controller);
3834
3921
  return (filter) => {
3835
3922
  announceWhenDrawn({
3836
3923
  drawn: () => controller.getState().filter === filter,
3837
- text: () => messages.filterResults(
3838
- controller.getView().rows.length,
3924
+ text: () => controller.getOptions().dataMode === "server" ? messages.searchResults(resultCount(controller)) : messages.filterResults(
3925
+ resultCount(controller),
3839
3926
  controller.getOptions().dataSource?.length ?? 0
3840
3927
  )
3841
3928
  });
@@ -3864,7 +3951,7 @@ function useFilterValueCache(controller, messages) {
3864
3951
  }
3865
3952
 
3866
3953
  // src/DataGrid/panels/GridPanels.tsx
3867
- import { jsx as jsx22 } from "react/jsx-runtime";
3954
+ import { jsx as jsx24 } from "react/jsx-runtime";
3868
3955
  var panelKinds = {
3869
3956
  columnChooser: { component: ColumnChooser, trapFocus: false },
3870
3957
  filter: { component: FilterMenu, trapFocus: true }
@@ -3875,7 +3962,7 @@ function GridPanels({
3875
3962
  commands,
3876
3963
  messages
3877
3964
  }) {
3878
- const initialFocus = useRef15(null);
3965
+ const initialFocus = useRef16(null);
3879
3966
  const applyFilter = useApplyFilter(
3880
3967
  controller,
3881
3968
  messages,
@@ -3887,7 +3974,7 @@ function GridPanels({
3887
3974
  return null;
3888
3975
  }
3889
3976
  const { component: Panel, trapFocus } = panelKinds[panel.kind];
3890
- return /* @__PURE__ */ jsx22(
3977
+ return /* @__PURE__ */ jsx24(
3891
3978
  Overlay,
3892
3979
  {
3893
3980
  anchor: panel.anchor,
@@ -3900,7 +3987,7 @@ function GridPanels({
3900
3987
  trapFocus,
3901
3988
  scope: panel.scope,
3902
3989
  onDismiss: close,
3903
- children: /* @__PURE__ */ jsx22(
3990
+ children: /* @__PURE__ */ jsx24(
3904
3991
  Panel,
3905
3992
  {
3906
3993
  target: panel.target,
@@ -3944,7 +4031,7 @@ function panelApi(panels, controller) {
3944
4031
  }
3945
4032
 
3946
4033
  // src/DataGrid/panels/useGridPanels.ts
3947
- import { useRef as useRef16 } from "react";
4034
+ import { useRef as useRef17 } from "react";
3948
4035
  import {
3949
4036
  writingDirection as writingDirection6
3950
4037
  } from "@gridkitjs/dom";
@@ -3973,7 +4060,7 @@ function useGridPanels({
3973
4060
  headerTableRef,
3974
4061
  overlay
3975
4062
  }) {
3976
- const openings = useRef16(0);
4063
+ const openings = useRef17(0);
3977
4064
  function placeFor(root, target) {
3978
4065
  const element = target.area === "toolbar" ? toolbarItem(root, target.itemId) : target.area === "header" ? headerCell2(headerTableRef.current, target.columnId) : null;
3979
4066
  if (element !== null) {
@@ -4019,7 +4106,7 @@ function useGridPanels({
4019
4106
  }
4020
4107
 
4021
4108
  // src/DataGrid/toolbar/GridToolbar.tsx
4022
- import { useLayoutEffect as useLayoutEffect13, useRef as useRef19 } from "react";
4109
+ import { useLayoutEffect as useLayoutEffect13, useRef as useRef20 } from "react";
4023
4110
  import {
4024
4111
  resolveToolbar,
4025
4112
  toolbarEntries
@@ -4028,7 +4115,7 @@ import { splitToolbarItems } from "@gridkitjs/core/renderer";
4028
4115
  import { attachToolbar } from "@gridkitjs/dom";
4029
4116
 
4030
4117
  // src/DataGrid/toolbar/ToolbarMenuButton.tsx
4031
- import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
4118
+ import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
4032
4119
  function ToolbarMenuButton({
4033
4120
  itemKey,
4034
4121
  attributes,
@@ -4055,13 +4142,13 @@ function ToolbarMenuButton({
4055
4142
  ...ariaAttr(more, "data-gridkit-toolbar-more", ""),
4056
4143
  ...buttonProps,
4057
4144
  children: [
4058
- icon !== void 0 && /* @__PURE__ */ jsx23("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(MenuIcon, { name: icon }) }),
4145
+ icon !== void 0 && /* @__PURE__ */ jsx25("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(MenuIcon, { name: icon }) }),
4059
4146
  label,
4060
- /* @__PURE__ */ jsx23("span", { className: "gridkit-toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(ChevronDownIcon, {}) })
4147
+ /* @__PURE__ */ jsx25("span", { className: "gridkit-toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(ChevronDownIcon, {}) })
4061
4148
  ]
4062
4149
  }
4063
4150
  ),
4064
- state.kind === "open" && /* @__PURE__ */ jsx23(
4151
+ state.kind === "open" && /* @__PURE__ */ jsx25(
4065
4152
  Overlay,
4066
4153
  {
4067
4154
  anchor: state.anchor,
@@ -4071,7 +4158,7 @@ function ToolbarMenuButton({
4071
4158
  returnFocusFallback,
4072
4159
  scope: state.scope,
4073
4160
  onDismiss: close,
4074
- children: /* @__PURE__ */ jsx23(
4161
+ children: /* @__PURE__ */ jsx25(
4075
4162
  GridMenu,
4076
4163
  {
4077
4164
  entries,
@@ -4091,9 +4178,9 @@ function ToolbarMenuButton({
4091
4178
  }
4092
4179
 
4093
4180
  // src/DataGrid/toolbar/ToolbarSearch.tsx
4094
- import { useEffect as useEffect6, useRef as useRef17, useState as useState12 } from "react";
4181
+ import { useEffect as useEffect6, useRef as useRef18, useState as useState12 } from "react";
4095
4182
  import { searchTextOf, setSearchText } from "@gridkitjs/core/renderer";
4096
- import { jsx as jsx24 } from "react/jsx-runtime";
4183
+ import { jsx as jsx26 } from "react/jsx-runtime";
4097
4184
  var SEARCH_DELAY_MS = 250;
4098
4185
  function ToolbarSearch({
4099
4186
  itemKey,
@@ -4104,8 +4191,8 @@ function ToolbarSearch({
4104
4191
  }) {
4105
4192
  const applied = searchTextOf(controller.getState().filter);
4106
4193
  const [draft, setDraft] = useState12(null);
4107
- const timer = useRef17(void 0);
4108
- const announceWhenDrawn = useAnnounceWhenDrawn(announce);
4194
+ const timer = useRef18(void 0);
4195
+ const announceWhenDrawn = useAnnounceWhenDrawn(announce, controller);
4109
4196
  const text = draft !== null && draft.over === applied ? draft.text : applied;
4110
4197
  function apply(next, over) {
4111
4198
  clearTimeout(timer.current);
@@ -4118,7 +4205,7 @@ function ToolbarSearch({
4118
4205
  if (searched !== filter) {
4119
4206
  announceWhenDrawn({
4120
4207
  drawn: () => searchTextOf(controller.getState().filter) === next,
4121
- text: () => messages.searchResults(controller.getView().rows.length)
4208
+ text: () => messages.searchResults(resultCount(controller))
4122
4209
  });
4123
4210
  controller.setFilter(searched);
4124
4211
  }
@@ -4129,7 +4216,7 @@ function ToolbarSearch({
4129
4216
  },
4130
4217
  []
4131
4218
  );
4132
- return /* @__PURE__ */ jsx24(
4219
+ return /* @__PURE__ */ jsx26(
4133
4220
  "input",
4134
4221
  {
4135
4222
  ...attributes,
@@ -4160,12 +4247,12 @@ function ToolbarSearch({
4160
4247
  }
4161
4248
 
4162
4249
  // src/DataGrid/toolbar/useToolbarOverflow.ts
4163
- import { useLayoutEffect as useLayoutEffect12, useRef as useRef18, useState as useState13 } from "react";
4250
+ import { useLayoutEffect as useLayoutEffect12, useRef as useRef19, useState as useState13 } from "react";
4164
4251
  import { observeToolbarOverflow } from "@gridkitjs/dom";
4165
4252
  function useToolbarOverflow(toolbarRef, items) {
4166
4253
  const [fit, setFit] = useState13(items.length);
4167
- const overflow = useRef18(null);
4168
- const measuredLayout = useRef18("");
4254
+ const overflow = useRef19(null);
4255
+ const measuredLayout = useRef19("");
4169
4256
  const layout = JSON.stringify(
4170
4257
  items.map((item) => [
4171
4258
  item.type,
@@ -4198,7 +4285,7 @@ function useToolbarOverflow(toolbarRef, items) {
4198
4285
  }
4199
4286
 
4200
4287
  // src/DataGrid/toolbar/GridToolbar.tsx
4201
- import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
4288
+ import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
4202
4289
  function reporting(run, report) {
4203
4290
  return () => {
4204
4291
  const ran = run();
@@ -4251,7 +4338,7 @@ function GridToolbar(props) {
4251
4338
  return null;
4252
4339
  }
4253
4340
  const options = typeof props.toolbar === "object" ? props.toolbar : void 0;
4254
- return /* @__PURE__ */ jsx25(
4341
+ return /* @__PURE__ */ jsx27(
4255
4342
  Toolbar,
4256
4343
  {
4257
4344
  ...props,
@@ -4272,7 +4359,7 @@ function Toolbar({
4272
4359
  messages,
4273
4360
  announce
4274
4361
  }) {
4275
- const toolbarRef = useRef19(null);
4362
+ const toolbarRef = useRef20(null);
4276
4363
  const items = resolveToolbar(entries, {
4277
4364
  commands: commands.commands,
4278
4365
  contextFor: commands.contextFor,
@@ -4317,14 +4404,14 @@ function Toolbar({
4317
4404
  item.run();
4318
4405
  },
4319
4406
  children: [
4320
- item.icon !== void 0 && /* @__PURE__ */ jsx25("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(MenuIcon, { name: item.icon }) }),
4407
+ item.icon !== void 0 && /* @__PURE__ */ jsx27("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx27(MenuIcon, { name: item.icon }) }),
4321
4408
  item.label
4322
4409
  ]
4323
4410
  },
4324
4411
  item.key
4325
4412
  );
4326
4413
  case "menu":
4327
- return /* @__PURE__ */ jsx25(
4414
+ return /* @__PURE__ */ jsx27(
4328
4415
  ToolbarMenuButton,
4329
4416
  {
4330
4417
  itemKey: item.key,
@@ -4337,7 +4424,7 @@ function Toolbar({
4337
4424
  item.key
4338
4425
  );
4339
4426
  case "search":
4340
- return /* @__PURE__ */ jsx25(
4427
+ return /* @__PURE__ */ jsx27(
4341
4428
  ToolbarSearch,
4342
4429
  {
4343
4430
  itemKey: item.key,
@@ -4349,7 +4436,7 @@ function Toolbar({
4349
4436
  item.key
4350
4437
  );
4351
4438
  case "separator":
4352
- return /* @__PURE__ */ jsx25(
4439
+ return /* @__PURE__ */ jsx27(
4353
4440
  "div",
4354
4441
  {
4355
4442
  role: "separator",
@@ -4360,7 +4447,7 @@ function Toolbar({
4360
4447
  item.key
4361
4448
  );
4362
4449
  case "spacer":
4363
- return /* @__PURE__ */ jsx25(
4450
+ return /* @__PURE__ */ jsx27(
4364
4451
  "div",
4365
4452
  {
4366
4453
  className: "gridkit-toolbar-spacer",
@@ -4369,7 +4456,7 @@ function Toolbar({
4369
4456
  item.key
4370
4457
  );
4371
4458
  case "custom":
4372
- return /* @__PURE__ */ jsx25(
4459
+ return /* @__PURE__ */ jsx27(
4373
4460
  "div",
4374
4461
  {
4375
4462
  ...item.attributes,
@@ -4391,7 +4478,7 @@ function Toolbar({
4391
4478
  className: "gridkit-toolbar",
4392
4479
  children: [
4393
4480
  shown.map(draw),
4394
- overflow.length > 0 && /* @__PURE__ */ jsx25(
4481
+ overflow.length > 0 && /* @__PURE__ */ jsx27(
4395
4482
  ToolbarMenuButton,
4396
4483
  {
4397
4484
  itemKey: "more",
@@ -4592,14 +4679,14 @@ function useGridController(options) {
4592
4679
  }
4593
4680
 
4594
4681
  // src/DataGrid/useInfiniteScroll.ts
4595
- import { useEffect as useEffect7, useRef as useRef20 } from "react";
4682
+ import { useEffect as useEffect7, useRef as useRef21 } from "react";
4596
4683
  import { attachInfiniteScroll } from "@gridkitjs/dom";
4597
4684
  function useInfiniteScroll({
4598
4685
  rootRef,
4599
4686
  sentinelRef,
4600
4687
  config
4601
4688
  }) {
4602
- const scroll = useRef20(null);
4689
+ const scroll = useRef21(null);
4603
4690
  useEffect7(() => {
4604
4691
  const root = rootRef.current;
4605
4692
  if (root === null) {
@@ -4627,10 +4714,10 @@ function useInfiniteScroll({
4627
4714
  }
4628
4715
 
4629
4716
  // src/DataGrid/useLiveAnnouncer.ts
4630
- import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect16, useRef as useRef21 } from "react";
4717
+ import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect16, useRef as useRef22 } from "react";
4631
4718
  import { createLiveAnnouncer } from "@gridkitjs/dom";
4632
4719
  function useLiveAnnouncer(containerRef) {
4633
- const announcer = useRef21(null);
4720
+ const announcer = useRef22(null);
4634
4721
  useLayoutEffect16(() => {
4635
4722
  const container = containerRef.current;
4636
4723
  if (container === null) {
@@ -4649,7 +4736,7 @@ function useLiveAnnouncer(containerRef) {
4649
4736
  }
4650
4737
 
4651
4738
  // src/DataGrid/useRowVirtualizer.ts
4652
- import { useLayoutEffect as useLayoutEffect17, useRef as useRef22, useState as useState18 } from "react";
4739
+ import { useLayoutEffect as useLayoutEffect17, useRef as useRef23, useState as useState18 } from "react";
4653
4740
  import {
4654
4741
  bodyRowFrom as bodyRowFrom3,
4655
4742
  createRowVirtualizer as createRowVirtualizer2
@@ -4690,8 +4777,8 @@ function useRowVirtualizer({
4690
4777
  overscan
4691
4778
  }) {
4692
4779
  const [virtualizer, setVirtualizer] = useState18(null);
4693
- const instance = useRef22(null);
4694
- const rowCount = useRef22(rows.length);
4780
+ const instance = useRef23(null);
4781
+ const rowCount = useRef23(rows.length);
4695
4782
  const [rowWindow, setRowWindow] = useState18(enabled ? NO_ROWS3 : ALL_ROWS);
4696
4783
  if (!enabled && rowWindow.kind !== "allRows") {
4697
4784
  setRowWindow(ALL_ROWS);
@@ -4735,7 +4822,7 @@ function useRowVirtualizer({
4735
4822
  }
4736
4823
 
4737
4824
  // src/DataGrid/DataGrid.tsx
4738
- import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
4825
+ import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
4739
4826
  var NO_AGGREGATES = [];
4740
4827
  function paginationReader(controller) {
4741
4828
  let last;
@@ -4773,6 +4860,12 @@ function tablesStyle(height, headerHeight, footerHeight, pinned) {
4773
4860
  const style = { ...heights, ...widths };
4774
4861
  return Object.keys(style).length === 0 ? void 0 : style;
4775
4862
  }
4863
+ function emptyContext(view, filter, loading, infiniteScroll) {
4864
+ if (view.pageRows.length > 0 || view.columns.length === 0 || loading || infiniteScroll?.hasMore === true) {
4865
+ return null;
4866
+ }
4867
+ return { filtered: filter.length > 0 };
4868
+ }
4776
4869
  function DataGrid(props) {
4777
4870
  const {
4778
4871
  borders,
@@ -4784,6 +4877,7 @@ function DataGrid(props) {
4784
4877
  groupableColumns = false,
4785
4878
  groupToggleIconColumns = true,
4786
4879
  groupByBarVisibility = "auto",
4880
+ loading = false,
4787
4881
  paginated = false,
4788
4882
  pager,
4789
4883
  infiniteScroll,
@@ -4805,15 +4899,15 @@ function DataGrid(props) {
4805
4899
  const hoverRows = hoverable?.rows ?? true;
4806
4900
  const hoverColumns = hoverable?.columns ?? true;
4807
4901
  const hoverCells = hoverable?.cells ?? true;
4808
- const viewportRef = useRef23(null);
4809
- const gridRef = useRef23(null);
4810
- const headerTableRef = useRef23(null);
4811
- const bodyTableRef = useRef23(null);
4812
- const bodyRef = useRef23(null);
4813
- const footerTableRef = useRef23(null);
4814
- const sentinelRef = useRef23(null);
4902
+ const viewportRef = useRef24(null);
4903
+ const gridRef = useRef24(null);
4904
+ const headerTableRef = useRef24(null);
4905
+ const bodyTableRef = useRef24(null);
4906
+ const bodyRef = useRef24(null);
4907
+ const footerTableRef = useRef24(null);
4908
+ const sentinelRef = useRef24(null);
4815
4909
  const viewportWidth = useElementWidth(gridRef, resizeMode === "fit");
4816
- const subscribersRef = useRef23(/* @__PURE__ */ new Set());
4910
+ const subscribersRef = useRef24(/* @__PURE__ */ new Set());
4817
4911
  const gridId = useId2();
4818
4912
  const announce = useLiveAnnouncer(viewportRef);
4819
4913
  const messages = useMemo5(
@@ -4856,11 +4950,30 @@ function DataGrid(props) {
4856
4950
  );
4857
4951
  }
4858
4952
  }, [paginated, hasInfiniteScroll]);
4953
+ const serverPagesUncounted = props.dataMode === "server" && paginated && props.rowCount === void 0;
4954
+ useEffect8(() => {
4955
+ if (serverPagesUncounted) {
4956
+ console.error(
4957
+ 'DataGrid: a `paginated` grid under `dataMode: "server"` needs `rowCount` \u2014 without it the pager counts only the rows given, one page. Pass `0` until the first response.'
4958
+ );
4959
+ }
4960
+ }, [serverPagesUncounted]);
4859
4961
  useInfiniteScroll({
4860
4962
  rootRef: gridRef,
4861
4963
  sentinelRef,
4862
4964
  config: infiniteScroll
4863
4965
  });
4966
+ const empty = emptyContext(view, state.filter, loading, infiniteScroll);
4967
+ const messageWidth = useElementWidth(
4968
+ gridRef,
4969
+ (empty !== null || loading) && resizeMode !== "fit"
4970
+ );
4971
+ const bodyViewportWidth = viewportWidth ?? messageWidth;
4972
+ useEffect8(() => {
4973
+ if (loading) {
4974
+ announce(messages.loading);
4975
+ }
4976
+ }, [loading, announce, messages.loading]);
4864
4977
  function columnOf(columnId) {
4865
4978
  return view.dataColumns.find((candidate) => candidate.id === columnId)?.column;
4866
4979
  }
@@ -5140,7 +5253,7 @@ function DataGrid(props) {
5140
5253
  ref: viewportRef,
5141
5254
  tabIndex: -1,
5142
5255
  children: [
5143
- /* @__PURE__ */ jsx26(
5256
+ /* @__PURE__ */ jsx28(
5144
5257
  GridToolbar,
5145
5258
  {
5146
5259
  toolbar: props.toolbar,
@@ -5152,7 +5265,7 @@ function DataGrid(props) {
5152
5265
  announce
5153
5266
  }
5154
5267
  ),
5155
- showGroupByBar && /* @__PURE__ */ jsx26(
5268
+ showGroupByBar && /* @__PURE__ */ jsx28(
5156
5269
  GroupByBar,
5157
5270
  {
5158
5271
  columns: view.columns,
@@ -5173,7 +5286,7 @@ function DataGrid(props) {
5173
5286
  id: gridId,
5174
5287
  className: "gridkit-data-grid-tables",
5175
5288
  role: state.groupBy.length > 0 ? "treegrid" : "grid",
5176
- "aria-rowcount": view.displayRows.length + (hasFooter ? 2 : 1),
5289
+ "aria-rowcount": view.rowCount + (hasFooter ? 2 : 1),
5177
5290
  "aria-colcount": view.columns.length,
5178
5291
  tabIndex: -1,
5179
5292
  style: tablesStyle(
@@ -5183,6 +5296,7 @@ function DataGrid(props) {
5183
5296
  pinnedWidths2(view.columns)
5184
5297
  ),
5185
5298
  ...ariaAttr(multiselectable, "aria-multiselectable", true),
5299
+ ...ariaAttr(loading, "aria-busy", true),
5186
5300
  ...ariaAttr(labelledBy !== void 0, "aria-labelledby", labelledBy),
5187
5301
  ...ariaAttr(
5188
5302
  labelledBy === void 0 && label !== void 0,
@@ -5213,8 +5327,8 @@ function DataGrid(props) {
5213
5327
  style: { width: totalColumnWidth(view.columns) },
5214
5328
  className: classNames(gridTableClassName, "gridkit-data-grid-header"),
5215
5329
  children: [
5216
- /* @__PURE__ */ jsx26(GridColgroup, { columns: view.columns }),
5217
- /* @__PURE__ */ jsx26(
5330
+ /* @__PURE__ */ jsx28(GridColgroup, { columns: view.columns }),
5331
+ /* @__PURE__ */ jsx28(
5218
5332
  GridHeader,
5219
5333
  {
5220
5334
  columns: view.columns,
@@ -5235,49 +5349,62 @@ function DataGrid(props) {
5235
5349
  ]
5236
5350
  }
5237
5351
  ),
5238
- /* @__PURE__ */ jsx26(
5352
+ /* @__PURE__ */ jsxs19(
5239
5353
  "div",
5240
5354
  {
5241
5355
  className: "gridkit-data-grid-body",
5242
5356
  ref: bodyRef,
5243
5357
  role: "rowgroup",
5244
5358
  tabIndex: -1,
5245
- children: /* @__PURE__ */ jsxs19(
5246
- "table",
5247
- {
5248
- ref: bodyTableRef,
5249
- role: "presentation",
5250
- style: { width: totalColumnWidth(view.columns) },
5251
- className: gridTableClassName,
5252
- children: [
5253
- /* @__PURE__ */ jsx26(GridColgroup, { columns: view.columns }),
5254
- /* @__PURE__ */ jsx26(
5255
- GridBody,
5256
- {
5257
- columns: view.columns,
5258
- definitions,
5259
- rows: view.pageRows,
5260
- activeColumnId: resize.activeColumnId,
5261
- nav,
5262
- selection,
5263
- controller,
5264
- aggregates,
5265
- groupAggregateDisplay,
5266
- virtualRange: virtualized ? virtualizer : null,
5267
- infiniteScroll,
5268
- sentinelRef,
5269
- locale,
5270
- getRowProps,
5271
- onRowClick,
5272
- onRowDoubleClick,
5273
- messages,
5274
- cellMenu: contextMenu.opens("cell"),
5275
- groupMenu: contextMenu.opens("group")
5276
- }
5277
- )
5278
- ]
5279
- }
5280
- )
5359
+ children: [
5360
+ /* @__PURE__ */ jsxs19(
5361
+ "table",
5362
+ {
5363
+ ref: bodyTableRef,
5364
+ role: "presentation",
5365
+ style: { width: totalColumnWidth(view.columns) },
5366
+ className: gridTableClassName,
5367
+ children: [
5368
+ /* @__PURE__ */ jsx28(GridColgroup, { columns: view.columns }),
5369
+ /* @__PURE__ */ jsx28(
5370
+ GridBody,
5371
+ {
5372
+ columns: view.columns,
5373
+ definitions,
5374
+ rows: view.pageRows,
5375
+ activeColumnId: resize.activeColumnId,
5376
+ nav,
5377
+ selection,
5378
+ controller,
5379
+ aggregates,
5380
+ groupAggregateDisplay,
5381
+ virtualRange: virtualized ? virtualizer : null,
5382
+ infiniteScroll,
5383
+ sentinelRef,
5384
+ empty,
5385
+ emptyTemplate: props.emptyTemplate,
5386
+ viewportWidth: bodyViewportWidth,
5387
+ locale,
5388
+ getRowProps,
5389
+ onRowClick,
5390
+ onRowDoubleClick,
5391
+ messages,
5392
+ cellMenu: contextMenu.opens("cell"),
5393
+ groupMenu: contextMenu.opens("group")
5394
+ }
5395
+ )
5396
+ ]
5397
+ }
5398
+ ),
5399
+ loading && /* @__PURE__ */ jsx28(
5400
+ GridLoadingOverlay,
5401
+ {
5402
+ empty: view.pageRows.length === 0,
5403
+ viewportWidth: bodyViewportWidth,
5404
+ children: props.loadingTemplate ? props.loadingTemplate() : messages.loading
5405
+ }
5406
+ )
5407
+ ]
5281
5408
  }
5282
5409
  ),
5283
5410
  hasFooter && /* @__PURE__ */ jsxs19(
@@ -5291,8 +5418,8 @@ function DataGrid(props) {
5291
5418
  "gridkit-data-grid-footer"
5292
5419
  ),
5293
5420
  children: [
5294
- /* @__PURE__ */ jsx26(GridColgroup, { columns: view.columns }),
5295
- /* @__PURE__ */ jsx26(
5421
+ /* @__PURE__ */ jsx28(GridColgroup, { columns: view.columns }),
5422
+ /* @__PURE__ */ jsx28(
5296
5423
  GridFooter,
5297
5424
  {
5298
5425
  columns: view.columns,
@@ -5300,7 +5427,7 @@ function DataGrid(props) {
5300
5427
  results: view.grandTotal,
5301
5428
  rows: view.rows.map((entry) => entry.row),
5302
5429
  locale,
5303
- ariaRowIndex: view.displayRows.length + 2
5430
+ ariaRowIndex: view.rowCount + 2
5304
5431
  }
5305
5432
  )
5306
5433
  ]
@@ -5309,8 +5436,8 @@ function DataGrid(props) {
5309
5436
  ]
5310
5437
  }
5311
5438
  ),
5312
- /* @__PURE__ */ jsx26(GridContextMenu, { contextMenu }),
5313
- /* @__PURE__ */ jsx26(
5439
+ /* @__PURE__ */ jsx28(GridContextMenu, { contextMenu }),
5440
+ /* @__PURE__ */ jsx28(
5314
5441
  GridPanels,
5315
5442
  {
5316
5443
  panels,
@@ -5319,7 +5446,7 @@ function DataGrid(props) {
5319
5446
  messages
5320
5447
  }
5321
5448
  ),
5322
- paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */ jsx26(GridPager, { pager: pagerContext, config: pager, messages }))
5449
+ paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */ jsx28(GridPager, { pager: pagerContext, config: pager, messages }))
5323
5450
  ]
5324
5451
  }
5325
5452
  );
@@ -5335,7 +5462,7 @@ import { useCallback as useCallback5 } from "react";
5335
5462
  import {
5336
5463
  useCallback as useCallback4,
5337
5464
  useEffect as useEffect9,
5338
- useRef as useRef24,
5465
+ useRef as useRef25,
5339
5466
  useSyncExternalStore as useSyncExternalStore3
5340
5467
  } from "react";
5341
5468
  function subscribeTo(api, listener) {
@@ -5352,7 +5479,7 @@ function unsubscribe(subscription) {
5352
5479
  }
5353
5480
  }
5354
5481
  function useGridSnapshot(gridRef, getSnapshot, fallback) {
5355
- const subscription = useRef24(null);
5482
+ const subscription = useRef25(null);
5356
5483
  const subscribe = useCallback4(
5357
5484
  (listener) => {
5358
5485
  subscription.current = subscribeTo(gridRef.current, listener);