@dynostack/react-grid 0.3.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Column, RowData, ColumnDef, SortingState, ColumnFiltersState, ColumnPinningState, VisibilityState, Table, CellContext, FilterFn } from '@tanstack/react-table';
3
1
  import * as React$1 from 'react';
4
2
  import { CSSProperties } from 'react';
3
+ import { Column, RowData, ColumnDef, SortingState, ColumnFiltersState, ColumnPinningState, VisibilityState, Table, CellContext, FilterFn } from '@tanstack/react-table';
5
4
 
6
5
  type RowActionId = "view" | "edit" | "duplicate" | "delete" | string;
7
6
  type CustomRowAction<TData> = {
@@ -20,7 +19,7 @@ type DataTableRowActionsProps<TData> = {
20
19
  onSaveEdit?: () => void;
21
20
  onCancelEdit?: () => void;
22
21
  };
23
- declare function DataTableRowActions<TData>({ row, actions, customActions, onAction, isEditing, onSaveEdit, onCancelEdit, }: DataTableRowActionsProps<TData>): react_jsx_runtime.JSX.Element;
22
+ declare function DataTableRowActions<TData>({ row, actions, customActions, onAction, isEditing, onSaveEdit, onCancelEdit, }: DataTableRowActionsProps<TData>): React$1.JSX.Element;
24
23
 
25
24
  /**
26
25
  * CSS variable overrides for a single DataTable instance.
@@ -119,6 +118,54 @@ declare function tokensToCssBlock(tokens?: DataTableTokens): string;
119
118
  */
120
119
  declare const themePresets: {
121
120
  neutral: DataTableModedTheme;
121
+ graphite: {
122
+ light: {
123
+ background: string;
124
+ card: string;
125
+ border: string;
126
+ radius: string;
127
+ fontFamily: string;
128
+ foreground?: string;
129
+ cardForeground?: string;
130
+ popover?: string;
131
+ popoverForeground?: string;
132
+ primary?: string;
133
+ primaryForeground?: string;
134
+ secondary?: string;
135
+ secondaryForeground?: string;
136
+ muted?: string;
137
+ mutedForeground?: string;
138
+ accent?: string;
139
+ accentForeground?: string;
140
+ destructive?: string;
141
+ destructiveForeground?: string;
142
+ input?: string;
143
+ ring?: string;
144
+ };
145
+ dark: {
146
+ background: string;
147
+ card: string;
148
+ popover: string;
149
+ border: string;
150
+ input: string;
151
+ muted: string;
152
+ mutedForeground: string;
153
+ accent: string;
154
+ primary: string;
155
+ primaryForeground: string;
156
+ ring: string;
157
+ destructive: string;
158
+ radius: string;
159
+ fontFamily: string;
160
+ foreground?: string;
161
+ cardForeground?: string;
162
+ popoverForeground?: string;
163
+ secondary?: string;
164
+ secondaryForeground?: string;
165
+ accentForeground?: string;
166
+ destructiveForeground?: string;
167
+ };
168
+ };
122
169
  light: {
123
170
  light: DataTableTokens | undefined;
124
171
  };
@@ -357,6 +404,18 @@ type DataTableProps<TData extends {
357
404
  pageSizeOptions?: number[];
358
405
  initialColumnPinning?: ColumnPinningState;
359
406
  initialColumnVisibility?: VisibilityState;
407
+ /** Initial sort order. */
408
+ initialSorting?: SortingState;
409
+ /** Observe selected row objects (loaded rows only in server mode). */
410
+ onSelectionChange?: (rows: TData[]) => void;
411
+ /** Accessible table name. */
412
+ ariaLabel?: string;
413
+ /** Alternating row backgrounds. */
414
+ striped?: boolean;
415
+ /** Keep headers visible inside a vertically constrained table. */
416
+ stickyHeader?: boolean;
417
+ /** Scroll viewport height, e.g. "480px". */
418
+ maxHeight?: React.CSSProperties["maxHeight"];
360
419
  /** Optional controlled global filter (for cross-tab persistence). */
361
420
  globalFilter?: string;
362
421
  onGlobalFilterChange?: (value: string) => void;
@@ -396,7 +455,7 @@ type DataTableProps<TData extends {
396
455
  };
397
456
  declare function DataTable<TData extends {
398
457
  id: string | number;
399
- }>({ data, columns, dataSource, isLoading, isFetching, onRefresh, totalRecords, exportFileName, enableSelection, renderSubRow, getSubRows, rowActions, customRowActions, onRowAction, onCellEdit, onRowSave, onAddRow, onBulkDelete, initialPageSize, pageSizeOptions, initialColumnPinning, initialColumnVisibility, globalFilter: globalFilterProp, onGlobalFilterChange, className, toolbarSlot, features, labels: labelsProp, density, theme, isolate, onView, onDelete, viewSheet, confirmDelete, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
458
+ }>({ data, columns, dataSource, isLoading, isFetching, onRefresh, totalRecords, exportFileName, enableSelection, renderSubRow, getSubRows, rowActions, customRowActions, onRowAction, onCellEdit, onRowSave, onAddRow, onBulkDelete, initialPageSize, pageSizeOptions, initialColumnPinning, initialColumnVisibility, initialSorting, onSelectionChange, ariaLabel, striped, stickyHeader, maxHeight, globalFilter: globalFilterProp, onGlobalFilterChange, className, toolbarSlot, features, labels: labelsProp, density, theme, isolate, onView, onDelete, viewSheet, confirmDelete, }: DataTableProps<TData>): React$1.JSX.Element;
400
459
 
401
460
  /**
402
461
  * Shared portal container for every overlay inside a DataTable (popover,
@@ -426,13 +485,13 @@ type Props$2<TData, TValue> = {
426
485
  column: Column<TData, TValue>;
427
486
  title: string;
428
487
  };
429
- declare function DataTableColumnHeader<TData, TValue>({ column, title, }: Props$2<TData, TValue>): react_jsx_runtime.JSX.Element;
488
+ declare function DataTableColumnHeader<TData, TValue>({ column, title, }: Props$2<TData, TValue>): React$1.JSX.Element;
430
489
 
431
490
  type Props$1<TData> = {
432
491
  table: Table<TData>;
433
492
  pageSizeOptions?: number[];
434
493
  };
435
- declare function DataTablePagination<TData>({ table, pageSizeOptions, }: Props$1<TData>): react_jsx_runtime.JSX.Element;
494
+ declare function DataTablePagination<TData>({ table, pageSizeOptions, }: Props$1<TData>): React$1.JSX.Element;
436
495
 
437
496
  type ToolbarFeatureFlags = {
438
497
  search?: boolean;
@@ -468,7 +527,7 @@ type Props<TData> = {
468
527
  features?: ToolbarFeatureFlags;
469
528
  labels?: ToolbarLabels;
470
529
  };
471
- declare function DataTableToolbar<TData>({ table, totalRecords, isFetching, onRefresh, onAddRow, onBulkDelete, exportFileName, globalFilter, onGlobalFilterChange, toolbarSlot, features, labels: labelsProp, }: Props<TData>): react_jsx_runtime.JSX.Element;
530
+ declare function DataTableToolbar<TData>({ table, totalRecords, isFetching, onRefresh, onAddRow, onBulkDelete, exportFileName, globalFilter, onGlobalFilterChange, toolbarSlot, features, labels: labelsProp, }: Props<TData>): React$1.JSX.Element;
472
531
 
473
532
  type EditableCellProps<TData, TValue> = CellContext<TData, TValue> & {
474
533
  isEditing: boolean;
@@ -478,7 +537,7 @@ type EditableCellProps<TData, TValue> = CellContext<TData, TValue> & {
478
537
  onCancel: () => void;
479
538
  onStartEdit: () => void;
480
539
  };
481
- declare function EditableCell<TData, TValue>({ getValue, column, row, isEditing, autoOpen, onCommit, onCancel, onStartEdit, }: EditableCellProps<TData, TValue>): react_jsx_runtime.JSX.Element;
540
+ declare function EditableCell<TData, TValue>({ getValue, column, row, isEditing, autoOpen, onCommit, onCancel, onStartEdit, }: EditableCellProps<TData, TValue>): React$1.JSX.Element;
482
541
 
483
542
  type TextOp = "contains" | "notContains" | "equals" | "notEqual" | "startsWith" | "endsWith" | "blank" | "notBlank";
484
543
  type NumberOp = "equals" | "notEqual" | "lessThan" | "lessThanOrEqual" | "greaterThan" | "greaterThanOrEqual" | "inRange" | "blank" | "notBlank";
@@ -507,9 +566,11 @@ type CommonProps<TData, TValue> = {
507
566
  column: Column<TData, TValue>;
508
567
  onClose: () => void;
509
568
  };
510
- declare function ColumnFilterPanel<TData, TValue>(props: CommonProps<TData, TValue>): react_jsx_runtime.JSX.Element | null;
569
+ declare function ColumnFilterPanel<TData, TValue>(props: CommonProps<TData, TValue>): React$1.JSX.Element | null;
511
570
 
571
+ /** Neutralize spreadsheet formulas in untrusted text; preserve real numbers. */
572
+ declare function sanitizeSpreadsheetValue(value: unknown): string;
512
573
  declare function exportToCsv<TData>(table: Table<TData>, fileName?: string): void;
513
574
  declare function exportToExcel<TData>(table: Table<TData>, fileName?: string): void;
514
575
 
515
- export { type AdvFilter, type CellEditorType, ColumnFilterPanel, type Combine, type Condition, type ConfirmDeleteConfig, type ConfirmDeleteContext, type CustomRowAction, DataTable, type DataTableColumn, DataTableColumnHeader, type DataTableDataSource, type DataTableDataSourceResult, type DataTableDensity, type DataTableErrorContext, type DataTableFeatures, type DataTableFetchParams, type DataTableLabels, type DataTableModedTheme, DataTablePagination, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, type DataTableTheme, type DataTableThemeName, type DataTableTokens, DataTableToolbar, type DateOp, EditableCell, type FilterType, ISOLATE_DARK_TOKENS, ISOLATE_LIGHT_TOKENS, type NumberOp, PortalContainerContext, type RowAction, type RowActionId, type SelectOption, type SetFilter, type TextOp, type ViewSheetConfig, type ViewSheetDensity, type ViewSheetLabels, booleanFilterFn, buildPreset, dateFilterFn, exportToCsv, exportToExcel, isFilterActive, numberFilterFn, setFilterFn, splitTheme, textFilterFn, themePresets, themeToStyle, tokensToCssBlock, tokensToStyle, usePortalContainer };
576
+ export { type AdvFilter, type CellEditorType, ColumnFilterPanel, type Combine, type Condition, type ConfirmDeleteConfig, type ConfirmDeleteContext, type CustomRowAction, DataTable, type DataTableColumn, DataTableColumnHeader, type DataTableDataSource, type DataTableDataSourceResult, type DataTableDensity, type DataTableErrorContext, type DataTableFeatures, type DataTableFetchParams, type DataTableLabels, type DataTableModedTheme, DataTablePagination, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, type DataTableTheme, type DataTableThemeName, type DataTableTokens, DataTableToolbar, type DateOp, EditableCell, type FilterType, ISOLATE_DARK_TOKENS, ISOLATE_LIGHT_TOKENS, type NumberOp, PortalContainerContext, type RowAction, type RowActionId, type SelectOption, type SetFilter, type TextOp, type ViewSheetConfig, type ViewSheetDensity, type ViewSheetLabels, booleanFilterFn, buildPreset, dateFilterFn, exportToCsv, exportToExcel, isFilterActive, numberFilterFn, sanitizeSpreadsheetValue, setFilterFn, splitTheme, textFilterFn, themePresets, themeToStyle, tokensToCssBlock, tokensToStyle, usePortalContainer };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Column, RowData, ColumnDef, SortingState, ColumnFiltersState, ColumnPinningState, VisibilityState, Table, CellContext, FilterFn } from '@tanstack/react-table';
3
1
  import * as React$1 from 'react';
4
2
  import { CSSProperties } from 'react';
3
+ import { Column, RowData, ColumnDef, SortingState, ColumnFiltersState, ColumnPinningState, VisibilityState, Table, CellContext, FilterFn } from '@tanstack/react-table';
5
4
 
6
5
  type RowActionId = "view" | "edit" | "duplicate" | "delete" | string;
7
6
  type CustomRowAction<TData> = {
@@ -20,7 +19,7 @@ type DataTableRowActionsProps<TData> = {
20
19
  onSaveEdit?: () => void;
21
20
  onCancelEdit?: () => void;
22
21
  };
23
- declare function DataTableRowActions<TData>({ row, actions, customActions, onAction, isEditing, onSaveEdit, onCancelEdit, }: DataTableRowActionsProps<TData>): react_jsx_runtime.JSX.Element;
22
+ declare function DataTableRowActions<TData>({ row, actions, customActions, onAction, isEditing, onSaveEdit, onCancelEdit, }: DataTableRowActionsProps<TData>): React$1.JSX.Element;
24
23
 
25
24
  /**
26
25
  * CSS variable overrides for a single DataTable instance.
@@ -119,6 +118,54 @@ declare function tokensToCssBlock(tokens?: DataTableTokens): string;
119
118
  */
120
119
  declare const themePresets: {
121
120
  neutral: DataTableModedTheme;
121
+ graphite: {
122
+ light: {
123
+ background: string;
124
+ card: string;
125
+ border: string;
126
+ radius: string;
127
+ fontFamily: string;
128
+ foreground?: string;
129
+ cardForeground?: string;
130
+ popover?: string;
131
+ popoverForeground?: string;
132
+ primary?: string;
133
+ primaryForeground?: string;
134
+ secondary?: string;
135
+ secondaryForeground?: string;
136
+ muted?: string;
137
+ mutedForeground?: string;
138
+ accent?: string;
139
+ accentForeground?: string;
140
+ destructive?: string;
141
+ destructiveForeground?: string;
142
+ input?: string;
143
+ ring?: string;
144
+ };
145
+ dark: {
146
+ background: string;
147
+ card: string;
148
+ popover: string;
149
+ border: string;
150
+ input: string;
151
+ muted: string;
152
+ mutedForeground: string;
153
+ accent: string;
154
+ primary: string;
155
+ primaryForeground: string;
156
+ ring: string;
157
+ destructive: string;
158
+ radius: string;
159
+ fontFamily: string;
160
+ foreground?: string;
161
+ cardForeground?: string;
162
+ popoverForeground?: string;
163
+ secondary?: string;
164
+ secondaryForeground?: string;
165
+ accentForeground?: string;
166
+ destructiveForeground?: string;
167
+ };
168
+ };
122
169
  light: {
123
170
  light: DataTableTokens | undefined;
124
171
  };
@@ -357,6 +404,18 @@ type DataTableProps<TData extends {
357
404
  pageSizeOptions?: number[];
358
405
  initialColumnPinning?: ColumnPinningState;
359
406
  initialColumnVisibility?: VisibilityState;
407
+ /** Initial sort order. */
408
+ initialSorting?: SortingState;
409
+ /** Observe selected row objects (loaded rows only in server mode). */
410
+ onSelectionChange?: (rows: TData[]) => void;
411
+ /** Accessible table name. */
412
+ ariaLabel?: string;
413
+ /** Alternating row backgrounds. */
414
+ striped?: boolean;
415
+ /** Keep headers visible inside a vertically constrained table. */
416
+ stickyHeader?: boolean;
417
+ /** Scroll viewport height, e.g. "480px". */
418
+ maxHeight?: React.CSSProperties["maxHeight"];
360
419
  /** Optional controlled global filter (for cross-tab persistence). */
361
420
  globalFilter?: string;
362
421
  onGlobalFilterChange?: (value: string) => void;
@@ -396,7 +455,7 @@ type DataTableProps<TData extends {
396
455
  };
397
456
  declare function DataTable<TData extends {
398
457
  id: string | number;
399
- }>({ data, columns, dataSource, isLoading, isFetching, onRefresh, totalRecords, exportFileName, enableSelection, renderSubRow, getSubRows, rowActions, customRowActions, onRowAction, onCellEdit, onRowSave, onAddRow, onBulkDelete, initialPageSize, pageSizeOptions, initialColumnPinning, initialColumnVisibility, globalFilter: globalFilterProp, onGlobalFilterChange, className, toolbarSlot, features, labels: labelsProp, density, theme, isolate, onView, onDelete, viewSheet, confirmDelete, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
458
+ }>({ data, columns, dataSource, isLoading, isFetching, onRefresh, totalRecords, exportFileName, enableSelection, renderSubRow, getSubRows, rowActions, customRowActions, onRowAction, onCellEdit, onRowSave, onAddRow, onBulkDelete, initialPageSize, pageSizeOptions, initialColumnPinning, initialColumnVisibility, initialSorting, onSelectionChange, ariaLabel, striped, stickyHeader, maxHeight, globalFilter: globalFilterProp, onGlobalFilterChange, className, toolbarSlot, features, labels: labelsProp, density, theme, isolate, onView, onDelete, viewSheet, confirmDelete, }: DataTableProps<TData>): React$1.JSX.Element;
400
459
 
401
460
  /**
402
461
  * Shared portal container for every overlay inside a DataTable (popover,
@@ -426,13 +485,13 @@ type Props$2<TData, TValue> = {
426
485
  column: Column<TData, TValue>;
427
486
  title: string;
428
487
  };
429
- declare function DataTableColumnHeader<TData, TValue>({ column, title, }: Props$2<TData, TValue>): react_jsx_runtime.JSX.Element;
488
+ declare function DataTableColumnHeader<TData, TValue>({ column, title, }: Props$2<TData, TValue>): React$1.JSX.Element;
430
489
 
431
490
  type Props$1<TData> = {
432
491
  table: Table<TData>;
433
492
  pageSizeOptions?: number[];
434
493
  };
435
- declare function DataTablePagination<TData>({ table, pageSizeOptions, }: Props$1<TData>): react_jsx_runtime.JSX.Element;
494
+ declare function DataTablePagination<TData>({ table, pageSizeOptions, }: Props$1<TData>): React$1.JSX.Element;
436
495
 
437
496
  type ToolbarFeatureFlags = {
438
497
  search?: boolean;
@@ -468,7 +527,7 @@ type Props<TData> = {
468
527
  features?: ToolbarFeatureFlags;
469
528
  labels?: ToolbarLabels;
470
529
  };
471
- declare function DataTableToolbar<TData>({ table, totalRecords, isFetching, onRefresh, onAddRow, onBulkDelete, exportFileName, globalFilter, onGlobalFilterChange, toolbarSlot, features, labels: labelsProp, }: Props<TData>): react_jsx_runtime.JSX.Element;
530
+ declare function DataTableToolbar<TData>({ table, totalRecords, isFetching, onRefresh, onAddRow, onBulkDelete, exportFileName, globalFilter, onGlobalFilterChange, toolbarSlot, features, labels: labelsProp, }: Props<TData>): React$1.JSX.Element;
472
531
 
473
532
  type EditableCellProps<TData, TValue> = CellContext<TData, TValue> & {
474
533
  isEditing: boolean;
@@ -478,7 +537,7 @@ type EditableCellProps<TData, TValue> = CellContext<TData, TValue> & {
478
537
  onCancel: () => void;
479
538
  onStartEdit: () => void;
480
539
  };
481
- declare function EditableCell<TData, TValue>({ getValue, column, row, isEditing, autoOpen, onCommit, onCancel, onStartEdit, }: EditableCellProps<TData, TValue>): react_jsx_runtime.JSX.Element;
540
+ declare function EditableCell<TData, TValue>({ getValue, column, row, isEditing, autoOpen, onCommit, onCancel, onStartEdit, }: EditableCellProps<TData, TValue>): React$1.JSX.Element;
482
541
 
483
542
  type TextOp = "contains" | "notContains" | "equals" | "notEqual" | "startsWith" | "endsWith" | "blank" | "notBlank";
484
543
  type NumberOp = "equals" | "notEqual" | "lessThan" | "lessThanOrEqual" | "greaterThan" | "greaterThanOrEqual" | "inRange" | "blank" | "notBlank";
@@ -507,9 +566,11 @@ type CommonProps<TData, TValue> = {
507
566
  column: Column<TData, TValue>;
508
567
  onClose: () => void;
509
568
  };
510
- declare function ColumnFilterPanel<TData, TValue>(props: CommonProps<TData, TValue>): react_jsx_runtime.JSX.Element | null;
569
+ declare function ColumnFilterPanel<TData, TValue>(props: CommonProps<TData, TValue>): React$1.JSX.Element | null;
511
570
 
571
+ /** Neutralize spreadsheet formulas in untrusted text; preserve real numbers. */
572
+ declare function sanitizeSpreadsheetValue(value: unknown): string;
512
573
  declare function exportToCsv<TData>(table: Table<TData>, fileName?: string): void;
513
574
  declare function exportToExcel<TData>(table: Table<TData>, fileName?: string): void;
514
575
 
515
- export { type AdvFilter, type CellEditorType, ColumnFilterPanel, type Combine, type Condition, type ConfirmDeleteConfig, type ConfirmDeleteContext, type CustomRowAction, DataTable, type DataTableColumn, DataTableColumnHeader, type DataTableDataSource, type DataTableDataSourceResult, type DataTableDensity, type DataTableErrorContext, type DataTableFeatures, type DataTableFetchParams, type DataTableLabels, type DataTableModedTheme, DataTablePagination, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, type DataTableTheme, type DataTableThemeName, type DataTableTokens, DataTableToolbar, type DateOp, EditableCell, type FilterType, ISOLATE_DARK_TOKENS, ISOLATE_LIGHT_TOKENS, type NumberOp, PortalContainerContext, type RowAction, type RowActionId, type SelectOption, type SetFilter, type TextOp, type ViewSheetConfig, type ViewSheetDensity, type ViewSheetLabels, booleanFilterFn, buildPreset, dateFilterFn, exportToCsv, exportToExcel, isFilterActive, numberFilterFn, setFilterFn, splitTheme, textFilterFn, themePresets, themeToStyle, tokensToCssBlock, tokensToStyle, usePortalContainer };
576
+ export { type AdvFilter, type CellEditorType, ColumnFilterPanel, type Combine, type Condition, type ConfirmDeleteConfig, type ConfirmDeleteContext, type CustomRowAction, DataTable, type DataTableColumn, DataTableColumnHeader, type DataTableDataSource, type DataTableDataSourceResult, type DataTableDensity, type DataTableErrorContext, type DataTableFeatures, type DataTableFetchParams, type DataTableLabels, type DataTableModedTheme, DataTablePagination, type DataTableProps, DataTableRowActions, type DataTableRowActionsProps, type DataTableTheme, type DataTableThemeName, type DataTableTokens, DataTableToolbar, type DateOp, EditableCell, type FilterType, ISOLATE_DARK_TOKENS, ISOLATE_LIGHT_TOKENS, type NumberOp, PortalContainerContext, type RowAction, type RowActionId, type SelectOption, type SetFilter, type TextOp, type ViewSheetConfig, type ViewSheetDensity, type ViewSheetLabels, booleanFilterFn, buildPreset, dateFilterFn, exportToCsv, exportToExcel, isFilterActive, numberFilterFn, sanitizeSpreadsheetValue, setFilterFn, splitTheme, textFilterFn, themePresets, themeToStyle, tokensToCssBlock, tokensToStyle, usePortalContainer };