@ricsam/react-spreadsheets 0.0.0 → 0.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.
package/README.md CHANGED
@@ -1,45 +1,145 @@
1
1
  # @ricsam/react-spreadsheets
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@ricsam/react-spreadsheets`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**
3
+ React spreadsheet primitives: an infinitely scrollable, virtualized grid with
4
+ selection, inline editing, clipboard, fill handles, column/row resizing and
5
+ floating overlays — plus optional bindings for
6
+ [`@ricsam/formula-engine`](https://github.com/ricsam/formula-engine).
7
+
8
+ - **Infinite grid** — rows and columns are unbounded; only visible cells render.
9
+ - **Canvas gridlines + DOM cells** — crisp lines, fully stylable cells.
10
+ - **Zero styling dependencies** — one plain CSS file themed with custom properties.
11
+ - **Bring your own state** — controlled or uncontrolled cell data.
12
+ - **Optional formula engine** — drop in `FormulaSheet` / `FormulaWorkbook` for
13
+ formulas, spill ranges, tables, styles and multi-sheet workbooks.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ bun add @ricsam/react-spreadsheets @ricsam/selection-manager
19
+ # optional, for the formula-aware components
20
+ bun add @ricsam/formula-engine
21
+ ```
22
+
23
+ `react`, `react-dom` and `@ricsam/selection-manager` are peer dependencies.
24
+
25
+ ## Usage
26
+
27
+ Import the stylesheet once, near your app root:
28
+
29
+ ```ts
30
+ import "@ricsam/react-spreadsheets/styles.css";
31
+ ```
32
+
33
+ ### Standalone grid
34
+
35
+ ```tsx
36
+ import { useState } from "react";
37
+ import { Spreadsheet, type SerializedCellValue } from "@ricsam/react-spreadsheets";
38
+ import "@ricsam/react-spreadsheets/styles.css";
39
+
40
+ export function Demo() {
41
+ const [cells, setCells] = useState<Map<string, SerializedCellValue>>(
42
+ () => new Map([["A1", "Region"], ["B1", "Revenue"], ["A2", "EMEA"], ["B2", 120]]),
43
+ );
44
+
45
+ return (
46
+ <Spreadsheet
47
+ style={{ height: 480 }}
48
+ cellData={cells}
49
+ onCellDataChange={setCells}
50
+ />
51
+ );
52
+ }
53
+ ```
54
+
55
+ ### With the formula engine
56
+
57
+ ```tsx
58
+ import { FormulaEngine } from "@ricsam/formula-engine";
59
+ import { FormulaSheet } from "@ricsam/react-spreadsheets";
60
+ import "@ricsam/react-spreadsheets/styles.css";
61
+
62
+ const engine = FormulaEngine.buildEmpty();
63
+ engine.addWorkbook("Workbook1");
64
+ engine.addSheet({ workbookName: "Workbook1", sheetName: "Sheet1" });
65
+ engine.setSheetContent(
66
+ { workbookName: "Workbook1", sheetName: "Sheet1" },
67
+ new Map([
68
+ ["A1", 10],
69
+ ["A2", 20],
70
+ ["A3", "=SUM(A1:A2)"], // renders 30
71
+ ]),
72
+ );
73
+
74
+ export function Demo() {
75
+ return (
76
+ <FormulaSheet
77
+ engine={engine}
78
+ workbookName="Workbook1"
79
+ sheetName="Sheet1"
80
+ style={{ height: 480 }}
81
+ />
82
+ );
83
+ }
84
+ ```
85
+
86
+ `FormulaWorkbook` adds Excel-style sheet tabs, renaming, deletion and zoom on
87
+ top of `FormulaSheet`.
88
+
89
+ ## Theming
90
+
91
+ All colors, fonts and sizes are CSS custom properties declared on `.rsp-root`.
92
+ Override them anywhere in your cascade:
93
+
94
+ ```css
95
+ .rsp-root {
96
+ --rsp-accent: #7c3aed;
97
+ --rsp-bg: #ffffff;
98
+ --rsp-header-bg: #f4f4f5;
99
+ --rsp-cell-font-size: 13px;
100
+ }
101
+ ```
102
+
103
+ Light and dark are resolved automatically with `light-dark()`. To pin a subtree
104
+ to one mode, set `color-scheme: light` (or `dark`) on `.rsp-root`; canvas
105
+ gridlines follow the same setting.
106
+
107
+ Per-cell styling is done in JS:
108
+
109
+ ```tsx
110
+ <Spreadsheet
111
+ cellData={cells}
112
+ customCellStyle={(cell) =>
113
+ typeof cell.value === "number" && cell.value < 0
114
+ ? { color: "#dc2626", fontWeight: 600 }
115
+ : {}
116
+ }
117
+ customCellRenderer={(cell) => <span>{String(cell.value ?? "")}</span>}
118
+ />
119
+ ```
120
+
121
+ ## Key props
122
+
123
+ | Prop | Description |
124
+ | --- | --- |
125
+ | `cellData` | `Map<string, SerializedCellValue>` keyed by A1 reference. Omit for uncontrolled mode. |
126
+ | `onCellDataChange` | Called with the next map after an edit, paste or fill. |
127
+ | `columnWidths` / `rowHeights` | Controlled sizing, keyed by column letter / 1-based row. |
128
+ | `customCellStyle` | Per-cell `CSSProperties`. |
129
+ | `customCellRenderer` | Per-cell React node. |
130
+ | `parseValue` | Coerce raw editor strings (e.g. text → number) before storing. |
131
+ | `selection` | Selection state, callbacks and `effects(selectionManager)` for copy/paste/fill hooks. |
132
+ | `components` + `overlayChildren` | Floating overlays anchored to the grid, optionally snapped to cell edges. |
133
+
134
+ ## Development
135
+
136
+ ```bash
137
+ bun install
138
+ bun test # unit + React rendering tests
139
+ bun run typecheck
140
+ bun run build # emits dist/{mjs,cjs,types} + styles.css
141
+ ```
142
+
143
+ ## License
144
+
145
+ MIT