@open-grid/primitives 0.1.0 → 0.3.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +120 -53
  2. package/dist/index.js +220 -149
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -3,6 +3,64 @@ import { CellCoordinate, ColumnPinningPosition, ColumnId, Grid, ColumnLayout, Ro
3
3
  type PrimitiveProps = Record<string, string | number | boolean | undefined>;
4
4
  declare const GRID_DENSITIES: readonly ["compact", "standard", "comfortable"];
5
5
  type GridDensity = (typeof GRID_DENSITIES)[number];
6
+ interface GridLocalization {
7
+ dataGridLabel: string;
8
+ noRows: string;
9
+ loadingRowsLabel: string;
10
+ loadingRows: string;
11
+ gridErrorLabel: string;
12
+ gridError: string;
13
+ retryLoadingRowsLabel: string;
14
+ retry: string;
15
+ filterPlaceholder: string;
16
+ filterColumnLabel: (label: string) => string;
17
+ searchGridRowsLabel: string;
18
+ searchRowsPlaceholder: string;
19
+ searchAllRowsLabel: string;
20
+ clearRowSearchLabel: string;
21
+ clear: string;
22
+ rowSelectionLabel: string;
23
+ selectAllRowsOnCurrentPageLabel: string;
24
+ selectPage: string;
25
+ selectedRows: (count: number) => string;
26
+ clearRowSelectionLabel: string;
27
+ clearSelection: string;
28
+ gridColumnsLabel: string;
29
+ manageColumnsLabel: (visibleCount: number, totalCount: number) => string;
30
+ columnsSummary: (visibleCount: number, totalCount: number) => string;
31
+ findColumns: string;
32
+ columnVisibilityLabel: string;
33
+ columnsVisible: (visibleCount: number, totalCount: number) => string;
34
+ noColumnsFound: string;
35
+ showAllColumnsLabel: string;
36
+ showAll: string;
37
+ rowDensityLabel: string;
38
+ useDensityLabel: (density: GridDensity) => string;
39
+ densityLabel: (density: GridDensity) => string;
40
+ paginationLabel: string;
41
+ paginationActionLabel: (action: PaginationAction) => string;
42
+ pageStatus: (page: number, pageCount: number) => string;
43
+ rowsPerPageLabel: string;
44
+ pageSizeOption: (pageSize: number) => string;
45
+ resizeColumnLabel: (columnId: string) => string;
46
+ columnPinningLabel: (columnId: string) => string;
47
+ pinColumnLabel: (columnId: string, position: ColumnPinningPosition) => string;
48
+ openColumnMenuLabel: (columnId: string) => string;
49
+ columnMenuLabel: (columnId: string) => string;
50
+ headerActionMenuTrigger: string;
51
+ headerActionMenuItemLabel: (itemId: HeaderActionMenuDefaultItemId, grouped: boolean) => string;
52
+ columnGroupingLabel: string;
53
+ groupingPanelEmpty: string;
54
+ moveColumnGroupingLabel: (columnId: string, direction: "left" | "right") => string;
55
+ removeColumnGroupingLabel: (columnId: string) => string;
56
+ toggleRowExpandedLabel: (expanded: boolean, label: string) => string;
57
+ blankGroupValue: string;
58
+ groupFooterTotal: string;
59
+ editColumnLabel: (columnId: string) => string;
60
+ }
61
+ type GridLocalizationOverrides = Partial<GridLocalization>;
62
+ declare const DEFAULT_GRID_LOCALIZATION: Readonly<GridLocalization>;
63
+ declare function createGridLocalization(overrides?: GridLocalizationOverrides): Readonly<GridLocalization>;
6
64
  declare const GRID_PREFERENCES_VERSION: 1;
7
65
  interface GridPreferencesState {
8
66
  columnVisibility: GridState["columnVisibility"];
@@ -18,6 +76,14 @@ interface GridPreferences {
18
76
  interface GridPreferencesOptions {
19
77
  validColumnIds?: readonly string[] | undefined;
20
78
  }
79
+ interface GridPreferencesMigration {
80
+ fromVersion: number;
81
+ toVersion: number;
82
+ migrate: (preferences: Readonly<Record<string, unknown>>) => unknown;
83
+ }
84
+ interface GridPreferencesParseOptions extends GridPreferencesOptions {
85
+ migrations?: readonly GridPreferencesMigration[] | undefined;
86
+ }
21
87
  interface GridPreferencesStorageLike {
22
88
  getItem: (key: string) => string | null;
23
89
  setItem: (key: string, value: string) => void;
@@ -641,70 +707,71 @@ interface MeasuredSizeCacheLike {
641
707
  set: (key: string, size: number) => boolean;
642
708
  }
643
709
  declare const HEADER_ACTION_MENU_ENABLED_ITEM_SELECTOR = "[role=\"menuitem\"]:not(:disabled):not([aria-disabled=\"true\"])";
644
- declare const HEADER_ACTION_MENU_TRIGGER_TEXT = "...";
645
- declare const GROUPING_PANEL_EMPTY_MESSAGE = "Drag column headers here to group";
710
+ declare const HEADER_ACTION_MENU_TRIGGER_TEXT: string;
711
+ declare const GROUPING_PANEL_EMPTY_MESSAGE: string;
646
712
  declare const GRID_FOCUSED_CELL_SELECTOR = "[role=\"gridcell\"][data-focused=\"true\"]";
647
713
  declare const GRID_INTERACTIVE_KEYBOARD_TARGET_SELECTOR = "button, input, select, textarea, a[href], [contenteditable]:not([contenteditable='false']), [role='button'], [role='menuitem'], [role='separator'], [role='slider'], [role='textbox'], [role='combobox'], [role='searchbox'], [role='spinbutton']";
648
714
  declare function getGridProps<TData>(grid: Grid<TData>, options?: GridRowCoordinateOptions): PrimitiveProps;
649
715
  declare function getGridHeaderProps(): PrimitiveProps;
650
- declare function getGridLoadingOverlayProps(): PrimitiveProps;
651
- declare function getGridLoadingText(): string;
652
- declare function getGridErrorOverlayProps(): PrimitiveProps;
653
- declare function getGridErrorText(): string;
654
- declare function getGridErrorRetryButtonProps(): PrimitiveProps;
655
- declare function getGridErrorRetryButtonText(): string;
716
+ declare function getGridLoadingOverlayProps(localization?: GridLocalization): PrimitiveProps;
717
+ declare function getGridLoadingText(localization?: GridLocalization): string;
718
+ declare function getGridErrorOverlayProps(localization?: GridLocalization): PrimitiveProps;
719
+ declare function getGridErrorText(localization?: GridLocalization): string;
720
+ declare function getGridErrorRetryButtonProps(localization?: GridLocalization): PrimitiveProps;
721
+ declare function getGridErrorRetryButtonText(localization?: GridLocalization): string;
656
722
  declare function getGridHeaderRowProps(options?: GridHeaderRowPrimitiveOptions): PrimitiveProps;
657
723
  declare function getGridHeaderRowCount<TData>(grid: Grid<TData>, options?: GridRowCoordinateOptions): number;
658
724
  declare function getGridBodyRowIndexOffset<TData>(grid: Grid<TData>, options?: GridRowCoordinateOptions): number;
659
725
  declare function getColumnFilterCellProps<TData>(column: Column<TData, unknown>, options: ColumnFilterCellPrimitiveOptions): PrimitiveProps;
660
- declare function getColumnFilterInputProps<TData>(column: Column<TData, unknown>, options: ColumnFilterInputPrimitiveOptions): PrimitiveProps;
726
+ declare function getColumnFilterInputProps<TData>(column: Column<TData, unknown>, options: ColumnFilterInputPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
661
727
  declare function getColumnFilterText(filters: ColumnFiltersState, columnId: ColumnId): string;
662
- declare function getQuickFilterProps(): PrimitiveProps;
663
- declare function getQuickFilterInputProps(options: QuickFilterInputPrimitiveOptions): PrimitiveProps;
664
- declare function getQuickFilterClearButtonProps(value: string): PrimitiveProps;
665
- declare function getQuickFilterClearButtonText(): string;
666
- declare function getRowSelectionControlsProps(): PrimitiveProps;
667
- declare function getRowSelectionCheckboxProps(options?: RowSelectionCheckboxPrimitiveOptions): PrimitiveProps;
668
- declare function getRowSelectionCheckboxText(): string;
728
+ declare function getQuickFilterProps(localization?: GridLocalization): PrimitiveProps;
729
+ declare function getQuickFilterInputProps(options: QuickFilterInputPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
730
+ declare function getQuickFilterClearButtonProps(value: string, localization?: GridLocalization): PrimitiveProps;
731
+ declare function getQuickFilterClearButtonText(localization?: GridLocalization): string;
732
+ declare function getRowSelectionControlsProps(localization?: GridLocalization): PrimitiveProps;
733
+ declare function getRowSelectionCheckboxProps(options?: RowSelectionCheckboxPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
734
+ declare function getRowSelectionCheckboxText(localization?: GridLocalization): string;
669
735
  declare function getRowSelectionStatusProps(): PrimitiveProps;
670
- declare function getRowSelectionStatusText(selectedCount: number): string;
671
- declare function getRowSelectionClearButtonProps(disabled?: boolean): PrimitiveProps;
672
- declare function getRowSelectionClearButtonText(): string;
736
+ declare function getRowSelectionStatusText(selectedCount: number, localization?: GridLocalization): string;
737
+ declare function getRowSelectionClearButtonProps(disabled?: boolean, localization?: GridLocalization): PrimitiveProps;
738
+ declare function getRowSelectionClearButtonText(localization?: GridLocalization): string;
673
739
  declare function setCheckboxIndeterminate(target: unknown, indeterminate: boolean): boolean;
674
- declare function getColumnVisibilityControlsProps(): PrimitiveProps;
675
- declare function getColumnVisibilitySummaryProps(visibleCount: number, totalCount: number): PrimitiveProps;
676
- declare function getColumnVisibilitySummaryText(visibleCount: number, totalCount: number): string;
677
- declare function getColumnVisibilitySearchInputProps(value: string): PrimitiveProps;
678
- declare function getColumnVisibilityListProps(): PrimitiveProps;
740
+ declare function getColumnVisibilityControlsProps(localization?: GridLocalization): PrimitiveProps;
741
+ declare function getColumnVisibilitySummaryProps(visibleCount: number, totalCount: number, localization?: GridLocalization): PrimitiveProps;
742
+ declare function getColumnVisibilitySummaryText(visibleCount: number, totalCount: number, localization?: GridLocalization): string;
743
+ declare function getColumnVisibilitySearchInputProps(value: string, localization?: GridLocalization): PrimitiveProps;
744
+ declare function getColumnVisibilityListProps(localization?: GridLocalization): PrimitiveProps;
679
745
  declare function getColumnVisibilityCheckboxProps(options: ColumnVisibilityCheckboxPrimitiveOptions): PrimitiveProps;
680
746
  declare function getColumnVisibilityStatusProps(): PrimitiveProps;
681
- declare function getColumnVisibilityStatusText(visibleCount: number, totalCount: number): string;
682
- declare function getColumnVisibilityEmptyText(): string;
683
- declare function getColumnVisibilityResetButtonProps(hiddenCount: number): PrimitiveProps;
684
- declare function getColumnVisibilityResetButtonText(): string;
747
+ declare function getColumnVisibilityStatusText(visibleCount: number, totalCount: number, localization?: GridLocalization): string;
748
+ declare function getColumnVisibilityEmptyText(localization?: GridLocalization): string;
749
+ declare function getColumnVisibilityResetButtonProps(hiddenCount: number, localization?: GridLocalization): PrimitiveProps;
750
+ declare function getColumnVisibilityResetButtonText(localization?: GridLocalization): string;
685
751
  declare function normalizeGridDensity(value: unknown, fallback?: GridDensity): GridDensity;
752
+ declare function migrateGridPreferences(value: unknown, migrations?: readonly GridPreferencesMigration[]): Record<string, unknown> | null;
686
753
  declare function createGridPreferences(state?: Partial<GridState>, density?: GridDensity, options?: GridPreferencesOptions): GridPreferences;
687
754
  declare function serializeGridPreferences(preferences: GridPreferences, options?: GridPreferencesOptions): string;
688
- declare function parseGridPreferences(value: string, options?: GridPreferencesOptions): GridPreferences | null;
755
+ declare function parseGridPreferences(value: string, options?: GridPreferencesParseOptions): GridPreferences | null;
689
756
  declare function getBrowserGridPreferencesStorage(environment?: GridPreferencesStorageEnvironmentLike | null | undefined): GridPreferencesStorageLike | null;
690
- declare function readGridPreferences(storage: GridPreferencesStorageLike | null | undefined, key: string, options?: GridPreferencesOptions): GridPreferences | null;
757
+ declare function readGridPreferences(storage: GridPreferencesStorageLike | null | undefined, key: string, options?: GridPreferencesParseOptions): GridPreferences | null;
691
758
  declare function writeGridPreferences(storage: GridPreferencesStorageLike | null | undefined, key: string, state: Partial<GridState>, density: GridDensity, options?: GridPreferencesOptions): boolean;
692
759
  declare function removeGridPreferences(storage: GridPreferencesStorageLike | null | undefined, key: string): boolean;
693
760
  declare function getGridDensityProps(density: GridDensity): PrimitiveProps;
694
761
  declare function getGridDensityRowHeight(density: GridDensity): number;
695
- declare function getDensityControlsProps(): PrimitiveProps;
696
- declare function getDensityButtonProps(density: GridDensity, currentDensity: GridDensity): PrimitiveProps;
697
- declare function getDensityButtonText(density: GridDensity): string;
762
+ declare function getDensityControlsProps(localization?: GridLocalization): PrimitiveProps;
763
+ declare function getDensityButtonProps(density: GridDensity, currentDensity: GridDensity, localization?: GridLocalization): PrimitiveProps;
764
+ declare function getDensityButtonText(density: GridDensity, localization?: GridLocalization): string;
698
765
  declare function getFilteredColumnVisibilityColumns<TData>(columns: readonly Column<TData, unknown>[], query: string): Column<TData, unknown>[];
699
766
  declare function getNextColumnFilters(filters: ColumnFiltersState, columnId: ColumnId, value: string): ColumnFiltersState;
700
- declare function getPaginationProps(): PrimitiveProps;
701
- declare function getPaginationButtonProps(options: PaginationButtonPrimitiveOptions): PrimitiveProps;
767
+ declare function getPaginationProps(localization?: GridLocalization): PrimitiveProps;
768
+ declare function getPaginationButtonProps(options: PaginationButtonPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
702
769
  declare function getPaginationButtonText(action: PaginationAction): string;
703
770
  declare function getPaginationStatusProps(): PrimitiveProps;
704
- declare function getPaginationPageText<TData>(grid: Grid<TData>): string;
705
- declare function getPaginationPageSizeSelectProps(pageSize: number): PrimitiveProps;
771
+ declare function getPaginationPageText<TData>(grid: Grid<TData>, localization?: GridLocalization): string;
772
+ declare function getPaginationPageSizeSelectProps(pageSize: number, localization?: GridLocalization): PrimitiveProps;
706
773
  declare function getPaginationPageSizeOptions(options?: readonly number[], currentPageSize?: number): number[];
707
- declare function getPaginationPageSizeOptionText(pageSize: number): string;
774
+ declare function getPaginationPageSizeOptionText(pageSize: number, localization?: GridLocalization): string;
708
775
  declare function getGridBodyProps(options?: GridBodyPrimitiveOptions): PrimitiveProps;
709
776
  declare function getGridEmptyRowProps(options?: GridEmptyRowPrimitiveOptions): PrimitiveProps;
710
777
  declare function getGridEmptyCellProps(options?: GridEmptyCellPrimitiveOptions): PrimitiveProps;
@@ -737,7 +804,7 @@ declare function getCellEditorKeyboardAction(event: {
737
804
  key: string;
738
805
  }): CellEditorKeyboardAction | null;
739
806
  declare function getGridKeyboardFocusMove(event: GridKeyboardShortcutEventLike): GridKeyboardFocusMove | null;
740
- declare function getColumnResizeHandleProps<TData>(column: Column<TData, unknown>, options?: ColumnResizeHandlePrimitiveOptions): PrimitiveProps;
807
+ declare function getColumnResizeHandleProps<TData>(column: Column<TData, unknown>, options?: ColumnResizeHandlePrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
741
808
  declare function getColumnResizeStartSize<TData>(grid: Grid<TData>, column: Column<TData, unknown>): number;
742
809
  declare function getColumnResizeKeyboardSize<TData>(column: Column<TData, unknown>, startSize: number, event: ColumnResizeKeyboardEventLike, options?: ColumnResizeKeyboardSizeOptions): number | null;
743
810
  declare function getColumnResizePointerSize(startSize: number, startX: number, event: ColumnResizePointerEventLike): number;
@@ -755,15 +822,15 @@ declare function addPointerMoveUpListeners(listeners: PointerMoveUpListeners, ta
755
822
  declare function addPointerUpCancelListeners(listeners: PointerUpCancelListeners, target?: PointerUpCancelListenerTargetLike | null | undefined): () => void;
756
823
  declare function addPointerMoveUpCancelListeners(listeners: PointerMoveUpCancelListeners, target?: PointerMoveUpCancelListenerTargetLike | null | undefined): () => void;
757
824
  declare function addPassiveScrollListener(listener: ScrollListener, target: ScrollListenerTargetLike): () => void;
758
- declare function getColumnPinningControlsProps<TData>(column: Column<TData, unknown>): PrimitiveProps;
825
+ declare function getColumnPinningControlsProps<TData>(column: Column<TData, unknown>, localization?: GridLocalization): PrimitiveProps;
759
826
  declare function getColumnPinningButtonText(position: ColumnPinningPosition): string;
760
- declare function getColumnPinningButtonProps<TData>(column: Column<TData, unknown>, options: ColumnPinningButtonPrimitiveOptions): PrimitiveProps;
761
- declare function getHeaderActionMenuTriggerProps<TData>(column: Column<TData, unknown>, options: HeaderActionMenuTriggerPrimitiveOptions): PrimitiveProps;
827
+ declare function getColumnPinningButtonProps<TData>(column: Column<TData, unknown>, options: ColumnPinningButtonPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
828
+ declare function getHeaderActionMenuTriggerProps<TData>(column: Column<TData, unknown>, options: HeaderActionMenuTriggerPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
762
829
  declare function getHeaderActionMenuId(columnId: string): string;
763
830
  declare function getHeaderActionMenuTriggerId(columnId: string): string;
764
- declare function getHeaderActionMenuProps<TData>(column: Column<TData, unknown>): PrimitiveProps;
765
- declare function getHeaderActionMenuDefaultItemLabel(itemId: HeaderActionMenuDefaultItemId, options?: HeaderActionMenuDefaultItemLabelOptions): string;
766
- declare function getHeaderActionMenuDefaultItemDescriptors(options: HeaderActionMenuDefaultItemDescriptorOptions): HeaderActionMenuDefaultItemDescriptor[];
831
+ declare function getHeaderActionMenuProps<TData>(column: Column<TData, unknown>, localization?: GridLocalization): PrimitiveProps;
832
+ declare function getHeaderActionMenuDefaultItemLabel(itemId: HeaderActionMenuDefaultItemId, options?: HeaderActionMenuDefaultItemLabelOptions, localization?: GridLocalization): string;
833
+ declare function getHeaderActionMenuDefaultItemDescriptors(options: HeaderActionMenuDefaultItemDescriptorOptions, localization?: GridLocalization): HeaderActionMenuDefaultItemDescriptor[];
767
834
  declare function getHeaderActionMenuItemProps(options?: HeaderActionMenuItemPrimitiveOptions): PrimitiveProps;
768
835
  declare function getHeaderActionMenuCustomItemProps(options?: HeaderActionMenuLabelPrimitiveOptions): PrimitiveProps;
769
836
  declare function getHeaderActionMenuLabelProps(): PrimitiveProps;
@@ -782,21 +849,21 @@ declare function isHeaderActionMenuSeparatorItem<TItem extends HeaderActionMenuP
782
849
  type: "separator";
783
850
  }>;
784
851
  declare function getHeaderActionMenuCustomItemUserProps(item: HeaderActionMenuPrimitiveCustomItem | null | false | undefined): Record<string, unknown>;
785
- declare function getGroupingPanelProps(options?: GroupingPanelPrimitiveOptions): PrimitiveProps;
852
+ declare function getGroupingPanelProps(options?: GroupingPanelPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
786
853
  declare function getGroupingPanelPlaceholderProps(): PrimitiveProps;
787
854
  declare function getGroupingPanelChipProps<TData>(column: Column<TData, unknown>): PrimitiveProps;
788
- declare function getGroupingPanelMoveButtonProps<TData>(column: Column<TData, unknown>, options: GroupingPanelMoveButtonPrimitiveOptions): PrimitiveProps;
789
- declare function getGroupingPanelRemoveButtonProps<TData>(column: Column<TData, unknown>): PrimitiveProps;
855
+ declare function getGroupingPanelMoveButtonProps<TData>(column: Column<TData, unknown>, options: GroupingPanelMoveButtonPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
856
+ declare function getGroupingPanelRemoveButtonProps<TData>(column: Column<TData, unknown>, localization?: GridLocalization): PrimitiveProps;
790
857
  declare function getIsGroupLabelCell<TData>(row: Row<TData>, column: Column<TData, unknown>, visibleColumns: readonly Column<TData, unknown>[]): boolean;
791
- declare function getGroupValueText(value: unknown): string;
792
- declare function getGroupRowLabel<TData, TFallback = string>(row: Row<TData>, column: Column<TData, unknown>, options?: GroupRowLabelOptions<TFallback>): string | TFallback;
858
+ declare function getGroupValueText(value: unknown, localization?: GridLocalization): string;
859
+ declare function getGroupRowLabel<TData, TFallback = string>(row: Row<TData>, column: Column<TData, unknown>, options?: GroupRowLabelOptions<TFallback>, localization?: GridLocalization): string | TFallback;
793
860
  declare function getGroupCellIndent<TData>(row: Row<TData>, options?: GroupCellIndentOptions): number;
794
861
  declare function getGroupCellIndentStyle<TData>(row: Row<TData>, options?: GroupCellIndentOptions): GroupCellIndentStyleProps;
795
862
  declare function getGroupCellIndentStyleText<TData>(row: Row<TData>, options?: GroupCellIndentOptions): string;
796
863
  declare function getGroupRowCountText<TData>(row: Row<TData>): string | undefined;
797
864
  declare function getRowProps<TData>(row: Row<TData>, rowIndex: number, options?: RowPrimitiveOptions): PrimitiveProps;
798
865
  declare function getRowLayoutProps<TData>(row: Row<TData>, options?: RowLayoutPrimitiveOptions): PrimitiveProps;
799
- declare function getRowExpansionToggleProps<TData>(row: Row<TData>, options: RowExpansionTogglePrimitiveOptions): PrimitiveProps;
866
+ declare function getRowExpansionToggleProps<TData>(row: Row<TData>, options: RowExpansionTogglePrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
800
867
  declare function getRowExpansionToggleText(expanded: boolean): string;
801
868
  declare function getRowExpansionSpacerProps(): PrimitiveProps;
802
869
  declare function getCellProps<TData>(row: Row<TData>, column: Column<TData, unknown>, _rowIndex: number, columnIndex: number, options?: CellPrimitiveOptions): PrimitiveProps;
@@ -825,7 +892,7 @@ declare function escapeGridHtml(value: string): string;
825
892
  declare function getColumnHeaderText<TData>(column: Column<TData, unknown>): string;
826
893
  declare function getCellFillHandleVisible<TData>(row: Row<TData>, column: Column<TData, unknown>, options: CellFillHandleVisibilityOptions): boolean;
827
894
  declare function getCanStartCellPointerDrag(event: PointerButtonEventLike, editingCell: CellCoordinate | null | undefined): boolean;
828
- declare function getCellEditorProps<TData>(column: Column<TData, unknown>, options?: CellEditorPrimitiveOptions): PrimitiveProps;
895
+ declare function getCellEditorProps<TData>(column: Column<TData, unknown>, options?: CellEditorPrimitiveOptions, localization?: GridLocalization): PrimitiveProps;
829
896
  declare function getCellEditorOptionProps(option: CellEditorOptionPrimitiveOptions): PrimitiveProps;
830
897
  declare function getCellEditorOptionText(option: CellEditorOptionPrimitiveOptions): string;
831
898
  declare function getCellValidationMessageProps(): PrimitiveProps;
@@ -928,4 +995,4 @@ declare function getPinnedColumnOffsetStyleText(layout: PinnedColumnOffsetStyleL
928
995
  declare function isCellCoordinateEqual(left: CellCoordinate | null | undefined, right: CellCoordinate | null | undefined): boolean;
929
996
  declare function isFocusedCell(focusedCell: CellCoordinate | null, rowId: string, columnId: string): boolean;
930
997
 
931
- export { type BrowserDownloadAnchorLike, type BrowserDownloadBlobConstructorLike, type BrowserDownloadDocumentLike, type BrowserDownloadEnvironment, type BrowserDownloadParentLike, type BrowserDownloadUrlLike, type BrowserExportFileLike, type CellEditValidationEventLike, type CellEditorKeyboardAction, type CellEditorOptionPrimitiveOptions, type CellEditorPrimitiveOptions, type CellEditorValueEventLike, type CellEditorValueTargetLike, type CellFillHandleVisibilityOptions, type CellLayoutPrimitiveOptions, type CellPrimitiveOptions, type CheckboxIndeterminateTargetLike, type ClickSuppressionController, type ClipboardTextAreaLike, type ClipboardTextDocumentLike, type ClipboardTextEnvironment, type ClipboardTextNavigatorLike, type ClipboardTextParentLike, type ColumnFilterCellPrimitiveOptions, type ColumnFilterInputPrimitiveOptions, type ColumnIdItemLike, type ColumnLayoutTotalWidthItemLike, type ColumnMoveDirection, type ColumnMoveGrid, type ColumnPinningButtonPrimitiveOptions, type ColumnResizeDefaultPreventableEventLike, type ColumnResizeFinalSizeEventLike, type ColumnResizeHandlePrimitiveOptions, type ColumnResizeKeyboardEventLike, type ColumnResizeKeyboardSizeOptions, type ColumnResizePointerEventLike, type ColumnVirtualizationPrimitiveOptions, type ColumnVisibilityCheckboxPrimitiveOptions, DEFAULT_PAGINATION_PAGE_SIZE_OPTIONS, type DatasetElementLike, type DefaultPreventableEventLike, type DefaultPreventablePropagationEventLike, type DefaultPreventedEventLike, type ElementIdLookupLike, type FocusableElementLike, type FocusableSelectableElementLike, type FocusedCellContainerLike, type FocusedCellRestoreFrameSyncOptions, type FocusedCellRestoreOptions, type FocusedCellScrollElementOptions, type FocusedCellScrollOptions, type FocusedCellScrollPosition, type FocusedRowSelectionTarget, GRID_DENSITIES, GRID_FOCUSED_CELL_SELECTOR, GRID_INTERACTIVE_KEYBOARD_TARGET_SELECTOR, GRID_PREFERENCES_VERSION, GROUPING_PANEL_EMPTY_MESSAGE, type GridBodyPrimitiveOptions, type GridDensity, type GridEmptyCellPrimitiveOptions, type GridEmptyRowPrimitiveOptions, type GridHeaderRowPrimitiveOptions, type GridKeyboardEditAction, type GridKeyboardFocusMove, type GridKeyboardShortcutAction, type GridKeyboardShortcutEventLike, type GridPreferences, type GridPreferencesOptions, type GridPreferencesState, type GridPreferencesStorageEnvironmentLike, type GridPreferencesStorageLike, type GridRowCoordinateOptions, type GroupCellIndentOptions, type GroupCellIndentStyleProps, type GroupRowLabelOptions, type GroupingColumnMoveGrid, type GroupingPanelMoveButtonPrimitiveOptions, type GroupingPanelPrimitiveOptions, HEADER_ACTION_MENU_ENABLED_ITEM_SELECTOR, HEADER_ACTION_MENU_TRIGGER_TEXT, type HeaderActionMenuActiveElementDocumentLike, type HeaderActionMenuActiveElementTargetLike, type HeaderActionMenuDefaultItemDescriptor, type HeaderActionMenuDefaultItemDescriptorOptions, type HeaderActionMenuDefaultItemId, type HeaderActionMenuDefaultItemLabelOptions, type HeaderActionMenuFocusTargetEventLike, type HeaderActionMenuFocusTargetLike, type HeaderActionMenuItemFocusPosition, type HeaderActionMenuItemFocusTargetLike, type HeaderActionMenuItemPrimitiveOptions, type HeaderActionMenuKeyboardAction, type HeaderActionMenuLabelPrimitiveOptions, type HeaderActionMenuPrimitiveCustomItem, type HeaderActionMenuPrimitiveItem, type HeaderActionMenuPrimitiveLabelItem, type HeaderActionMenuPrimitiveSeparatorItem, type HeaderActionMenuTriggerPrimitiveOptions, type HeaderButtonPrimitiveOptions, type HeaderCellLayoutPrimitiveOptions, type HeaderCellPrimitiveOptions, type HeaderDragEndAction, type HeaderDragEndActionOptions, type HeaderDragEndColumnLike, type HeaderDragEndLike, type HeaderKeyboardMoveEventLike, type HeaderSortIndicatorTextOptions, type InlineSizeStyleProps, type KeyboardTargetEventLike, type MeasuredBlockElementLike, type MeasuredBlockRectElementLike, type MeasuredBlockRectElementTargetLike, type MeasuredInlineDatasetElementTargetLike, type MeasuredInlineElementLike, type MeasuredSizeCacheLike, type ObservedElementMapLike, type OffsetBlockElementLike, type PaginationAction, type PaginationButtonPrimitiveOptions, type PinnedColumnOffsetStyleLayoutLike, type PinnedColumnOffsetStyleProps, type PointerButtonEventLike, type PointerButtonsEventLike, type PointerCaptureEventLike, type PointerCaptureTargetLike, type PointerClientCoordinateLike, type PointerDragMovementLike, type PointerDragSessionLike, type PointerDragStartLike, type PointerHitTestElementLike, type PointerIdEventLike, type PointerListener, type PointerMoveUpCancelListenerTargetLike, type PointerMoveUpCancelListeners, type PointerMoveUpListenerTargetLike, type PointerMoveUpListeners, type PointerUpCancelListenerTargetLike, type PointerUpCancelListeners, type PrimitiveProps, type PropagationEventLike, type QuickFilterInputPrimitiveOptions, type ResizeObserverBlockSizeEntryLike, type ResizeObserverConstructorLike, type ResizeObserverDatasetEntryLike, type ResizeObserverDatasetTargetLike, type ResizeObserverDisconnectLike, type ResizeObserverEntryDatasetKey, type ResizeObserverInlineSizeEntryLike, type ResizeObserverObserveLike, type ResizeObserverUnobserveLike, type ResolvedColumnVirtualizationOptions, type ResolvedRowVirtualizationOptions, type RowExpansionTogglePrimitiveOptions, type RowIdItemLike, type RowLayoutPrimitiveOptions, type RowPrimitiveOptions, type RowSelectionCheckboxPrimitiveOptions, type RowSelectionToggleEventLike, type RowVirtualizationPrimitiveOptions, type ScrollFrameElementLike, type ScrollFrameElementOptions, type ScrollFrameOptionsLike, type ScrollListener, type ScrollListenerTargetLike, type ScrollPositionElementLike, type VirtualBodyStyleProps, type VirtualBodyStyleRangeLike, type VirtualRowStyleItemLike, type VirtualRowStyleProps, type VirtualizedInlineSizeStyleProps, addPassiveScrollListener, addPointerMoveUpCancelListeners, addPointerMoveUpListeners, addPointerUpCancelListeners, applyResizeObserverMeasuredSizes, createClickSuppressionController, createGridPreferences, createResizeObserver, disconnectResizeObserver, downloadBrowserExportFile, escapeGridHtml, focusCellEditorElement, focusElement, focusElementById, focusFocusedCellInGrid, focusHeaderActionMenuItem, focusHeaderActionMenuItemById, focusHeaderActionMenuTrigger, focusHeaderActionMenuTriggerById, getBrowserGridPreferencesStorage, getCanApplyColumnResize, getCanCancelCellEdit, getCanContinuePointerDrag, getCanEndPointerDrag, getCanRestoreFocusedCell, getCanRunGridKeyboardShortcut, getCanStartCellEdit, getCanStartCellPointerDrag, getCanStartColumnResize, getCanStartFocusedCellEdit, getCanToggleRowSelection, getCellDisplayText, getCellEditText, getCellEditValidationMessage, getCellEditorEventValue, getCellEditorKeyboardAction, getCellEditorOptionProps, getCellEditorOptionText, getCellEditorProps, getCellEditorTargetValue, getCellFillHandleProps, getCellFillHandleVisible, getCellLayoutProps, getCellProps, getCellValidationMessageProps, getColumnById, getColumnFilterCellProps, getColumnFilterInputProps, getColumnFilterText, getColumnHeaderText, getColumnIndexById, getColumnLayoutById, getColumnLayoutTotalWidth, getColumnPinningButtonProps, getColumnPinningButtonText, getColumnPinningControlsProps, getColumnResizeFinalSize, getColumnResizeHandleProps, getColumnResizeKeyboardSize, getColumnResizePointerSize, getColumnResizeStartSize, getColumnSpacerProps, getColumnVisibilityCheckboxProps, getColumnVisibilityControlsProps, getColumnVisibilityEmptyText, getColumnVisibilityListProps, getColumnVisibilityResetButtonProps, getColumnVisibilityResetButtonText, getColumnVisibilitySearchInputProps, getColumnVisibilityStatusProps, getColumnVisibilityStatusText, getColumnVisibilitySummaryProps, getColumnVisibilitySummaryText, getDefaultBrowserDownloadEnvironment, getDefaultClipboardTextEnvironment, getDefaultPointerMoveUpCancelListenerTarget, getDefaultPointerMoveUpListenerTarget, getDefaultPointerUpCancelListenerTarget, getDensityButtonProps, getDensityButtonText, getDensityControlsProps, getElementOffsetBlockSize, getEnabledHeaderActionMenuItems, getFilteredColumnVisibilityColumns, getFocusedCellScrollOptionsFromElement, getFocusedRowSelectionTarget, getGridBodyProps, getGridBodyRowIndexOffset, getGridDensityProps, getGridDensityRowHeight, getGridEmptyCellProps, getGridEmptyRowProps, getGridErrorOverlayProps, getGridErrorRetryButtonProps, getGridErrorRetryButtonText, getGridErrorText, getGridHeaderProps, getGridHeaderRowCount, getGridHeaderRowProps, getGridKeyboardEditAction, getGridKeyboardFocusMove, getGridKeyboardShortcutAction, getGridLoadingOverlayProps, getGridLoadingText, getGridProps, getGroupCellIndent, getGroupCellIndentStyle, getGroupCellIndentStyleText, getGroupRowCountText, getGroupRowLabel, getGroupValueText, getGroupingPanelChipProps, getGroupingPanelMoveButtonProps, getGroupingPanelPlaceholderProps, getGroupingPanelProps, getGroupingPanelRemoveButtonProps, getHeaderActionMenuActiveElement, getHeaderActionMenuCustomItemProps, getHeaderActionMenuCustomItemUserProps, getHeaderActionMenuDefaultItemDescriptors, getHeaderActionMenuDefaultItemLabel, getHeaderActionMenuFocusTarget, getHeaderActionMenuId, getHeaderActionMenuItemProps, getHeaderActionMenuKeyboardAction, getHeaderActionMenuLabelProps, getHeaderActionMenuProps, getHeaderActionMenuSeparatorProps, getHeaderActionMenuTriggerFocusPosition, getHeaderActionMenuTriggerId, getHeaderActionMenuTriggerProps, getHeaderButtonProps, getHeaderCellLayoutProps, getHeaderCellProps, getHeaderDragEndAction, getHeaderKeyboardMoveDirection, getHeaderPlaceholderCellProps, getHeaderSortIndicatorProps, getHeaderSortIndicatorText, getInlineSizeStyle, getInlineSizeStyleText, getIsGroupLabelCell, getMeasuredElementBlockSize, getMeasuredElementBlockSizeFromRect, getMeasuredElementBlockSizeFromTarget, getMeasuredElementInlineSize, getNextColumnFilters, getPaginationButtonProps, getPaginationButtonText, getPaginationPageSizeOptionText, getPaginationPageSizeOptions, getPaginationPageSizeSelectProps, getPaginationPageText, getPaginationProps, getPaginationStatusProps, getPinnedColumnOffsetStyle, getPinnedColumnOffsetStyleText, getPointerCaptureTarget, getQuickFilterClearButtonProps, getQuickFilterClearButtonText, getQuickFilterInputProps, getQuickFilterProps, getResizeObserverEntryBlockSize, getResizeObserverEntryDatasetId, getResizeObserverEntryInlineSize, getRowById, getRowExpansionSpacerProps, getRowExpansionToggleProps, getRowExpansionToggleText, getRowLayoutProps, getRowProps, getRowSelectionCheckboxProps, getRowSelectionCheckboxText, getRowSelectionClearButtonProps, getRowSelectionClearButtonText, getRowSelectionControlsProps, getRowSelectionStatusProps, getRowSelectionStatusText, getScrollForFocusedCell, getScrollFrameOptionsFromElement, getShouldCancelFocusedCellRestoreOnFrameSync, getShouldPreventEventDefault, getSizeOffset, getVirtualBodyStyle, getVirtualBodyStyleText, getVirtualRowStyle, getVirtualRowStyleText, getVirtualizedInlineSizeStyle, getVirtualizedInlineSizeStyleText, hasPointerMovedPastDragThreshold, isCellCoordinateEqual, isFocusableElement, isFocusedCell, isGridInteractiveKeyboardEventTarget, isGridInteractiveKeyboardTarget, isHeaderActionMenuActionItem, isHeaderActionMenuCloseAction, isHeaderActionMenuCustomItem, isHeaderActionMenuFocusAction, isHeaderActionMenuFocusTarget, isHeaderActionMenuItem, isHeaderActionMenuLabelItem, isHeaderActionMenuSeparatorItem, isHeaderActionMenuTabCloseAction, isHeaderDragGroupAction, isHeaderDragMoveAction, isMeasuredBlockElement, isMeasuredBlockRectElement, isMeasuredBlockRectElementTarget, isMeasuredInlineDatasetElementTarget, isMeasuredInlineElement, isPointerCaptureTarget, isPointerInsideElement, isPrimaryPointerButton, isPrimaryPointerDragActive, isResizeObserverDatasetTarget, moveColumnToTarget, moveGroupedColumn, moveVisibleColumn, normalizeGridDensity, observeElements, parseCellEditValue, parseGridPreferences, preventDefaultAndStopPropagation, preventEventDefault, readClipboardText, readGridPreferences, removeGridPreferences, removeObservedElement, replaceObservedElement, resolveColumnVirtualizationOptions, resolveRowVirtualizationOptions, scrollElementToPosition, serializeGridPreferences, setCheckboxIndeterminate, setElementDatasetId, stopEventPropagation, tryReleasePointerCapture, trySetPointerCapture, updatePointerDragDidMovePastThreshold, writeClipboardText, writeGridPreferences };
998
+ export { type BrowserDownloadAnchorLike, type BrowserDownloadBlobConstructorLike, type BrowserDownloadDocumentLike, type BrowserDownloadEnvironment, type BrowserDownloadParentLike, type BrowserDownloadUrlLike, type BrowserExportFileLike, type CellEditValidationEventLike, type CellEditorKeyboardAction, type CellEditorOptionPrimitiveOptions, type CellEditorPrimitiveOptions, type CellEditorValueEventLike, type CellEditorValueTargetLike, type CellFillHandleVisibilityOptions, type CellLayoutPrimitiveOptions, type CellPrimitiveOptions, type CheckboxIndeterminateTargetLike, type ClickSuppressionController, type ClipboardTextAreaLike, type ClipboardTextDocumentLike, type ClipboardTextEnvironment, type ClipboardTextNavigatorLike, type ClipboardTextParentLike, type ColumnFilterCellPrimitiveOptions, type ColumnFilterInputPrimitiveOptions, type ColumnIdItemLike, type ColumnLayoutTotalWidthItemLike, type ColumnMoveDirection, type ColumnMoveGrid, type ColumnPinningButtonPrimitiveOptions, type ColumnResizeDefaultPreventableEventLike, type ColumnResizeFinalSizeEventLike, type ColumnResizeHandlePrimitiveOptions, type ColumnResizeKeyboardEventLike, type ColumnResizeKeyboardSizeOptions, type ColumnResizePointerEventLike, type ColumnVirtualizationPrimitiveOptions, type ColumnVisibilityCheckboxPrimitiveOptions, DEFAULT_GRID_LOCALIZATION, DEFAULT_PAGINATION_PAGE_SIZE_OPTIONS, type DatasetElementLike, type DefaultPreventableEventLike, type DefaultPreventablePropagationEventLike, type DefaultPreventedEventLike, type ElementIdLookupLike, type FocusableElementLike, type FocusableSelectableElementLike, type FocusedCellContainerLike, type FocusedCellRestoreFrameSyncOptions, type FocusedCellRestoreOptions, type FocusedCellScrollElementOptions, type FocusedCellScrollOptions, type FocusedCellScrollPosition, type FocusedRowSelectionTarget, GRID_DENSITIES, GRID_FOCUSED_CELL_SELECTOR, GRID_INTERACTIVE_KEYBOARD_TARGET_SELECTOR, GRID_PREFERENCES_VERSION, GROUPING_PANEL_EMPTY_MESSAGE, type GridBodyPrimitiveOptions, type GridDensity, type GridEmptyCellPrimitiveOptions, type GridEmptyRowPrimitiveOptions, type GridHeaderRowPrimitiveOptions, type GridKeyboardEditAction, type GridKeyboardFocusMove, type GridKeyboardShortcutAction, type GridKeyboardShortcutEventLike, type GridLocalization, type GridLocalizationOverrides, type GridPreferences, type GridPreferencesMigration, type GridPreferencesOptions, type GridPreferencesParseOptions, type GridPreferencesState, type GridPreferencesStorageEnvironmentLike, type GridPreferencesStorageLike, type GridRowCoordinateOptions, type GroupCellIndentOptions, type GroupCellIndentStyleProps, type GroupRowLabelOptions, type GroupingColumnMoveGrid, type GroupingPanelMoveButtonPrimitiveOptions, type GroupingPanelPrimitiveOptions, HEADER_ACTION_MENU_ENABLED_ITEM_SELECTOR, HEADER_ACTION_MENU_TRIGGER_TEXT, type HeaderActionMenuActiveElementDocumentLike, type HeaderActionMenuActiveElementTargetLike, type HeaderActionMenuDefaultItemDescriptor, type HeaderActionMenuDefaultItemDescriptorOptions, type HeaderActionMenuDefaultItemId, type HeaderActionMenuDefaultItemLabelOptions, type HeaderActionMenuFocusTargetEventLike, type HeaderActionMenuFocusTargetLike, type HeaderActionMenuItemFocusPosition, type HeaderActionMenuItemFocusTargetLike, type HeaderActionMenuItemPrimitiveOptions, type HeaderActionMenuKeyboardAction, type HeaderActionMenuLabelPrimitiveOptions, type HeaderActionMenuPrimitiveCustomItem, type HeaderActionMenuPrimitiveItem, type HeaderActionMenuPrimitiveLabelItem, type HeaderActionMenuPrimitiveSeparatorItem, type HeaderActionMenuTriggerPrimitiveOptions, type HeaderButtonPrimitiveOptions, type HeaderCellLayoutPrimitiveOptions, type HeaderCellPrimitiveOptions, type HeaderDragEndAction, type HeaderDragEndActionOptions, type HeaderDragEndColumnLike, type HeaderDragEndLike, type HeaderKeyboardMoveEventLike, type HeaderSortIndicatorTextOptions, type InlineSizeStyleProps, type KeyboardTargetEventLike, type MeasuredBlockElementLike, type MeasuredBlockRectElementLike, type MeasuredBlockRectElementTargetLike, type MeasuredInlineDatasetElementTargetLike, type MeasuredInlineElementLike, type MeasuredSizeCacheLike, type ObservedElementMapLike, type OffsetBlockElementLike, type PaginationAction, type PaginationButtonPrimitiveOptions, type PinnedColumnOffsetStyleLayoutLike, type PinnedColumnOffsetStyleProps, type PointerButtonEventLike, type PointerButtonsEventLike, type PointerCaptureEventLike, type PointerCaptureTargetLike, type PointerClientCoordinateLike, type PointerDragMovementLike, type PointerDragSessionLike, type PointerDragStartLike, type PointerHitTestElementLike, type PointerIdEventLike, type PointerListener, type PointerMoveUpCancelListenerTargetLike, type PointerMoveUpCancelListeners, type PointerMoveUpListenerTargetLike, type PointerMoveUpListeners, type PointerUpCancelListenerTargetLike, type PointerUpCancelListeners, type PrimitiveProps, type PropagationEventLike, type QuickFilterInputPrimitiveOptions, type ResizeObserverBlockSizeEntryLike, type ResizeObserverConstructorLike, type ResizeObserverDatasetEntryLike, type ResizeObserverDatasetTargetLike, type ResizeObserverDisconnectLike, type ResizeObserverEntryDatasetKey, type ResizeObserverInlineSizeEntryLike, type ResizeObserverObserveLike, type ResizeObserverUnobserveLike, type ResolvedColumnVirtualizationOptions, type ResolvedRowVirtualizationOptions, type RowExpansionTogglePrimitiveOptions, type RowIdItemLike, type RowLayoutPrimitiveOptions, type RowPrimitiveOptions, type RowSelectionCheckboxPrimitiveOptions, type RowSelectionToggleEventLike, type RowVirtualizationPrimitiveOptions, type ScrollFrameElementLike, type ScrollFrameElementOptions, type ScrollFrameOptionsLike, type ScrollListener, type ScrollListenerTargetLike, type ScrollPositionElementLike, type VirtualBodyStyleProps, type VirtualBodyStyleRangeLike, type VirtualRowStyleItemLike, type VirtualRowStyleProps, type VirtualizedInlineSizeStyleProps, addPassiveScrollListener, addPointerMoveUpCancelListeners, addPointerMoveUpListeners, addPointerUpCancelListeners, applyResizeObserverMeasuredSizes, createClickSuppressionController, createGridLocalization, createGridPreferences, createResizeObserver, disconnectResizeObserver, downloadBrowserExportFile, escapeGridHtml, focusCellEditorElement, focusElement, focusElementById, focusFocusedCellInGrid, focusHeaderActionMenuItem, focusHeaderActionMenuItemById, focusHeaderActionMenuTrigger, focusHeaderActionMenuTriggerById, getBrowserGridPreferencesStorage, getCanApplyColumnResize, getCanCancelCellEdit, getCanContinuePointerDrag, getCanEndPointerDrag, getCanRestoreFocusedCell, getCanRunGridKeyboardShortcut, getCanStartCellEdit, getCanStartCellPointerDrag, getCanStartColumnResize, getCanStartFocusedCellEdit, getCanToggleRowSelection, getCellDisplayText, getCellEditText, getCellEditValidationMessage, getCellEditorEventValue, getCellEditorKeyboardAction, getCellEditorOptionProps, getCellEditorOptionText, getCellEditorProps, getCellEditorTargetValue, getCellFillHandleProps, getCellFillHandleVisible, getCellLayoutProps, getCellProps, getCellValidationMessageProps, getColumnById, getColumnFilterCellProps, getColumnFilterInputProps, getColumnFilterText, getColumnHeaderText, getColumnIndexById, getColumnLayoutById, getColumnLayoutTotalWidth, getColumnPinningButtonProps, getColumnPinningButtonText, getColumnPinningControlsProps, getColumnResizeFinalSize, getColumnResizeHandleProps, getColumnResizeKeyboardSize, getColumnResizePointerSize, getColumnResizeStartSize, getColumnSpacerProps, getColumnVisibilityCheckboxProps, getColumnVisibilityControlsProps, getColumnVisibilityEmptyText, getColumnVisibilityListProps, getColumnVisibilityResetButtonProps, getColumnVisibilityResetButtonText, getColumnVisibilitySearchInputProps, getColumnVisibilityStatusProps, getColumnVisibilityStatusText, getColumnVisibilitySummaryProps, getColumnVisibilitySummaryText, getDefaultBrowserDownloadEnvironment, getDefaultClipboardTextEnvironment, getDefaultPointerMoveUpCancelListenerTarget, getDefaultPointerMoveUpListenerTarget, getDefaultPointerUpCancelListenerTarget, getDensityButtonProps, getDensityButtonText, getDensityControlsProps, getElementOffsetBlockSize, getEnabledHeaderActionMenuItems, getFilteredColumnVisibilityColumns, getFocusedCellScrollOptionsFromElement, getFocusedRowSelectionTarget, getGridBodyProps, getGridBodyRowIndexOffset, getGridDensityProps, getGridDensityRowHeight, getGridEmptyCellProps, getGridEmptyRowProps, getGridErrorOverlayProps, getGridErrorRetryButtonProps, getGridErrorRetryButtonText, getGridErrorText, getGridHeaderProps, getGridHeaderRowCount, getGridHeaderRowProps, getGridKeyboardEditAction, getGridKeyboardFocusMove, getGridKeyboardShortcutAction, getGridLoadingOverlayProps, getGridLoadingText, getGridProps, getGroupCellIndent, getGroupCellIndentStyle, getGroupCellIndentStyleText, getGroupRowCountText, getGroupRowLabel, getGroupValueText, getGroupingPanelChipProps, getGroupingPanelMoveButtonProps, getGroupingPanelPlaceholderProps, getGroupingPanelProps, getGroupingPanelRemoveButtonProps, getHeaderActionMenuActiveElement, getHeaderActionMenuCustomItemProps, getHeaderActionMenuCustomItemUserProps, getHeaderActionMenuDefaultItemDescriptors, getHeaderActionMenuDefaultItemLabel, getHeaderActionMenuFocusTarget, getHeaderActionMenuId, getHeaderActionMenuItemProps, getHeaderActionMenuKeyboardAction, getHeaderActionMenuLabelProps, getHeaderActionMenuProps, getHeaderActionMenuSeparatorProps, getHeaderActionMenuTriggerFocusPosition, getHeaderActionMenuTriggerId, getHeaderActionMenuTriggerProps, getHeaderButtonProps, getHeaderCellLayoutProps, getHeaderCellProps, getHeaderDragEndAction, getHeaderKeyboardMoveDirection, getHeaderPlaceholderCellProps, getHeaderSortIndicatorProps, getHeaderSortIndicatorText, getInlineSizeStyle, getInlineSizeStyleText, getIsGroupLabelCell, getMeasuredElementBlockSize, getMeasuredElementBlockSizeFromRect, getMeasuredElementBlockSizeFromTarget, getMeasuredElementInlineSize, getNextColumnFilters, getPaginationButtonProps, getPaginationButtonText, getPaginationPageSizeOptionText, getPaginationPageSizeOptions, getPaginationPageSizeSelectProps, getPaginationPageText, getPaginationProps, getPaginationStatusProps, getPinnedColumnOffsetStyle, getPinnedColumnOffsetStyleText, getPointerCaptureTarget, getQuickFilterClearButtonProps, getQuickFilterClearButtonText, getQuickFilterInputProps, getQuickFilterProps, getResizeObserverEntryBlockSize, getResizeObserverEntryDatasetId, getResizeObserverEntryInlineSize, getRowById, getRowExpansionSpacerProps, getRowExpansionToggleProps, getRowExpansionToggleText, getRowLayoutProps, getRowProps, getRowSelectionCheckboxProps, getRowSelectionCheckboxText, getRowSelectionClearButtonProps, getRowSelectionClearButtonText, getRowSelectionControlsProps, getRowSelectionStatusProps, getRowSelectionStatusText, getScrollForFocusedCell, getScrollFrameOptionsFromElement, getShouldCancelFocusedCellRestoreOnFrameSync, getShouldPreventEventDefault, getSizeOffset, getVirtualBodyStyle, getVirtualBodyStyleText, getVirtualRowStyle, getVirtualRowStyleText, getVirtualizedInlineSizeStyle, getVirtualizedInlineSizeStyleText, hasPointerMovedPastDragThreshold, isCellCoordinateEqual, isFocusableElement, isFocusedCell, isGridInteractiveKeyboardEventTarget, isGridInteractiveKeyboardTarget, isHeaderActionMenuActionItem, isHeaderActionMenuCloseAction, isHeaderActionMenuCustomItem, isHeaderActionMenuFocusAction, isHeaderActionMenuFocusTarget, isHeaderActionMenuItem, isHeaderActionMenuLabelItem, isHeaderActionMenuSeparatorItem, isHeaderActionMenuTabCloseAction, isHeaderDragGroupAction, isHeaderDragMoveAction, isMeasuredBlockElement, isMeasuredBlockRectElement, isMeasuredBlockRectElementTarget, isMeasuredInlineDatasetElementTarget, isMeasuredInlineElement, isPointerCaptureTarget, isPointerInsideElement, isPrimaryPointerButton, isPrimaryPointerDragActive, isResizeObserverDatasetTarget, migrateGridPreferences, moveColumnToTarget, moveGroupedColumn, moveVisibleColumn, normalizeGridDensity, observeElements, parseCellEditValue, parseGridPreferences, preventDefaultAndStopPropagation, preventEventDefault, readClipboardText, readGridPreferences, removeGridPreferences, removeObservedElement, replaceObservedElement, resolveColumnVirtualizationOptions, resolveRowVirtualizationOptions, scrollElementToPosition, serializeGridPreferences, setCheckboxIndeterminate, setElementDatasetId, stopEventPropagation, tryReleasePointerCapture, trySetPointerCapture, updatePointerDragDidMovePastThreshold, writeClipboardText, writeGridPreferences };
package/dist/index.js CHANGED
@@ -1,15 +1,84 @@
1
1
  // src/index.ts
2
2
  var GRID_DENSITIES = ["compact", "standard", "comfortable"];
3
+ var DEFAULT_GRID_LOCALIZATION = Object.freeze({
4
+ dataGridLabel: "Data grid",
5
+ noRows: "No rows",
6
+ loadingRowsLabel: "Loading rows",
7
+ loadingRows: "Loading rows...",
8
+ gridErrorLabel: "Grid error",
9
+ gridError: "Unable to load rows.",
10
+ retryLoadingRowsLabel: "Retry loading rows",
11
+ retry: "Retry",
12
+ filterPlaceholder: "Filter",
13
+ filterColumnLabel: (label) => `Filter ${label}`,
14
+ searchGridRowsLabel: "Search grid rows",
15
+ searchRowsPlaceholder: "Search rows",
16
+ searchAllRowsLabel: "Search all rows",
17
+ clearRowSearchLabel: "Clear row search",
18
+ clear: "Clear",
19
+ rowSelectionLabel: "Row selection",
20
+ selectAllRowsOnCurrentPageLabel: "Select all rows on current page",
21
+ selectPage: "Select page",
22
+ selectedRows: (count) => `${count} ${count === 1 ? "row" : "rows"} selected`,
23
+ clearRowSelectionLabel: "Clear row selection",
24
+ clearSelection: "Clear selection",
25
+ gridColumnsLabel: "Grid columns",
26
+ manageColumnsLabel: (visibleCount, totalCount) => `Manage columns, ${visibleCount} of ${totalCount} columns visible`,
27
+ columnsSummary: (visibleCount, totalCount) => `Columns ${visibleCount}/${totalCount}`,
28
+ findColumns: "Find columns",
29
+ columnVisibilityLabel: "Column visibility",
30
+ columnsVisible: (visibleCount, totalCount) => `${visibleCount} of ${totalCount} columns visible`,
31
+ noColumnsFound: "No columns found",
32
+ showAllColumnsLabel: "Show all columns",
33
+ showAll: "Show all",
34
+ rowDensityLabel: "Row density",
35
+ useDensityLabel: (density) => `Use ${density} density`,
36
+ densityLabel: (density) => ({ compact: "Compact", standard: "Standard", comfortable: "Comfortable" })[density],
37
+ paginationLabel: "Pagination",
38
+ paginationActionLabel: (action) => ({ first: "First page", previous: "Previous page", next: "Next page", last: "Last page" })[action],
39
+ pageStatus: (page, pageCount) => `Page ${page} of ${pageCount}`,
40
+ rowsPerPageLabel: "Rows per page",
41
+ pageSizeOption: (pageSize) => `${pageSize} rows`,
42
+ resizeColumnLabel: (columnId) => `Resize ${columnId} column`,
43
+ columnPinningLabel: (columnId) => `${columnId} column pinning`,
44
+ pinColumnLabel: (columnId, position) => position === "left" ? `Pin ${columnId} left` : position === "right" ? `Pin ${columnId} right` : `Unpin ${columnId}`,
45
+ openColumnMenuLabel: (columnId) => `Open ${columnId} column menu`,
46
+ columnMenuLabel: (columnId) => `${columnId} column menu`,
47
+ headerActionMenuTrigger: "...",
48
+ headerActionMenuItemLabel: (itemId, grouped) => ({
49
+ "sort-asc": "Sort ascending",
50
+ "sort-desc": "Sort descending",
51
+ "clear-sort": "Clear sort",
52
+ "move-left": "Move left",
53
+ "move-right": "Move right",
54
+ "pin-left": "Pin left",
55
+ unpin: "Unpin",
56
+ "pin-right": "Pin right",
57
+ "toggle-group": grouped ? "Ungroup column" : "Group by column"
58
+ })[itemId],
59
+ columnGroupingLabel: "Column grouping",
60
+ groupingPanelEmpty: "Drag column headers here to group",
61
+ moveColumnGroupingLabel: (columnId, direction) => `Move ${columnId} grouping ${direction}`,
62
+ removeColumnGroupingLabel: (columnId) => `Remove ${columnId} grouping`,
63
+ toggleRowExpandedLabel: (expanded, label) => `${expanded ? "Collapse" : "Expand"} ${label}`,
64
+ blankGroupValue: "(blank)",
65
+ groupFooterTotal: "Total",
66
+ editColumnLabel: (columnId) => `Edit ${columnId}`
67
+ });
68
+ function createGridLocalization(overrides = {}) {
69
+ return Object.freeze({ ...DEFAULT_GRID_LOCALIZATION, ...overrides });
70
+ }
3
71
  var GRID_PREFERENCES_VERSION = 1;
4
72
  var DEFAULT_PAGINATION_PAGE_SIZE_OPTIONS = [25, 50, 100];
5
73
  var HEADER_ACTION_MENU_ENABLED_ITEM_SELECTOR = '[role="menuitem"]:not(:disabled):not([aria-disabled="true"])';
6
- var HEADER_ACTION_MENU_TRIGGER_TEXT = "...";
7
- var GROUPING_PANEL_EMPTY_MESSAGE = "Drag column headers here to group";
74
+ var HEADER_ACTION_MENU_TRIGGER_TEXT = DEFAULT_GRID_LOCALIZATION.headerActionMenuTrigger;
75
+ var GROUPING_PANEL_EMPTY_MESSAGE = DEFAULT_GRID_LOCALIZATION.groupingPanelEmpty;
8
76
  var GRID_FOCUSED_CELL_SELECTOR = '[role="gridcell"][data-focused="true"]';
9
77
  var GRID_INTERACTIVE_KEYBOARD_TARGET_SELECTOR = "button, input, select, textarea, a[href], [contenteditable]:not([contenteditable='false']), [role='button'], [role='menuitem'], [role='separator'], [role='slider'], [role='textbox'], [role='combobox'], [role='searchbox'], [role='spinbutton']";
10
78
  function getGridProps(grid, options = {}) {
11
79
  const headerRowCount = getGridHeaderRowCount(grid, options);
12
- const rowCount = grid.getOptions().manualPagination ? -1 : headerRowCount + Math.max(1, grid.getPrePaginationRowModel().rows.length);
80
+ const hasKnownRowCount = !grid.getOptions().manualPagination || typeof grid.getOptions().rowCount === "number";
81
+ const rowCount = hasKnownRowCount ? headerRowCount + Math.max(1, grid.getRowCount()) : -1;
13
82
  const columnCount = grid.getVisibleLeafColumns().length;
14
83
  return {
15
84
  role: "grid",
@@ -27,35 +96,35 @@ function getGridHeaderProps() {
27
96
  role: "rowgroup"
28
97
  };
29
98
  }
30
- function getGridLoadingOverlayProps() {
99
+ function getGridLoadingOverlayProps(localization = DEFAULT_GRID_LOCALIZATION) {
31
100
  return {
32
101
  role: "status",
33
102
  "aria-live": "polite",
34
- "aria-label": "Loading rows"
103
+ "aria-label": localization.loadingRowsLabel
35
104
  };
36
105
  }
37
- function getGridLoadingText() {
38
- return "Loading rows...";
106
+ function getGridLoadingText(localization = DEFAULT_GRID_LOCALIZATION) {
107
+ return localization.loadingRows;
39
108
  }
40
- function getGridErrorOverlayProps() {
109
+ function getGridErrorOverlayProps(localization = DEFAULT_GRID_LOCALIZATION) {
41
110
  return {
42
111
  role: "alert",
43
112
  "aria-live": "assertive",
44
113
  "aria-atomic": true,
45
- "aria-label": "Grid error"
114
+ "aria-label": localization.gridErrorLabel
46
115
  };
47
116
  }
48
- function getGridErrorText() {
49
- return "Unable to load rows.";
117
+ function getGridErrorText(localization = DEFAULT_GRID_LOCALIZATION) {
118
+ return localization.gridError;
50
119
  }
51
- function getGridErrorRetryButtonProps() {
120
+ function getGridErrorRetryButtonProps(localization = DEFAULT_GRID_LOCALIZATION) {
52
121
  return {
53
122
  type: "button",
54
- "aria-label": "Retry loading rows"
123
+ "aria-label": localization.retryLoadingRowsLabel
55
124
  };
56
125
  }
57
- function getGridErrorRetryButtonText() {
58
- return "Retry";
126
+ function getGridErrorRetryButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
127
+ return localization.retry;
59
128
  }
60
129
  function getGridHeaderRowProps(options = {}) {
61
130
  return {
@@ -83,12 +152,12 @@ function getColumnFilterCellProps(column, options) {
83
152
  "data-pinned-edge": options.pinnedEdge
84
153
  };
85
154
  }
86
- function getColumnFilterInputProps(column, options) {
155
+ function getColumnFilterInputProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
87
156
  return {
88
157
  type: "search",
89
158
  value: options.value == null ? "" : String(options.value),
90
- placeholder: "Filter",
91
- "aria-label": `Filter ${options.label}`,
159
+ placeholder: localization.filterPlaceholder,
160
+ "aria-label": localization.filterColumnLabel(options.label),
92
161
  "data-column-id": column.id,
93
162
  autoComplete: "off"
94
163
  };
@@ -97,48 +166,48 @@ function getColumnFilterText(filters, columnId) {
97
166
  const value = filters.find((filter) => filter.id === columnId)?.value;
98
167
  return value == null ? "" : String(value);
99
168
  }
100
- function getQuickFilterProps() {
169
+ function getQuickFilterProps(localization = DEFAULT_GRID_LOCALIZATION) {
101
170
  return {
102
171
  role: "search",
103
- "aria-label": "Search grid rows"
172
+ "aria-label": localization.searchGridRowsLabel
104
173
  };
105
174
  }
106
- function getQuickFilterInputProps(options) {
175
+ function getQuickFilterInputProps(options, localization = DEFAULT_GRID_LOCALIZATION) {
107
176
  return {
108
177
  type: "search",
109
178
  value: options.value,
110
- placeholder: "Search rows",
111
- "aria-label": "Search all rows",
179
+ placeholder: localization.searchRowsPlaceholder,
180
+ "aria-label": localization.searchAllRowsLabel,
112
181
  autoComplete: "off"
113
182
  };
114
183
  }
115
- function getQuickFilterClearButtonProps(value) {
184
+ function getQuickFilterClearButtonProps(value, localization = DEFAULT_GRID_LOCALIZATION) {
116
185
  return {
117
186
  type: "button",
118
- "aria-label": "Clear row search",
187
+ "aria-label": localization.clearRowSearchLabel,
119
188
  disabled: value.length === 0 || void 0
120
189
  };
121
190
  }
122
- function getQuickFilterClearButtonText() {
123
- return "Clear";
191
+ function getQuickFilterClearButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
192
+ return localization.clear;
124
193
  }
125
- function getRowSelectionControlsProps() {
194
+ function getRowSelectionControlsProps(localization = DEFAULT_GRID_LOCALIZATION) {
126
195
  return {
127
196
  role: "group",
128
- "aria-label": "Row selection"
197
+ "aria-label": localization.rowSelectionLabel
129
198
  };
130
199
  }
131
- function getRowSelectionCheckboxProps(options = {}) {
200
+ function getRowSelectionCheckboxProps(options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
132
201
  return {
133
202
  type: "checkbox",
134
203
  checked: options.allSelected || false,
135
204
  disabled: options.disabled || void 0,
136
205
  "aria-checked": options.someSelected ? "mixed" : options.allSelected || false,
137
- "aria-label": "Select all rows on current page"
206
+ "aria-label": localization.selectAllRowsOnCurrentPageLabel
138
207
  };
139
208
  }
140
- function getRowSelectionCheckboxText() {
141
- return "Select page";
209
+ function getRowSelectionCheckboxText(localization = DEFAULT_GRID_LOCALIZATION) {
210
+ return localization.selectPage;
142
211
  }
143
212
  function getRowSelectionStatusProps() {
144
213
  return {
@@ -147,19 +216,19 @@ function getRowSelectionStatusProps() {
147
216
  "aria-atomic": true
148
217
  };
149
218
  }
150
- function getRowSelectionStatusText(selectedCount) {
219
+ function getRowSelectionStatusText(selectedCount, localization = DEFAULT_GRID_LOCALIZATION) {
151
220
  const count = Number.isFinite(selectedCount) ? Math.max(0, Math.floor(selectedCount)) : 0;
152
- return `${count} ${count === 1 ? "row" : "rows"} selected`;
221
+ return localization.selectedRows(count);
153
222
  }
154
- function getRowSelectionClearButtonProps(disabled = false) {
223
+ function getRowSelectionClearButtonProps(disabled = false, localization = DEFAULT_GRID_LOCALIZATION) {
155
224
  return {
156
225
  type: "button",
157
226
  disabled: disabled || void 0,
158
- "aria-label": "Clear row selection"
227
+ "aria-label": localization.clearRowSelectionLabel
159
228
  };
160
229
  }
161
- function getRowSelectionClearButtonText() {
162
- return "Clear selection";
230
+ function getRowSelectionClearButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
231
+ return localization.clearSelection;
163
232
  }
164
233
  function setCheckboxIndeterminate(target, indeterminate) {
165
234
  if (!target || typeof target !== "object" || !("indeterminate" in target)) {
@@ -168,33 +237,34 @@ function setCheckboxIndeterminate(target, indeterminate) {
168
237
  target.indeterminate = indeterminate;
169
238
  return true;
170
239
  }
171
- function getColumnVisibilityControlsProps() {
240
+ function getColumnVisibilityControlsProps(localization = DEFAULT_GRID_LOCALIZATION) {
172
241
  return {
173
- "aria-label": "Grid columns"
242
+ "aria-label": localization.gridColumnsLabel
174
243
  };
175
244
  }
176
- function getColumnVisibilitySummaryProps(visibleCount, totalCount) {
245
+ function getColumnVisibilitySummaryProps(visibleCount, totalCount, localization = DEFAULT_GRID_LOCALIZATION) {
246
+ const { visible, total } = normalizeColumnVisibilityCounts(visibleCount, totalCount);
177
247
  return {
178
- "aria-label": `Manage columns, ${getColumnVisibilityStatusText(visibleCount, totalCount)}`
248
+ "aria-label": localization.manageColumnsLabel(visible, total)
179
249
  };
180
250
  }
181
- function getColumnVisibilitySummaryText(visibleCount, totalCount) {
251
+ function getColumnVisibilitySummaryText(visibleCount, totalCount, localization = DEFAULT_GRID_LOCALIZATION) {
182
252
  const { visible, total } = normalizeColumnVisibilityCounts(visibleCount, totalCount);
183
- return `Columns ${visible}/${total}`;
253
+ return localization.columnsSummary(visible, total);
184
254
  }
185
- function getColumnVisibilitySearchInputProps(value) {
255
+ function getColumnVisibilitySearchInputProps(value, localization = DEFAULT_GRID_LOCALIZATION) {
186
256
  return {
187
257
  type: "search",
188
258
  value,
189
- placeholder: "Find columns",
190
- "aria-label": "Find columns",
259
+ placeholder: localization.findColumns,
260
+ "aria-label": localization.findColumns,
191
261
  autoComplete: "off"
192
262
  };
193
263
  }
194
- function getColumnVisibilityListProps() {
264
+ function getColumnVisibilityListProps(localization = DEFAULT_GRID_LOCALIZATION) {
195
265
  return {
196
266
  role: "group",
197
- "aria-label": "Column visibility"
267
+ "aria-label": localization.columnVisibilityLabel
198
268
  };
199
269
  }
200
270
  function getColumnVisibilityCheckboxProps(options) {
@@ -214,22 +284,22 @@ function getColumnVisibilityStatusProps() {
214
284
  "aria-atomic": true
215
285
  };
216
286
  }
217
- function getColumnVisibilityStatusText(visibleCount, totalCount) {
287
+ function getColumnVisibilityStatusText(visibleCount, totalCount, localization = DEFAULT_GRID_LOCALIZATION) {
218
288
  const { visible, total } = normalizeColumnVisibilityCounts(visibleCount, totalCount);
219
- return `${visible} of ${total} columns visible`;
289
+ return localization.columnsVisible(visible, total);
220
290
  }
221
- function getColumnVisibilityEmptyText() {
222
- return "No columns found";
291
+ function getColumnVisibilityEmptyText(localization = DEFAULT_GRID_LOCALIZATION) {
292
+ return localization.noColumnsFound;
223
293
  }
224
- function getColumnVisibilityResetButtonProps(hiddenCount) {
294
+ function getColumnVisibilityResetButtonProps(hiddenCount, localization = DEFAULT_GRID_LOCALIZATION) {
225
295
  return {
226
296
  type: "button",
227
297
  disabled: !Number.isFinite(hiddenCount) || hiddenCount <= 0 || void 0,
228
- "aria-label": "Show all columns"
298
+ "aria-label": localization.showAllColumnsLabel
229
299
  };
230
300
  }
231
- function getColumnVisibilityResetButtonText() {
232
- return "Show all";
301
+ function getColumnVisibilityResetButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
302
+ return localization.showAll;
233
303
  }
234
304
  function normalizeGridDensity(value, fallback = "standard") {
235
305
  return GRID_DENSITIES.includes(value) ? value : fallback;
@@ -237,6 +307,40 @@ function normalizeGridDensity(value, fallback = "standard") {
237
307
  function getGridPreferenceRecord(value) {
238
308
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
239
309
  }
310
+ function getGridPreferenceVersion(value) {
311
+ return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : null;
312
+ }
313
+ function migrateGridPreferences(value, migrations = []) {
314
+ let preferences = getGridPreferenceRecord(value);
315
+ const initialVersion = getGridPreferenceVersion(preferences?.version);
316
+ if (!preferences || initialVersion === null || initialVersion > GRID_PREFERENCES_VERSION) {
317
+ return null;
318
+ }
319
+ const migrationsByVersion = /* @__PURE__ */ new Map();
320
+ for (const migration of migrations) {
321
+ if (getGridPreferenceVersion(migration.fromVersion) === null || getGridPreferenceVersion(migration.toVersion) === null || migration.toVersion <= migration.fromVersion || migration.toVersion > GRID_PREFERENCES_VERSION || migrationsByVersion.has(migration.fromVersion)) {
322
+ return null;
323
+ }
324
+ migrationsByVersion.set(migration.fromVersion, migration);
325
+ }
326
+ let version = initialVersion;
327
+ while (version < GRID_PREFERENCES_VERSION) {
328
+ const migration = migrationsByVersion.get(version);
329
+ if (!migration) {
330
+ return null;
331
+ }
332
+ try {
333
+ preferences = getGridPreferenceRecord(migration.migrate(preferences));
334
+ } catch {
335
+ return null;
336
+ }
337
+ if (!preferences || preferences.version !== migration.toVersion) {
338
+ return null;
339
+ }
340
+ version = migration.toVersion;
341
+ }
342
+ return preferences;
343
+ }
240
344
  function getGridPreferenceColumnIds(value, validColumnIds) {
241
345
  if (!Array.isArray(value)) {
242
346
  return [];
@@ -282,7 +386,7 @@ function serializeGridPreferences(preferences, options = {}) {
282
386
  }
283
387
  function parseGridPreferences(value, options = {}) {
284
388
  try {
285
- const parsed = getGridPreferenceRecord(JSON.parse(value));
389
+ const parsed = migrateGridPreferences(JSON.parse(value), options.migrations);
286
390
  if (!parsed || parsed.version !== GRID_PREFERENCES_VERSION) {
287
391
  return null;
288
392
  }
@@ -357,28 +461,23 @@ function getGridDensityRowHeight(density) {
357
461
  };
358
462
  return heights[normalizeGridDensity(density)];
359
463
  }
360
- function getDensityControlsProps() {
464
+ function getDensityControlsProps(localization = DEFAULT_GRID_LOCALIZATION) {
361
465
  return {
362
466
  role: "group",
363
- "aria-label": "Row density"
467
+ "aria-label": localization.rowDensityLabel
364
468
  };
365
469
  }
366
- function getDensityButtonProps(density, currentDensity) {
470
+ function getDensityButtonProps(density, currentDensity, localization = DEFAULT_GRID_LOCALIZATION) {
367
471
  const normalizedDensity = normalizeGridDensity(density);
368
472
  return {
369
473
  type: "button",
370
- "aria-label": `Use ${normalizedDensity} density`,
474
+ "aria-label": localization.useDensityLabel(normalizedDensity),
371
475
  "aria-pressed": normalizedDensity === normalizeGridDensity(currentDensity),
372
476
  "data-density": normalizedDensity
373
477
  };
374
478
  }
375
- function getDensityButtonText(density) {
376
- const labels = {
377
- compact: "Compact",
378
- standard: "Standard",
379
- comfortable: "Comfortable"
380
- };
381
- return labels[normalizeGridDensity(density)];
479
+ function getDensityButtonText(density, localization = DEFAULT_GRID_LOCALIZATION) {
480
+ return localization.densityLabel(normalizeGridDensity(density));
382
481
  }
383
482
  function getFilteredColumnVisibilityColumns(columns, query) {
384
483
  const normalizedQuery = query.trim().toLocaleLowerCase();
@@ -407,22 +506,16 @@ function getNextColumnFilters(filters, columnId, value) {
407
506
  }
408
507
  return filters.map((filter, index) => index === existingIndex ? { id: columnId, value } : filter);
409
508
  }
410
- function getPaginationProps() {
509
+ function getPaginationProps(localization = DEFAULT_GRID_LOCALIZATION) {
411
510
  return {
412
511
  role: "navigation",
413
- "aria-label": "Pagination"
512
+ "aria-label": localization.paginationLabel
414
513
  };
415
514
  }
416
- function getPaginationButtonProps(options) {
417
- const labels = {
418
- first: "First page",
419
- previous: "Previous page",
420
- next: "Next page",
421
- last: "Last page"
422
- };
515
+ function getPaginationButtonProps(options, localization = DEFAULT_GRID_LOCALIZATION) {
423
516
  return {
424
517
  type: "button",
425
- "aria-label": labels[options.action],
518
+ "aria-label": localization.paginationActionLabel(options.action),
426
519
  disabled: options.disabled || void 0
427
520
  };
428
521
  }
@@ -441,18 +534,18 @@ function getPaginationStatusProps() {
441
534
  "aria-live": "polite"
442
535
  };
443
536
  }
444
- function getPaginationPageText(grid) {
537
+ function getPaginationPageText(grid, localization = DEFAULT_GRID_LOCALIZATION) {
445
538
  const pageCount = grid.getPageCount();
446
539
  const rawPageIndex = grid.getState().pagination.pageIndex;
447
540
  const pageIndex = Math.min(
448
541
  Number.isFinite(rawPageIndex) ? Math.max(0, Math.floor(rawPageIndex)) : 0,
449
542
  pageCount - 1
450
543
  );
451
- return `Page ${pageIndex + 1} of ${pageCount}`;
544
+ return localization.pageStatus(pageIndex + 1, pageCount);
452
545
  }
453
- function getPaginationPageSizeSelectProps(pageSize) {
546
+ function getPaginationPageSizeSelectProps(pageSize, localization = DEFAULT_GRID_LOCALIZATION) {
454
547
  return {
455
- "aria-label": "Rows per page",
548
+ "aria-label": localization.rowsPerPageLabel,
456
549
  value: Number.isFinite(pageSize) && pageSize > 0 ? Math.max(1, Math.floor(pageSize)) : 1
457
550
  };
458
551
  }
@@ -463,8 +556,8 @@ function getPaginationPageSizeOptions(options = DEFAULT_PAGINATION_PAGE_SIZE_OPT
463
556
  const current = Number.isFinite(currentPageSize) && (currentPageSize ?? 0) > 0 ? Math.max(1, Math.floor(currentPageSize ?? 1)) : null;
464
557
  return Array.from(new Set(current === null ? normalized : [...normalized, current])).sort((left, right) => left - right);
465
558
  }
466
- function getPaginationPageSizeOptionText(pageSize) {
467
- return `${pageSize} rows`;
559
+ function getPaginationPageSizeOptionText(pageSize, localization = DEFAULT_GRID_LOCALIZATION) {
560
+ return localization.pageSizeOption(pageSize);
468
561
  }
469
562
  function getGridBodyProps(options = {}) {
470
563
  return {
@@ -662,11 +755,11 @@ function getGridKeyboardFocusMove(event) {
662
755
  }
663
756
  return null;
664
757
  }
665
- function getColumnResizeHandleProps(column, options = {}) {
758
+ function getColumnResizeHandleProps(column, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
666
759
  return {
667
760
  role: "separator",
668
761
  "aria-orientation": "vertical",
669
- "aria-label": `Resize ${column.id} column`,
762
+ "aria-label": localization.resizeColumnLabel(column.id),
670
763
  "aria-valuenow": options.valueNow ?? column.getSize(),
671
764
  "aria-valuemin": column.columnDef.minSize,
672
765
  "aria-valuemax": column.columnDef.maxSize,
@@ -807,9 +900,9 @@ function addPassiveScrollListener(listener, target) {
807
900
  target.removeEventListener("scroll", listener);
808
901
  };
809
902
  }
810
- function getColumnPinningControlsProps(column) {
903
+ function getColumnPinningControlsProps(column, localization = DEFAULT_GRID_LOCALIZATION) {
811
904
  return {
812
- "aria-label": `${column.id} column pinning`
905
+ "aria-label": localization.columnPinningLabel(column.id)
813
906
  };
814
907
  }
815
908
  function getColumnPinningButtonText(position) {
@@ -821,19 +914,18 @@ function getColumnPinningButtonText(position) {
821
914
  }
822
915
  return "-";
823
916
  }
824
- function getColumnPinningButtonProps(column, options) {
825
- const label = options.position === "left" ? `Pin ${column.id} left` : options.position === "right" ? `Pin ${column.id} right` : `Unpin ${column.id}`;
917
+ function getColumnPinningButtonProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
826
918
  return {
827
919
  type: "button",
828
- "aria-label": label,
920
+ "aria-label": localization.pinColumnLabel(column.id, options.position),
829
921
  "aria-pressed": options.active,
830
922
  disabled: options.active
831
923
  };
832
924
  }
833
- function getHeaderActionMenuTriggerProps(column, options) {
925
+ function getHeaderActionMenuTriggerProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
834
926
  return {
835
927
  type: "button",
836
- "aria-label": `Open ${column.id} column menu`,
928
+ "aria-label": localization.openColumnMenuLabel(column.id),
837
929
  "aria-expanded": options.expanded,
838
930
  "aria-haspopup": "menu",
839
931
  "aria-controls": options.expanded ? options.controls : void 0
@@ -845,85 +937,61 @@ function getHeaderActionMenuId(columnId) {
845
937
  function getHeaderActionMenuTriggerId(columnId) {
846
938
  return `${getHeaderActionMenuId(columnId)}-trigger`;
847
939
  }
848
- function getHeaderActionMenuProps(column) {
940
+ function getHeaderActionMenuProps(column, localization = DEFAULT_GRID_LOCALIZATION) {
849
941
  return {
850
942
  role: "menu",
851
- "aria-label": `${column.id} column menu`,
943
+ "aria-label": localization.columnMenuLabel(column.id),
852
944
  tabIndex: -1
853
945
  };
854
946
  }
855
- function getHeaderActionMenuDefaultItemLabel(itemId, options = {}) {
856
- if (itemId === "sort-asc") {
857
- return "Sort ascending";
858
- }
859
- if (itemId === "sort-desc") {
860
- return "Sort descending";
861
- }
862
- if (itemId === "clear-sort") {
863
- return "Clear sort";
864
- }
865
- if (itemId === "move-left") {
866
- return "Move left";
867
- }
868
- if (itemId === "move-right") {
869
- return "Move right";
870
- }
871
- if (itemId === "pin-left") {
872
- return "Pin left";
873
- }
874
- if (itemId === "unpin") {
875
- return "Unpin";
876
- }
877
- if (itemId === "pin-right") {
878
- return "Pin right";
879
- }
880
- return options.grouped ? "Ungroup column" : "Group by column";
947
+ function getHeaderActionMenuDefaultItemLabel(itemId, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
948
+ return localization.headerActionMenuItemLabel(itemId, options.grouped ?? false);
881
949
  }
882
- function getHeaderActionMenuDefaultItemDescriptors(options) {
950
+ function getHeaderActionMenuDefaultItemDescriptors(options, localization = DEFAULT_GRID_LOCALIZATION) {
883
951
  const descriptors = [
884
952
  {
885
953
  id: "sort-asc",
886
- label: getHeaderActionMenuDefaultItemLabel("sort-asc")
954
+ label: getHeaderActionMenuDefaultItemLabel("sort-asc", {}, localization)
887
955
  },
888
956
  {
889
957
  id: "sort-desc",
890
- label: getHeaderActionMenuDefaultItemLabel("sort-desc")
958
+ label: getHeaderActionMenuDefaultItemLabel("sort-desc", {}, localization)
891
959
  },
892
960
  {
893
961
  id: "clear-sort",
894
- label: getHeaderActionMenuDefaultItemLabel("clear-sort"),
962
+ label: getHeaderActionMenuDefaultItemLabel("clear-sort", {}, localization),
895
963
  disabled: !options.sortDirection
896
964
  },
897
965
  {
898
966
  id: "move-left",
899
- label: getHeaderActionMenuDefaultItemLabel("move-left"),
967
+ label: getHeaderActionMenuDefaultItemLabel("move-left", {}, localization),
900
968
  disabled: !options.canMoveLeft
901
969
  },
902
970
  {
903
971
  id: "move-right",
904
- label: getHeaderActionMenuDefaultItemLabel("move-right"),
972
+ label: getHeaderActionMenuDefaultItemLabel("move-right", {}, localization),
905
973
  disabled: !options.canMoveRight
906
974
  },
907
975
  {
908
976
  id: "pin-left",
909
- label: getHeaderActionMenuDefaultItemLabel("pin-left"),
977
+ label: getHeaderActionMenuDefaultItemLabel("pin-left", {}, localization),
910
978
  disabled: options.pinningPosition === "left"
911
979
  },
912
980
  {
913
981
  id: "unpin",
914
- label: getHeaderActionMenuDefaultItemLabel("unpin"),
982
+ label: getHeaderActionMenuDefaultItemLabel("unpin", {}, localization),
915
983
  disabled: options.pinningPosition === false
916
984
  },
917
985
  {
918
986
  id: "pin-right",
919
- label: getHeaderActionMenuDefaultItemLabel("pin-right"),
987
+ label: getHeaderActionMenuDefaultItemLabel("pin-right", {}, localization),
920
988
  disabled: options.pinningPosition === "right"
921
989
  }
922
990
  ];
923
991
  if (options.canGroup) {
924
992
  descriptors.push({
925
993
  id: "toggle-group",
926
- label: getHeaderActionMenuDefaultItemLabel("toggle-group", { grouped: options.isGrouped })
994
+ label: getHeaderActionMenuDefaultItemLabel("toggle-group", { grouped: options.isGrouped }, localization)
927
995
  });
928
996
  }
929
997
  return descriptors;
@@ -970,9 +1038,9 @@ function isHeaderActionMenuSeparatorItem(item) {
970
1038
  function getHeaderActionMenuCustomItemUserProps(item) {
971
1039
  return item ? item.props ?? {} : {};
972
1040
  }
973
- function getGroupingPanelProps(options = {}) {
1041
+ function getGroupingPanelProps(options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
974
1042
  return {
975
- "aria-label": "Column grouping",
1043
+ "aria-label": localization.columnGroupingLabel,
976
1044
  "data-empty": options.empty || void 0
977
1045
  };
978
1046
  }
@@ -986,17 +1054,17 @@ function getGroupingPanelChipProps(column) {
986
1054
  "data-column-id": column.id
987
1055
  };
988
1056
  }
989
- function getGroupingPanelMoveButtonProps(column, options) {
1057
+ function getGroupingPanelMoveButtonProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
990
1058
  return {
991
1059
  type: "button",
992
- "aria-label": `Move ${column.id} grouping ${options.direction}`,
1060
+ "aria-label": localization.moveColumnGroupingLabel(column.id, options.direction),
993
1061
  disabled: options.disabled || false
994
1062
  };
995
1063
  }
996
- function getGroupingPanelRemoveButtonProps(column) {
1064
+ function getGroupingPanelRemoveButtonProps(column, localization = DEFAULT_GRID_LOCALIZATION) {
997
1065
  return {
998
1066
  type: "button",
999
- "aria-label": `Remove ${column.id} grouping`
1067
+ "aria-label": localization.removeColumnGroupingLabel(column.id)
1000
1068
  };
1001
1069
  }
1002
1070
  function getIsGroupLabelCell(row, column, visibleColumns) {
@@ -1009,20 +1077,20 @@ function getIsGroupLabelCell(row, column, visibleColumns) {
1009
1077
  }
1010
1078
  return column.id === row.groupingColumnId || !visibleColumns.some((candidate) => candidate.id === row.groupingColumnId) && column.id === firstVisibleColumnId;
1011
1079
  }
1012
- function getGroupValueText(value) {
1080
+ function getGroupValueText(value, localization = DEFAULT_GRID_LOCALIZATION) {
1013
1081
  if (value instanceof Date) {
1014
1082
  return value.toISOString();
1015
1083
  }
1016
- return value == null ? "(blank)" : String(value);
1084
+ return value == null ? localization.blankGroupValue : String(value);
1017
1085
  }
1018
- function getGroupRowLabel(row, column, options = {}) {
1086
+ function getGroupRowLabel(row, column, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
1019
1087
  if (row.getIsGroupFooter()) {
1020
- return row.groupFooterLabel ?? "Total";
1088
+ return row.groupFooterLabel ?? localization.groupFooterTotal;
1021
1089
  }
1022
1090
  if (row.groupingColumnId) {
1023
- return `${row.groupingColumnId}: ${getGroupValueText(row.groupingValue)}`;
1091
+ return `${row.groupingColumnId}: ${getGroupValueText(row.groupingValue, localization)}`;
1024
1092
  }
1025
- return options.fallback ?? getGroupValueText(row.getValue(column.id));
1093
+ return options.fallback ?? getGroupValueText(row.getValue(column.id), localization);
1026
1094
  }
1027
1095
  function getGroupCellIndent(row, options = {}) {
1028
1096
  const depthSize = options.depthSize ?? 16;
@@ -1059,10 +1127,10 @@ function getRowLayoutProps(row, options = {}) {
1059
1127
  "data-column-virtualized": options.columnVirtualized || void 0
1060
1128
  };
1061
1129
  }
1062
- function getRowExpansionToggleProps(row, options) {
1130
+ function getRowExpansionToggleProps(row, options, localization = DEFAULT_GRID_LOCALIZATION) {
1063
1131
  return {
1064
1132
  type: "button",
1065
- "aria-label": `${options.expanded ? "Collapse" : "Expand"} ${options.label}`,
1133
+ "aria-label": localization.toggleRowExpandedLabel(options.expanded, options.label),
1066
1134
  "aria-expanded": options.expanded,
1067
1135
  "data-row-id": row.id,
1068
1136
  "data-expanded": options.expanded
@@ -1276,9 +1344,9 @@ function getCellFillHandleVisible(row, column, options) {
1276
1344
  function getCanStartCellPointerDrag(event, editingCell) {
1277
1345
  return isPrimaryPointerButton(event) && !editingCell;
1278
1346
  }
1279
- function getCellEditorProps(column, options = {}) {
1347
+ function getCellEditorProps(column, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
1280
1348
  return {
1281
- "aria-label": `Edit ${column.id}`,
1349
+ "aria-label": localization.editColumnLabel(column.id),
1282
1350
  "aria-invalid": options.invalid || void 0
1283
1351
  };
1284
1352
  }
@@ -1831,6 +1899,7 @@ function isFocusedCell(focusedCell, rowId, columnId) {
1831
1899
  return isCellCoordinateEqual(focusedCell, { rowId, columnId });
1832
1900
  }
1833
1901
  export {
1902
+ DEFAULT_GRID_LOCALIZATION,
1834
1903
  DEFAULT_PAGINATION_PAGE_SIZE_OPTIONS,
1835
1904
  GRID_DENSITIES,
1836
1905
  GRID_FOCUSED_CELL_SELECTOR,
@@ -1845,6 +1914,7 @@ export {
1845
1914
  addPointerUpCancelListeners,
1846
1915
  applyResizeObserverMeasuredSizes,
1847
1916
  createClickSuppressionController,
1917
+ createGridLocalization,
1848
1918
  createGridPreferences,
1849
1919
  createResizeObserver,
1850
1920
  disconnectResizeObserver,
@@ -2055,6 +2125,7 @@ export {
2055
2125
  isPrimaryPointerButton,
2056
2126
  isPrimaryPointerDragActive,
2057
2127
  isResizeObserverDatasetTarget,
2128
+ migrateGridPreferences,
2058
2129
  moveColumnToTarget,
2059
2130
  moveGroupedColumn,
2060
2131
  moveVisibleColumn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-grid/primitives",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Unstyled primitive prop helpers for Open Grid.",
5
5
  "keywords": [
6
6
  "data-grid",
@@ -36,7 +36,7 @@
36
36
  "lint": "tsc --noEmit"
37
37
  },
38
38
  "dependencies": {
39
- "@open-grid/core": "0.1.0"
39
+ "@open-grid/core": "0.3.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "tsup": "^8.3.5",