@gridkitjs/react 0.17.1 → 0.19.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
@@ -7,17 +7,20 @@ import {
7
7
  useImperativeHandle as useImperativeHandle3,
8
8
  useMemo as useMemo5,
9
9
  useRef as useRef23,
10
- useState as useState18
10
+ useState as useState19
11
11
  } from "react";
12
12
  import {
13
- bodyFocus as bodyFocus3,
14
13
  headerFocus as headerFocus3,
15
- moveColumnBefore,
16
14
  resolveColumnHeaderText as resolveColumnHeaderText2,
15
+ resolveColumnPin as resolveColumnPin2,
17
16
  resolveMessages,
18
- resolveRows,
19
- totalColumnWidth
17
+ resolveRows
20
18
  } from "@gridkitjs/core";
19
+ import {
20
+ moveColumnInPinGroup,
21
+ pinnedWidths as pinnedWidths2,
22
+ totalColumnWidth
23
+ } from "@gridkitjs/core/renderer";
21
24
 
22
25
  // src/DataGrid/components/GridColgroup.tsx
23
26
  import { jsx } from "react/jsx-runtime";
@@ -28,15 +31,19 @@ function GridColgroup({ columns }) {
28
31
  // src/DataGrid/components/GridHeader.tsx
29
32
  import { createPortal } from "react-dom";
30
33
  import {
31
- buildKeyShortcuts,
32
34
  headerFocus,
33
- intentOf,
34
35
  isColumnFiltered,
35
- KEYBOARD_STEP,
36
- resolveColumnFilterMenu,
37
36
  sortDirectionFor,
38
37
  sortPriorityFor
39
38
  } from "@gridkitjs/core";
39
+ import {
40
+ buildKeyShortcuts,
41
+ inlineStep,
42
+ intentOf,
43
+ KEYBOARD_STEP,
44
+ resolveColumnFilterMenu
45
+ } from "@gridkitjs/core/renderer";
46
+ import { writingDirection } from "@gridkitjs/dom";
40
47
 
41
48
  // src/DataGrid/ariaAttr.ts
42
49
  function ariaAttr(condition, key, value) {
@@ -108,6 +115,27 @@ function isOwnEvent(event) {
108
115
  return event.target instanceof Node && event.currentTarget.contains(event.target);
109
116
  }
110
117
 
118
+ // src/DataGrid/pinnedCell.ts
119
+ function pinnedCellClassNames({
120
+ pinned,
121
+ pinEdge
122
+ }) {
123
+ if (pinned === "none") return "";
124
+ return classNames(
125
+ pinned === "start" ? "is-pinned-start" : "is-pinned-end",
126
+ pinEdge && "is-pinned-edge"
127
+ );
128
+ }
129
+ function pinnedCellStyle({
130
+ pinned,
131
+ pinOffset
132
+ }) {
133
+ if (pinned === "none") return void 0;
134
+ return {
135
+ "--gridkit-pin-offset": `${String(pinOffset)}px`
136
+ };
137
+ }
138
+
111
139
  // src/DataGrid/useGridSelection.ts
112
140
  import { useMemo } from "react";
113
141
  function keyboardSelectIntent(event) {
@@ -175,12 +203,14 @@ function GridHeader({
175
203
  }
176
204
  }
177
205
  return /* @__PURE__ */ jsxs2("thead", { role: "rowgroup", children: [
178
- /* @__PURE__ */ jsx3("tr", { className: "grid-header", role: "row", "aria-rowindex": 1, children: columns.map((entry, index) => {
206
+ /* @__PURE__ */ jsx3("tr", { className: "gridkit-grid-header", role: "row", "aria-rowindex": 1, children: columns.map((entry, index) => {
179
207
  const { column } = entry;
180
208
  const resizing = resize.activeColumnId === entry.id;
181
209
  const dragging = drag.draggedColumnId === entry.id;
182
- const dropBefore = beforeId !== void 0 && beforeId === entry.id;
183
- const dropAfter = beforeId === null && index === columns.length - 1;
210
+ const dragBlocked = draggedEntry !== null && entry.pinned !== draggedEntry.pinned;
211
+ const next = columns[index + 1];
212
+ const dropBefore = beforeId === entry.id && !dragBlocked;
213
+ const dropAfter = !dragBlocked && (next === void 0 ? beforeId === null : beforeId === next.id && next.pinned !== entry.pinned);
184
214
  const selected = selection.selectedColumnIds.has(entry.id);
185
215
  const sortable = column.sortable ?? sortableColumns;
186
216
  const sortDirection = sortDirectionFor(columnSort, entry.id);
@@ -220,23 +250,25 @@ function GridHeader({
220
250
  if (drag.justDragged(entry.id)) {
221
251
  return;
222
252
  }
223
- if (event.target instanceof Element && (event.target.closest(".header-resize-handle") !== null || event.target.closest(".header-sort-toggle") !== null || event.target.closest(".header-group-toggle") !== null || event.target.closest(".header-filter-toggle") !== null)) {
253
+ if (event.target instanceof Element && (event.target.closest(".gridkit-header-resize-handle") !== null || event.target.closest(".gridkit-header-sort-toggle") !== null || event.target.closest(".gridkit-header-group-toggle") !== null || event.target.closest(".gridkit-header-filter-toggle") !== null)) {
224
254
  return;
225
255
  }
226
256
  selection.selectColumn(entry.id, intentOf(event));
227
257
  },
228
258
  onKeyDown: (event) => {
229
259
  if (!isOwnEvent(event)) return;
230
- const horizontal = event.key === "ArrowLeft" || event.key === "ArrowRight";
231
- const direction = event.key === "ArrowLeft" ? -1 : 1;
232
- if (horizontal && event.ctrlKey && entry.reorderable) {
260
+ const step = inlineStep(
261
+ event.key,
262
+ writingDirection(event.currentTarget)
263
+ );
264
+ if (step !== null && event.ctrlKey && entry.reorderable) {
233
265
  event.preventDefault();
234
- drag.moveByKeyboard(entry, direction);
266
+ drag.moveByKeyboard(entry, step);
235
267
  return;
236
268
  }
237
- if (horizontal && event.altKey && entry.resizable) {
269
+ if (step !== null && event.altKey && entry.resizable) {
238
270
  event.preventDefault();
239
- resize.nudge(entry, direction * KEYBOARD_STEP);
271
+ resize.nudge(entry, step * KEYBOARD_STEP);
240
272
  return;
241
273
  }
242
274
  if (event.key === "Enter" && event.altKey && entry.resizable) {
@@ -272,7 +304,7 @@ function GridHeader({
272
304
  nav.onKeyDown(event);
273
305
  },
274
306
  className: classNames(
275
- "header-cell",
307
+ "gridkit-header-cell",
276
308
  // The grab affordance a header showing either drag
277
309
  // destination shares — a column dragged only for grouping
278
310
  // (`groupByDraggable` without `reorderable`) grabs the same
@@ -283,9 +315,12 @@ function GridHeader({
283
315
  dragging ? "is-dragging" : "",
284
316
  dropBefore ? "is-drop-before" : "",
285
317
  dropAfter ? "is-drop-after" : "",
318
+ dragBlocked ? "is-drag-blocked" : "",
286
319
  column.wrap?.header ? "is-wrapped" : "",
320
+ pinnedCellClassNames(entry),
287
321
  column.headerClassName ?? ""
288
322
  ),
323
+ style: pinnedCellStyle(entry),
289
324
  ...ariaAttr(shortcuts !== "", "aria-keyshortcuts", shortcuts),
290
325
  ...ariaAttr(
291
326
  filtered,
@@ -316,7 +351,7 @@ function GridHeader({
316
351
  "span",
317
352
  {
318
353
  className: classNames(
319
- "header-group-toggle",
354
+ "gridkit-header-group-toggle",
320
355
  isGrouped ? "is-grouped" : ""
321
356
  ),
322
357
  "aria-hidden": "true",
@@ -342,7 +377,7 @@ function GridHeader({
342
377
  "span",
343
378
  {
344
379
  className: classNames(
345
- "header-sort-toggle",
380
+ "gridkit-header-sort-toggle",
346
381
  sortDirection !== null ? `is-sorted-${sortDirection}` : ""
347
382
  ),
348
383
  "aria-hidden": "true",
@@ -357,7 +392,7 @@ function GridHeader({
357
392
  },
358
393
  children: [
359
394
  sortDirection === null ? /* @__PURE__ */ jsx3(ChevronsUpDownIcon, {}) : /* @__PURE__ */ jsx3(ChevronUpIcon, {}),
360
- sortPriority !== null && sortPriority > 1 && /* @__PURE__ */ jsx3("span", { className: "header-sort-priority", children: sortPriority })
395
+ sortPriority !== null && sortPriority > 1 && /* @__PURE__ */ jsx3("span", { className: "gridkit-header-sort-priority", children: sortPriority })
361
396
  ]
362
397
  }
363
398
  ),
@@ -371,7 +406,7 @@ function GridHeader({
371
406
  "span",
372
407
  {
373
408
  className: classNames(
374
- "header-filter-toggle",
409
+ "gridkit-header-filter-toggle",
375
410
  filtered ? "is-filtered" : ""
376
411
  ),
377
412
  "aria-hidden": "true",
@@ -394,7 +429,7 @@ function GridHeader({
394
429
  /* @__PURE__ */ jsx3(
395
430
  "span",
396
431
  {
397
- className: "header-resize-handle",
432
+ className: "gridkit-header-resize-handle",
398
433
  "aria-hidden": "true",
399
434
  tabIndex: -1,
400
435
  onPointerDown: (event) => {
@@ -414,7 +449,7 @@ function GridHeader({
414
449
  /* @__PURE__ */ jsx3(
415
450
  "div",
416
451
  {
417
- className: "gridkit-data-grid header-cell drag-ghost",
452
+ className: "gridkit-data-grid gridkit-header-cell gridkit-drag-ghost",
418
453
  style: {
419
454
  width: draggedEntry.width,
420
455
  transform: drag.ghostTransform
@@ -434,10 +469,9 @@ import {
434
469
  useState as useState2
435
470
  } from "react";
436
471
  import {
437
- bodyFocus,
438
- groupRowId,
439
- intentOf as intentOf2
472
+ bodyFocus
440
473
  } from "@gridkitjs/core";
474
+ import { intentOf as intentOf2 } from "@gridkitjs/core/renderer";
441
475
  import {
442
476
  bodyCellFrom,
443
477
  bodyRowFrom,
@@ -454,7 +488,8 @@ import {
454
488
  import {
455
489
  createGridFocus,
456
490
  findBodyRow,
457
- measurePageSize
491
+ measurePageSize,
492
+ writingDirection as writingDirection2
458
493
  } from "@gridkitjs/dom";
459
494
  function tabIndexFor(columnIndex, focusedColumnIndex) {
460
495
  return columnIndex === focusedColumnIndex ? 0 : -1;
@@ -518,7 +553,8 @@ function useGridNavigation({
518
553
  if (gridFocus.handleKey(
519
554
  event.key,
520
555
  event,
521
- measurePageSize(bodyTableRef.current)
556
+ measurePageSize(bodyTableRef.current, gridRef.current),
557
+ writingDirection2(event.currentTarget)
522
558
  )) {
523
559
  event.preventDefault();
524
560
  }
@@ -614,7 +650,7 @@ function GridGroupRowComponent({
614
650
  "data-gridkit-group": groupId,
615
651
  "data-gridkit-row-index": rowIndex,
616
652
  className: classNames(
617
- "grid-group-row",
653
+ "gridkit-grid-group-row",
618
654
  `is-group-level-${String(level)}`
619
655
  ),
620
656
  children: /* @__PURE__ */ jsx4(
@@ -624,35 +660,35 @@ function GridGroupRowComponent({
624
660
  colSpan: columnCount,
625
661
  tabIndex: focused ? 0 : -1,
626
662
  "aria-keyshortcuts": contextMenu ? "Space Enter Shift+F10" : "Space Enter",
627
- className: "grid-group-cell",
663
+ className: "gridkit-grid-group-cell",
628
664
  children: /* @__PURE__ */ jsxs3(
629
665
  "div",
630
666
  {
631
- className: "grid-group-cell-content",
667
+ className: "gridkit-grid-group-cell-content",
632
668
  style: { paddingInlineStart: `${String(level * 1.25 + 0.5)}rem` },
633
669
  children: [
634
670
  /* @__PURE__ */ jsx4(
635
671
  "span",
636
672
  {
637
673
  className: classNames(
638
- "group-toggle",
674
+ "gridkit-group-toggle",
639
675
  expanded ? "is-expanded" : "is-collapsed"
640
676
  ),
641
677
  "aria-hidden": "true"
642
678
  }
643
679
  ),
644
- /* @__PURE__ */ jsxs3("span", { className: "group-label", children: [
680
+ /* @__PURE__ */ jsxs3("span", { className: "gridkit-group-label", children: [
645
681
  resolveColumnLabel(groupColumn),
646
682
  ":",
647
683
  " ",
648
684
  formatGroupValue(value, groupColumn, locale, cellMessages)
649
685
  ] }),
650
- /* @__PURE__ */ jsxs3("span", { className: "group-count", children: [
686
+ /* @__PURE__ */ jsxs3("span", { className: "gridkit-group-count", children: [
651
687
  "(",
652
688
  count,
653
689
  ")"
654
690
  ] }),
655
- aggregates.length > 0 && /* @__PURE__ */ jsx4("span", { className: "group-aggregates", children: aggregates.map((spec) => {
691
+ aggregates.length > 0 && /* @__PURE__ */ jsx4("span", { className: "gridkit-group-aggregates", children: aggregates.map((spec) => {
656
692
  const key = spec.id ?? spec.columnId;
657
693
  const aggregateValue = results.get(key);
658
694
  const column = definitions.get(spec.columnId);
@@ -664,7 +700,7 @@ function GridGroupRowComponent({
664
700
  locale
665
701
  );
666
702
  const aggregateLabel = spec.id ?? (column === void 0 ? spec.columnId : resolveColumnLabel(column));
667
- return /* @__PURE__ */ jsxs3("span", { className: "group-aggregate", children: [
703
+ return /* @__PURE__ */ jsxs3("span", { className: "gridkit-group-aggregate", children: [
668
704
  aggregateLabel,
669
705
  ": ",
670
706
  rendered
@@ -685,6 +721,20 @@ var GridGroupRow_default = GridGroupRow;
685
721
 
686
722
  // src/DataGrid/components/GridGroupSummaryRow.tsx
687
723
  import { memo as memo2 } from "react";
724
+
725
+ // src/DataGrid/textAlign.ts
726
+ function textAlignFor(alignment) {
727
+ switch (alignment) {
728
+ case "left":
729
+ return "start";
730
+ case "right":
731
+ return "end";
732
+ case "center":
733
+ return "center";
734
+ }
735
+ }
736
+
737
+ // src/DataGrid/components/GridGroupSummaryRow.tsx
688
738
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
689
739
  function GridGroupSummaryRowComponent({
690
740
  groupId,
@@ -706,7 +756,7 @@ function GridGroupSummaryRowComponent({
706
756
  "data-gridkit-group-summary": groupId,
707
757
  "data-gridkit-row-index": rowIndex,
708
758
  className: classNames(
709
- "grid-group-summary-row",
759
+ "gridkit-grid-group-summary-row",
710
760
  `is-group-level-${String(level)}`
711
761
  ),
712
762
  children: columns.map((entry) => {
@@ -718,13 +768,19 @@ function GridGroupSummaryRowComponent({
718
768
  {
719
769
  role: "gridcell",
720
770
  "data-gridkit-column": entry.id,
721
- className: "grid-group-summary-cell",
722
- style: { textAlign: specs[0]?.alignment ?? entry.alignment },
771
+ className: classNames(
772
+ "gridkit-grid-group-summary-cell",
773
+ pinnedCellClassNames(entry)
774
+ ),
775
+ style: {
776
+ textAlign: textAlignFor(specs[0]?.alignment ?? entry.alignment),
777
+ ...pinnedCellStyle(entry)
778
+ },
723
779
  children: [
724
780
  entry.id === columns[0]?.id && /* @__PURE__ */ jsx5(
725
781
  "span",
726
782
  {
727
- className: "grid-group-summary-indent",
783
+ className: "gridkit-grid-group-summary-indent",
728
784
  style: { width: `${String(level * 1.25 + 0.5)}rem` },
729
785
  "aria-hidden": "true"
730
786
  }
@@ -766,6 +822,9 @@ function GridRowComponent({
766
822
  row,
767
823
  rowIndex,
768
824
  datasetIndex,
825
+ groupLevel,
826
+ groupPosition,
827
+ groupSetSize,
769
828
  activeColumnId,
770
829
  selectedColumnIds,
771
830
  selected,
@@ -793,13 +852,17 @@ function GridRowComponent({
793
852
  "aria-rowindex": datasetIndex + 2,
794
853
  "data-gridkit-row-index": rowIndex,
795
854
  "data-gridkit-row-id": rowId,
855
+ "aria-level": groupLevel === void 0 ? void 0 : groupLevel + 1,
856
+ "aria-posinset": groupPosition,
857
+ "aria-setsize": groupSetSize,
796
858
  ...ariaAttr(rowsSelectable, "aria-selected", selected),
797
859
  className: classNames(
798
- "grid-row",
860
+ "gridkit-grid-row",
799
861
  selected ? "is-selected" : "",
800
862
  rowClassName
801
863
  ),
802
- children: columns.map(({ id, column, alignment }, columnIndex) => {
864
+ children: columns.map((entry, columnIndex) => {
865
+ const { id, column, alignment } = entry;
803
866
  const value = accessDotted(row, column.field);
804
867
  const cellSelected = id === selectedColumnId;
805
868
  return /* @__PURE__ */ jsx6(
@@ -812,13 +875,17 @@ function GridRowComponent({
812
875
  ...ariaAttr(cellsSelectable, "aria-selected", cellSelected),
813
876
  ...ariaAttr(shortcuts !== "", "aria-keyshortcuts", shortcuts),
814
877
  className: classNames(
815
- "grid-cell",
878
+ "gridkit-grid-cell",
816
879
  id === activeColumnId ? "is-resizing" : "",
817
880
  cellSelected || selectedColumnIds.has(id) ? "is-selected" : "",
818
881
  column.wrap?.cells ? "is-wrapped" : "",
882
+ pinnedCellClassNames(entry),
819
883
  column.cellClassName ?? ""
820
884
  ),
821
- style: { textAlign: alignment },
885
+ style: {
886
+ textAlign: textAlignFor(alignment),
887
+ ...pinnedCellStyle(entry)
888
+ },
822
889
  children: column.cellTemplate ? column.cellTemplate({
823
890
  value,
824
891
  row,
@@ -839,27 +906,6 @@ var GridRow_default = GridRow;
839
906
 
840
907
  // src/DataGrid/components/GridBody.tsx
841
908
  import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
842
- function groupAriaMeta(rows) {
843
- const totals = /* @__PURE__ */ new Map();
844
- for (const entry of rows) {
845
- if (!("kind" in entry) || entry.kind !== "group") continue;
846
- const parentKey = groupRowId(entry.path.slice(0, -1));
847
- totals.set(parentKey, (totals.get(parentKey) ?? 0) + 1);
848
- }
849
- const seen = /* @__PURE__ */ new Map();
850
- const meta = /* @__PURE__ */ new Map();
851
- for (const entry of rows) {
852
- if (!("kind" in entry) || entry.kind !== "group") continue;
853
- const parentKey = groupRowId(entry.path.slice(0, -1));
854
- const posinset = (seen.get(parentKey) ?? 0) + 1;
855
- seen.set(parentKey, posinset);
856
- meta.set(entry.groupId, {
857
- posinset,
858
- setsize: totals.get(parentKey) ?? posinset
859
- });
860
- }
861
- return meta;
862
- }
863
909
  function GridBody({
864
910
  columns,
865
911
  definitions,
@@ -882,7 +928,6 @@ function GridBody({
882
928
  groupMenu
883
929
  }) {
884
930
  const { selectedCell, rowMode, cellMode, toggleOnClick } = selection;
885
- const ariaMeta = useMemo2(() => groupAriaMeta(rows), [rows]);
886
931
  const visibleRows = virtualRange === null ? rows : rows.slice(virtualRange.startIndex, virtualRange.endIndex + 1);
887
932
  const { booleanTrue, booleanFalse, blankGroupValue } = messages;
888
933
  const cellMessages = useMemo2(
@@ -892,14 +937,14 @@ function GridBody({
892
937
  const [resolveRowProps] = useState2(() => createRowPropsResolver());
893
938
  const rowPropsOf = resolveRowProps(
894
939
  visibleRows.filter(
895
- (entry) => !("kind" in entry)
940
+ (entry) => entry.kind === "data"
896
941
  ),
897
942
  getRowProps
898
943
  );
899
944
  function targetOf(target) {
900
945
  const position = bodyCellFrom(target);
901
946
  const entry = position === null ? void 0 : rows[position.rowIndex];
902
- if (position === null || entry === void 0 || "kind" in entry) {
947
+ if (position === null || entry?.kind !== "data") {
903
948
  return null;
904
949
  }
905
950
  return { position, rowId: entry.rowId };
@@ -915,7 +960,7 @@ function GridBody({
915
960
  function rowPointerEventOf(event) {
916
961
  const target = bodyRowFrom(event.target);
917
962
  const entry = target === null ? void 0 : rows[target.rowIndex];
918
- if (target === null || entry === void 0 || "kind" in entry) {
963
+ if (target === null || entry?.kind !== "data") {
919
964
  return null;
920
965
  }
921
966
  return {
@@ -940,8 +985,8 @@ function GridBody({
940
985
  return /* @__PURE__ */ jsxs5(
941
986
  "tbody",
942
987
  {
943
- role: "rowgroup",
944
- className: "grid-body",
988
+ role: "presentation",
989
+ className: "gridkit-grid-body",
945
990
  onFocus: (event) => {
946
991
  const group = groupRowFrom(event.target);
947
992
  if (group !== null) {
@@ -1016,75 +1061,85 @@ function GridBody({
1016
1061
  }
1017
1062
  ) }),
1018
1063
  visibleRows.map((entry) => {
1019
- if (!("kind" in entry)) {
1020
- const rowProps = rowPropsOf(entry.rowId);
1021
- return /* @__PURE__ */ jsx7(
1022
- GridRow_default,
1023
- {
1024
- ref: virtualRange?.measureRow(entry.rowIndex),
1025
- columns,
1026
- rowId: entry.rowId,
1027
- row: entry.row,
1028
- rowIndex: entry.rowIndex,
1029
- datasetIndex: entry.datasetIndex,
1030
- activeColumnId,
1031
- selectedColumnIds: selection.selectedColumnIds,
1032
- selected: selection.selectedRowIds.has(entry.rowId),
1033
- selectedColumnId: selectedCell?.rowId === entry.rowId ? selectedCell.columnId : null,
1034
- focusedColumnIndex: focusedColumnInRow(nav.focus, entry.rowIndex),
1035
- rowsSelectable: rowMode !== false,
1036
- cellsSelectable: cellMode !== false,
1037
- contextMenu: cellMenu,
1038
- locale,
1039
- cellMessages,
1040
- rowClassName: rowProps.className,
1041
- rowAttributes: rowProps.attributes
1042
- },
1043
- entry.rowId
1044
- );
1045
- }
1046
- if (entry.kind === "group-summary") {
1047
- return /* @__PURE__ */ jsx7(
1048
- GridGroupSummaryRow_default,
1049
- {
1050
- ref: virtualRange?.measureRow(entry.rowIndex),
1051
- groupId: entry.groupId,
1052
- level: entry.level,
1053
- rowIndex: entry.rowIndex,
1054
- datasetIndex: entry.datasetIndex,
1055
- results: entry.aggregates,
1056
- aggregates,
1057
- columns,
1058
- locale
1059
- },
1060
- `${entry.groupId}-summary`
1061
- );
1064
+ switch (entry.kind) {
1065
+ case "data": {
1066
+ const rowProps = rowPropsOf(entry.rowId);
1067
+ return /* @__PURE__ */ jsx7(
1068
+ GridRow_default,
1069
+ {
1070
+ ref: virtualRange?.measureRow(entry.rowIndex),
1071
+ columns,
1072
+ rowId: entry.rowId,
1073
+ row: entry.row,
1074
+ rowIndex: entry.rowIndex,
1075
+ datasetIndex: entry.datasetIndex,
1076
+ groupLevel: entry.groupPosition?.level,
1077
+ groupPosition: entry.groupPosition?.position,
1078
+ groupSetSize: entry.groupPosition?.setSize,
1079
+ activeColumnId,
1080
+ selectedColumnIds: selection.selectedColumnIds,
1081
+ selected: selection.selectedRowIds.has(entry.rowId),
1082
+ selectedColumnId: selectedCell.kind === "cell" && selectedCell.rowId === entry.rowId ? selectedCell.columnId : null,
1083
+ focusedColumnIndex: focusedColumnInRow(
1084
+ nav.focus,
1085
+ entry.rowIndex
1086
+ ),
1087
+ rowsSelectable: rowMode !== false,
1088
+ cellsSelectable: cellMode !== false,
1089
+ contextMenu: cellMenu,
1090
+ locale,
1091
+ cellMessages,
1092
+ rowClassName: rowProps.className,
1093
+ rowAttributes: rowProps.attributes
1094
+ },
1095
+ entry.rowId
1096
+ );
1097
+ }
1098
+ case "group-summary":
1099
+ return /* @__PURE__ */ jsx7(
1100
+ GridGroupSummaryRow_default,
1101
+ {
1102
+ ref: virtualRange?.measureRow(entry.rowIndex),
1103
+ groupId: entry.groupId,
1104
+ level: entry.level,
1105
+ rowIndex: entry.rowIndex,
1106
+ datasetIndex: entry.datasetIndex,
1107
+ results: entry.aggregates,
1108
+ aggregates,
1109
+ columns,
1110
+ locale
1111
+ },
1112
+ `${entry.groupId}-summary`
1113
+ );
1114
+ case "group":
1115
+ return /* @__PURE__ */ jsx7(
1116
+ GridGroupRow_default,
1117
+ {
1118
+ ref: virtualRange?.measureRow(entry.rowIndex),
1119
+ columnCount: columns.length,
1120
+ groupId: entry.groupId,
1121
+ level: entry.level,
1122
+ groupColumn: definitions.get(entry.columnId) ?? { field: entry.columnId },
1123
+ value: entry.value,
1124
+ expanded: entry.expanded,
1125
+ count: entry.count,
1126
+ rowIndex: entry.rowIndex,
1127
+ datasetIndex: entry.datasetIndex,
1128
+ posinset: entry.position,
1129
+ setsize: entry.setSize,
1130
+ aggregates: groupAggregateDisplay === "inline" ? aggregates : [],
1131
+ results: entry.aggregates,
1132
+ definitions,
1133
+ locale,
1134
+ cellMessages,
1135
+ focused: focusedColumnInRow(nav.focus, entry.rowIndex) !== null,
1136
+ contextMenu: groupMenu
1137
+ },
1138
+ entry.groupId
1139
+ );
1140
+ default:
1141
+ return entry;
1062
1142
  }
1063
- return /* @__PURE__ */ jsx7(
1064
- GridGroupRow_default,
1065
- {
1066
- ref: virtualRange?.measureRow(entry.rowIndex),
1067
- columnCount: columns.length,
1068
- groupId: entry.groupId,
1069
- level: entry.level,
1070
- groupColumn: definitions.get(entry.columnId) ?? { field: entry.columnId },
1071
- value: entry.value,
1072
- expanded: entry.expanded,
1073
- count: entry.count,
1074
- rowIndex: entry.rowIndex,
1075
- datasetIndex: entry.datasetIndex,
1076
- posinset: ariaMeta.get(entry.groupId)?.posinset ?? 1,
1077
- setsize: ariaMeta.get(entry.groupId)?.setsize ?? 1,
1078
- aggregates: groupAggregateDisplay === "inline" ? aggregates : [],
1079
- results: entry.aggregates,
1080
- definitions,
1081
- locale,
1082
- cellMessages,
1083
- focused: focusedColumnInRow(nav.focus, entry.rowIndex) !== null,
1084
- contextMenu: groupMenu
1085
- },
1086
- entry.groupId
1087
- );
1088
1143
  }),
1089
1144
  virtualRange !== null && virtualRange.offsetAfter > 0 && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx7(
1090
1145
  "td",
@@ -1097,13 +1152,20 @@ function GridBody({
1097
1152
  }
1098
1153
  ) }),
1099
1154
  infiniteScroll?.hasMore && /* @__PURE__ */ jsxs5(Fragment, { children: [
1100
- infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", className: "grid-loading-row", children: /* @__PURE__ */ jsx7("td", { colSpan: columns.length, className: "grid-loading-cell", children: infiniteScroll.loadingTemplate ? infiniteScroll.loadingTemplate() : messages.loadingMore }) }),
1155
+ infiniteScroll.isLoadingMore === true && /* @__PURE__ */ jsx7("tr", { "aria-hidden": "true", className: "gridkit-grid-loading-row", children: /* @__PURE__ */ jsx7(
1156
+ "td",
1157
+ {
1158
+ colSpan: columns.length,
1159
+ className: "gridkit-grid-loading-cell",
1160
+ children: infiniteScroll.loadingTemplate ? infiniteScroll.loadingTemplate() : messages.loadingMore
1161
+ }
1162
+ ) }),
1101
1163
  /* @__PURE__ */ jsx7(
1102
1164
  "tr",
1103
1165
  {
1104
1166
  "aria-hidden": "true",
1105
1167
  ref: sentinelRef,
1106
- className: "grid-sentinel-row",
1168
+ className: "gridkit-grid-sentinel-row",
1107
1169
  children: /* @__PURE__ */ jsx7(
1108
1170
  "td",
1109
1171
  {
@@ -1129,36 +1191,50 @@ function GridFooter({
1129
1191
  locale,
1130
1192
  ariaRowIndex
1131
1193
  }) {
1132
- return /* @__PURE__ */ jsx8("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx8("tr", { className: "grid-footer", role: "row", "aria-rowindex": ariaRowIndex, children: columns.map((entry) => {
1133
- const specs = aggregates.filter(
1134
- (candidate) => candidate.columnId === entry.id
1135
- );
1136
- return /* @__PURE__ */ jsx8(
1137
- "td",
1138
- {
1139
- role: "gridcell",
1140
- "data-gridkit-column": entry.id,
1141
- className: "grid-footer-cell",
1142
- style: { textAlign: specs[0]?.alignment ?? entry.alignment },
1143
- children: specs.map(
1144
- (spec) => renderAggregate(
1145
- results.get(spec.id ?? spec.columnId),
1146
- spec,
1147
- entry.column,
1148
- rows,
1149
- locale
1150
- )
1151
- ).flatMap(
1152
- (rendered, index) => index === 0 ? [rendered] : [", ", rendered]
1153
- )
1154
- },
1155
- entry.id
1156
- );
1157
- }) }) });
1194
+ return /* @__PURE__ */ jsx8("tfoot", { role: "rowgroup", children: /* @__PURE__ */ jsx8(
1195
+ "tr",
1196
+ {
1197
+ className: "gridkit-grid-footer",
1198
+ role: "row",
1199
+ "aria-rowindex": ariaRowIndex,
1200
+ children: columns.map((entry) => {
1201
+ const specs = aggregates.filter(
1202
+ (candidate) => candidate.columnId === entry.id
1203
+ );
1204
+ return /* @__PURE__ */ jsx8(
1205
+ "td",
1206
+ {
1207
+ role: "gridcell",
1208
+ "data-gridkit-column": entry.id,
1209
+ className: classNames(
1210
+ "gridkit-grid-footer-cell",
1211
+ pinnedCellClassNames(entry)
1212
+ ),
1213
+ style: {
1214
+ textAlign: textAlignFor(specs[0]?.alignment ?? entry.alignment),
1215
+ ...pinnedCellStyle(entry)
1216
+ },
1217
+ children: specs.map(
1218
+ (spec) => renderAggregate(
1219
+ results.get(spec.id ?? spec.columnId),
1220
+ spec,
1221
+ entry.column,
1222
+ rows,
1223
+ locale
1224
+ )
1225
+ ).flatMap(
1226
+ (rendered, index) => index === 0 ? [rendered] : [", ", rendered]
1227
+ )
1228
+ },
1229
+ entry.id
1230
+ );
1231
+ })
1232
+ }
1233
+ ) });
1158
1234
  }
1159
1235
 
1160
1236
  // src/DataGrid/components/GridPager.tsx
1161
- import { paginationWindow } from "@gridkitjs/core";
1237
+ import { paginationWindow } from "@gridkitjs/core/renderer";
1162
1238
  import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
1163
1239
  function PagerNavButton({
1164
1240
  className,
@@ -1171,7 +1247,7 @@ function PagerNavButton({
1171
1247
  "button",
1172
1248
  {
1173
1249
  type: "button",
1174
- className: `grid-pager-button grid-pager-nav ${className}`,
1250
+ className: `gridkit-grid-pager-button gridkit-grid-pager-nav ${className}`,
1175
1251
  "aria-label": label,
1176
1252
  title: label,
1177
1253
  ...ariaAttr(disabled, "aria-disabled", true),
@@ -1198,11 +1274,11 @@ function GridPager({ pager, config, messages }) {
1198
1274
  role: "group",
1199
1275
  "aria-label": messages.pagerLabel,
1200
1276
  children: [
1201
- /* @__PURE__ */ jsxs6("div", { className: "grid-pager-bar", style: barStyle, children: [
1277
+ /* @__PURE__ */ jsxs6("div", { className: "gridkit-grid-pager-bar", style: barStyle, children: [
1202
1278
  /* @__PURE__ */ jsx9(
1203
1279
  PagerNavButton,
1204
1280
  {
1205
- className: "grid-pager-first",
1281
+ className: "gridkit-grid-pager-first",
1206
1282
  label: messages.firstPage,
1207
1283
  disabled: atFirst,
1208
1284
  onClick: () => {
@@ -1214,7 +1290,7 @@ function GridPager({ pager, config, messages }) {
1214
1290
  /* @__PURE__ */ jsx9(
1215
1291
  PagerNavButton,
1216
1292
  {
1217
- className: "grid-pager-previous",
1293
+ className: "gridkit-grid-pager-previous",
1218
1294
  label: messages.previousPage,
1219
1295
  disabled: atFirst,
1220
1296
  onClick: () => {
@@ -1230,7 +1306,7 @@ function GridPager({ pager, config, messages }) {
1230
1306
  (entry, index) => entry === "ellipsis" ? /* @__PURE__ */ jsx9(
1231
1307
  "span",
1232
1308
  {
1233
- className: "grid-pager-ellipsis",
1309
+ className: "gridkit-grid-pager-ellipsis",
1234
1310
  "aria-hidden": "true",
1235
1311
  children: "\u2026"
1236
1312
  },
@@ -1239,7 +1315,7 @@ function GridPager({ pager, config, messages }) {
1239
1315
  "button",
1240
1316
  {
1241
1317
  type: "button",
1242
- className: "grid-pager-button grid-pager-page",
1318
+ className: "gridkit-grid-pager-button gridkit-grid-pager-page",
1243
1319
  "aria-label": messages.pageButtonLabel(entry),
1244
1320
  "aria-current": entry === currentPage ? "page" : void 0,
1245
1321
  onClick: () => {
@@ -1249,17 +1325,24 @@ function GridPager({ pager, config, messages }) {
1249
1325
  },
1250
1326
  entry
1251
1327
  )
1252
- ) : /* @__PURE__ */ jsxs6("span", { className: "grid-pager-status-slot", children: [
1253
- /* @__PURE__ */ jsx9("span", { className: "grid-pager-status", children: messages.pageStatus(
1328
+ ) : /* @__PURE__ */ jsxs6("span", { className: "gridkit-grid-pager-status-slot", children: [
1329
+ /* @__PURE__ */ jsx9("span", { className: "gridkit-grid-pager-status", children: messages.pageStatus(
1254
1330
  pageCount === 0 ? 0 : currentPage,
1255
1331
  pageCount
1256
1332
  ) }),
1257
- /* @__PURE__ */ jsx9("span", { className: "grid-pager-status-sizer", "aria-hidden": "true", children: messages.pageStatus(pageCount, pageCount) })
1333
+ /* @__PURE__ */ jsx9(
1334
+ "span",
1335
+ {
1336
+ className: "gridkit-grid-pager-status-sizer",
1337
+ "aria-hidden": "true",
1338
+ children: messages.pageStatus(pageCount, pageCount)
1339
+ }
1340
+ )
1258
1341
  ] }),
1259
1342
  /* @__PURE__ */ jsx9(
1260
1343
  PagerNavButton,
1261
1344
  {
1262
- className: "grid-pager-next",
1345
+ className: "gridkit-grid-pager-next",
1263
1346
  label: messages.nextPage,
1264
1347
  disabled: atLast,
1265
1348
  onClick: () => {
@@ -1271,7 +1354,7 @@ function GridPager({ pager, config, messages }) {
1271
1354
  /* @__PURE__ */ jsx9(
1272
1355
  PagerNavButton,
1273
1356
  {
1274
- className: "grid-pager-last",
1357
+ className: "gridkit-grid-pager-last",
1275
1358
  label: messages.lastPage,
1276
1359
  disabled: atLast,
1277
1360
  onClick: () => {
@@ -1281,7 +1364,7 @@ function GridPager({ pager, config, messages }) {
1281
1364
  }
1282
1365
  )
1283
1366
  ] }),
1284
- sizeOptions !== void 0 && sizeOptions.length > 0 && /* @__PURE__ */ jsxs6("label", { className: "grid-pager-page-size", children: [
1367
+ sizeOptions !== void 0 && sizeOptions.length > 0 && /* @__PURE__ */ jsxs6("label", { className: "gridkit-grid-pager-page-size", children: [
1285
1368
  /* @__PURE__ */ jsx9(
1286
1369
  "select",
1287
1370
  {
@@ -1292,7 +1375,7 @@ function GridPager({ pager, config, messages }) {
1292
1375
  children: sizeOptions.map((size) => /* @__PURE__ */ jsx9("option", { value: size, children: size }, size))
1293
1376
  }
1294
1377
  ),
1295
- /* @__PURE__ */ jsx9("span", { className: "grid-pager-page-size-label", children: messages.pageSizeLabel })
1378
+ /* @__PURE__ */ jsx9("span", { className: "gridkit-grid-pager-page-size-label", children: messages.pageSizeLabel })
1296
1379
  ] })
1297
1380
  ]
1298
1381
  }
@@ -1302,9 +1385,13 @@ function GridPager({ pager, config, messages }) {
1302
1385
  // src/DataGrid/components/GroupByBar.tsx
1303
1386
  import { createPortal as createPortal2 } from "react-dom";
1304
1387
  import {
1305
- resolveColumnLabel as resolveColumnLabel2,
1306
- resolveKeyboardDropTarget
1388
+ resolveColumnLabel as resolveColumnLabel2
1307
1389
  } from "@gridkitjs/core";
1390
+ import {
1391
+ inlineStep as inlineStep2,
1392
+ resolveKeyboardDropTarget
1393
+ } from "@gridkitjs/core/renderer";
1394
+ import { writingDirection as writingDirection3 } from "@gridkitjs/dom";
1308
1395
 
1309
1396
  // src/DataGrid/useGroupByDrag.ts
1310
1397
  import {
@@ -1469,7 +1556,7 @@ function GroupByBar({
1469
1556
  role: "group",
1470
1557
  "aria-label": messages.groupByBarLabel,
1471
1558
  children: [
1472
- showPlaceholder && /* @__PURE__ */ jsx10("span", { className: "group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
1559
+ showPlaceholder && /* @__PURE__ */ jsx10("span", { className: "gridkit-group-by-bar-placeholder", children: messages.groupByBarPlaceholder }),
1473
1560
  groupBy.map((entry, index) => {
1474
1561
  const dropBefore = activeDropTarget?.beforeColumnId === entry.columnId;
1475
1562
  const dropAfter = activeDropTarget?.beforeColumnId === null && index === groupBy.length - 1;
@@ -1478,7 +1565,7 @@ function GroupByBar({
1478
1565
  "span",
1479
1566
  {
1480
1567
  className: classNames(
1481
- "group-by-chip",
1568
+ "gridkit-group-by-chip",
1482
1569
  dragging ? "is-dragging" : "",
1483
1570
  dropBefore ? "is-drop-before" : "",
1484
1571
  dropAfter ? "is-drop-after" : ""
@@ -1495,22 +1582,22 @@ function GroupByBar({
1495
1582
  chipDrag.startDrag(entry.columnId, event);
1496
1583
  },
1497
1584
  onKeyDown: (event) => {
1498
- const horizontal = event.key === "ArrowLeft" || event.key === "ArrowRight";
1499
- if (horizontal && event.ctrlKey) {
1585
+ const step = inlineStep2(
1586
+ event.key,
1587
+ writingDirection3(event.currentTarget)
1588
+ );
1589
+ if (step !== null && event.ctrlKey) {
1500
1590
  event.preventDefault();
1501
- moveByKeyboard(
1502
- entry.columnId,
1503
- event.key === "ArrowLeft" ? -1 : 1
1504
- );
1591
+ moveByKeyboard(entry.columnId, step);
1505
1592
  }
1506
1593
  },
1507
1594
  children: [
1508
- /* @__PURE__ */ jsx10("span", { className: "group-by-chip-label", children: labelFor(entry.columnId) }),
1595
+ /* @__PURE__ */ jsx10("span", { className: "gridkit-group-by-chip-label", children: labelFor(entry.columnId) }),
1509
1596
  /* @__PURE__ */ jsx10(
1510
1597
  "button",
1511
1598
  {
1512
1599
  type: "button",
1513
- className: "group-by-chip-remove",
1600
+ className: "gridkit-group-by-chip-remove",
1514
1601
  "aria-label": messages.removeGroupBy(columnName(entry.columnId)),
1515
1602
  onPointerDown: (event) => {
1516
1603
  event.stopPropagation();
@@ -1530,7 +1617,7 @@ function GroupByBar({
1530
1617
  /* @__PURE__ */ jsx10(
1531
1618
  "span",
1532
1619
  {
1533
- className: "group-by-chip drag-ghost",
1620
+ className: "gridkit-group-by-chip gridkit-drag-ghost",
1534
1621
  style: { transform: chipDrag.ghostTransform },
1535
1622
  "aria-hidden": "true",
1536
1623
  children: labelFor(chipDrag.draggedColumnId)
@@ -1546,7 +1633,8 @@ function GroupByBar({
1546
1633
  // src/DataGrid/announcedCallbacks.ts
1547
1634
  import {
1548
1635
  isColumnVisible,
1549
- isGroupExpanded
1636
+ isGroupExpanded,
1637
+ resolveColumnPin
1550
1638
  } from "@gridkitjs/core";
1551
1639
  function announcedCallbacks({
1552
1640
  callbacks,
@@ -1561,8 +1649,8 @@ function announcedCallbacks({
1561
1649
  * continuous `"move"` phase as well, and a live region given every frame
1562
1650
  * of a drag says nothing an assistive technology can keep up with.
1563
1651
  */
1564
- onColumnResize: (event) => {
1565
- callbacks.onColumnResize?.(event);
1652
+ onColumnSizingChange: (event) => {
1653
+ callbacks.onColumnSizingChange?.(event);
1566
1654
  if (event.phase === "end") {
1567
1655
  announce(
1568
1656
  messages.columnResized(
@@ -1600,6 +1688,26 @@ function announcedCallbacks({
1600
1688
  shown ? messages.columnShown(columnName(columnId)) : messages.columnHidden(columnName(columnId))
1601
1689
  );
1602
1690
  },
1691
+ /**
1692
+ * Naming the one column pinned or unpinned and the edge it went to. A
1693
+ * change touching several columns, as `setColumnPinning` or restoring a
1694
+ * layout can, may pin some and unpin others, and says nothing.
1695
+ */
1696
+ onColumnPinningChange: (event) => {
1697
+ callbacks.onColumnPinningChange?.(event);
1698
+ const [columnId, ...others] = event.columnIds;
1699
+ if (columnId === void 0 || others.length > 0) {
1700
+ return;
1701
+ }
1702
+ const column = columnOf(columnId);
1703
+ if (column === void 0) {
1704
+ return;
1705
+ }
1706
+ const pin = resolveColumnPin(column, event.pinning);
1707
+ announce(
1708
+ pin === "none" ? messages.columnUnpinned(columnName(columnId)) : messages.columnPinned(columnName(columnId), pin)
1709
+ );
1710
+ },
1603
1711
  /** A toggle, a stack, or a clear back to "none" each get their own. */
1604
1712
  onColumnSortChange: (event) => {
1605
1713
  callbacks.onColumnSortChange?.(event);
@@ -1716,7 +1824,7 @@ function useGridCopy({
1716
1824
  const { pageRows, columns } = controller.getView();
1717
1825
  const entry = pageRows[focus.rowIndex];
1718
1826
  const column = columns[focus.columnIndex];
1719
- return entry === void 0 || "kind" in entry || column === void 0 ? null : { area: "cell", rowId: entry.rowId, columnId: column.id };
1827
+ return entry?.kind !== "data" || column === void 0 ? null : { area: "cell", rowId: entry.rowId, columnId: column.id };
1720
1828
  }
1721
1829
  return (event) => {
1722
1830
  if (!isCopyKey(event) || isNativeCopy(event.target)) {
@@ -1947,20 +2055,27 @@ import {
1947
2055
  import { useLayoutEffect as useLayoutEffect3, useRef as useRef5 } from "react";
1948
2056
  import { createPortal as createPortal3 } from "react-dom";
1949
2057
  import {
1950
- attachOverlay
2058
+ attachOverlay,
2059
+ writingDirection as writingDirection4
1951
2060
  } from "@gridkitjs/dom";
1952
2061
  import { jsx as jsx11 } from "react/jsx-runtime";
1953
2062
  var ANCHOR_GAP = 4;
1954
2063
  function attachedFocus(focus) {
1955
2064
  return typeof focus === "object" && !(focus instanceof HTMLElement) ? focus.current ?? "first" : focus;
1956
2065
  }
1957
- function overlayThemeClassName(element) {
2066
+ function themeClassNameOf(element) {
1958
2067
  const scope = element?.closest(".gridkit-light, .gridkit-dark");
1959
2068
  if (scope === null || scope === void 0) {
1960
2069
  return "";
1961
2070
  }
1962
2071
  return scope.classList.contains("gridkit-dark") ? "gridkit-dark" : "gridkit-light";
1963
2072
  }
2073
+ function overlayScope(element) {
2074
+ return {
2075
+ themeClassName: themeClassNameOf(element),
2076
+ direction: writingDirection4(element ?? document.documentElement)
2077
+ };
2078
+ }
1964
2079
  function Overlay({
1965
2080
  anchor,
1966
2081
  placement,
@@ -1971,7 +2086,7 @@ function Overlay({
1971
2086
  returnFocusFallback,
1972
2087
  ignoreScrollAfterInput,
1973
2088
  trapFocus,
1974
- themeClassName,
2089
+ scope,
1975
2090
  onDismiss,
1976
2091
  children
1977
2092
  }) {
@@ -2015,7 +2130,8 @@ function Overlay({
2015
2130
  "div",
2016
2131
  {
2017
2132
  ref: panelRef,
2018
- className: classNames("gridkit-overlay", themeClassName),
2133
+ className: classNames("gridkit-overlay", scope.themeClassName),
2134
+ dir: scope.direction,
2019
2135
  children
2020
2136
  }
2021
2137
  ),
@@ -2105,17 +2221,17 @@ function MenuItem({
2105
2221
  {
2106
2222
  role: checked === void 0 ? "menuitem" : "menuitemcheckbox",
2107
2223
  "data-gridkit-menu-item": entry.id,
2108
- className: "menu-item",
2224
+ className: "gridkit-menu-item",
2109
2225
  ...ariaAttr(isItem2 && entry.disabled, "aria-disabled", true),
2110
2226
  ...ariaAttr(checked !== void 0, "aria-checked", checked),
2111
2227
  ...ariaAttr(shortcut !== void 0, "aria-keyshortcuts", shortcut),
2112
2228
  ...ariaAttr(!isItem2, "aria-haspopup", "menu"),
2113
2229
  ...ariaAttr(!isItem2, "aria-expanded", expanded),
2114
2230
  children: [
2115
- /* @__PURE__ */ jsx13("span", { className: "menu-item-icon", "aria-hidden": "true", children: checked === true ? /* @__PURE__ */ jsx13(CheckIcon, {}) : /* @__PURE__ */ jsx13(MenuIcon, { name: entry.icon }) }),
2116
- /* @__PURE__ */ jsx13("span", { className: "menu-item-label", children: entry.label }),
2117
- shortcut !== void 0 && /* @__PURE__ */ jsx13("span", { className: "menu-item-shortcut", "aria-hidden": "true", children: shortcut }),
2118
- !isItem2 && /* @__PURE__ */ jsx13("span", { className: "menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(ChevronRightIcon2, {}) })
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, {}) })
2119
2235
  ]
2120
2236
  }
2121
2237
  );
@@ -2123,7 +2239,7 @@ function MenuItem({
2123
2239
  function GridMenu({
2124
2240
  entries,
2125
2241
  label,
2126
- themeClassName,
2242
+ scope,
2127
2243
  onRun,
2128
2244
  onClose,
2129
2245
  onCloseSubmenu,
@@ -2218,7 +2334,14 @@ function GridMenu({
2218
2334
  "aria-label": label,
2219
2335
  className: "gridkit-menu",
2220
2336
  children: entries.map(
2221
- (entry) => entry.type === "separator" ? /* @__PURE__ */ jsx13("div", { role: "separator", className: "menu-separator" }, entry.key) : /* @__PURE__ */ jsx13(
2337
+ (entry) => entry.type === "separator" ? /* @__PURE__ */ jsx13(
2338
+ "div",
2339
+ {
2340
+ role: "separator",
2341
+ className: "gridkit-menu-separator"
2342
+ },
2343
+ entry.key
2344
+ ) : /* @__PURE__ */ jsx13(
2222
2345
  MenuItem,
2223
2346
  {
2224
2347
  entry,
@@ -2236,14 +2359,14 @@ function GridMenu({
2236
2359
  placement: "right-start",
2237
2360
  offset: submenu.offset,
2238
2361
  initialFocus: submenu.focus,
2239
- themeClassName,
2362
+ scope,
2240
2363
  onDismiss: closeSubmenu,
2241
2364
  children: /* @__PURE__ */ jsx13(
2242
2365
  GridMenu,
2243
2366
  {
2244
2367
  entries: openEntry.items,
2245
2368
  label: openEntry.label,
2246
- themeClassName,
2369
+ scope,
2247
2370
  onRun,
2248
2371
  onClose,
2249
2372
  onCloseSubmenu: closeSubmenu,
@@ -2272,14 +2395,14 @@ function GridContextMenu({
2272
2395
  gap: menu.anchor instanceof Element ? ANCHOR_GAP : 0,
2273
2396
  returnFocusTo: menu.cell ?? void 0,
2274
2397
  returnFocusFallback,
2275
- themeClassName: menu.themeClassName,
2398
+ scope: menu.scope,
2276
2399
  onDismiss: close,
2277
2400
  children: /* @__PURE__ */ jsx14(
2278
2401
  GridMenu,
2279
2402
  {
2280
2403
  entries: menu.entries,
2281
2404
  label: menu.label,
2282
- themeClassName: menu.themeClassName,
2405
+ scope: menu.scope,
2283
2406
  onRun: run,
2284
2407
  onClose: close
2285
2408
  }
@@ -2298,10 +2421,10 @@ import {
2298
2421
  } from "react";
2299
2422
  import {
2300
2423
  contextMenuEntries,
2301
- hasContextMenu,
2302
2424
  isSameCell,
2303
2425
  resolveMenu
2304
2426
  } from "@gridkitjs/core";
2427
+ import { hasContextMenu, pinnedWidths } from "@gridkitjs/core/renderer";
2305
2428
  import {
2306
2429
  attachContextMenuTrigger
2307
2430
  } from "@gridkitjs/dom";
@@ -2315,7 +2438,8 @@ import {
2315
2438
  bodyCellFrom as bodyCellFrom2,
2316
2439
  bodyRowFrom as bodyRowFrom2,
2317
2440
  findBodyRow as findBodyRow2,
2318
- groupRowFrom as groupRowFrom2
2441
+ groupRowFrom as groupRowFrom2,
2442
+ writingDirection as writingDirection5
2319
2443
  } from "@gridkitjs/dom";
2320
2444
  function headerCell(parts, columnIndex) {
2321
2445
  const element = parts.headerTable?.tHead?.rows[0]?.cells[columnIndex];
@@ -2325,24 +2449,46 @@ function bodyCell(parts, rowIndex, columnIndex) {
2325
2449
  const element = findBodyRow2(parts.bodyTable, rowIndex)?.cells[columnIndex];
2326
2450
  return element === void 0 ? null : { element, focus: bodyFocus2(rowIndex, columnIndex) };
2327
2451
  }
2452
+ function underPinnedColumns(element, parts) {
2453
+ return parts.pinnedWidths.start + parts.pinnedWidths.end > 0 && element instanceof HTMLTableCellElement && !element.matches(".is-pinned-start, .is-pinned-end");
2454
+ }
2328
2455
  function viewOf(element, parts) {
2329
- const root = parts.root?.getBoundingClientRect();
2330
- if (root === void 0) {
2456
+ const { scroller } = parts;
2457
+ if (scroller === null) {
2331
2458
  return null;
2332
2459
  }
2333
- const body = parts.body?.contains(element) === true ? parts.body.getBoundingClientRect() : root;
2334
- const left = Math.max(root.left, body.left);
2335
- const top = Math.max(root.top, body.top);
2460
+ const view = scroller.getBoundingClientRect();
2461
+ let { top, bottom, left, right } = view;
2462
+ if (parts.body?.contains(element) === true) {
2463
+ top = Math.max(
2464
+ top,
2465
+ parts.headerTable?.getBoundingClientRect().bottom ?? top
2466
+ );
2467
+ bottom = Math.min(
2468
+ bottom,
2469
+ parts.footerTable?.getBoundingClientRect().top ?? bottom
2470
+ );
2471
+ }
2472
+ if (underPinnedColumns(element, parts)) {
2473
+ const { start, end } = parts.pinnedWidths;
2474
+ const rtl = writingDirection5(element) === "rtl";
2475
+ const portLeft = view.left + scroller.clientLeft;
2476
+ left = portLeft + (rtl ? end : start);
2477
+ right = portLeft + scroller.clientWidth - (rtl ? start : end);
2478
+ }
2336
2479
  return new DOMRect(
2337
2480
  left,
2338
2481
  top,
2339
- Math.max(0, Math.min(root.right, body.right) - left),
2340
- Math.max(0, Math.min(root.bottom, body.bottom) - top)
2482
+ Math.max(0, right - left),
2483
+ Math.max(0, bottom - top)
2341
2484
  );
2342
2485
  }
2343
2486
  function clamp(value, min, max) {
2344
2487
  return Math.min(Math.max(value, min), max);
2345
2488
  }
2489
+ function inlineStartOf(element, box) {
2490
+ return writingDirection5(element) === "rtl" ? box.right : box.left;
2491
+ }
2346
2492
  function onCell(target, cell, parts) {
2347
2493
  if (cell === null) {
2348
2494
  return null;
@@ -2356,14 +2502,22 @@ function onCell(target, cell, parts) {
2356
2502
  target,
2357
2503
  cell,
2358
2504
  anchor: {
2359
- x: clamp(box.left, view.left, view.right),
2505
+ x: clamp(inlineStartOf(cell.element, box), view.left, view.right),
2360
2506
  y: clamp(box.bottom, view.top, view.bottom)
2361
2507
  }
2362
2508
  };
2363
2509
  }
2364
- function onBody(body) {
2365
- const { left, top } = body.getBoundingClientRect();
2366
- return { target: { area: "body" }, cell: null, anchor: { x: left, y: top } };
2510
+ function onBody(body, parts) {
2511
+ const box = body.getBoundingClientRect();
2512
+ const view = viewOf(body, parts) ?? box;
2513
+ return {
2514
+ target: { area: "body" },
2515
+ cell: null,
2516
+ anchor: {
2517
+ x: inlineStartOf(body, view),
2518
+ y: clamp(box.top, view.top, view.bottom)
2519
+ }
2520
+ };
2367
2521
  }
2368
2522
  function headerPlaceAt(element, parts) {
2369
2523
  const cell = element.closest("th[data-gridkit-column]");
@@ -2386,7 +2540,7 @@ function bodyPlaceAt(element, parts) {
2386
2540
  if (group !== null) {
2387
2541
  const entry = pageRows[group.rowIndex];
2388
2542
  const cell = bodyCell(parts, group.rowIndex, 0);
2389
- return entry !== void 0 && "kind" in entry && entry.kind === "group" && cell?.element.contains(element) === true ? onCell(
2543
+ return entry !== void 0 && entry.kind === "group" && cell?.element.contains(element) === true ? onCell(
2390
2544
  { area: "group", groupId: entry.groupId, columnId: entry.columnId },
2391
2545
  cell,
2392
2546
  parts
@@ -2396,13 +2550,13 @@ function bodyPlaceAt(element, parts) {
2396
2550
  if (position !== null) {
2397
2551
  const entry = pageRows[position.rowIndex];
2398
2552
  const cell = bodyCell(parts, position.rowIndex, position.columnIndex);
2399
- return entry !== void 0 && !("kind" in entry) && cell?.element.contains(element) === true ? onCell(
2553
+ return entry !== void 0 && entry.kind === "data" && cell?.element.contains(element) === true ? onCell(
2400
2554
  { area: "cell", rowId: entry.rowId, columnId: position.columnId },
2401
2555
  cell,
2402
2556
  parts
2403
2557
  ) : null;
2404
2558
  }
2405
- return bodyRowFrom2(element) === null ? onBody(body) : null;
2559
+ return bodyRowFrom2(element) === null ? onBody(body, parts) : null;
2406
2560
  }
2407
2561
  function placeAt(element, parts) {
2408
2562
  return headerPlaceAt(element, parts) ?? bodyPlaceAt(element, parts);
@@ -2418,7 +2572,7 @@ function placeOf(target, parts) {
2418
2572
  );
2419
2573
  case "cell": {
2420
2574
  const rowIndex = parts.pageRows.findIndex(
2421
- (entry) => !("kind" in entry) && entry.rowId === target.rowId
2575
+ (entry) => entry.kind === "data" && entry.rowId === target.rowId
2422
2576
  );
2423
2577
  return onCell(
2424
2578
  target,
@@ -2428,21 +2582,23 @@ function placeOf(target, parts) {
2428
2582
  }
2429
2583
  case "group": {
2430
2584
  const rowIndex = parts.pageRows.findIndex(
2431
- (entry) => "kind" in entry && entry.kind === "group" && entry.groupId === target.groupId
2585
+ (entry) => entry.kind === "group" && entry.groupId === target.groupId
2432
2586
  );
2433
2587
  return onCell(target, bodyCell(parts, rowIndex, 0), parts);
2434
2588
  }
2435
2589
  case "body":
2436
- return parts.body === null ? null : onBody(parts.body);
2590
+ return parts.body === null ? null : onBody(parts.body, parts);
2437
2591
  }
2438
2592
  }
2439
2593
 
2440
2594
  // src/DataGrid/contextMenu/useContextMenu.ts
2441
2595
  function useContextMenu({
2442
2596
  rootRef,
2597
+ scrollRef,
2443
2598
  headerTableRef,
2444
2599
  bodyTableRef,
2445
- bodyScrollRef,
2600
+ bodyRef,
2601
+ footerTableRef,
2446
2602
  contextMenu,
2447
2603
  overlay,
2448
2604
  controller,
@@ -2458,11 +2614,13 @@ function useContextMenu({
2458
2614
  function parts() {
2459
2615
  const { columns, pageRows } = controller.getView();
2460
2616
  return {
2461
- root: rootRef.current,
2617
+ scroller: scrollRef.current,
2462
2618
  headerTable: headerTableRef.current,
2463
2619
  bodyTable: bodyTableRef.current,
2464
- body: bodyScrollRef.current,
2620
+ body: bodyRef.current,
2621
+ footerTable: footerTableRef.current,
2465
2622
  columns,
2623
+ pinnedWidths: pinnedWidths(columns),
2466
2624
  pageRows
2467
2625
  };
2468
2626
  }
@@ -2490,7 +2648,11 @@ function useContextMenu({
2490
2648
  if (target.area !== "cell") {
2491
2649
  return false;
2492
2650
  }
2493
- const cell = { rowId: target.rowId, columnId: target.columnId };
2651
+ const cell = {
2652
+ kind: "cell",
2653
+ rowId: target.rowId,
2654
+ columnId: target.columnId
2655
+ };
2494
2656
  const selectRow = selection.rowMode !== false && !state.rowSelection.includes(target.rowId);
2495
2657
  const selectCell = selection.cellMode !== false && !isSameCell(state.cellSelection, cell);
2496
2658
  if (selectRow) {
@@ -2530,7 +2692,7 @@ function useContextMenu({
2530
2692
  label: labelOf(target),
2531
2693
  anchor: point ?? anchor,
2532
2694
  cell: cell?.element ?? null,
2533
- themeClassName: overlayThemeClassName(rootRef.current)
2695
+ scope: overlayScope(rootRef.current)
2534
2696
  }
2535
2697
  });
2536
2698
  return true;
@@ -2621,7 +2783,7 @@ import { useRef as useRef15 } from "react";
2621
2783
 
2622
2784
  // src/DataGrid/columnChooser/ColumnChooser.tsx
2623
2785
  import { useLayoutEffect as useLayoutEffect7, useRef as useRef9, useState as useState6 } from "react";
2624
- import { resolveColumnChooser } from "@gridkitjs/core";
2786
+ import { resolveColumnChooser } from "@gridkitjs/core/renderer";
2625
2787
  import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
2626
2788
  function ColumnChooser({
2627
2789
  controller,
@@ -2657,7 +2819,7 @@ function ColumnChooser({
2657
2819
  "input",
2658
2820
  {
2659
2821
  type: "search",
2660
- className: "column-chooser-search",
2822
+ className: "gridkit-column-chooser-search",
2661
2823
  "aria-label": messages.columnChooserSearchLabel,
2662
2824
  placeholder: messages.searchPlaceholder,
2663
2825
  value: search,
@@ -2666,8 +2828,8 @@ function ColumnChooser({
2666
2828
  }
2667
2829
  }
2668
2830
  ),
2669
- entries.length === 0 ? /* @__PURE__ */ jsx15("p", { role: "status", className: "column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
2670
- /* @__PURE__ */ jsxs10("label", { className: "column-chooser-option column-chooser-all", children: [
2831
+ entries.length === 0 ? /* @__PURE__ */ jsx15("p", { role: "status", className: "gridkit-column-chooser-empty", children: messages.noMatchingColumns }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
2832
+ /* @__PURE__ */ jsxs10("label", { className: "gridkit-column-chooser-option gridkit-column-chooser-all", children: [
2671
2833
  /* @__PURE__ */ jsx15(
2672
2834
  "input",
2673
2835
  {
@@ -2684,7 +2846,7 @@ function ColumnChooser({
2684
2846
  ),
2685
2847
  messages.showAllColumns
2686
2848
  ] }),
2687
- /* @__PURE__ */ jsx15("ul", { className: "column-chooser-list", children: entries.map((entry) => /* @__PURE__ */ jsx15("li", { children: /* @__PURE__ */ jsxs10("label", { className: "column-chooser-option", children: [
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: [
2688
2850
  /* @__PURE__ */ jsx15(
2689
2851
  "input",
2690
2852
  {
@@ -2707,10 +2869,10 @@ function ColumnChooser({
2707
2869
  // src/DataGrid/filterMenu/FilterMenu.tsx
2708
2870
  import { useEffect as useEffect4, useRef as useRef14 } from "react";
2709
2871
  import {
2710
- resolveColumnFilterMenu as resolveColumnFilterMenu2,
2711
2872
  resolveColumnHeaderText,
2712
2873
  resolveMenu as resolveMenu2
2713
2874
  } from "@gridkitjs/core";
2875
+ import { resolveColumnFilterMenu as resolveColumnFilterMenu2 } from "@gridkitjs/core/renderer";
2714
2876
 
2715
2877
  // src/DataGrid/filterMenu/ExcelFilterEditor.tsx
2716
2878
  import {
@@ -2726,7 +2888,7 @@ import {
2726
2888
  filterChecklist,
2727
2889
  filterDraftChanged as filterDraftChanged3,
2728
2890
  selectAllState
2729
- } from "@gridkitjs/core";
2891
+ } from "@gridkitjs/core/renderer";
2730
2892
 
2731
2893
  // src/DataGrid/filterMenu/excelEditorState.ts
2732
2894
  import {
@@ -2735,7 +2897,7 @@ import {
2735
2897
  filterEditorReducer,
2736
2898
  initialFilterEditorDraft,
2737
2899
  toValuesDraft
2738
- } from "@gridkitjs/core";
2900
+ } from "@gridkitjs/core/renderer";
2739
2901
  function openValues(filter, columnId, values) {
2740
2902
  const shape = describeColumnFilter(filter, columnId);
2741
2903
  return {
@@ -2782,7 +2944,7 @@ function useMenuButton({
2782
2944
  setState({
2783
2945
  kind: "open",
2784
2946
  anchor: button,
2785
- themeClassName: overlayThemeClassName(button),
2947
+ scope: overlayScope(button),
2786
2948
  gap: gap(button),
2787
2949
  focusItem: onLast ? itemCount - 1 : 0
2788
2950
  });
@@ -2850,12 +3012,19 @@ function OperatorMenuButton({
2850
3012
  {
2851
3013
  ref,
2852
3014
  type: "button",
2853
- className: "filter-menu-submenu",
3015
+ className: "gridkit-filter-menu-submenu",
2854
3016
  ...buttonProps,
2855
3017
  children: [
2856
- /* @__PURE__ */ jsx16("span", { className: "filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx16(CheckIcon, {}) }),
3018
+ /* @__PURE__ */ jsx16("span", { className: "gridkit-filter-menu-submenu-icon", "aria-hidden": "true", children: active !== void 0 && /* @__PURE__ */ jsx16(CheckIcon, {}) }),
2857
3019
  label,
2858
- /* @__PURE__ */ jsx16("span", { className: "filter-menu-submenu-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(ChevronRightIcon2, {}) })
3020
+ /* @__PURE__ */ jsx16(
3021
+ "span",
3022
+ {
3023
+ className: "gridkit-filter-menu-submenu-indicator",
3024
+ "aria-hidden": "true",
3025
+ children: /* @__PURE__ */ jsx16(ChevronRightIcon2, {})
3026
+ }
3027
+ )
2859
3028
  ]
2860
3029
  }
2861
3030
  ),
@@ -2866,14 +3035,14 @@ function OperatorMenuButton({
2866
3035
  placement: "right-start",
2867
3036
  gap: state.gap,
2868
3037
  returnFocusTo: state.anchor,
2869
- themeClassName: state.themeClassName,
3038
+ scope: state.scope,
2870
3039
  onDismiss: close,
2871
3040
  children: /* @__PURE__ */ jsx16(
2872
3041
  GridMenu,
2873
3042
  {
2874
3043
  entries,
2875
3044
  label,
2876
- themeClassName: state.themeClassName,
3045
+ scope: state.scope,
2877
3046
  behaviourRef,
2878
3047
  onRun: (item) => {
2879
3048
  item.run();
@@ -2900,13 +3069,13 @@ import {
2900
3069
  draftToFilter,
2901
3070
  filterDraftChanged as filterDraftChanged2,
2902
3071
  filterEditorReducer as filterEditorReducer2
2903
- } from "@gridkitjs/core";
3072
+ } from "@gridkitjs/core/renderer";
2904
3073
 
2905
3074
  // src/DataGrid/filterMenu/ConditionRow.tsx
2906
3075
  import {
2907
3076
  filterOperandArity,
2908
3077
  parseFilterOperand
2909
- } from "@gridkitjs/core";
3078
+ } from "@gridkitjs/core/renderer";
2910
3079
  import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
2911
3080
  function inputType(family, type) {
2912
3081
  switch (family) {
@@ -2930,7 +3099,7 @@ function OperandField({
2930
3099
  }) {
2931
3100
  const field = {
2932
3101
  ref: fieldRef,
2933
- className: "filter-menu-value",
3102
+ className: "gridkit-filter-menu-value",
2934
3103
  "aria-label": label,
2935
3104
  "aria-invalid": invalidMessageId === void 0 ? void 0 : true,
2936
3105
  "aria-describedby": invalidMessageId,
@@ -2971,13 +3140,13 @@ function ConditionRow({
2971
3140
  ref,
2972
3141
  role: "group",
2973
3142
  "aria-label": messages.filterConditionLabel(position),
2974
- className: "filter-menu-condition",
3143
+ className: "gridkit-filter-menu-condition",
2975
3144
  children: [
2976
3145
  /* @__PURE__ */ jsx17(
2977
3146
  "select",
2978
3147
  {
2979
3148
  ref: arity === 0 ? focusRef : void 0,
2980
- className: "filter-menu-operator",
3149
+ className: "gridkit-filter-menu-operator",
2981
3150
  "aria-label": messages.filterOperatorFieldLabel,
2982
3151
  value: row.operator,
2983
3152
  onChange: (event) => {
@@ -3026,7 +3195,7 @@ import {
3026
3195
  conditionsFromRows,
3027
3196
  describeColumnFilter as describeColumnFilter2,
3028
3197
  initialFilterEditorDraft as initialFilterEditorDraft2
3029
- } from "@gridkitjs/core";
3198
+ } from "@gridkitjs/core/renderer";
3030
3199
  var NO_ROWS = [];
3031
3200
  var NO_VALUES = {
3032
3201
  options: [],
@@ -3118,8 +3287,8 @@ function CombinatorChoice({
3118
3287
  {
3119
3288
  role: "radiogroup",
3120
3289
  "aria-label": messages.filterCombinatorLabel,
3121
- className: "filter-menu-combinator",
3122
- children: COMBINATORS.map((choice) => /* @__PURE__ */ jsxs13("label", { className: "filter-menu-combinator-option", children: [
3290
+ className: "gridkit-filter-menu-combinator",
3291
+ children: COMBINATORS.map((choice) => /* @__PURE__ */ jsxs13("label", { className: "gridkit-filter-menu-combinator-option", children: [
3123
3292
  /* @__PURE__ */ jsx18(
3124
3293
  "input",
3125
3294
  {
@@ -3198,8 +3367,8 @@ function SimpleFilterEditor({
3198
3367
  rowElements.current[first]?.querySelector('[aria-invalid="true"]')?.focus();
3199
3368
  }
3200
3369
  }, [invalid]);
3201
- return /* @__PURE__ */ jsxs13("div", { className: "filter-menu-conditions", children: [
3202
- opened.custom && /* @__PURE__ */ jsx18("p", { className: "filter-menu-custom", children: messages.customFilter }),
3370
+ return /* @__PURE__ */ jsxs13("div", { className: "gridkit-filter-menu-conditions", children: [
3371
+ opened.custom && /* @__PURE__ */ jsx18("p", { className: "gridkit-filter-menu-custom", children: messages.customFilter }),
3203
3372
  draft.rows.map((row, index) => (
3204
3373
  // A row is its place: the first condition, or the second.
3205
3374
  /* @__PURE__ */ jsxs13(Fragment5, { children: [
@@ -3234,7 +3403,7 @@ function SimpleFilterEditor({
3234
3403
  )
3235
3404
  ] }, index)
3236
3405
  )),
3237
- invalid.length > 0 && /* @__PURE__ */ jsx18("p", { id: invalidMessageId, className: "filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
3406
+ invalid.length > 0 && /* @__PURE__ */ jsx18("p", { id: invalidMessageId, className: "gridkit-filter-menu-invalid", children: messages.filterValueInvalid(menu.family) })
3238
3407
  ] });
3239
3408
  }
3240
3409
 
@@ -3308,7 +3477,7 @@ function ValueChecklist({
3308
3477
  role: "listbox",
3309
3478
  "aria-multiselectable": "true",
3310
3479
  "aria-label": label,
3311
- className: "filter-menu-checklist",
3480
+ className: "gridkit-filter-menu-checklist",
3312
3481
  children: [
3313
3482
  /* @__PURE__ */ jsx19("div", { role: "presentation", style: { height: range.offsetBefore } }),
3314
3483
  shown.map((item, offset) => {
@@ -3323,13 +3492,20 @@ function ValueChecklist({
3323
3492
  "aria-checked": item.checked,
3324
3493
  "aria-setsize": items.length,
3325
3494
  "aria-posinset": index + 1,
3326
- className: "filter-menu-option",
3495
+ className: "gridkit-filter-menu-option",
3327
3496
  children: [
3328
- /* @__PURE__ */ jsx19("span", { className: "filter-menu-option-check", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(CheckIcon, {}) }),
3329
- /* @__PURE__ */ jsx19("span", { className: "filter-menu-option-label", children: item.label }),
3497
+ /* @__PURE__ */ jsx19(
3498
+ "span",
3499
+ {
3500
+ className: "gridkit-filter-menu-option-check",
3501
+ "aria-hidden": "true",
3502
+ children: /* @__PURE__ */ jsx19(CheckIcon, {})
3503
+ }
3504
+ ),
3505
+ /* @__PURE__ */ jsx19("span", { className: "gridkit-filter-menu-option-label", children: item.label }),
3330
3506
  showCounts && /* @__PURE__ */ jsxs14(Fragment6, { children: [
3331
3507
  " ",
3332
- /* @__PURE__ */ jsx19("span", { className: "filter-menu-option-count", children: String(item.count) })
3508
+ /* @__PURE__ */ jsx19("span", { className: "gridkit-filter-menu-option-count", children: String(item.count) })
3333
3509
  ] })
3334
3510
  ]
3335
3511
  },
@@ -3415,12 +3591,12 @@ function ExcelFilterEditor({
3415
3591
  "button",
3416
3592
  {
3417
3593
  type: "button",
3418
- className: "filter-menu-back",
3594
+ className: "gridkit-filter-menu-back",
3419
3595
  onClick: () => {
3420
3596
  setMode({ kind: "values", focusOnMount: true });
3421
3597
  },
3422
3598
  children: [
3423
- /* @__PURE__ */ jsx20("span", { className: "filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(ChevronLeftIcon2, {}) }),
3599
+ /* @__PURE__ */ jsx20("span", { className: "gridkit-filter-menu-back-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(ChevronLeftIcon2, {}) }),
3424
3600
  messages.filterBackToValues
3425
3601
  ]
3426
3602
  }
@@ -3443,7 +3619,7 @@ function ExcelFilterEditor({
3443
3619
  ] });
3444
3620
  }
3445
3621
  const { shape } = opened;
3446
- return /* @__PURE__ */ jsxs15("div", { className: "filter-menu-values", children: [
3622
+ return /* @__PURE__ */ jsxs15("div", { className: "gridkit-filter-menu-values", children: [
3447
3623
  menu.operators.length > 0 && /* @__PURE__ */ jsx20(
3448
3624
  OperatorMenuButton,
3449
3625
  {
@@ -3456,13 +3632,13 @@ function ExcelFilterEditor({
3456
3632
  }
3457
3633
  }
3458
3634
  ),
3459
- (shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx20("p", { className: "filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
3635
+ (shape.kind === "conditions" || shape.kind === "custom") && /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-custom", children: shape.kind === "conditions" ? messages.filterByCondition : messages.customFilter }),
3460
3636
  /* @__PURE__ */ jsx20(
3461
3637
  "input",
3462
3638
  {
3463
3639
  ref: initialFocusRef,
3464
3640
  type: "search",
3465
- className: "filter-menu-search",
3641
+ className: "gridkit-filter-menu-search",
3466
3642
  "aria-label": messages.filterSearchLabel,
3467
3643
  placeholder: messages.searchPlaceholder,
3468
3644
  value: draft.search,
@@ -3471,7 +3647,7 @@ function ExcelFilterEditor({
3471
3647
  }
3472
3648
  }
3473
3649
  ),
3474
- /* @__PURE__ */ jsxs15("label", { className: "filter-menu-select-all", children: [
3650
+ /* @__PURE__ */ jsxs15("label", { className: "gridkit-filter-menu-select-all", children: [
3475
3651
  /* @__PURE__ */ jsx20(
3476
3652
  "input",
3477
3653
  {
@@ -3486,7 +3662,7 @@ function ExcelFilterEditor({
3486
3662
  ),
3487
3663
  messages.filterSelectAll
3488
3664
  ] }),
3489
- checklist.needsSearch ? /* @__PURE__ */ jsx20("p", { className: "filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx20(
3665
+ checklist.needsSearch ? /* @__PURE__ */ jsx20("p", { className: "gridkit-filter-menu-search-first", children: messages.filterSearchFirst(checklist.total) }) : /* @__PURE__ */ jsx20(
3490
3666
  ValueChecklist,
3491
3667
  {
3492
3668
  items: checklist.items,
@@ -3497,7 +3673,7 @@ function ExcelFilterEditor({
3497
3673
  }
3498
3674
  }
3499
3675
  ),
3500
- checklist.hiddenCount > 0 && /* @__PURE__ */ jsx20("p", { role: "status", className: "filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
3676
+ checklist.hiddenCount > 0 && /* @__PURE__ */ jsx20("p", { role: "status", className: "gridkit-filter-menu-more", children: messages.filterMoreValues(checklist.hiddenCount) })
3501
3677
  ] });
3502
3678
  }
3503
3679
 
@@ -3570,7 +3746,7 @@ function FilterMenu({
3570
3746
  children: /* @__PURE__ */ jsxs16(
3571
3747
  "form",
3572
3748
  {
3573
- className: "filter-menu-form",
3749
+ className: "gridkit-filter-menu-form",
3574
3750
  noValidate: true,
3575
3751
  onSubmit: apply,
3576
3752
  onKeyDown: (event) => {
@@ -3580,11 +3756,11 @@ function FilterMenu({
3580
3756
  }
3581
3757
  },
3582
3758
  children: [
3583
- sortItems.length > 0 && /* @__PURE__ */ jsx21("div", { className: "filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
3759
+ sortItems.length > 0 && /* @__PURE__ */ jsx21("div", { className: "gridkit-filter-menu-sort", children: sortItems.map((item) => /* @__PURE__ */ jsxs16(
3584
3760
  "button",
3585
3761
  {
3586
3762
  type: "button",
3587
- className: "filter-menu-sort-item",
3763
+ className: "gridkit-filter-menu-sort-item",
3588
3764
  disabled: item.disabled,
3589
3765
  ...ariaAttr(
3590
3766
  item.checked !== void 0,
@@ -3595,19 +3771,26 @@ function FilterMenu({
3595
3771
  run(item);
3596
3772
  },
3597
3773
  children: [
3598
- /* @__PURE__ */ jsx21("span", { className: "filter-menu-sort-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx21(MenuIcon, { name: item.icon }) }),
3774
+ /* @__PURE__ */ jsx21(
3775
+ "span",
3776
+ {
3777
+ className: "gridkit-filter-menu-sort-icon",
3778
+ "aria-hidden": "true",
3779
+ children: /* @__PURE__ */ jsx21(MenuIcon, { name: item.icon })
3780
+ }
3781
+ ),
3599
3782
  item.label
3600
3783
  ]
3601
3784
  },
3602
3785
  item.id
3603
3786
  )) }),
3604
3787
  menu.ui === "excel" ? /* @__PURE__ */ jsx21(ExcelFilterEditor, { ...editorProps, columnValues }) : /* @__PURE__ */ jsx21(SimpleFilterEditor, { ...editorProps }),
3605
- /* @__PURE__ */ jsxs16("div", { className: "filter-menu-actions", children: [
3788
+ /* @__PURE__ */ jsxs16("div", { className: "gridkit-filter-menu-actions", children: [
3606
3789
  clearItem !== void 0 && /* @__PURE__ */ jsx21(
3607
3790
  "button",
3608
3791
  {
3609
3792
  type: "button",
3610
- className: "filter-menu-clear",
3793
+ className: "gridkit-filter-menu-clear",
3611
3794
  disabled: clearItem.disabled,
3612
3795
  onClick: () => {
3613
3796
  run(clearItem);
@@ -3615,8 +3798,16 @@ function FilterMenu({
3615
3798
  children: clearItem.label
3616
3799
  }
3617
3800
  ),
3618
- /* @__PURE__ */ jsx21("button", { type: "button", className: "filter-menu-cancel", onClick: close, children: messages.cancelFilter }),
3619
- /* @__PURE__ */ jsx21("button", { type: "submit", className: "filter-menu-apply", children: messages.applyFilter })
3801
+ /* @__PURE__ */ jsx21(
3802
+ "button",
3803
+ {
3804
+ type: "button",
3805
+ className: "gridkit-filter-menu-cancel",
3806
+ onClick: close,
3807
+ children: messages.cancelFilter
3808
+ }
3809
+ ),
3810
+ /* @__PURE__ */ jsx21("button", { type: "submit", className: "gridkit-filter-menu-apply", children: messages.applyFilter })
3620
3811
  ] })
3621
3812
  ]
3622
3813
  }
@@ -3656,7 +3847,7 @@ function useApplyFilter(controller, messages, announce) {
3656
3847
  import { useState as useState11 } from "react";
3657
3848
  import {
3658
3849
  createColumnValueOptionsCache
3659
- } from "@gridkitjs/core";
3850
+ } from "@gridkitjs/core/renderer";
3660
3851
  var NO_ROWS2 = [];
3661
3852
  function useFilterValueCache(controller, messages) {
3662
3853
  const [cache] = useState11(createColumnValueOptionsCache);
@@ -3707,7 +3898,7 @@ function GridPanels({
3707
3898
  returnFocusFallback,
3708
3899
  ignoreScrollAfterInput: true,
3709
3900
  trapFocus,
3710
- themeClassName: panel.themeClassName,
3901
+ scope: panel.scope,
3711
3902
  onDismiss: close,
3712
3903
  children: /* @__PURE__ */ jsx22(
3713
3904
  Panel,
@@ -3730,7 +3921,7 @@ function GridPanels({
3730
3921
  }
3731
3922
 
3732
3923
  // src/DataGrid/panels/panelApi.ts
3733
- import { resolveColumnFilterMenu as resolveColumnFilterMenu3 } from "@gridkitjs/core";
3924
+ import { resolveColumnFilterMenu as resolveColumnFilterMenu3 } from "@gridkitjs/core/renderer";
3734
3925
  function panelApi(panels, controller) {
3735
3926
  return {
3736
3927
  openColumnChooser: () => {
@@ -3754,6 +3945,9 @@ function panelApi(panels, controller) {
3754
3945
 
3755
3946
  // src/DataGrid/panels/useGridPanels.ts
3756
3947
  import { useRef as useRef16 } from "react";
3948
+ import {
3949
+ writingDirection as writingDirection6
3950
+ } from "@gridkitjs/dom";
3757
3951
  function toolbarItem(root, itemId) {
3758
3952
  const items = root.querySelectorAll(
3759
3953
  ":scope > .gridkit-toolbar > [data-gridkit-toolbar-item]"
@@ -3790,9 +3984,9 @@ function useGridPanels({
3790
3984
  returnFocusTo: element
3791
3985
  };
3792
3986
  }
3793
- const { right, top } = root.getBoundingClientRect();
3987
+ const { left, right, top } = root.getBoundingClientRect();
3794
3988
  return {
3795
- anchor: { x: right, y: top },
3989
+ anchor: { x: writingDirection6(root) === "rtl" ? left : right, y: top },
3796
3990
  placement: "bottom-end",
3797
3991
  returnFocusTo: void 0
3798
3992
  };
@@ -3813,7 +4007,7 @@ function useGridPanels({
3813
4007
  kind,
3814
4008
  target,
3815
4009
  ...placeFor(root, target),
3816
- themeClassName: overlayThemeClassName(root)
4010
+ scope: overlayScope(root)
3817
4011
  }
3818
4012
  });
3819
4013
  },
@@ -3828,9 +4022,9 @@ function useGridPanels({
3828
4022
  import { useLayoutEffect as useLayoutEffect13, useRef as useRef19 } from "react";
3829
4023
  import {
3830
4024
  resolveToolbar,
3831
- splitToolbarItems,
3832
4025
  toolbarEntries
3833
4026
  } from "@gridkitjs/core";
4027
+ import { splitToolbarItems } from "@gridkitjs/core/renderer";
3834
4028
  import { attachToolbar } from "@gridkitjs/dom";
3835
4029
 
3836
4030
  // src/DataGrid/toolbar/ToolbarMenuButton.tsx
@@ -3853,14 +4047,17 @@ function ToolbarMenuButton({
3853
4047
  {
3854
4048
  ...attributes,
3855
4049
  type: "button",
3856
- className: classNames("toolbar-button", more && "toolbar-more"),
4050
+ className: classNames(
4051
+ "gridkit-toolbar-button",
4052
+ more && "gridkit-toolbar-more"
4053
+ ),
3857
4054
  "data-gridkit-toolbar-item": itemKey,
3858
4055
  ...ariaAttr(more, "data-gridkit-toolbar-more", ""),
3859
4056
  ...buttonProps,
3860
4057
  children: [
3861
- icon !== void 0 && /* @__PURE__ */ jsx23("span", { className: "toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(MenuIcon, { name: icon }) }),
4058
+ icon !== void 0 && /* @__PURE__ */ jsx23("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(MenuIcon, { name: icon }) }),
3862
4059
  label,
3863
- /* @__PURE__ */ jsx23("span", { className: "toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(ChevronDownIcon, {}) })
4060
+ /* @__PURE__ */ jsx23("span", { className: "gridkit-toolbar-button-indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx23(ChevronDownIcon, {}) })
3864
4061
  ]
3865
4062
  }
3866
4063
  ),
@@ -3872,14 +4069,14 @@ function ToolbarMenuButton({
3872
4069
  gap: state.gap,
3873
4070
  returnFocusTo: state.anchor,
3874
4071
  returnFocusFallback,
3875
- themeClassName: state.themeClassName,
4072
+ scope: state.scope,
3876
4073
  onDismiss: close,
3877
4074
  children: /* @__PURE__ */ jsx23(
3878
4075
  GridMenu,
3879
4076
  {
3880
4077
  entries,
3881
4078
  label,
3882
- themeClassName: state.themeClassName,
4079
+ scope: state.scope,
3883
4080
  behaviourRef,
3884
4081
  onRun: (item) => {
3885
4082
  item.run();
@@ -3895,10 +4092,7 @@ function ToolbarMenuButton({
3895
4092
 
3896
4093
  // src/DataGrid/toolbar/ToolbarSearch.tsx
3897
4094
  import { useEffect as useEffect6, useRef as useRef17, useState as useState12 } from "react";
3898
- import {
3899
- searchTextOf,
3900
- setSearchText
3901
- } from "@gridkitjs/core";
4095
+ import { searchTextOf, setSearchText } from "@gridkitjs/core/renderer";
3902
4096
  import { jsx as jsx24 } from "react/jsx-runtime";
3903
4097
  var SEARCH_DELAY_MS = 250;
3904
4098
  function ToolbarSearch({
@@ -3940,7 +4134,7 @@ function ToolbarSearch({
3940
4134
  {
3941
4135
  ...attributes,
3942
4136
  type: "search",
3943
- className: "toolbar-search",
4137
+ className: "gridkit-toolbar-search",
3944
4138
  "data-gridkit-toolbar-item": itemKey,
3945
4139
  "aria-label": messages.searchLabel,
3946
4140
  placeholder: messages.searchPlaceholder,
@@ -4106,7 +4300,7 @@ function Toolbar({
4106
4300
  {
4107
4301
  ...item.attributes,
4108
4302
  type: "button",
4109
- className: "toolbar-button",
4303
+ className: "gridkit-toolbar-button",
4110
4304
  "data-gridkit-toolbar-item": item.key,
4111
4305
  ...ariaAttr(item.disabled, "aria-disabled", true),
4112
4306
  ...ariaAttr(
@@ -4123,7 +4317,7 @@ function Toolbar({
4123
4317
  item.run();
4124
4318
  },
4125
4319
  children: [
4126
- item.icon !== void 0 && /* @__PURE__ */ jsx25("span", { className: "toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(MenuIcon, { name: item.icon }) }),
4320
+ item.icon !== void 0 && /* @__PURE__ */ jsx25("span", { className: "gridkit-toolbar-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx25(MenuIcon, { name: item.icon }) }),
4127
4321
  item.label
4128
4322
  ]
4129
4323
  },
@@ -4160,7 +4354,7 @@ function Toolbar({
4160
4354
  {
4161
4355
  role: "separator",
4162
4356
  "aria-orientation": "vertical",
4163
- className: "toolbar-separator",
4357
+ className: "gridkit-toolbar-separator",
4164
4358
  "data-gridkit-toolbar-item": item.key
4165
4359
  },
4166
4360
  item.key
@@ -4169,7 +4363,7 @@ function Toolbar({
4169
4363
  return /* @__PURE__ */ jsx25(
4170
4364
  "div",
4171
4365
  {
4172
- className: "toolbar-spacer",
4366
+ className: "gridkit-toolbar-spacer",
4173
4367
  "data-gridkit-toolbar-item": item.key
4174
4368
  },
4175
4369
  item.key
@@ -4179,7 +4373,7 @@ function Toolbar({
4179
4373
  "div",
4180
4374
  {
4181
4375
  ...item.attributes,
4182
- className: "toolbar-custom",
4376
+ className: "gridkit-toolbar-custom",
4183
4377
  "data-gridkit-toolbar-item": item.key,
4184
4378
  children: renderItem?.(item.id)
4185
4379
  },
@@ -4213,21 +4407,21 @@ function Toolbar({
4213
4407
  }
4214
4408
 
4215
4409
  // src/DataGrid/useColumnDrag.ts
4216
- import {
4217
- resolveKeyboardDropTarget as resolveKeyboardDropTarget2
4218
- } from "@gridkitjs/core";
4410
+ import { resolveKeyboardDropTarget as resolveKeyboardDropTarget2 } from "@gridkitjs/core/renderer";
4219
4411
  import { resolveColumnDropTarget } from "@gridkitjs/dom";
4220
4412
  function useColumnDrag({
4221
4413
  order,
4222
4414
  groupBy,
4223
4415
  groupByDraggableIds,
4416
+ pinOf,
4224
4417
  onDrop
4225
4418
  }) {
4226
4419
  const drag = useDragReorder({
4227
4420
  resolveTarget: (clientX, clientY, movedId) => resolveColumnDropTarget(clientX, clientY, movedId, {
4228
4421
  order,
4229
4422
  groupBy,
4230
- groupByDraggableIds
4423
+ groupByDraggableIds,
4424
+ pinOf
4231
4425
  }),
4232
4426
  onDrop
4233
4427
  });
@@ -4260,7 +4454,7 @@ import {
4260
4454
  clampColumnWidth,
4261
4455
  resolveColumnConstraints,
4262
4456
  sizeColumnToContent
4263
- } from "@gridkitjs/core";
4457
+ } from "@gridkitjs/core/renderer";
4264
4458
  import { measureColumnContent, startColumnResizeGesture } from "@gridkitjs/dom";
4265
4459
  function useColumnResize({
4266
4460
  tableRef,
@@ -4345,12 +4539,31 @@ function useColumnResize({
4345
4539
  return { activeColumnId, startResize, sizeToContent, nudge };
4346
4540
  }
4347
4541
 
4348
- // src/DataGrid/useElementWidth.ts
4542
+ // src/DataGrid/useElementHeight.ts
4349
4543
  import { useLayoutEffect as useLayoutEffect14, useState as useState15 } from "react";
4544
+ import { observeElementHeight } from "@gridkitjs/dom";
4545
+ function useElementHeight(ref, enabled) {
4546
+ const [height, setHeight] = useState15(null);
4547
+ useLayoutEffect14(() => {
4548
+ const element = ref.current;
4549
+ if (element === null || !enabled) {
4550
+ return void 0;
4551
+ }
4552
+ const disconnect = observeElementHeight(element, setHeight);
4553
+ return () => {
4554
+ disconnect();
4555
+ setHeight(null);
4556
+ };
4557
+ }, [ref, enabled]);
4558
+ return enabled ? height : null;
4559
+ }
4560
+
4561
+ // src/DataGrid/useElementWidth.ts
4562
+ import { useLayoutEffect as useLayoutEffect15, useState as useState16 } from "react";
4350
4563
  import { observeElementWidth } from "@gridkitjs/dom";
4351
4564
  function useElementWidth(ref, enabled) {
4352
- const [width, setWidth] = useState15(null);
4353
- useLayoutEffect14(() => {
4565
+ const [width, setWidth] = useState16(null);
4566
+ useLayoutEffect15(() => {
4354
4567
  const element = ref.current;
4355
4568
  if (element === null || !enabled) {
4356
4569
  return void 0;
@@ -4361,12 +4574,12 @@ function useElementWidth(ref, enabled) {
4361
4574
  }
4362
4575
 
4363
4576
  // src/DataGrid/useGridController.ts
4364
- import { useState as useState16, useSyncExternalStore as useSyncExternalStore2 } from "react";
4577
+ import { useState as useState17, useSyncExternalStore as useSyncExternalStore2 } from "react";
4365
4578
  import {
4366
4579
  createGridController
4367
4580
  } from "@gridkitjs/core";
4368
4581
  function useGridController(options) {
4369
- const [controller] = useState16(
4582
+ const [controller] = useState17(
4370
4583
  () => createGridController(options)
4371
4584
  );
4372
4585
  controller.setOptions(options);
@@ -4414,11 +4627,11 @@ function useInfiniteScroll({
4414
4627
  }
4415
4628
 
4416
4629
  // src/DataGrid/useLiveAnnouncer.ts
4417
- import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect15, useRef as useRef21 } from "react";
4630
+ import { useCallback as useCallback3, useLayoutEffect as useLayoutEffect16, useRef as useRef21 } from "react";
4418
4631
  import { createLiveAnnouncer } from "@gridkitjs/dom";
4419
4632
  function useLiveAnnouncer(containerRef) {
4420
4633
  const announcer = useRef21(null);
4421
- useLayoutEffect15(() => {
4634
+ useLayoutEffect16(() => {
4422
4635
  const container = containerRef.current;
4423
4636
  if (container === null) {
4424
4637
  return void 0;
@@ -4436,7 +4649,7 @@ function useLiveAnnouncer(containerRef) {
4436
4649
  }
4437
4650
 
4438
4651
  // src/DataGrid/useRowVirtualizer.ts
4439
- import { useLayoutEffect as useLayoutEffect16, useRef as useRef22, useState as useState17 } from "react";
4652
+ import { useLayoutEffect as useLayoutEffect17, useRef as useRef22, useState as useState18 } from "react";
4440
4653
  import {
4441
4654
  bodyRowFrom as bodyRowFrom3,
4442
4655
  createRowVirtualizer as createRowVirtualizer2
@@ -4471,25 +4684,25 @@ function ignoreRow() {
4471
4684
  function useRowVirtualizer({
4472
4685
  enabled,
4473
4686
  rows,
4474
- bodyScrollRef,
4687
+ scrollRef,
4475
4688
  bodyTableRef,
4476
4689
  estimatedRowHeight,
4477
4690
  overscan
4478
4691
  }) {
4479
- const [virtualizer, setVirtualizer] = useState17(null);
4692
+ const [virtualizer, setVirtualizer] = useState18(null);
4480
4693
  const instance = useRef22(null);
4481
4694
  const rowCount = useRef22(rows.length);
4482
- const [rowWindow, setRowWindow] = useState17(enabled ? NO_ROWS3 : ALL_ROWS);
4695
+ const [rowWindow, setRowWindow] = useState18(enabled ? NO_ROWS3 : ALL_ROWS);
4483
4696
  if (!enabled && rowWindow.kind !== "allRows") {
4484
4697
  setRowWindow(ALL_ROWS);
4485
4698
  }
4486
- useLayoutEffect16(() => {
4699
+ useLayoutEffect17(() => {
4487
4700
  rowCount.current = rows.length;
4488
4701
  instance.current?.setRowCount(rows.length);
4489
4702
  instance.current?.resetHeights();
4490
4703
  }, [rows]);
4491
- useLayoutEffect16(() => {
4492
- const element = bodyScrollRef.current;
4704
+ useLayoutEffect17(() => {
4705
+ const element = scrollRef.current;
4493
4706
  if (!enabled || element === null) {
4494
4707
  return void 0;
4495
4708
  }
@@ -4507,7 +4720,7 @@ function useRowVirtualizer({
4507
4720
  return () => {
4508
4721
  created.destroy();
4509
4722
  };
4510
- }, [enabled, bodyScrollRef, bodyTableRef, estimatedRowHeight, overscan]);
4723
+ }, [enabled, scrollRef, bodyTableRef, estimatedRowHeight, overscan]);
4511
4724
  const range = rangeOf(rowWindow, rows.length);
4512
4725
  return {
4513
4726
  startIndex: range.startIndex,
@@ -4547,18 +4760,18 @@ function selectedRowsReader(controller) {
4547
4760
  return last.selected;
4548
4761
  };
4549
4762
  }
4550
- function focusAt(rowIndex, columnIndex) {
4551
- return rowIndex < 0 ? headerFocus3(columnIndex) : bodyFocus3(rowIndex, columnIndex);
4552
- }
4553
- function focusedCellReader() {
4554
- let last;
4555
- return (focus) => {
4556
- if (last?.focus !== focus) {
4557
- const rowIndex = focus.area === "header" ? -1 : focus.rowIndex;
4558
- last = { focus, cell: { rowIndex, columnIndex: focus.columnIndex } };
4559
- }
4560
- return last.cell;
4763
+ function tablesStyle(height, headerHeight, footerHeight, pinned) {
4764
+ const heights = height === void 0 ? {} : {
4765
+ "--gridkit-body-height": typeof height === "number" ? `${String(height)}px` : height,
4766
+ ...headerHeight === null ? {} : { "--gridkit-header-height": `${String(headerHeight)}px` },
4767
+ ...footerHeight === null ? {} : { "--gridkit-footer-height": `${String(footerHeight)}px` }
4561
4768
  };
4769
+ const widths = pinned.start === 0 && pinned.end === 0 ? {} : {
4770
+ "--gridkit-pinned-start-width": `${String(pinned.start)}px`,
4771
+ "--gridkit-pinned-end-width": `${String(pinned.end)}px`
4772
+ };
4773
+ const style = { ...heights, ...widths };
4774
+ return Object.keys(style).length === 0 ? void 0 : style;
4562
4775
  }
4563
4776
  function DataGrid(props) {
4564
4777
  const {
@@ -4596,9 +4809,10 @@ function DataGrid(props) {
4596
4809
  const gridRef = useRef23(null);
4597
4810
  const headerTableRef = useRef23(null);
4598
4811
  const bodyTableRef = useRef23(null);
4599
- const bodyScrollRef = useRef23(null);
4812
+ const bodyRef = useRef23(null);
4813
+ const footerTableRef = useRef23(null);
4600
4814
  const sentinelRef = useRef23(null);
4601
- const viewportWidth = useElementWidth(viewportRef, resizeMode === "fit");
4815
+ const viewportWidth = useElementWidth(gridRef, resizeMode === "fit");
4602
4816
  const subscribersRef = useRef23(/* @__PURE__ */ new Set());
4603
4817
  const gridId = useId2();
4604
4818
  const announce = useLiveAnnouncer(viewportRef);
@@ -4617,13 +4831,12 @@ function DataGrid(props) {
4617
4831
  columnOf
4618
4832
  })
4619
4833
  });
4620
- const [readPagination] = useState18(() => paginationReader(controller));
4621
- const [readSelectedRows] = useState18(() => selectedRowsReader(controller));
4622
- const [readFocusedCell] = useState18(focusedCellReader);
4834
+ const [readPagination] = useState19(() => paginationReader(controller));
4835
+ const [readSelectedRows] = useState19(() => selectedRowsReader(controller));
4623
4836
  const virtualizer = useRowVirtualizer({
4624
4837
  enabled: virtualized,
4625
4838
  rows: view.pageRows,
4626
- bodyScrollRef,
4839
+ scrollRef: gridRef,
4627
4840
  bodyTableRef,
4628
4841
  estimatedRowHeight,
4629
4842
  overscan
@@ -4644,7 +4857,7 @@ function DataGrid(props) {
4644
4857
  }
4645
4858
  }, [paginated, hasInfiniteScroll]);
4646
4859
  useInfiniteScroll({
4647
- rootRef: bodyScrollRef,
4860
+ rootRef: gridRef,
4648
4861
  sentinelRef,
4649
4862
  config: infiniteScroll
4650
4863
  });
@@ -4685,7 +4898,7 @@ function DataGrid(props) {
4685
4898
  // vertical movement steps over it rather than landing there.
4686
4899
  isSkippableRow: (rowIndex) => {
4687
4900
  const entry = view.pageRows[rowIndex];
4688
- return entry !== void 0 && "kind" in entry && entry.kind === "group-summary";
4901
+ return entry?.kind === "group-summary";
4689
4902
  }
4690
4903
  });
4691
4904
  const overlay = useGridOverlay({
@@ -4725,20 +4938,36 @@ function DataGrid(props) {
4725
4938
  ),
4726
4939
  [view.columns]
4727
4940
  );
4941
+ function pinOf(columnId) {
4942
+ const column = definitions.get(columnId);
4943
+ return column === void 0 ? "none" : resolveColumnPin2(column, state.columnPinning);
4944
+ }
4728
4945
  function handleDrop(target, movedId) {
4729
4946
  if (target.kind === "group-by") {
4730
4947
  controller.moveGroupBy(movedId, target.beforeColumnId);
4731
4948
  return;
4732
4949
  }
4733
- const next = moveColumnBefore(orderedIds, movedId, target.beforeId);
4950
+ const next = moveColumnInPinGroup(
4951
+ orderedIds,
4952
+ pinOf,
4953
+ movedId,
4954
+ target.beforeId
4955
+ );
4734
4956
  if (next === orderedIds) {
4735
4957
  return;
4736
4958
  }
4737
4959
  controller.moveColumn(movedId, target.beforeId);
4738
- const shown = next.filter((id) => displayedIds.includes(id));
4739
- const position = shown.indexOf(movedId);
4960
+ const pin = pinOf(movedId);
4961
+ const group = next.filter(
4962
+ (id) => pinOf(id) === pin && displayedIds.includes(id)
4963
+ );
4964
+ const position = displayedIds.findIndex((id) => pinOf(id) === pin) + group.indexOf(movedId);
4740
4965
  announce(
4741
- messages.columnMoved(columnName(movedId), position + 1, shown.length)
4966
+ messages.columnMoved(
4967
+ columnName(movedId),
4968
+ position + 1,
4969
+ displayedIds.length
4970
+ )
4742
4971
  );
4743
4972
  nav.focusCell(headerFocus3(position));
4744
4973
  }
@@ -4746,6 +4975,7 @@ function DataGrid(props) {
4746
4975
  order: displayedIds,
4747
4976
  groupBy: state.groupBy,
4748
4977
  groupByDraggableIds,
4978
+ pinOf,
4749
4979
  onDrop: handleDrop
4750
4980
  });
4751
4981
  const draggedColumnAlreadyGrouped = drag.draggedColumnId !== null && state.groupBy.some((entry) => entry.columnId === drag.draggedColumnId);
@@ -4766,9 +4996,11 @@ function DataGrid(props) {
4766
4996
  const multiselectable = selection.rowMode === "multiple" || selection.columnMode === "multiple";
4767
4997
  const contextMenu = useContextMenu({
4768
4998
  rootRef: viewportRef,
4999
+ scrollRef: gridRef,
4769
5000
  headerTableRef,
4770
5001
  bodyTableRef,
4771
- bodyScrollRef,
5002
+ bodyRef,
5003
+ footerTableRef,
4772
5004
  contextMenu: props.contextMenu,
4773
5005
  overlay,
4774
5006
  controller,
@@ -4801,6 +5033,7 @@ function DataGrid(props) {
4801
5033
  getColumnSizing: () => controller.getState().columnSizing,
4802
5034
  getColumnOrder: () => controller.getState().columnOrder,
4803
5035
  getColumnVisibility: () => controller.getState().columnVisibility,
5036
+ getColumnPinning: () => controller.getState().columnPinning,
4804
5037
  getColumnSort: () => controller.getState().columnSort,
4805
5038
  getFilter: () => controller.getState().filter,
4806
5039
  getGroupBy: () => controller.getState().groupBy,
@@ -4812,12 +5045,10 @@ function DataGrid(props) {
4812
5045
  getSelectedRows: readSelectedRows,
4813
5046
  getColumnSelection: () => controller.getState().columnSelection,
4814
5047
  getCellSelection: () => controller.getState().cellSelection,
4815
- getFocusedCell: () => readFocusedCell(nav.focus),
5048
+ getFocusedCell: () => nav.focus,
4816
5049
  getState: controller.getState,
4817
5050
  restoreState: controller.restoreState,
4818
- focusCell: (rowIndex, columnIndex) => {
4819
- nav.focusCell(focusAt(rowIndex, columnIndex));
4820
- },
5051
+ focusCell: nav.focusCell,
4821
5052
  clearSelection: controller.clearSelection,
4822
5053
  selectAllRows: controller.selectAllRows,
4823
5054
  selectRows: controller.selectRows,
@@ -4829,6 +5060,7 @@ function DataGrid(props) {
4829
5060
  setPageSize: controller.setPageSize,
4830
5061
  showColumns: controller.showColumns,
4831
5062
  hideColumns: controller.hideColumns,
5063
+ pinColumn: controller.pinColumn,
4832
5064
  setFilter: controller.setFilter,
4833
5065
  setColumnSort: controller.setColumnSort,
4834
5066
  setGroupBy: controller.setGroupBy,
@@ -4837,6 +5069,7 @@ function DataGrid(props) {
4837
5069
  setColumnSizing: controller.setColumnSizing,
4838
5070
  setColumnOrder: controller.setColumnOrder,
4839
5071
  setColumnVisibility: controller.setColumnVisibility,
5072
+ setColumnPinning: controller.setColumnPinning,
4840
5073
  setRowSelection: controller.setRowSelection,
4841
5074
  setColumnSelection: controller.setColumnSelection,
4842
5075
  setCellSelection: controller.setCellSelection,
@@ -4856,7 +5089,7 @@ function DataGrid(props) {
4856
5089
  runCommand: (commandId, target = { area: "grid" }) => commands.run(commandId, target, "api"),
4857
5090
  scrollToRow: (rowId, options) => {
4858
5091
  const index = controller.getView().pageRows.findIndex(
4859
- (entry) => !("kind" in entry) && entry.rowId === rowId
5092
+ (entry) => entry.kind === "data" && entry.rowId === rowId
4860
5093
  );
4861
5094
  if (index === -1) return;
4862
5095
  if (virtualized) {
@@ -4883,193 +5116,213 @@ function DataGrid(props) {
4883
5116
  }));
4884
5117
  const gridTableClassName = classNames(
4885
5118
  "gridkit-data-grid",
4886
- borders ? `borders-${borders}` : "",
5119
+ borders ? `gridkit-borders-${borders}` : "",
4887
5120
  // Hover is on by default and selection off, so one set of classes
4888
5121
  // turns styling off and the other turns it on. The polarity differs
4889
5122
  // because the defaults do.
4890
- hoverRows ? "" : "no-hover-rows",
4891
- hoverColumns ? "" : "no-hover-columns",
4892
- hoverCells ? "" : "no-hover-cells",
4893
- selection.rowMode === false ? "" : "selectable-rows",
4894
- selection.columnMode === false ? "" : "selectable-columns",
4895
- selection.cellMode === false ? "" : "selectable-cells"
5123
+ hoverRows ? "" : "gridkit-no-hover-rows",
5124
+ hoverColumns ? "" : "gridkit-no-hover-columns",
5125
+ hoverCells ? "" : "gridkit-no-hover-cells",
5126
+ selection.rowMode === false ? "" : "gridkit-selectable-rows",
5127
+ selection.columnMode === false ? "" : "gridkit-selectable-columns",
5128
+ selection.cellMode === false ? "" : "gridkit-selectable-cells"
4896
5129
  );
4897
5130
  const hasFooter = aggregates.length > 0;
4898
- return /* @__PURE__ */ jsxs19("div", { className: "gridkit-data-grid-viewport", ref: viewportRef, children: [
4899
- /* @__PURE__ */ jsx26(
4900
- GridToolbar,
4901
- {
4902
- toolbar: props.toolbar,
4903
- renderItem: props.renderToolbarItem,
4904
- gridId,
4905
- controller,
4906
- commands,
4907
- messages,
4908
- announce
4909
- }
4910
- ),
4911
- showGroupByBar && /* @__PURE__ */ jsx26(
4912
- GroupByBar,
4913
- {
4914
- columns: view.columns,
4915
- definitions,
4916
- groupBy: state.groupBy,
4917
- controller,
4918
- columnName,
4919
- headerDragEligible: dragEligibleForGroupBy,
4920
- headerDragBlocked: draggedColumnAlreadyGrouped,
4921
- headerDropTarget: headerGroupByDropTarget,
4922
- messages
4923
- }
4924
- ),
4925
- /* @__PURE__ */ jsxs19(
4926
- "div",
4927
- {
4928
- ref: gridRef,
4929
- id: gridId,
4930
- className: "gridkit-data-grid-tables",
4931
- role: state.groupBy.length > 0 ? "treegrid" : "grid",
4932
- "aria-rowcount": view.displayRows.length + (hasFooter ? 2 : 1),
4933
- "aria-colcount": view.columns.length,
4934
- ...ariaAttr(multiselectable, "aria-multiselectable", true),
4935
- ...ariaAttr(labelledBy !== void 0, "aria-labelledby", labelledBy),
4936
- ...ariaAttr(
4937
- labelledBy === void 0 && label !== void 0,
4938
- "aria-label",
4939
- label
4940
- ),
4941
- onKeyDown: (event) => {
4942
- if (!isOwnEvent(event)) return;
4943
- handleCopyKey(event);
4944
- if (event.key === "Escape") {
4945
- if (drag.draggedColumnId !== null || resize.activeColumnId !== null)
4946
- return;
4947
- selection.clear();
4948
- return;
5131
+ const headerHeight = useElementHeight(headerTableRef, height !== void 0);
5132
+ const footerHeight = useElementHeight(
5133
+ footerTableRef,
5134
+ height !== void 0 && hasFooter
5135
+ );
5136
+ return /* @__PURE__ */ jsxs19(
5137
+ "div",
5138
+ {
5139
+ className: "gridkit-data-grid-viewport",
5140
+ ref: viewportRef,
5141
+ tabIndex: -1,
5142
+ children: [
5143
+ /* @__PURE__ */ jsx26(
5144
+ GridToolbar,
5145
+ {
5146
+ toolbar: props.toolbar,
5147
+ renderItem: props.renderToolbarItem,
5148
+ gridId,
5149
+ controller,
5150
+ commands,
5151
+ messages,
5152
+ announce
4949
5153
  }
4950
- if ((event.ctrlKey || event.metaKey) && (event.key === "a" || event.key === "A")) {
4951
- if (selection.rowMode !== "multiple") return;
4952
- event.preventDefault();
4953
- selection.selectAllRows();
5154
+ ),
5155
+ showGroupByBar && /* @__PURE__ */ jsx26(
5156
+ GroupByBar,
5157
+ {
5158
+ columns: view.columns,
5159
+ definitions,
5160
+ groupBy: state.groupBy,
5161
+ controller,
5162
+ columnName,
5163
+ headerDragEligible: dragEligibleForGroupBy,
5164
+ headerDragBlocked: draggedColumnAlreadyGrouped,
5165
+ headerDropTarget: headerGroupByDropTarget,
5166
+ messages
4954
5167
  }
4955
- },
4956
- children: [
4957
- /* @__PURE__ */ jsxs19(
4958
- "table",
4959
- {
4960
- ref: headerTableRef,
4961
- role: "presentation",
4962
- style: { width: totalColumnWidth(view.columns) },
4963
- className: classNames(gridTableClassName, "gridkit-data-grid-header"),
4964
- children: [
4965
- /* @__PURE__ */ jsx26(GridColgroup, { columns: view.columns }),
4966
- /* @__PURE__ */ jsx26(
4967
- GridHeader,
4968
- {
4969
- columns: view.columns,
4970
- resize,
4971
- drag,
4972
- controller,
4973
- state,
4974
- sortableColumns,
4975
- groupableColumns,
4976
- groupToggleIconColumns,
4977
- headerMenu: contextMenu.opens("header"),
4978
- panels,
4979
- messages,
4980
- nav,
4981
- selection
4982
- }
4983
- )
4984
- ]
4985
- }
4986
- ),
4987
- /* @__PURE__ */ jsx26(
4988
- "div",
4989
- {
4990
- className: "gridkit-data-grid-body",
4991
- ref: bodyScrollRef,
4992
- style: height === void 0 ? void 0 : {
4993
- "--gridkit-body-height": typeof height === "number" ? `${String(height)}px` : height
4994
- },
4995
- children: /* @__PURE__ */ jsxs19(
5168
+ ),
5169
+ /* @__PURE__ */ jsxs19(
5170
+ "div",
5171
+ {
5172
+ ref: gridRef,
5173
+ id: gridId,
5174
+ className: "gridkit-data-grid-tables",
5175
+ role: state.groupBy.length > 0 ? "treegrid" : "grid",
5176
+ "aria-rowcount": view.displayRows.length + (hasFooter ? 2 : 1),
5177
+ "aria-colcount": view.columns.length,
5178
+ tabIndex: -1,
5179
+ style: tablesStyle(
5180
+ height,
5181
+ headerHeight,
5182
+ footerHeight,
5183
+ pinnedWidths2(view.columns)
5184
+ ),
5185
+ ...ariaAttr(multiselectable, "aria-multiselectable", true),
5186
+ ...ariaAttr(labelledBy !== void 0, "aria-labelledby", labelledBy),
5187
+ ...ariaAttr(
5188
+ labelledBy === void 0 && label !== void 0,
5189
+ "aria-label",
5190
+ label
5191
+ ),
5192
+ onKeyDown: (event) => {
5193
+ if (!isOwnEvent(event)) return;
5194
+ handleCopyKey(event);
5195
+ if (event.key === "Escape") {
5196
+ if (drag.draggedColumnId !== null || resize.activeColumnId !== null)
5197
+ return;
5198
+ selection.clear();
5199
+ return;
5200
+ }
5201
+ if ((event.ctrlKey || event.metaKey) && (event.key === "a" || event.key === "A")) {
5202
+ if (selection.rowMode !== "multiple") return;
5203
+ event.preventDefault();
5204
+ selection.selectAllRows();
5205
+ }
5206
+ },
5207
+ children: [
5208
+ /* @__PURE__ */ jsxs19(
4996
5209
  "table",
4997
5210
  {
4998
- ref: bodyTableRef,
5211
+ ref: headerTableRef,
4999
5212
  role: "presentation",
5000
5213
  style: { width: totalColumnWidth(view.columns) },
5001
- className: gridTableClassName,
5214
+ className: classNames(gridTableClassName, "gridkit-data-grid-header"),
5002
5215
  children: [
5003
5216
  /* @__PURE__ */ jsx26(GridColgroup, { columns: view.columns }),
5004
5217
  /* @__PURE__ */ jsx26(
5005
- GridBody,
5218
+ GridHeader,
5006
5219
  {
5007
5220
  columns: view.columns,
5008
- definitions,
5009
- rows: view.pageRows,
5010
- activeColumnId: resize.activeColumnId,
5011
- nav,
5012
- selection,
5221
+ resize,
5222
+ drag,
5013
5223
  controller,
5224
+ state,
5225
+ sortableColumns,
5226
+ groupableColumns,
5227
+ groupToggleIconColumns,
5228
+ headerMenu: contextMenu.opens("header"),
5229
+ panels,
5230
+ messages,
5231
+ nav,
5232
+ selection
5233
+ }
5234
+ )
5235
+ ]
5236
+ }
5237
+ ),
5238
+ /* @__PURE__ */ jsx26(
5239
+ "div",
5240
+ {
5241
+ className: "gridkit-data-grid-body",
5242
+ ref: bodyRef,
5243
+ role: "rowgroup",
5244
+ 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
+ )
5281
+ }
5282
+ ),
5283
+ hasFooter && /* @__PURE__ */ jsxs19(
5284
+ "table",
5285
+ {
5286
+ ref: footerTableRef,
5287
+ role: "presentation",
5288
+ style: { width: totalColumnWidth(view.columns) },
5289
+ className: classNames(
5290
+ gridTableClassName,
5291
+ "gridkit-data-grid-footer"
5292
+ ),
5293
+ children: [
5294
+ /* @__PURE__ */ jsx26(GridColgroup, { columns: view.columns }),
5295
+ /* @__PURE__ */ jsx26(
5296
+ GridFooter,
5297
+ {
5298
+ columns: view.columns,
5014
5299
  aggregates,
5015
- groupAggregateDisplay,
5016
- virtualRange: virtualized ? virtualizer : null,
5017
- infiniteScroll,
5018
- sentinelRef,
5300
+ results: view.grandTotal,
5301
+ rows: view.rows.map((entry) => entry.row),
5019
5302
  locale,
5020
- getRowProps,
5021
- onRowClick,
5022
- onRowDoubleClick,
5023
- messages,
5024
- cellMenu: contextMenu.opens("cell"),
5025
- groupMenu: contextMenu.opens("group")
5303
+ ariaRowIndex: view.displayRows.length + 2
5026
5304
  }
5027
5305
  )
5028
5306
  ]
5029
5307
  }
5030
5308
  )
5031
- }
5032
- ),
5033
- hasFooter && /* @__PURE__ */ jsxs19(
5034
- "table",
5035
- {
5036
- role: "presentation",
5037
- style: { width: totalColumnWidth(view.columns) },
5038
- className: classNames(
5039
- gridTableClassName,
5040
- "gridkit-data-grid-footer"
5041
- ),
5042
- children: [
5043
- /* @__PURE__ */ jsx26(GridColgroup, { columns: view.columns }),
5044
- /* @__PURE__ */ jsx26(
5045
- GridFooter,
5046
- {
5047
- columns: view.columns,
5048
- aggregates,
5049
- results: view.grandTotal,
5050
- rows: view.rows.map((entry) => entry.row),
5051
- locale,
5052
- ariaRowIndex: view.displayRows.length + 2
5053
- }
5054
- )
5055
- ]
5056
- }
5057
- )
5058
- ]
5059
- }
5060
- ),
5061
- /* @__PURE__ */ jsx26(GridContextMenu, { contextMenu }),
5062
- /* @__PURE__ */ jsx26(
5063
- GridPanels,
5064
- {
5065
- panels,
5066
- controller,
5067
- commands,
5068
- messages
5069
- }
5070
- ),
5071
- paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */ jsx26(GridPager, { pager: pagerContext, config: pager, messages }))
5072
- ] });
5309
+ ]
5310
+ }
5311
+ ),
5312
+ /* @__PURE__ */ jsx26(GridContextMenu, { contextMenu }),
5313
+ /* @__PURE__ */ jsx26(
5314
+ GridPanels,
5315
+ {
5316
+ panels,
5317
+ controller,
5318
+ commands,
5319
+ messages
5320
+ }
5321
+ ),
5322
+ paginated && (pager?.template ? pager.template(pagerContext) : /* @__PURE__ */ jsx26(GridPager, { pager: pagerContext, config: pager, messages }))
5323
+ ]
5324
+ }
5325
+ );
5073
5326
  }
5074
5327
 
5075
5328
  // src/index.ts
@@ -5209,7 +5462,7 @@ function useColumnSortState(gridRef) {
5209
5462
  // src/DataGrid/hooks/useSelectionState.ts
5210
5463
  import { useCallback as useCallback8 } from "react";
5211
5464
  var FALLBACK_SELECTION = [];
5212
- var FALLBACK_CELL_SELECTION = null;
5465
+ var FALLBACK_CELL_SELECTION = { kind: "none" };
5213
5466
  function useSelectionState(gridRef) {
5214
5467
  const rowSelection = useGridSnapshot(
5215
5468
  gridRef,
@@ -5283,13 +5536,24 @@ function useColumnVisibilityState(gridRef) {
5283
5536
  );
5284
5537
  }
5285
5538
 
5539
+ // src/DataGrid/hooks/useColumnPinningState.ts
5540
+ import { useCallback as useCallback13 } from "react";
5541
+ var FALLBACK_PINNING = {};
5542
+ function useColumnPinningState(gridRef) {
5543
+ return useGridSnapshot(
5544
+ gridRef,
5545
+ useCallback13((api) => api.getColumnPinning(), []),
5546
+ FALLBACK_PINNING
5547
+ );
5548
+ }
5549
+
5286
5550
  // src/DataGrid/hooks/useFilterState.ts
5287
- import { useCallback as useCallback13, useState as useState19 } from "react";
5551
+ import { useCallback as useCallback14, useState as useState20 } from "react";
5288
5552
  function useFilterState(gridRef) {
5289
- const [fallback] = useState19(() => []);
5553
+ const [fallback] = useState20(() => []);
5290
5554
  const filter = useGridSnapshot(
5291
5555
  gridRef,
5292
- useCallback13((api) => api.getFilter(), []),
5556
+ useCallback14((api) => api.getFilter(), []),
5293
5557
  fallback
5294
5558
  );
5295
5559
  return {
@@ -5308,6 +5572,7 @@ export {
5308
5572
  serializeGridState,
5309
5573
  useAggregateState,
5310
5574
  useColumnOrderState,
5575
+ useColumnPinningState,
5311
5576
  useColumnSizingState,
5312
5577
  useColumnSortState,
5313
5578
  useColumnVisibilityState,