@ricsam/react-spreadsheets 0.0.7 → 0.0.8
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/README.md +64 -1
- package/dist/cjs/lib.cjs +302 -46
- package/dist/cjs/lib.cjs.map +4 -4
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/lib.mjs +303 -47
- package/dist/mjs/lib.mjs.map +4 -4
- package/dist/mjs/package.json +1 -1
- package/dist/styles.css +36 -0
- package/dist/types/lib.d.ts +2 -1
- package/dist/types/spreadsheet/spreadsheet.d.ts +13 -1
- package/package.json +3 -3
package/dist/mjs/package.json
CHANGED
package/dist/styles.css
CHANGED
|
@@ -150,6 +150,7 @@
|
|
|
150
150
|
--_rsp-accent-contrast: var(--rsp-accent-contrast, #ffffff);
|
|
151
151
|
--_rsp-selection-bg: var(--rsp-selection-bg, var(--rsp-light, #e8f2fe) var(--rsp-dark, #17304f));
|
|
152
152
|
--_rsp-selection-range-bg: var(--rsp-selection-range-bg, var(--rsp-light, #f1f7fe) var(--rsp-dark, #14263d));
|
|
153
|
+
--_rsp-reference-accent: var(--rsp-reference-accent, var(--rsp-light, #f97316) var(--rsp-dark, #fb923c));
|
|
153
154
|
--_rsp-hover-bg: var(--rsp-hover-bg, var(--rsp-light, #f5f7fa) var(--rsp-dark, #1c2436));
|
|
154
155
|
--_rsp-focus-ring: var(--rsp-focus-ring, var(--rsp-light, rgba(33, 150, 243, 0.22)) var(--rsp-dark, rgba(88, 166, 255, 0.28)));
|
|
155
156
|
|
|
@@ -276,6 +277,41 @@
|
|
|
276
277
|
z-index: 2;
|
|
277
278
|
}
|
|
278
279
|
|
|
280
|
+
/* Formula references are not primary selections. They live in one independent
|
|
281
|
+
overlay so table fills, conditional styles and the selected-cell perimeter
|
|
282
|
+
remain untouched. Four animated gradients create Excel-like marching ants. */
|
|
283
|
+
.rsp-reference-selection {
|
|
284
|
+
position: absolute;
|
|
285
|
+
z-index: 4;
|
|
286
|
+
pointer-events: none;
|
|
287
|
+
background-image:
|
|
288
|
+
linear-gradient(90deg, var(--_rsp-reference-accent) 50%, transparent 50%),
|
|
289
|
+
linear-gradient(90deg, var(--_rsp-reference-accent) 50%, transparent 50%),
|
|
290
|
+
linear-gradient(0deg, var(--_rsp-reference-accent) 50%, transparent 50%),
|
|
291
|
+
linear-gradient(0deg, var(--_rsp-reference-accent) 50%, transparent 50%);
|
|
292
|
+
background-position: 0 0, 0 100%, 0 0, 100% 0;
|
|
293
|
+
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
|
|
294
|
+
background-size: 8px 2px, 8px 2px, 2px 8px, 2px 8px;
|
|
295
|
+
filter: drop-shadow(0 0 1px var(--_rsp-bg));
|
|
296
|
+
animation: rsp-reference-marching-ants 480ms linear infinite;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.rsp-reference-selection-selecting {
|
|
300
|
+
opacity: 0.9;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@keyframes rsp-reference-marching-ants {
|
|
304
|
+
to {
|
|
305
|
+
background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@media (prefers-reduced-motion: reduce) {
|
|
310
|
+
.rsp-reference-selection {
|
|
311
|
+
animation: none;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
279
315
|
/* The editor surface must win over the selection tint above (equal specificity
|
|
280
316
|
would otherwise leave the selected-cell background showing through), and over
|
|
281
317
|
a consumer background so the text being typed stays legible. */
|
package/dist/types/lib.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* Remember to import the stylesheet once in your app:
|
|
9
9
|
* import "@ricsam/react-spreadsheets/styles.css";
|
|
10
10
|
*/
|
|
11
|
-
export { Spreadsheet, type SpreadsheetProps, type SpreadsheetRef, type SpreadsheetChild, type SpreadsheetChildInitial, type SpreadsheetChildState, type SpreadsheetComponent, } from "./spreadsheet/spreadsheet";
|
|
11
|
+
export { Spreadsheet, type SpreadsheetProps, type SpreadsheetRef, type SpreadsheetScrollAlignment, type SpreadsheetScrollToCellOptions, type SpreadsheetChild, type SpreadsheetChildInitial, type SpreadsheetChildState, type SpreadsheetComponent, } from "./spreadsheet/spreadsheet";
|
|
12
|
+
export type { SelectionNavigationModel } from "@ricsam/selection-manager";
|
|
12
13
|
export { FormulaSheet, FormulaWorkbook, WorkbookClipboardManager, WorkbookSelectionManager, } from "./workbook/workbook";
|
|
13
14
|
export { coerceCellInput, getCellDisplayText, getCellDisplayValue, } from "./workbook/cell-data-type";
|
|
14
15
|
export { normalizeBorderSides, hasAnyBorderSide, type BorderSides, type NormalizedBorderSides, } from "./workbook/border-sides";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Format, SelectionManager, type SelectionManagerState } from '@ricsam/selection-manager';
|
|
1
|
+
import { type Format, SelectionManager, type SelectionNavigationModel, type SelectionManagerState, type SMCell } from '@ricsam/selection-manager';
|
|
2
2
|
import React, { type ReactNode } from 'react';
|
|
3
3
|
import type { CellRenderContext, SerializedCellValue, SpreadsheetColumnWidths, SpreadsheetRowHeights } from '../types';
|
|
4
4
|
import { type CellSnapAnchor } from './snapping';
|
|
@@ -39,6 +39,10 @@ export interface SpreadsheetProps {
|
|
|
39
39
|
cellData?: Map<string, SerializedCellValue>;
|
|
40
40
|
onCellDataChange?: (data: Map<string, SerializedCellValue>) => void;
|
|
41
41
|
onCellDataChangeError?: (error: unknown) => void;
|
|
42
|
+
/** Finite number of rows. Omit for an unbounded sheet. */
|
|
43
|
+
rowCount?: number;
|
|
44
|
+
/** Finite number of columns. Omit for an unbounded sheet. */
|
|
45
|
+
columnCount?: number;
|
|
42
46
|
columnWidths?: SpreadsheetColumnWidths;
|
|
43
47
|
onColumnWidthsChange?: (columnWidths: SpreadsheetColumnWidths) => void;
|
|
44
48
|
rowHeights?: SpreadsheetRowHeights;
|
|
@@ -62,6 +66,8 @@ export interface SpreadsheetProps {
|
|
|
62
66
|
onStateChange?: (state: SelectionManagerState) => void;
|
|
63
67
|
effects?: (selectionManager: SelectionManager) => (() => void) | void;
|
|
64
68
|
formats?: Format[];
|
|
69
|
+
/** Data- and table-aware keyboard navigation hooks. */
|
|
70
|
+
navigation?: SelectionNavigationModel;
|
|
65
71
|
};
|
|
66
72
|
components?: Record<string, SpreadsheetComponent>;
|
|
67
73
|
overlayChildren?: SpreadsheetChild[];
|
|
@@ -79,9 +85,15 @@ export interface SpreadsheetProps {
|
|
|
79
85
|
/** Whether the parent component is selected (used to gate overlay selection) */
|
|
80
86
|
parentSelected?: boolean;
|
|
81
87
|
}
|
|
88
|
+
export type SpreadsheetScrollAlignment = 'nearest' | 'start' | 'end';
|
|
89
|
+
export interface SpreadsheetScrollToCellOptions {
|
|
90
|
+
align?: SpreadsheetScrollAlignment;
|
|
91
|
+
}
|
|
82
92
|
export interface SpreadsheetRef {
|
|
83
93
|
focus: () => void;
|
|
84
94
|
blur: () => void;
|
|
95
|
+
/** Reveal a zero-based cell without changing the selection. */
|
|
96
|
+
scrollToCell: (cell: SMCell, options?: SpreadsheetScrollToCellOptions) => void;
|
|
85
97
|
}
|
|
86
98
|
export declare const Spreadsheet: React.ForwardRefExoticComponent<SpreadsheetProps & {
|
|
87
99
|
disableClipboard?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/react-spreadsheets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Headless-friendly React spreadsheet and workbook components: infinite virtualized grid, zoom, resizing, clipboard, fill handles and formula-engine bindings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/mjs/lib.mjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@ricsam/formula-engine": ">=0.2.0",
|
|
46
|
-
"@ricsam/selection-manager": ">=0.0.
|
|
46
|
+
"@ricsam/selection-manager": ">=0.0.29",
|
|
47
47
|
"react": "^18 || ^19",
|
|
48
48
|
"react-dom": "^18 || ^19"
|
|
49
49
|
},
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@happy-dom/global-registrator": "^18.0.1",
|
|
57
57
|
"@ricsam/formula-engine": "^0.2.15",
|
|
58
|
-
"@ricsam/selection-manager": "^0.0.
|
|
58
|
+
"@ricsam/selection-manager": "^0.0.29",
|
|
59
59
|
"@testing-library/react": "^16.3.0",
|
|
60
60
|
"@types/bun": "latest",
|
|
61
61
|
"@types/react": "^19",
|