@open-grid/primitives 0.1.0 → 0.2.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 +218 -148
  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,10 +1,78 @@
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 = {}) {
@@ -27,35 +95,35 @@ function getGridHeaderProps() {
27
95
  role: "rowgroup"
28
96
  };
29
97
  }
30
- function getGridLoadingOverlayProps() {
98
+ function getGridLoadingOverlayProps(localization = DEFAULT_GRID_LOCALIZATION) {
31
99
  return {
32
100
  role: "status",
33
101
  "aria-live": "polite",
34
- "aria-label": "Loading rows"
102
+ "aria-label": localization.loadingRowsLabel
35
103
  };
36
104
  }
37
- function getGridLoadingText() {
38
- return "Loading rows...";
105
+ function getGridLoadingText(localization = DEFAULT_GRID_LOCALIZATION) {
106
+ return localization.loadingRows;
39
107
  }
40
- function getGridErrorOverlayProps() {
108
+ function getGridErrorOverlayProps(localization = DEFAULT_GRID_LOCALIZATION) {
41
109
  return {
42
110
  role: "alert",
43
111
  "aria-live": "assertive",
44
112
  "aria-atomic": true,
45
- "aria-label": "Grid error"
113
+ "aria-label": localization.gridErrorLabel
46
114
  };
47
115
  }
48
- function getGridErrorText() {
49
- return "Unable to load rows.";
116
+ function getGridErrorText(localization = DEFAULT_GRID_LOCALIZATION) {
117
+ return localization.gridError;
50
118
  }
51
- function getGridErrorRetryButtonProps() {
119
+ function getGridErrorRetryButtonProps(localization = DEFAULT_GRID_LOCALIZATION) {
52
120
  return {
53
121
  type: "button",
54
- "aria-label": "Retry loading rows"
122
+ "aria-label": localization.retryLoadingRowsLabel
55
123
  };
56
124
  }
57
- function getGridErrorRetryButtonText() {
58
- return "Retry";
125
+ function getGridErrorRetryButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
126
+ return localization.retry;
59
127
  }
60
128
  function getGridHeaderRowProps(options = {}) {
61
129
  return {
@@ -83,12 +151,12 @@ function getColumnFilterCellProps(column, options) {
83
151
  "data-pinned-edge": options.pinnedEdge
84
152
  };
85
153
  }
86
- function getColumnFilterInputProps(column, options) {
154
+ function getColumnFilterInputProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
87
155
  return {
88
156
  type: "search",
89
157
  value: options.value == null ? "" : String(options.value),
90
- placeholder: "Filter",
91
- "aria-label": `Filter ${options.label}`,
158
+ placeholder: localization.filterPlaceholder,
159
+ "aria-label": localization.filterColumnLabel(options.label),
92
160
  "data-column-id": column.id,
93
161
  autoComplete: "off"
94
162
  };
@@ -97,48 +165,48 @@ function getColumnFilterText(filters, columnId) {
97
165
  const value = filters.find((filter) => filter.id === columnId)?.value;
98
166
  return value == null ? "" : String(value);
99
167
  }
100
- function getQuickFilterProps() {
168
+ function getQuickFilterProps(localization = DEFAULT_GRID_LOCALIZATION) {
101
169
  return {
102
170
  role: "search",
103
- "aria-label": "Search grid rows"
171
+ "aria-label": localization.searchGridRowsLabel
104
172
  };
105
173
  }
106
- function getQuickFilterInputProps(options) {
174
+ function getQuickFilterInputProps(options, localization = DEFAULT_GRID_LOCALIZATION) {
107
175
  return {
108
176
  type: "search",
109
177
  value: options.value,
110
- placeholder: "Search rows",
111
- "aria-label": "Search all rows",
178
+ placeholder: localization.searchRowsPlaceholder,
179
+ "aria-label": localization.searchAllRowsLabel,
112
180
  autoComplete: "off"
113
181
  };
114
182
  }
115
- function getQuickFilterClearButtonProps(value) {
183
+ function getQuickFilterClearButtonProps(value, localization = DEFAULT_GRID_LOCALIZATION) {
116
184
  return {
117
185
  type: "button",
118
- "aria-label": "Clear row search",
186
+ "aria-label": localization.clearRowSearchLabel,
119
187
  disabled: value.length === 0 || void 0
120
188
  };
121
189
  }
122
- function getQuickFilterClearButtonText() {
123
- return "Clear";
190
+ function getQuickFilterClearButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
191
+ return localization.clear;
124
192
  }
125
- function getRowSelectionControlsProps() {
193
+ function getRowSelectionControlsProps(localization = DEFAULT_GRID_LOCALIZATION) {
126
194
  return {
127
195
  role: "group",
128
- "aria-label": "Row selection"
196
+ "aria-label": localization.rowSelectionLabel
129
197
  };
130
198
  }
131
- function getRowSelectionCheckboxProps(options = {}) {
199
+ function getRowSelectionCheckboxProps(options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
132
200
  return {
133
201
  type: "checkbox",
134
202
  checked: options.allSelected || false,
135
203
  disabled: options.disabled || void 0,
136
204
  "aria-checked": options.someSelected ? "mixed" : options.allSelected || false,
137
- "aria-label": "Select all rows on current page"
205
+ "aria-label": localization.selectAllRowsOnCurrentPageLabel
138
206
  };
139
207
  }
140
- function getRowSelectionCheckboxText() {
141
- return "Select page";
208
+ function getRowSelectionCheckboxText(localization = DEFAULT_GRID_LOCALIZATION) {
209
+ return localization.selectPage;
142
210
  }
143
211
  function getRowSelectionStatusProps() {
144
212
  return {
@@ -147,19 +215,19 @@ function getRowSelectionStatusProps() {
147
215
  "aria-atomic": true
148
216
  };
149
217
  }
150
- function getRowSelectionStatusText(selectedCount) {
218
+ function getRowSelectionStatusText(selectedCount, localization = DEFAULT_GRID_LOCALIZATION) {
151
219
  const count = Number.isFinite(selectedCount) ? Math.max(0, Math.floor(selectedCount)) : 0;
152
- return `${count} ${count === 1 ? "row" : "rows"} selected`;
220
+ return localization.selectedRows(count);
153
221
  }
154
- function getRowSelectionClearButtonProps(disabled = false) {
222
+ function getRowSelectionClearButtonProps(disabled = false, localization = DEFAULT_GRID_LOCALIZATION) {
155
223
  return {
156
224
  type: "button",
157
225
  disabled: disabled || void 0,
158
- "aria-label": "Clear row selection"
226
+ "aria-label": localization.clearRowSelectionLabel
159
227
  };
160
228
  }
161
- function getRowSelectionClearButtonText() {
162
- return "Clear selection";
229
+ function getRowSelectionClearButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
230
+ return localization.clearSelection;
163
231
  }
164
232
  function setCheckboxIndeterminate(target, indeterminate) {
165
233
  if (!target || typeof target !== "object" || !("indeterminate" in target)) {
@@ -168,33 +236,34 @@ function setCheckboxIndeterminate(target, indeterminate) {
168
236
  target.indeterminate = indeterminate;
169
237
  return true;
170
238
  }
171
- function getColumnVisibilityControlsProps() {
239
+ function getColumnVisibilityControlsProps(localization = DEFAULT_GRID_LOCALIZATION) {
172
240
  return {
173
- "aria-label": "Grid columns"
241
+ "aria-label": localization.gridColumnsLabel
174
242
  };
175
243
  }
176
- function getColumnVisibilitySummaryProps(visibleCount, totalCount) {
244
+ function getColumnVisibilitySummaryProps(visibleCount, totalCount, localization = DEFAULT_GRID_LOCALIZATION) {
245
+ const { visible, total } = normalizeColumnVisibilityCounts(visibleCount, totalCount);
177
246
  return {
178
- "aria-label": `Manage columns, ${getColumnVisibilityStatusText(visibleCount, totalCount)}`
247
+ "aria-label": localization.manageColumnsLabel(visible, total)
179
248
  };
180
249
  }
181
- function getColumnVisibilitySummaryText(visibleCount, totalCount) {
250
+ function getColumnVisibilitySummaryText(visibleCount, totalCount, localization = DEFAULT_GRID_LOCALIZATION) {
182
251
  const { visible, total } = normalizeColumnVisibilityCounts(visibleCount, totalCount);
183
- return `Columns ${visible}/${total}`;
252
+ return localization.columnsSummary(visible, total);
184
253
  }
185
- function getColumnVisibilitySearchInputProps(value) {
254
+ function getColumnVisibilitySearchInputProps(value, localization = DEFAULT_GRID_LOCALIZATION) {
186
255
  return {
187
256
  type: "search",
188
257
  value,
189
- placeholder: "Find columns",
190
- "aria-label": "Find columns",
258
+ placeholder: localization.findColumns,
259
+ "aria-label": localization.findColumns,
191
260
  autoComplete: "off"
192
261
  };
193
262
  }
194
- function getColumnVisibilityListProps() {
263
+ function getColumnVisibilityListProps(localization = DEFAULT_GRID_LOCALIZATION) {
195
264
  return {
196
265
  role: "group",
197
- "aria-label": "Column visibility"
266
+ "aria-label": localization.columnVisibilityLabel
198
267
  };
199
268
  }
200
269
  function getColumnVisibilityCheckboxProps(options) {
@@ -214,22 +283,22 @@ function getColumnVisibilityStatusProps() {
214
283
  "aria-atomic": true
215
284
  };
216
285
  }
217
- function getColumnVisibilityStatusText(visibleCount, totalCount) {
286
+ function getColumnVisibilityStatusText(visibleCount, totalCount, localization = DEFAULT_GRID_LOCALIZATION) {
218
287
  const { visible, total } = normalizeColumnVisibilityCounts(visibleCount, totalCount);
219
- return `${visible} of ${total} columns visible`;
288
+ return localization.columnsVisible(visible, total);
220
289
  }
221
- function getColumnVisibilityEmptyText() {
222
- return "No columns found";
290
+ function getColumnVisibilityEmptyText(localization = DEFAULT_GRID_LOCALIZATION) {
291
+ return localization.noColumnsFound;
223
292
  }
224
- function getColumnVisibilityResetButtonProps(hiddenCount) {
293
+ function getColumnVisibilityResetButtonProps(hiddenCount, localization = DEFAULT_GRID_LOCALIZATION) {
225
294
  return {
226
295
  type: "button",
227
296
  disabled: !Number.isFinite(hiddenCount) || hiddenCount <= 0 || void 0,
228
- "aria-label": "Show all columns"
297
+ "aria-label": localization.showAllColumnsLabel
229
298
  };
230
299
  }
231
- function getColumnVisibilityResetButtonText() {
232
- return "Show all";
300
+ function getColumnVisibilityResetButtonText(localization = DEFAULT_GRID_LOCALIZATION) {
301
+ return localization.showAll;
233
302
  }
234
303
  function normalizeGridDensity(value, fallback = "standard") {
235
304
  return GRID_DENSITIES.includes(value) ? value : fallback;
@@ -237,6 +306,40 @@ function normalizeGridDensity(value, fallback = "standard") {
237
306
  function getGridPreferenceRecord(value) {
238
307
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
239
308
  }
309
+ function getGridPreferenceVersion(value) {
310
+ return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : null;
311
+ }
312
+ function migrateGridPreferences(value, migrations = []) {
313
+ let preferences = getGridPreferenceRecord(value);
314
+ const initialVersion = getGridPreferenceVersion(preferences?.version);
315
+ if (!preferences || initialVersion === null || initialVersion > GRID_PREFERENCES_VERSION) {
316
+ return null;
317
+ }
318
+ const migrationsByVersion = /* @__PURE__ */ new Map();
319
+ for (const migration of migrations) {
320
+ if (getGridPreferenceVersion(migration.fromVersion) === null || getGridPreferenceVersion(migration.toVersion) === null || migration.toVersion <= migration.fromVersion || migration.toVersion > GRID_PREFERENCES_VERSION || migrationsByVersion.has(migration.fromVersion)) {
321
+ return null;
322
+ }
323
+ migrationsByVersion.set(migration.fromVersion, migration);
324
+ }
325
+ let version = initialVersion;
326
+ while (version < GRID_PREFERENCES_VERSION) {
327
+ const migration = migrationsByVersion.get(version);
328
+ if (!migration) {
329
+ return null;
330
+ }
331
+ try {
332
+ preferences = getGridPreferenceRecord(migration.migrate(preferences));
333
+ } catch {
334
+ return null;
335
+ }
336
+ if (!preferences || preferences.version !== migration.toVersion) {
337
+ return null;
338
+ }
339
+ version = migration.toVersion;
340
+ }
341
+ return preferences;
342
+ }
240
343
  function getGridPreferenceColumnIds(value, validColumnIds) {
241
344
  if (!Array.isArray(value)) {
242
345
  return [];
@@ -282,7 +385,7 @@ function serializeGridPreferences(preferences, options = {}) {
282
385
  }
283
386
  function parseGridPreferences(value, options = {}) {
284
387
  try {
285
- const parsed = getGridPreferenceRecord(JSON.parse(value));
388
+ const parsed = migrateGridPreferences(JSON.parse(value), options.migrations);
286
389
  if (!parsed || parsed.version !== GRID_PREFERENCES_VERSION) {
287
390
  return null;
288
391
  }
@@ -357,28 +460,23 @@ function getGridDensityRowHeight(density) {
357
460
  };
358
461
  return heights[normalizeGridDensity(density)];
359
462
  }
360
- function getDensityControlsProps() {
463
+ function getDensityControlsProps(localization = DEFAULT_GRID_LOCALIZATION) {
361
464
  return {
362
465
  role: "group",
363
- "aria-label": "Row density"
466
+ "aria-label": localization.rowDensityLabel
364
467
  };
365
468
  }
366
- function getDensityButtonProps(density, currentDensity) {
469
+ function getDensityButtonProps(density, currentDensity, localization = DEFAULT_GRID_LOCALIZATION) {
367
470
  const normalizedDensity = normalizeGridDensity(density);
368
471
  return {
369
472
  type: "button",
370
- "aria-label": `Use ${normalizedDensity} density`,
473
+ "aria-label": localization.useDensityLabel(normalizedDensity),
371
474
  "aria-pressed": normalizedDensity === normalizeGridDensity(currentDensity),
372
475
  "data-density": normalizedDensity
373
476
  };
374
477
  }
375
- function getDensityButtonText(density) {
376
- const labels = {
377
- compact: "Compact",
378
- standard: "Standard",
379
- comfortable: "Comfortable"
380
- };
381
- return labels[normalizeGridDensity(density)];
478
+ function getDensityButtonText(density, localization = DEFAULT_GRID_LOCALIZATION) {
479
+ return localization.densityLabel(normalizeGridDensity(density));
382
480
  }
383
481
  function getFilteredColumnVisibilityColumns(columns, query) {
384
482
  const normalizedQuery = query.trim().toLocaleLowerCase();
@@ -407,22 +505,16 @@ function getNextColumnFilters(filters, columnId, value) {
407
505
  }
408
506
  return filters.map((filter, index) => index === existingIndex ? { id: columnId, value } : filter);
409
507
  }
410
- function getPaginationProps() {
508
+ function getPaginationProps(localization = DEFAULT_GRID_LOCALIZATION) {
411
509
  return {
412
510
  role: "navigation",
413
- "aria-label": "Pagination"
511
+ "aria-label": localization.paginationLabel
414
512
  };
415
513
  }
416
- function getPaginationButtonProps(options) {
417
- const labels = {
418
- first: "First page",
419
- previous: "Previous page",
420
- next: "Next page",
421
- last: "Last page"
422
- };
514
+ function getPaginationButtonProps(options, localization = DEFAULT_GRID_LOCALIZATION) {
423
515
  return {
424
516
  type: "button",
425
- "aria-label": labels[options.action],
517
+ "aria-label": localization.paginationActionLabel(options.action),
426
518
  disabled: options.disabled || void 0
427
519
  };
428
520
  }
@@ -441,18 +533,18 @@ function getPaginationStatusProps() {
441
533
  "aria-live": "polite"
442
534
  };
443
535
  }
444
- function getPaginationPageText(grid) {
536
+ function getPaginationPageText(grid, localization = DEFAULT_GRID_LOCALIZATION) {
445
537
  const pageCount = grid.getPageCount();
446
538
  const rawPageIndex = grid.getState().pagination.pageIndex;
447
539
  const pageIndex = Math.min(
448
540
  Number.isFinite(rawPageIndex) ? Math.max(0, Math.floor(rawPageIndex)) : 0,
449
541
  pageCount - 1
450
542
  );
451
- return `Page ${pageIndex + 1} of ${pageCount}`;
543
+ return localization.pageStatus(pageIndex + 1, pageCount);
452
544
  }
453
- function getPaginationPageSizeSelectProps(pageSize) {
545
+ function getPaginationPageSizeSelectProps(pageSize, localization = DEFAULT_GRID_LOCALIZATION) {
454
546
  return {
455
- "aria-label": "Rows per page",
547
+ "aria-label": localization.rowsPerPageLabel,
456
548
  value: Number.isFinite(pageSize) && pageSize > 0 ? Math.max(1, Math.floor(pageSize)) : 1
457
549
  };
458
550
  }
@@ -463,8 +555,8 @@ function getPaginationPageSizeOptions(options = DEFAULT_PAGINATION_PAGE_SIZE_OPT
463
555
  const current = Number.isFinite(currentPageSize) && (currentPageSize ?? 0) > 0 ? Math.max(1, Math.floor(currentPageSize ?? 1)) : null;
464
556
  return Array.from(new Set(current === null ? normalized : [...normalized, current])).sort((left, right) => left - right);
465
557
  }
466
- function getPaginationPageSizeOptionText(pageSize) {
467
- return `${pageSize} rows`;
558
+ function getPaginationPageSizeOptionText(pageSize, localization = DEFAULT_GRID_LOCALIZATION) {
559
+ return localization.pageSizeOption(pageSize);
468
560
  }
469
561
  function getGridBodyProps(options = {}) {
470
562
  return {
@@ -662,11 +754,11 @@ function getGridKeyboardFocusMove(event) {
662
754
  }
663
755
  return null;
664
756
  }
665
- function getColumnResizeHandleProps(column, options = {}) {
757
+ function getColumnResizeHandleProps(column, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
666
758
  return {
667
759
  role: "separator",
668
760
  "aria-orientation": "vertical",
669
- "aria-label": `Resize ${column.id} column`,
761
+ "aria-label": localization.resizeColumnLabel(column.id),
670
762
  "aria-valuenow": options.valueNow ?? column.getSize(),
671
763
  "aria-valuemin": column.columnDef.minSize,
672
764
  "aria-valuemax": column.columnDef.maxSize,
@@ -807,9 +899,9 @@ function addPassiveScrollListener(listener, target) {
807
899
  target.removeEventListener("scroll", listener);
808
900
  };
809
901
  }
810
- function getColumnPinningControlsProps(column) {
902
+ function getColumnPinningControlsProps(column, localization = DEFAULT_GRID_LOCALIZATION) {
811
903
  return {
812
- "aria-label": `${column.id} column pinning`
904
+ "aria-label": localization.columnPinningLabel(column.id)
813
905
  };
814
906
  }
815
907
  function getColumnPinningButtonText(position) {
@@ -821,19 +913,18 @@ function getColumnPinningButtonText(position) {
821
913
  }
822
914
  return "-";
823
915
  }
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}`;
916
+ function getColumnPinningButtonProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
826
917
  return {
827
918
  type: "button",
828
- "aria-label": label,
919
+ "aria-label": localization.pinColumnLabel(column.id, options.position),
829
920
  "aria-pressed": options.active,
830
921
  disabled: options.active
831
922
  };
832
923
  }
833
- function getHeaderActionMenuTriggerProps(column, options) {
924
+ function getHeaderActionMenuTriggerProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
834
925
  return {
835
926
  type: "button",
836
- "aria-label": `Open ${column.id} column menu`,
927
+ "aria-label": localization.openColumnMenuLabel(column.id),
837
928
  "aria-expanded": options.expanded,
838
929
  "aria-haspopup": "menu",
839
930
  "aria-controls": options.expanded ? options.controls : void 0
@@ -845,85 +936,61 @@ function getHeaderActionMenuId(columnId) {
845
936
  function getHeaderActionMenuTriggerId(columnId) {
846
937
  return `${getHeaderActionMenuId(columnId)}-trigger`;
847
938
  }
848
- function getHeaderActionMenuProps(column) {
939
+ function getHeaderActionMenuProps(column, localization = DEFAULT_GRID_LOCALIZATION) {
849
940
  return {
850
941
  role: "menu",
851
- "aria-label": `${column.id} column menu`,
942
+ "aria-label": localization.columnMenuLabel(column.id),
852
943
  tabIndex: -1
853
944
  };
854
945
  }
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";
946
+ function getHeaderActionMenuDefaultItemLabel(itemId, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
947
+ return localization.headerActionMenuItemLabel(itemId, options.grouped ?? false);
881
948
  }
882
- function getHeaderActionMenuDefaultItemDescriptors(options) {
949
+ function getHeaderActionMenuDefaultItemDescriptors(options, localization = DEFAULT_GRID_LOCALIZATION) {
883
950
  const descriptors = [
884
951
  {
885
952
  id: "sort-asc",
886
- label: getHeaderActionMenuDefaultItemLabel("sort-asc")
953
+ label: getHeaderActionMenuDefaultItemLabel("sort-asc", {}, localization)
887
954
  },
888
955
  {
889
956
  id: "sort-desc",
890
- label: getHeaderActionMenuDefaultItemLabel("sort-desc")
957
+ label: getHeaderActionMenuDefaultItemLabel("sort-desc", {}, localization)
891
958
  },
892
959
  {
893
960
  id: "clear-sort",
894
- label: getHeaderActionMenuDefaultItemLabel("clear-sort"),
961
+ label: getHeaderActionMenuDefaultItemLabel("clear-sort", {}, localization),
895
962
  disabled: !options.sortDirection
896
963
  },
897
964
  {
898
965
  id: "move-left",
899
- label: getHeaderActionMenuDefaultItemLabel("move-left"),
966
+ label: getHeaderActionMenuDefaultItemLabel("move-left", {}, localization),
900
967
  disabled: !options.canMoveLeft
901
968
  },
902
969
  {
903
970
  id: "move-right",
904
- label: getHeaderActionMenuDefaultItemLabel("move-right"),
971
+ label: getHeaderActionMenuDefaultItemLabel("move-right", {}, localization),
905
972
  disabled: !options.canMoveRight
906
973
  },
907
974
  {
908
975
  id: "pin-left",
909
- label: getHeaderActionMenuDefaultItemLabel("pin-left"),
976
+ label: getHeaderActionMenuDefaultItemLabel("pin-left", {}, localization),
910
977
  disabled: options.pinningPosition === "left"
911
978
  },
912
979
  {
913
980
  id: "unpin",
914
- label: getHeaderActionMenuDefaultItemLabel("unpin"),
981
+ label: getHeaderActionMenuDefaultItemLabel("unpin", {}, localization),
915
982
  disabled: options.pinningPosition === false
916
983
  },
917
984
  {
918
985
  id: "pin-right",
919
- label: getHeaderActionMenuDefaultItemLabel("pin-right"),
986
+ label: getHeaderActionMenuDefaultItemLabel("pin-right", {}, localization),
920
987
  disabled: options.pinningPosition === "right"
921
988
  }
922
989
  ];
923
990
  if (options.canGroup) {
924
991
  descriptors.push({
925
992
  id: "toggle-group",
926
- label: getHeaderActionMenuDefaultItemLabel("toggle-group", { grouped: options.isGrouped })
993
+ label: getHeaderActionMenuDefaultItemLabel("toggle-group", { grouped: options.isGrouped }, localization)
927
994
  });
928
995
  }
929
996
  return descriptors;
@@ -970,9 +1037,9 @@ function isHeaderActionMenuSeparatorItem(item) {
970
1037
  function getHeaderActionMenuCustomItemUserProps(item) {
971
1038
  return item ? item.props ?? {} : {};
972
1039
  }
973
- function getGroupingPanelProps(options = {}) {
1040
+ function getGroupingPanelProps(options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
974
1041
  return {
975
- "aria-label": "Column grouping",
1042
+ "aria-label": localization.columnGroupingLabel,
976
1043
  "data-empty": options.empty || void 0
977
1044
  };
978
1045
  }
@@ -986,17 +1053,17 @@ function getGroupingPanelChipProps(column) {
986
1053
  "data-column-id": column.id
987
1054
  };
988
1055
  }
989
- function getGroupingPanelMoveButtonProps(column, options) {
1056
+ function getGroupingPanelMoveButtonProps(column, options, localization = DEFAULT_GRID_LOCALIZATION) {
990
1057
  return {
991
1058
  type: "button",
992
- "aria-label": `Move ${column.id} grouping ${options.direction}`,
1059
+ "aria-label": localization.moveColumnGroupingLabel(column.id, options.direction),
993
1060
  disabled: options.disabled || false
994
1061
  };
995
1062
  }
996
- function getGroupingPanelRemoveButtonProps(column) {
1063
+ function getGroupingPanelRemoveButtonProps(column, localization = DEFAULT_GRID_LOCALIZATION) {
997
1064
  return {
998
1065
  type: "button",
999
- "aria-label": `Remove ${column.id} grouping`
1066
+ "aria-label": localization.removeColumnGroupingLabel(column.id)
1000
1067
  };
1001
1068
  }
1002
1069
  function getIsGroupLabelCell(row, column, visibleColumns) {
@@ -1009,20 +1076,20 @@ function getIsGroupLabelCell(row, column, visibleColumns) {
1009
1076
  }
1010
1077
  return column.id === row.groupingColumnId || !visibleColumns.some((candidate) => candidate.id === row.groupingColumnId) && column.id === firstVisibleColumnId;
1011
1078
  }
1012
- function getGroupValueText(value) {
1079
+ function getGroupValueText(value, localization = DEFAULT_GRID_LOCALIZATION) {
1013
1080
  if (value instanceof Date) {
1014
1081
  return value.toISOString();
1015
1082
  }
1016
- return value == null ? "(blank)" : String(value);
1083
+ return value == null ? localization.blankGroupValue : String(value);
1017
1084
  }
1018
- function getGroupRowLabel(row, column, options = {}) {
1085
+ function getGroupRowLabel(row, column, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
1019
1086
  if (row.getIsGroupFooter()) {
1020
- return row.groupFooterLabel ?? "Total";
1087
+ return row.groupFooterLabel ?? localization.groupFooterTotal;
1021
1088
  }
1022
1089
  if (row.groupingColumnId) {
1023
- return `${row.groupingColumnId}: ${getGroupValueText(row.groupingValue)}`;
1090
+ return `${row.groupingColumnId}: ${getGroupValueText(row.groupingValue, localization)}`;
1024
1091
  }
1025
- return options.fallback ?? getGroupValueText(row.getValue(column.id));
1092
+ return options.fallback ?? getGroupValueText(row.getValue(column.id), localization);
1026
1093
  }
1027
1094
  function getGroupCellIndent(row, options = {}) {
1028
1095
  const depthSize = options.depthSize ?? 16;
@@ -1059,10 +1126,10 @@ function getRowLayoutProps(row, options = {}) {
1059
1126
  "data-column-virtualized": options.columnVirtualized || void 0
1060
1127
  };
1061
1128
  }
1062
- function getRowExpansionToggleProps(row, options) {
1129
+ function getRowExpansionToggleProps(row, options, localization = DEFAULT_GRID_LOCALIZATION) {
1063
1130
  return {
1064
1131
  type: "button",
1065
- "aria-label": `${options.expanded ? "Collapse" : "Expand"} ${options.label}`,
1132
+ "aria-label": localization.toggleRowExpandedLabel(options.expanded, options.label),
1066
1133
  "aria-expanded": options.expanded,
1067
1134
  "data-row-id": row.id,
1068
1135
  "data-expanded": options.expanded
@@ -1276,9 +1343,9 @@ function getCellFillHandleVisible(row, column, options) {
1276
1343
  function getCanStartCellPointerDrag(event, editingCell) {
1277
1344
  return isPrimaryPointerButton(event) && !editingCell;
1278
1345
  }
1279
- function getCellEditorProps(column, options = {}) {
1346
+ function getCellEditorProps(column, options = {}, localization = DEFAULT_GRID_LOCALIZATION) {
1280
1347
  return {
1281
- "aria-label": `Edit ${column.id}`,
1348
+ "aria-label": localization.editColumnLabel(column.id),
1282
1349
  "aria-invalid": options.invalid || void 0
1283
1350
  };
1284
1351
  }
@@ -1831,6 +1898,7 @@ function isFocusedCell(focusedCell, rowId, columnId) {
1831
1898
  return isCellCoordinateEqual(focusedCell, { rowId, columnId });
1832
1899
  }
1833
1900
  export {
1901
+ DEFAULT_GRID_LOCALIZATION,
1834
1902
  DEFAULT_PAGINATION_PAGE_SIZE_OPTIONS,
1835
1903
  GRID_DENSITIES,
1836
1904
  GRID_FOCUSED_CELL_SELECTOR,
@@ -1845,6 +1913,7 @@ export {
1845
1913
  addPointerUpCancelListeners,
1846
1914
  applyResizeObserverMeasuredSizes,
1847
1915
  createClickSuppressionController,
1916
+ createGridLocalization,
1848
1917
  createGridPreferences,
1849
1918
  createResizeObserver,
1850
1919
  disconnectResizeObserver,
@@ -2055,6 +2124,7 @@ export {
2055
2124
  isPrimaryPointerButton,
2056
2125
  isPrimaryPointerDragActive,
2057
2126
  isResizeObserverDatasetTarget,
2127
+ migrateGridPreferences,
2058
2128
  moveColumnToTarget,
2059
2129
  moveGroupedColumn,
2060
2130
  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.2.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.2.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "tsup": "^8.3.5",