react-kd-grid 5.0.1

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 (48) hide show
  1. package/README.md +309 -0
  2. package/dist/components/CellEditor.d.ts +23 -0
  3. package/dist/components/ColumnFilterSelector.d.ts +18 -0
  4. package/dist/components/CustomSelect.d.ts +14 -0
  5. package/dist/components/FooterAggregate.d.ts +16 -0
  6. package/dist/components/GridHeader.d.ts +39 -0
  7. package/dist/components/GridRows.d.ts +53 -0
  8. package/dist/components/GroupBar.d.ts +12 -0
  9. package/dist/components/GroupHeader.d.ts +29 -0
  10. package/dist/components/LicenseError.d.ts +9 -0
  11. package/dist/components/NoDataMessage.d.ts +11 -0
  12. package/dist/components/PaginationControls.d.ts +18 -0
  13. package/dist/components/Popover.d.ts +17 -0
  14. package/dist/components/RowContextMenu.d.ts +18 -0
  15. package/dist/components/SearchToolbar.d.ts +66 -0
  16. package/dist/components/filters/BooleanFilter.d.ts +7 -0
  17. package/dist/components/filters/DateFilter.d.ts +9 -0
  18. package/dist/components/filters/FilterContent.d.ts +9 -0
  19. package/dist/components/filters/FilterPopup.d.ts +2 -0
  20. package/dist/components/filters/MultiselectFilter.d.ts +10 -0
  21. package/dist/components/filters/NumberFilter.d.ts +9 -0
  22. package/dist/components/filters/TextFilter.d.ts +8 -0
  23. package/dist/components/filters/index.d.ts +6 -0
  24. package/dist/components/ui/DatePicker.d.ts +10 -0
  25. package/dist/constants.d.ts +1 -0
  26. package/dist/core/DataGrid.d.ts +3 -0
  27. package/dist/hooks/useAdvancedFiltering.d.ts +18 -0
  28. package/dist/hooks/useCellSelection.d.ts +67 -0
  29. package/dist/hooks/useColumnState.d.ts +45 -0
  30. package/dist/hooks/useDataWorker.d.ts +11 -0
  31. package/dist/hooks/useEditingCell.d.ts +49 -0
  32. package/dist/hooks/useExport.d.ts +14 -0
  33. package/dist/hooks/useGrouping.d.ts +28 -0
  34. package/dist/hooks/useInfiniteScroll.d.ts +31 -0
  35. package/dist/hooks/useLoadingBar.d.ts +21 -0
  36. package/dist/hooks/usePagination.d.ts +28 -0
  37. package/dist/hooks/useScrollSync.d.ts +29 -0
  38. package/dist/hooks/useSelection.d.ts +13 -0
  39. package/dist/hooks/useVirtualization.d.ts +17 -0
  40. package/dist/icons/index.d.ts +54 -0
  41. package/dist/index.d.ts +12 -0
  42. package/dist/index.esm.js +1 -0
  43. package/dist/index.js +1 -0
  44. package/dist/types.d.ts +592 -0
  45. package/dist/utils/dateUtils.d.ts +16 -0
  46. package/dist/utils/highlightText.d.ts +15 -0
  47. package/dist/utils/license.d.ts +3 -0
  48. package/package.json +97 -0
@@ -0,0 +1,7 @@
1
+ import { ColumnFilterValue } from "../../types";
2
+ interface BooleanFilterProps {
3
+ value: ColumnFilterValue | null;
4
+ onChange: (value: ColumnFilterValue | null) => void;
5
+ }
6
+ export declare const BooleanFilter: ({ value, onChange }: BooleanFilterProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ColumnFilterValue } from "../../types";
2
+ interface DateFilterProps {
3
+ value: ColumnFilterValue | null;
4
+ onChange: (value: ColumnFilterValue | null) => void;
5
+ min?: number;
6
+ max?: number;
7
+ }
8
+ export declare const DateFilter: ({ value, onChange, min, max }: DateFilterProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ColumnFilterValue, GridColumn, GridRow } from "../../types";
2
+ interface FilterContentProps {
3
+ column: GridColumn;
4
+ data: GridRow[];
5
+ value: ColumnFilterValue | null;
6
+ onChange: (val: ColumnFilterValue | null) => void;
7
+ }
8
+ export declare const FilterContent: ({ column, data, value, onChange }: FilterContentProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FilterPopupProps } from "../../types";
2
+ export declare const FilterPopup: ({ column, data, currentFilter, onApplyFilter, onClose, position, autoApply, }: FilterPopupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { ColumnFilterValue, FilterOption, GridRow } from "../../types";
2
+ interface MultiselectFilterProps {
3
+ value: ColumnFilterValue | null;
4
+ onChange: (value: ColumnFilterValue | null) => void;
5
+ options?: FilterOption[];
6
+ data: GridRow[];
7
+ columnKey: string;
8
+ }
9
+ export declare const MultiselectFilter: ({ value, onChange, options, data, columnKey, }: MultiselectFilterProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ColumnFilterValue } from "../../types";
2
+ interface NumberFilterProps {
3
+ value: ColumnFilterValue | null;
4
+ onChange: (value: ColumnFilterValue | null) => void;
5
+ min?: number;
6
+ max?: number;
7
+ }
8
+ export declare const NumberFilter: ({ value, onChange, min, max, }: NumberFilterProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ColumnFilterValue } from "../../types";
2
+ interface TextFilterProps {
3
+ value: ColumnFilterValue | null;
4
+ onChange: (value: ColumnFilterValue | null) => void;
5
+ placeholder?: string;
6
+ }
7
+ export declare const TextFilter: ({ value, onChange, placeholder, }: TextFilterProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ export { TextFilter } from './TextFilter';
2
+ export { NumberFilter } from './NumberFilter';
3
+ export { DateFilter } from './DateFilter';
4
+ export { MultiselectFilter } from './MultiselectFilter';
5
+ export { BooleanFilter } from './BooleanFilter';
6
+ export { FilterPopup } from './FilterPopup';
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ interface DatePickerProps {
3
+ name?: string;
4
+ label?: string;
5
+ value: string | null;
6
+ onChange: (value: string | null) => void;
7
+ className?: string;
8
+ }
9
+ export declare const DatePicker: React.FC<DatePickerProps>;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare const SELECT_COL_WIDTH = 48;
@@ -0,0 +1,3 @@
1
+ import type { KDGridProps, KDGridRef } from "../types";
2
+ export declare const KDGrid: import("react").ForwardRefExoticComponent<KDGridProps & import("react").RefAttributes<KDGridRef>>;
3
+ export default KDGrid;
@@ -0,0 +1,18 @@
1
+ import { GridRow, GridColumn, ActiveFilters, ColumnFilterValue } from "../types";
2
+ interface UseAdvancedFilteringProps {
3
+ data: GridRow[];
4
+ columns: GridColumn[];
5
+ }
6
+ export declare const useAdvancedFiltering: ({ data, columns, }: UseAdvancedFilteringProps) => {
7
+ globalFilter: string;
8
+ setGlobalFilter: (value: string) => void;
9
+ columnFilters: ActiveFilters;
10
+ filteredData: GridRow[];
11
+ setColumnFilter: (columnKey: string, filter: ColumnFilterValue | null) => void;
12
+ clearColumnFilter: (columnKey: string) => void;
13
+ clearAllFilters: () => void;
14
+ getActiveFilterCount: () => number;
15
+ /** True while a filter transition is in-flight — use to show a loading indicator */
16
+ isFilterPending: boolean;
17
+ };
18
+ export {};
@@ -0,0 +1,67 @@
1
+ import { RefObject } from "react";
2
+ import type { CellFocusParams, CellSelectionPayload, CopyCellsPayload } from "../types";
3
+ interface CellCoord {
4
+ rowIndex: number;
5
+ colIndex: number;
6
+ }
7
+ interface FocusedCell {
8
+ rowId: string | number;
9
+ columnKey: string;
10
+ }
11
+ interface DragOverlay {
12
+ x: number;
13
+ y: number;
14
+ rows: number;
15
+ cols: number;
16
+ }
17
+ interface UseCellSelectionProps {
18
+ cellFocusEnabled: boolean;
19
+ cellSelectionEnabled: boolean;
20
+ canSelectCell: (row: any, column: any) => boolean;
21
+ flatRows: any[];
22
+ columnsWithWidths: any[];
23
+ rowIndexById: Map<string | number, number>;
24
+ colIndexByKey: Map<string, number>;
25
+ rowById: Map<string | number, any>;
26
+ colByKey: Map<string, any>;
27
+ scrollRef: RefObject<HTMLDivElement>;
28
+ headerScrollRef: RefObject<HTMLDivElement>;
29
+ resolvedRowHeight: number;
30
+ selectable: boolean;
31
+ onCellFocusChange?: (params: CellFocusParams) => void;
32
+ onCellSelectionChange?: (payload: CellSelectionPayload) => void;
33
+ onCopyCells?: (payload: CopyCellsPayload) => void;
34
+ /** Stable column keys used to avoid dep on full column objects in effects */
35
+ columnKeys: string[];
36
+ /** Mirrors the grid-level getRowId — needed so focus/selection uses the correct key. */
37
+ getRowId?: (row: any) => string | number;
38
+ }
39
+ export interface UseCellSelectionReturn {
40
+ focusedCell: FocusedCell | null;
41
+ selectionAnchor: CellCoord | null;
42
+ selectionEnd: CellCoord | null;
43
+ dragOverlay: DragOverlay | null;
44
+ isCellSelected: (rowId: string | number, columnKey: string) => boolean;
45
+ isCellFocused: (rowId: string | number, columnKey: string) => boolean;
46
+ handleCellMouseDown: (params: {
47
+ row: any;
48
+ column: any;
49
+ event: any;
50
+ }) => void;
51
+ handleCellMouseEnter: (params: {
52
+ row: any;
53
+ column: any;
54
+ event: any;
55
+ }) => void;
56
+ }
57
+ /**
58
+ * Owns the entire cell focus + rectangular selection subsystem:
59
+ * - State: focusedCell, selectionAnchor, selectionEnd, dragOverlay
60
+ * - Mouse handlers: handleCellMouseDown, handleCellMouseEnter
61
+ * - Global effects: mouseup, mousemove, Shift+Arrow, keyboard focus nav
62
+ * - Auto-scroll RAF loop while dragging near scroll container edges
63
+ * - Ctrl/Cmd+C copy handler (Excel-compatible TSV output)
64
+ * - onCellSelectionChange callback (de-duped via signature ref)
65
+ */
66
+ export declare const useCellSelection: ({ cellFocusEnabled, cellSelectionEnabled, canSelectCell, flatRows, columnsWithWidths, rowIndexById, colIndexByKey, rowById, colByKey, scrollRef, headerScrollRef, resolvedRowHeight, selectable, onCellFocusChange, onCellSelectionChange, onCopyCells, columnKeys, getRowId, }: UseCellSelectionProps) => UseCellSelectionReturn;
67
+ export {};
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+ import type { GridColumn, GridRow, ColumnConfig, ColumnFilterValue, Density, SortConfig } from "../types";
3
+ interface UseColumnStateProps {
4
+ columns: GridColumn[];
5
+ data: GridRow[];
6
+ initialColumnConfig?: Partial<ColumnConfig>;
7
+ onColumnConfigChange?: (config: ColumnConfig) => void;
8
+ setSortConfig: (config: SortConfig) => void;
9
+ setGroupKeys: (keys: string[]) => void;
10
+ setDensity: (density: Density) => void;
11
+ setGlobalFilter: (value: string) => void;
12
+ setColumnFilter: (key: string, filter: ColumnFilterValue) => void;
13
+ sortConfig: SortConfig;
14
+ groupConfig: {
15
+ columnKeys: string[];
16
+ };
17
+ globalFilter: string;
18
+ columnFilters: Record<string, ColumnFilterValue | null>;
19
+ density: Density;
20
+ }
21
+ export interface UseColumnStateReturn {
22
+ columnWidths: Record<string, number>;
23
+ columnOrder: string[];
24
+ pinnedColumns: Set<string>;
25
+ columnVisibility: Record<string, boolean>;
26
+ handleColumnResize: (columnKey: string, width: number) => void;
27
+ handleColumnPin: (columnKey: string, pinned: boolean) => void;
28
+ handleColumnVisibilityChange: (columnKey: string, visible: boolean) => void;
29
+ setColumnOrder: React.Dispatch<React.SetStateAction<string[]>>;
30
+ autosizeColumn: (columnKey: string) => void;
31
+ autosizeAllColumns: () => void;
32
+ resetColumns: () => void;
33
+ setColumnWidths: React.Dispatch<React.SetStateAction<Record<string, number>>>;
34
+ setPinnedColumns: React.Dispatch<React.SetStateAction<Set<string>>>;
35
+ setColumnVisibility: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
36
+ }
37
+ /**
38
+ * Owns all column configuration state:
39
+ * - Column widths, order, pinning, visibility
40
+ * - Autosize (canvas-based measureText, with heuristic fallback)
41
+ * - Column config hydration from `initialColumnConfig` on mount
42
+ * - Debounced `onColumnConfigChange` emission
43
+ */
44
+ export declare const useColumnState: ({ columns, data, initialColumnConfig, onColumnConfigChange, setSortConfig, setGroupKeys, setDensity, setGlobalFilter, setColumnFilter, sortConfig, groupConfig, globalFilter, columnFilters, density, }: UseColumnStateProps) => UseColumnStateReturn;
45
+ export {};
@@ -0,0 +1,11 @@
1
+ type SortCfg = {
2
+ key: string;
3
+ direction: "asc" | "desc";
4
+ } | null;
5
+ /** Lazily-created worker singleton per hook instance. */
6
+ export declare function useDataWorker(options?: {
7
+ enabled?: boolean;
8
+ }): {
9
+ process: (rows: any[], sort: SortCfg) => Promise<any[]>;
10
+ };
11
+ export {};
@@ -0,0 +1,49 @@
1
+ /**
2
+ * useEditingCell
3
+ *
4
+ * Owns the lifecycle of an inline cell edit session:
5
+ * - Which cell is currently being edited (rowId + columnKey)
6
+ * - Starting an edit (triggered by double-click or F2)
7
+ * - Committing the edit and firing onCellEdit
8
+ * - Cancelling the edit
9
+ * - Keyboard F2 to open edit when a cell is focused (delegates from useCellSelection)
10
+ *
11
+ * Design: state is intentionally kept minimal. The *draft value* is owned by
12
+ * <CellEditor> because it needs to stay strictly local to the input DOM. This
13
+ * hook only needs to know *which* cell is open so GridRows can render the editor.
14
+ */
15
+ import type { GridColumn, GridRow, CellEditParams } from "../types";
16
+ export interface EditingCell {
17
+ rowId: string | number;
18
+ columnKey: string;
19
+ /** Snapshot of the value at the moment editing started. */
20
+ initialValue: any;
21
+ row: GridRow;
22
+ column: GridColumn;
23
+ }
24
+ interface UseEditingCellProps {
25
+ getRowId: (row: GridRow) => string | number;
26
+ onCellEdit?: (params: CellEditParams) => void;
27
+ onCellEditStart?: (params: {
28
+ row: GridRow;
29
+ column: GridColumn;
30
+ value: any;
31
+ }) => boolean | void;
32
+ /** Currently focused cell (from useCellSelection) — used for F2 shortcut. */
33
+ focusedCell?: {
34
+ rowId: string | number;
35
+ columnKey: string;
36
+ } | null;
37
+ /** Full row-and-column lookup helpers for F2 shortcut. */
38
+ getRowById?: (rowId: string | number) => GridRow | undefined;
39
+ getColumnByKey?: (key: string) => GridColumn | undefined;
40
+ }
41
+ export interface UseEditingCellReturn {
42
+ editingCell: EditingCell | null;
43
+ startEdit: (row: GridRow, column: GridColumn) => void;
44
+ commitEdit: (newValue: any) => void;
45
+ cancelEdit: () => void;
46
+ isEditing: (rowId: string | number, columnKey: string) => boolean;
47
+ }
48
+ export declare const useEditingCell: ({ getRowId, onCellEdit, onCellEditStart, focusedCell, getRowById, getColumnByKey, }: UseEditingCellProps) => UseEditingCellReturn;
49
+ export {};
@@ -0,0 +1,14 @@
1
+ import { GridRow, GridColumn, ExportFormat } from "../types";
2
+ interface UseExportProps {
3
+ data: GridRow[];
4
+ columns: GridColumn[];
5
+ selectedRows?: Set<string | number>;
6
+ filename?: string;
7
+ columnVisibility?: Record<string, boolean>;
8
+ }
9
+ export declare const useExport: ({ data, columns, selectedRows, filename, columnVisibility, }: UseExportProps) => {
10
+ exportData: (format: ExportFormat, exportSelected?: boolean) => void;
11
+ canExportSelected: boolean;
12
+ selectedCount: number;
13
+ };
14
+ export {};
@@ -0,0 +1,28 @@
1
+ import { GridRow, GroupConfig, GridColumn } from "../types";
2
+ interface UseGroupingProps {
3
+ data: GridRow[];
4
+ columns: GridColumn[];
5
+ }
6
+ export declare const useGrouping: ({ data, columns }: UseGroupingProps) => {
7
+ groupConfig: GroupConfig;
8
+ displayData: (GridRow & {
9
+ _isGroupHeader?: boolean;
10
+ _groupKey?: string;
11
+ _groupCount?: number;
12
+ _groupLevel?: number;
13
+ _groupColumnKey?: string;
14
+ _groupValue?: string;
15
+ _groupRows?: GridRow[];
16
+ _isGroupFooter?: boolean;
17
+ _groupAgg?: Record<string, any>;
18
+ })[];
19
+ handleGroupBy: (columnKey: string | null) => void;
20
+ addGroupKey: (columnKey: string) => void;
21
+ removeGroupKey: (columnKey: string) => void;
22
+ setGroupKeys: (columnKeys: string[]) => void;
23
+ toggleGroupExpansion: (groupPath: string) => void;
24
+ expandAllGroups: () => void;
25
+ collapseAllGroups: () => void;
26
+ isGrouped: boolean;
27
+ };
28
+ export {};
@@ -0,0 +1,31 @@
1
+ export interface UseInfiniteScrollOptions {
2
+ /** When false, the observer is disconnected entirely. */
3
+ enabled: boolean;
4
+ /** Whether there are more rows to load. */
5
+ hasMore: boolean;
6
+ /** True while a fetch is in flight – prevents double-triggering. */
7
+ isLoading: boolean;
8
+ /** Called when the sentinel enters the viewport. */
9
+ onLoadMore: () => void;
10
+ /**
11
+ * Pixels of extra root margin below the scroll viewport.
12
+ * A positive value means `onLoadMore` fires before the sentinel is
13
+ * fully visible (pre-fetch). Default: 200 px.
14
+ */
15
+ threshold?: number;
16
+ /**
17
+ * The scrollable element that clips the sentinel.
18
+ * If not provided, defaults to the browser viewport.
19
+ */
20
+ rootRef?: React.RefObject<Element | null>;
21
+ }
22
+ /**
23
+ * Attaches an IntersectionObserver to a sentinel <div> placed at the
24
+ * bottom of the scrollable area. When the sentinel enters the viewport
25
+ * (plus the optional threshold), onLoadMore is called.
26
+ *
27
+ * @returns `sentinelRef` – attach this to a div at the bottom of the list.
28
+ */
29
+ export declare function useInfiniteScroll({ enabled, onLoadMore, threshold, rootRef, }: UseInfiniteScrollOptions): {
30
+ sentinelRef: import("react").MutableRefObject<HTMLDivElement>;
31
+ };
@@ -0,0 +1,21 @@
1
+ import { RefObject } from "react";
2
+ interface UseLoadingBarProps {
3
+ loading: boolean;
4
+ isServerLoading: boolean;
5
+ resolvedHeaderHeight: number;
6
+ scrollRef: RefObject<HTMLDivElement>;
7
+ containerRef: RefObject<HTMLElement>;
8
+ }
9
+ interface UseLoadingBarReturn {
10
+ showLoader: boolean;
11
+ finishingLoader: boolean;
12
+ loaderTop: number;
13
+ }
14
+ /**
15
+ * Manages the animated top loading bar state.
16
+ * - Tracks overall loading (prop + server)
17
+ * - Smooth 200 ms "finish" fade-out when loading completes
18
+ * - Positions the bar just below the sticky header via ResizeObserver
19
+ */
20
+ export declare const useLoadingBar: ({ loading, isServerLoading, resolvedHeaderHeight, scrollRef, containerRef, }: UseLoadingBarProps) => UseLoadingBarReturn;
21
+ export {};
@@ -0,0 +1,28 @@
1
+ import { PaginationConfig, GridRow } from "../types";
2
+ interface UsePaginationProps {
3
+ data: GridRow[];
4
+ pagination?: {
5
+ enabled?: boolean;
6
+ mode?: "client" | "server";
7
+ pageSize?: number;
8
+ showPageSizeSelector?: boolean;
9
+ pageSizeOptions?: number[];
10
+ serverConfig?: {
11
+ enabled: boolean;
12
+ onPageChange: (page: number, pageSize: number) => Promise<void> | void;
13
+ onPageSizeChange?: (pageSize: number) => Promise<void> | void;
14
+ loading?: boolean;
15
+ totalRows: number;
16
+ };
17
+ };
18
+ }
19
+ export declare const usePagination: ({ data, pagination }: UsePaginationProps) => {
20
+ currentPage: number;
21
+ resetPage: () => void;
22
+ paginationConfig: PaginationConfig;
23
+ paginatedData: GridRow[];
24
+ isServerLoading: boolean;
25
+ handlePageChange: (page: number) => Promise<void>;
26
+ handlePageSizeChange: (newPageSize: number) => Promise<void>;
27
+ };
28
+ export {};
@@ -0,0 +1,29 @@
1
+ import { RefObject } from "react";
2
+ import React from "react";
3
+ interface UseScrollSyncProps {
4
+ scrollRef: RefObject<HTMLDivElement>;
5
+ footerScrollRef: RefObject<HTMLDivElement>;
6
+ hasFooterAggregate: boolean;
7
+ }
8
+ interface UseScrollSyncReturn {
9
+ /** Current horizontal scroll position of the body (RAF-throttled). */
10
+ hScrollLeft: number;
11
+ /** Current viewport width of the scroll container. */
12
+ viewportWidth: number;
13
+ /** Schedules a RAF-debounced update to hScrollLeft. */
14
+ scheduleHScrollUpdate: (value: number) => void;
15
+ /** Forwards horizontal wheel events from non-scrollable header/footer to the body. */
16
+ forwardWheelToBody: (e: React.WheelEvent<HTMLDivElement>) => void;
17
+ }
18
+ /**
19
+ * Coordinates horizontal scroll state between the body scroll container,
20
+ * the sticky footer aggregate row, and the horizontal virtualisation system.
21
+ *
22
+ * Responsibilities:
23
+ * - RAF-throttled `hScrollLeft` state (used by horizontal virtualisation)
24
+ * - `viewportWidth` via ResizeObserver (used for visible column slicing)
25
+ * - Footer ↔ body scroll sync via an event listener
26
+ * - `forwardWheelToBody` for header/footer wheel events
27
+ */
28
+ export declare const useScrollSync: ({ scrollRef, footerScrollRef, hasFooterAggregate, }: UseScrollSyncProps) => UseScrollSyncReturn;
29
+ export {};
@@ -0,0 +1,13 @@
1
+ import { GridRow } from "../types";
2
+ interface UseSelectionProps {
3
+ data: GridRow[];
4
+ selectedRowIds?: Iterable<string | number> | null;
5
+ onRowSelect?: (row: GridRow) => void;
6
+ getRowId?: (row: GridRow) => string | number;
7
+ }
8
+ export declare const useSelection: ({ data, selectedRowIds, onRowSelect, getRowId, }: UseSelectionProps) => {
9
+ selectedRows: Set<string | number>;
10
+ handleRowSelect: (rowId: string | number, isSelected: boolean) => void;
11
+ handleSelectAll: (isSelected: boolean) => void;
12
+ };
13
+ export {};
@@ -0,0 +1,17 @@
1
+ import { UIEvent } from "react";
2
+ import { VirtualizedRange, GridRow } from "../types";
3
+ interface UseVirtualizationProps {
4
+ data: GridRow[];
5
+ virtualized?: boolean;
6
+ rowHeight?: number;
7
+ overscan?: number;
8
+ height: number;
9
+ }
10
+ export declare const useVirtualization: ({ data, virtualized, rowHeight, overscan, height, }: UseVirtualizationProps) => {
11
+ scrollRef: import("react").MutableRefObject<HTMLDivElement>;
12
+ virtualizedRange: VirtualizedRange;
13
+ visibleData: GridRow[];
14
+ totalHeight: number;
15
+ handleScroll: (e: UIEvent<HTMLDivElement>) => void;
16
+ };
17
+ export {};
@@ -0,0 +1,54 @@
1
+ /**
2
+ * KDGrid Icon Library
3
+ *
4
+ * Hand-crafted inline SVG icons — zero external dependency.
5
+ * Every icon accepts standard SVG props (className, style, etc.)
6
+ * and defaults to currentColor so they inherit text color.
7
+ *
8
+ * All icons are 24×24 viewBox and stroke-based (strokeWidth=2),
9
+ * matching Lucide's visual style exactly.
10
+ */
11
+ import type { SVGProps } from "react";
12
+ type IconProps = SVGProps<SVGSVGElement> & {
13
+ size?: number;
14
+ };
15
+ export declare const ChevronLeft: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const ChevronRight: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const ChevronDown: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const ChevronsLeft: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const ChevronsRight: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const ArrowUp: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const ArrowDown: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const ArrowUpDown: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const X: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const Check: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const Copy: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const Edit: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const Trash2: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const Archive: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const Download: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
30
+ export declare const Menu: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const Filter: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
32
+ export declare const FilterX: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const Settings: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const Pin: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
35
+ export declare const PinOff: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const Group: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const Ungroup: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const MoreHorizontal: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
39
+ export declare const Eye: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
40
+ export declare const EyeOff: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
41
+ export declare const Search: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
42
+ export declare const Database: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
43
+ export declare const FileText: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
44
+ export declare const Table: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
45
+ export declare const Users: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
46
+ export declare const LocateFixed: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
47
+ export declare const Loader2: (p: IconProps) => import("react/jsx-runtime").JSX.Element;
48
+ /**
49
+ * Classic CSS-framework spinner — fill-based, works with `animate-spin`.
50
+ * A faint full ring (opacity-25) + a solid quarter-arc (opacity-75).
51
+ * Uses fill="currentColor" so colour is inherited from text / className.
52
+ */
53
+ export declare const Spinner: ({ size, className, style, ...rest }: IconProps) => import("react/jsx-runtime").JSX.Element;
54
+ export {};
@@ -0,0 +1,12 @@
1
+ export { KDGrid } from "./core/DataGrid";
2
+ export type { KDGridProps, KDGridRef, GridColumn, GridRow, Density, SortConfig, SortDirection, PaginationConfig, PaginationOptions, ExportOptions, PerformanceConfig, InfiniteScrollOptions, GroupConfig, ActiveFilters, ColumnFilterValue, ColumnFilter, FilterType, ColumnConfig, ContextMenuItem, BulkActionOption, SavedFilter, SearchMode, ExportFormat, RowEventParams, CellClickParams, CellContextMenuParams, CellFocusParams, CellEditParams, CellSelectionPayload, CopyCellsPayload, } from "./types";
3
+ export { usePagination } from "./hooks/usePagination";
4
+ export { useVirtualization } from "./hooks/useVirtualization";
5
+ export { useSelection } from "./hooks/useSelection";
6
+ export { useAdvancedFiltering } from "./hooks/useAdvancedFiltering";
7
+ export { setLicenseKey } from "./utils/license";
8
+ export { PaginationControls } from "./components/PaginationControls";
9
+ export { GridHeader } from "./components/GridHeader";
10
+ export { GridRows } from "./components/GridRows";
11
+ export { SearchToolbar } from "./components/SearchToolbar";
12
+ export { FooterAggregate } from "./components/FooterAggregate";