@particle-academy/fancy-sheets 0.4.6 → 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
@@ -18,6 +18,20 @@ interface CellFormat {
18
18
  displayFormat?: CellDisplayFormat;
19
19
  /** Number of decimal places to display (for number/currency/percentage) */
20
20
  decimals?: number;
21
+ /** Background color (any CSS color value) */
22
+ backgroundColor?: string;
23
+ /** Font color (any CSS color value) */
24
+ color?: string;
25
+ /** Font size in pixels */
26
+ fontSize?: number;
27
+ /** Top border color (renders 1px solid) */
28
+ borderTop?: string;
29
+ /** Right border color */
30
+ borderRight?: string;
31
+ /** Bottom border color */
32
+ borderBottom?: string;
33
+ /** Left border color (renders 1px solid) */
34
+ borderLeft?: string;
21
35
  }
22
36
  /** A single cell's complete data */
23
37
  interface CellData {
@@ -76,6 +90,17 @@ interface SelectionState {
76
90
  ranges: CellRange[];
77
91
  }
78
92
 
93
+ /** Custom context menu item for right-click menus */
94
+ interface SpreadsheetContextMenuItem {
95
+ /** Display label */
96
+ label: string;
97
+ /** Called with the active cell address when the item is clicked */
98
+ onClick: (address: string) => void;
99
+ /** Whether the item is disabled — static or per-cell function */
100
+ disabled?: boolean | ((address: string) => boolean);
101
+ /** Render with danger styling */
102
+ danger?: boolean;
103
+ }
79
104
  interface SpreadsheetProps {
80
105
  children: ReactNode;
81
106
  className?: string;
@@ -95,6 +120,8 @@ interface SpreadsheetProps {
95
120
  rowHeight?: number;
96
121
  /** Read-only mode */
97
122
  readOnly?: boolean;
123
+ /** Custom context menu items appended after built-in items */
124
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
98
125
  }
99
126
  interface SpreadsheetContextValue {
100
127
  workbook: WorkbookData;
@@ -132,6 +159,8 @@ interface SpreadsheetContextValue {
132
159
  getColumnWidth: (col: number) => number;
133
160
  isCellSelected: (address: string) => boolean;
134
161
  isCellActive: (address: string) => boolean;
162
+ /** Custom context menu items from consumer */
163
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
135
164
  /** @internal drag-to-select state */
136
165
  _isDragging: React.RefObject<boolean>;
137
166
  }
@@ -147,8 +176,10 @@ declare namespace SpreadsheetGrid {
147
176
  interface SpreadsheetToolbarProps {
148
177
  children?: React.ReactNode;
149
178
  className?: string;
179
+ /** Additional toolbar content appended after default buttons */
180
+ extra?: React.ReactNode;
150
181
  }
151
- declare function SpreadsheetToolbar({ children, className }: SpreadsheetToolbarProps): react_jsx_runtime.JSX.Element;
182
+ declare function SpreadsheetToolbar({ children, className, extra }: SpreadsheetToolbarProps): react_jsx_runtime.JSX.Element;
152
183
  declare namespace SpreadsheetToolbar {
153
184
  var displayName: string;
154
185
  }
@@ -161,7 +192,7 @@ declare namespace SpreadsheetSheetTabs {
161
192
  var displayName: string;
162
193
  }
163
194
 
164
- declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, }: SpreadsheetProps): react_jsx_runtime.JSX.Element;
195
+ declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, contextMenuItems, }: SpreadsheetProps): react_jsx_runtime.JSX.Element;
165
196
  declare namespace SpreadsheetRoot {
166
197
  var displayName: string;
167
198
  }
@@ -173,6 +204,62 @@ declare const Spreadsheet: typeof SpreadsheetRoot & {
173
204
 
174
205
  declare function useSpreadsheet(): SpreadsheetContextValue;
175
206
 
207
+ interface SheetProps {
208
+ /** Single sheet data (controlled) */
209
+ data?: SheetData;
210
+ /** Called when sheet data changes */
211
+ onChange?: (data: SheetData) => void;
212
+ className?: string;
213
+ /** Number of columns (default: 26) */
214
+ columnCount?: number;
215
+ /** Number of rows (default: 100) */
216
+ rowCount?: number;
217
+ /** Default column width in px (default: 100) */
218
+ defaultColumnWidth?: number;
219
+ /** Row height in px (default: 28) */
220
+ rowHeight?: number;
221
+ /** Read-only mode */
222
+ readOnly?: boolean;
223
+ /** Custom context menu items */
224
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
225
+ }
226
+ declare function Sheet({ data, onChange, contextMenuItems, ...props }: SheetProps): react_jsx_runtime.JSX.Element;
227
+ declare namespace Sheet {
228
+ var displayName: string;
229
+ }
230
+
231
+ interface SheetWorkbookProps {
232
+ /** Controlled workbook data */
233
+ data?: WorkbookData;
234
+ /** Default data (uncontrolled) */
235
+ defaultData?: WorkbookData;
236
+ /** Called on any data change */
237
+ onChange?: (data: WorkbookData) => void;
238
+ className?: string;
239
+ /** Number of columns (default: 26) */
240
+ columnCount?: number;
241
+ /** Number of rows (default: 100) */
242
+ rowCount?: number;
243
+ /** Default column width in px (default: 100) */
244
+ defaultColumnWidth?: number;
245
+ /** Row height in px (default: 28) */
246
+ rowHeight?: number;
247
+ /** Read-only mode */
248
+ readOnly?: boolean;
249
+ /** Hide the toolbar (default: false) */
250
+ hideToolbar?: boolean;
251
+ /** Hide the sheet tabs (default: false) */
252
+ hideTabs?: boolean;
253
+ /** Extra content appended to the default toolbar */
254
+ toolbarExtra?: ReactNode;
255
+ /** Custom context menu items */
256
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
257
+ }
258
+ declare function SheetWorkbook({ hideToolbar, hideTabs, toolbarExtra, contextMenuItems, ...props }: SheetWorkbookProps): react_jsx_runtime.JSX.Element;
259
+ declare namespace SheetWorkbook {
260
+ var displayName: string;
261
+ }
262
+
176
263
  /** Convert 0-based column index to letter(s): 0="A", 25="Z", 26="AA" */
177
264
  declare function columnToLetter(col: number): string;
178
265
  /** Convert column letter(s) to 0-based index: "A"=0, "Z"=25, "AA"=26 */
@@ -197,4 +284,4 @@ declare function workbookToCSV(workbook: WorkbookData, sheetId?: string): string
197
284
  type FormulaRangeFunction = (args: CellValue[][]) => CellValue;
198
285
  declare function registerFunction(name: string, fn: FormulaRangeFunction): void;
199
286
 
200
- export { type CellAddress, type CellData, type CellFormat, type CellMap, type CellRange, type CellValue, type ColumnWidths, type MergedRegion, type SelectionState, type SheetData, Spreadsheet, type SpreadsheetContextValue, type SpreadsheetProps, type TextAlign, type WorkbookData, columnToLetter, createEmptySheet, createEmptyWorkbook, csvToWorkbook, letterToColumn, parseAddress, parseCSV, registerFunction, stringifyCSV, toAddress, useSpreadsheet, workbookToCSV };
287
+ export { type CellAddress, type CellData, type CellFormat, type CellMap, type CellRange, type CellValue, type ColumnWidths, type FormulaRangeFunction, type MergedRegion, type SelectionState, Sheet, type SheetData, type SheetProps, SheetWorkbook, type SheetWorkbookProps, Spreadsheet, type SpreadsheetContextMenuItem, type SpreadsheetContextValue, type SpreadsheetProps, type TextAlign, type WorkbookData, columnToLetter, createEmptySheet, createEmptyWorkbook, csvToWorkbook, letterToColumn, parseAddress, parseCSV, registerFunction, stringifyCSV, toAddress, useSpreadsheet, workbookToCSV };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,20 @@ interface CellFormat {
18
18
  displayFormat?: CellDisplayFormat;
19
19
  /** Number of decimal places to display (for number/currency/percentage) */
20
20
  decimals?: number;
21
+ /** Background color (any CSS color value) */
22
+ backgroundColor?: string;
23
+ /** Font color (any CSS color value) */
24
+ color?: string;
25
+ /** Font size in pixels */
26
+ fontSize?: number;
27
+ /** Top border color (renders 1px solid) */
28
+ borderTop?: string;
29
+ /** Right border color */
30
+ borderRight?: string;
31
+ /** Bottom border color */
32
+ borderBottom?: string;
33
+ /** Left border color (renders 1px solid) */
34
+ borderLeft?: string;
21
35
  }
22
36
  /** A single cell's complete data */
23
37
  interface CellData {
@@ -76,6 +90,17 @@ interface SelectionState {
76
90
  ranges: CellRange[];
77
91
  }
78
92
 
93
+ /** Custom context menu item for right-click menus */
94
+ interface SpreadsheetContextMenuItem {
95
+ /** Display label */
96
+ label: string;
97
+ /** Called with the active cell address when the item is clicked */
98
+ onClick: (address: string) => void;
99
+ /** Whether the item is disabled — static or per-cell function */
100
+ disabled?: boolean | ((address: string) => boolean);
101
+ /** Render with danger styling */
102
+ danger?: boolean;
103
+ }
79
104
  interface SpreadsheetProps {
80
105
  children: ReactNode;
81
106
  className?: string;
@@ -95,6 +120,8 @@ interface SpreadsheetProps {
95
120
  rowHeight?: number;
96
121
  /** Read-only mode */
97
122
  readOnly?: boolean;
123
+ /** Custom context menu items appended after built-in items */
124
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
98
125
  }
99
126
  interface SpreadsheetContextValue {
100
127
  workbook: WorkbookData;
@@ -132,6 +159,8 @@ interface SpreadsheetContextValue {
132
159
  getColumnWidth: (col: number) => number;
133
160
  isCellSelected: (address: string) => boolean;
134
161
  isCellActive: (address: string) => boolean;
162
+ /** Custom context menu items from consumer */
163
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
135
164
  /** @internal drag-to-select state */
136
165
  _isDragging: React.RefObject<boolean>;
137
166
  }
@@ -147,8 +176,10 @@ declare namespace SpreadsheetGrid {
147
176
  interface SpreadsheetToolbarProps {
148
177
  children?: React.ReactNode;
149
178
  className?: string;
179
+ /** Additional toolbar content appended after default buttons */
180
+ extra?: React.ReactNode;
150
181
  }
151
- declare function SpreadsheetToolbar({ children, className }: SpreadsheetToolbarProps): react_jsx_runtime.JSX.Element;
182
+ declare function SpreadsheetToolbar({ children, className, extra }: SpreadsheetToolbarProps): react_jsx_runtime.JSX.Element;
152
183
  declare namespace SpreadsheetToolbar {
153
184
  var displayName: string;
154
185
  }
@@ -161,7 +192,7 @@ declare namespace SpreadsheetSheetTabs {
161
192
  var displayName: string;
162
193
  }
163
194
 
164
- declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, }: SpreadsheetProps): react_jsx_runtime.JSX.Element;
195
+ declare function SpreadsheetRoot({ children, className, data, defaultData, onChange, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, contextMenuItems, }: SpreadsheetProps): react_jsx_runtime.JSX.Element;
165
196
  declare namespace SpreadsheetRoot {
166
197
  var displayName: string;
167
198
  }
@@ -173,6 +204,62 @@ declare const Spreadsheet: typeof SpreadsheetRoot & {
173
204
 
174
205
  declare function useSpreadsheet(): SpreadsheetContextValue;
175
206
 
207
+ interface SheetProps {
208
+ /** Single sheet data (controlled) */
209
+ data?: SheetData;
210
+ /** Called when sheet data changes */
211
+ onChange?: (data: SheetData) => void;
212
+ className?: string;
213
+ /** Number of columns (default: 26) */
214
+ columnCount?: number;
215
+ /** Number of rows (default: 100) */
216
+ rowCount?: number;
217
+ /** Default column width in px (default: 100) */
218
+ defaultColumnWidth?: number;
219
+ /** Row height in px (default: 28) */
220
+ rowHeight?: number;
221
+ /** Read-only mode */
222
+ readOnly?: boolean;
223
+ /** Custom context menu items */
224
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
225
+ }
226
+ declare function Sheet({ data, onChange, contextMenuItems, ...props }: SheetProps): react_jsx_runtime.JSX.Element;
227
+ declare namespace Sheet {
228
+ var displayName: string;
229
+ }
230
+
231
+ interface SheetWorkbookProps {
232
+ /** Controlled workbook data */
233
+ data?: WorkbookData;
234
+ /** Default data (uncontrolled) */
235
+ defaultData?: WorkbookData;
236
+ /** Called on any data change */
237
+ onChange?: (data: WorkbookData) => void;
238
+ className?: string;
239
+ /** Number of columns (default: 26) */
240
+ columnCount?: number;
241
+ /** Number of rows (default: 100) */
242
+ rowCount?: number;
243
+ /** Default column width in px (default: 100) */
244
+ defaultColumnWidth?: number;
245
+ /** Row height in px (default: 28) */
246
+ rowHeight?: number;
247
+ /** Read-only mode */
248
+ readOnly?: boolean;
249
+ /** Hide the toolbar (default: false) */
250
+ hideToolbar?: boolean;
251
+ /** Hide the sheet tabs (default: false) */
252
+ hideTabs?: boolean;
253
+ /** Extra content appended to the default toolbar */
254
+ toolbarExtra?: ReactNode;
255
+ /** Custom context menu items */
256
+ contextMenuItems?: SpreadsheetContextMenuItem[] | ((address: string) => SpreadsheetContextMenuItem[]);
257
+ }
258
+ declare function SheetWorkbook({ hideToolbar, hideTabs, toolbarExtra, contextMenuItems, ...props }: SheetWorkbookProps): react_jsx_runtime.JSX.Element;
259
+ declare namespace SheetWorkbook {
260
+ var displayName: string;
261
+ }
262
+
176
263
  /** Convert 0-based column index to letter(s): 0="A", 25="Z", 26="AA" */
177
264
  declare function columnToLetter(col: number): string;
178
265
  /** Convert column letter(s) to 0-based index: "A"=0, "Z"=25, "AA"=26 */
@@ -197,4 +284,4 @@ declare function workbookToCSV(workbook: WorkbookData, sheetId?: string): string
197
284
  type FormulaRangeFunction = (args: CellValue[][]) => CellValue;
198
285
  declare function registerFunction(name: string, fn: FormulaRangeFunction): void;
199
286
 
200
- export { type CellAddress, type CellData, type CellFormat, type CellMap, type CellRange, type CellValue, type ColumnWidths, type MergedRegion, type SelectionState, type SheetData, Spreadsheet, type SpreadsheetContextValue, type SpreadsheetProps, type TextAlign, type WorkbookData, columnToLetter, createEmptySheet, createEmptyWorkbook, csvToWorkbook, letterToColumn, parseAddress, parseCSV, registerFunction, stringifyCSV, toAddress, useSpreadsheet, workbookToCSV };
287
+ export { type CellAddress, type CellData, type CellFormat, type CellMap, type CellRange, type CellValue, type ColumnWidths, type FormulaRangeFunction, type MergedRegion, type SelectionState, Sheet, type SheetData, type SheetProps, SheetWorkbook, type SheetWorkbookProps, Spreadsheet, type SpreadsheetContextMenuItem, type SpreadsheetContextValue, type SpreadsheetProps, type TextAlign, type WorkbookData, columnToLetter, createEmptySheet, createEmptyWorkbook, csvToWorkbook, letterToColumn, parseAddress, parseCSV, registerFunction, stringifyCSV, toAddress, useSpreadsheet, workbookToCSV };
package/dist/index.js CHANGED
@@ -1836,6 +1836,21 @@ var Cell = memo(function Cell2({ address, row, col }) {
1836
1836
  if (cell?.format?.bold) formatStyle.fontWeight = "bold";
1837
1837
  if (cell?.format?.italic) formatStyle.fontStyle = "italic";
1838
1838
  if (cell?.format?.textAlign) formatStyle.textAlign = cell.format.textAlign;
1839
+ if (cell?.format?.backgroundColor) formatStyle.backgroundColor = cell.format.backgroundColor;
1840
+ if (cell?.format?.color) formatStyle.color = cell.format.color;
1841
+ if (cell?.format?.fontSize) formatStyle.fontSize = cell.format.fontSize;
1842
+ if (cell?.format?.borderTop) {
1843
+ formatStyle.borderTopWidth = 1;
1844
+ formatStyle.borderTopStyle = "solid";
1845
+ formatStyle.borderTopColor = cell.format.borderTop;
1846
+ }
1847
+ if (cell?.format?.borderRight) formatStyle.borderRightColor = cell.format.borderRight;
1848
+ if (cell?.format?.borderBottom) formatStyle.borderBottomColor = cell.format.borderBottom;
1849
+ if (cell?.format?.borderLeft) {
1850
+ formatStyle.borderLeftWidth = 1;
1851
+ formatStyle.borderLeftStyle = "solid";
1852
+ formatStyle.borderLeftColor = cell.format.borderLeft;
1853
+ }
1839
1854
  return /* @__PURE__ */ jsx(
1840
1855
  "div",
1841
1856
  {
@@ -1995,7 +2010,8 @@ function SpreadsheetGrid({ className }) {
1995
2010
  setFrozenCols,
1996
2011
  extendSelection,
1997
2012
  undo,
1998
- redo
2013
+ redo,
2014
+ contextMenuItems
1999
2015
  } = useSpreadsheet();
2000
2016
  const containerRef = useRef(null);
2001
2017
  const handleKeyDown = useCallback(
@@ -2188,14 +2204,31 @@ function SpreadsheetGrid({ className }) {
2188
2204
  /* @__PURE__ */ jsx(ContextMenu.Item, { onClick: () => {
2189
2205
  const col = parseAddress(selection.activeCell).col;
2190
2206
  setFrozenCols(activeSheet.frozenCols > 0 ? 0 : col);
2191
- }, disabled: readOnly, children: activeSheet.frozenCols > 0 ? "Unfreeze columns" : "Freeze columns left" })
2207
+ }, disabled: readOnly, children: activeSheet.frozenCols > 0 ? "Unfreeze columns" : "Freeze columns left" }),
2208
+ (() => {
2209
+ const items = typeof contextMenuItems === "function" ? contextMenuItems(selection.activeCell) : contextMenuItems;
2210
+ if (!items || items.length === 0) return null;
2211
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2212
+ /* @__PURE__ */ jsx(ContextMenu.Separator, {}),
2213
+ items.map((item, i) => /* @__PURE__ */ jsx(
2214
+ ContextMenu.Item,
2215
+ {
2216
+ onClick: () => item.onClick(selection.activeCell),
2217
+ disabled: typeof item.disabled === "function" ? item.disabled(selection.activeCell) : item.disabled,
2218
+ danger: item.danger,
2219
+ children: item.label
2220
+ },
2221
+ i
2222
+ ))
2223
+ ] });
2224
+ })()
2192
2225
  ] })
2193
2226
  ] });
2194
2227
  }
2195
2228
  SpreadsheetGrid.displayName = "SpreadsheetGrid";
2196
2229
  var btnClass = "inline-flex items-center justify-center rounded px-2 py-1 text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 disabled:opacity-40 dark:text-zinc-300 dark:hover:bg-zinc-800";
2197
2230
  var activeBtnClass = "bg-zinc-200 dark:bg-zinc-700";
2198
- function DefaultToolbar() {
2231
+ function DefaultToolbar({ extra }) {
2199
2232
  const {
2200
2233
  selection,
2201
2234
  activeSheet,
@@ -2387,7 +2420,11 @@ function DefaultToolbar() {
2387
2420
  /* @__PURE__ */ jsx("span", { className: "text-[8px]", children: "\u2192" })
2388
2421
  ]
2389
2422
  }
2390
- )
2423
+ ),
2424
+ extra && /* @__PURE__ */ jsxs(Fragment, { children: [
2425
+ /* @__PURE__ */ jsx("div", { className: "mx-1 h-4 w-px bg-zinc-200 dark:bg-zinc-700" }),
2426
+ extra
2427
+ ] })
2391
2428
  ] }),
2392
2429
  /* @__PURE__ */ jsxs("div", { "data-fancy-sheets-formula-bar": "", className: "flex items-center gap-2 border-b border-zinc-200 px-2 py-1 dark:border-zinc-700", children: [
2393
2430
  /* @__PURE__ */ jsx("span", { className: "w-12 shrink-0 text-center text-[11px] font-medium text-zinc-500 dark:text-zinc-400", children: selection.activeCell }),
@@ -2406,8 +2443,8 @@ function DefaultToolbar() {
2406
2443
  ] })
2407
2444
  ] });
2408
2445
  }
2409
- function SpreadsheetToolbar({ children, className }) {
2410
- return /* @__PURE__ */ jsx("div", { "data-fancy-sheets-toolbar": "", className: cn("", className), children: children ?? /* @__PURE__ */ jsx(DefaultToolbar, {}) });
2446
+ function SpreadsheetToolbar({ children, className, extra }) {
2447
+ return /* @__PURE__ */ jsx("div", { "data-fancy-sheets-toolbar": "", className: cn("", className), children: children ?? /* @__PURE__ */ jsx(DefaultToolbar, { extra }) });
2411
2448
  }
2412
2449
  SpreadsheetToolbar.displayName = "SpreadsheetToolbar";
2413
2450
  function SpreadsheetSheetTabs({ className }) {
@@ -2504,7 +2541,8 @@ function SpreadsheetRoot({
2504
2541
  rowCount = 100,
2505
2542
  defaultColumnWidth = 100,
2506
2543
  rowHeight = 28,
2507
- readOnly = false
2544
+ readOnly = false,
2545
+ contextMenuItems
2508
2546
  }) {
2509
2547
  const { state, actions } = useSpreadsheetStore(data ?? defaultData);
2510
2548
  const onChangeRef = useRef(onChange);
@@ -2569,9 +2607,10 @@ function SpreadsheetRoot({
2569
2607
  getColumnWidth,
2570
2608
  isCellSelected,
2571
2609
  isCellActive,
2610
+ contextMenuItems,
2572
2611
  _isDragging: isDraggingRef
2573
2612
  }),
2574
- [state, activeSheet, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, actions, getColumnWidth, isCellSelected, isCellActive]
2613
+ [state, activeSheet, columnCount, rowCount, defaultColumnWidth, rowHeight, readOnly, actions, getColumnWidth, isCellSelected, isCellActive, contextMenuItems]
2575
2614
  );
2576
2615
  return /* @__PURE__ */ jsx(SpreadsheetContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
2577
2616
  "div",
@@ -2588,6 +2627,32 @@ var Spreadsheet = Object.assign(SpreadsheetRoot, {
2588
2627
  Grid: SpreadsheetGrid,
2589
2628
  SheetTabs: SpreadsheetSheetTabs
2590
2629
  });
2630
+ function Sheet({ data, onChange, contextMenuItems, ...props }) {
2631
+ const workbook = useMemo(
2632
+ () => data ? { sheets: [data], activeSheetId: data.id } : void 0,
2633
+ [data]
2634
+ );
2635
+ const handleChange = useMemo(() => {
2636
+ if (!onChange) return void 0;
2637
+ return (wb) => onChange(wb.sheets[0]);
2638
+ }, [onChange]);
2639
+ return /* @__PURE__ */ jsx(Spreadsheet, { data: workbook, onChange: handleChange, contextMenuItems, ...props, children: /* @__PURE__ */ jsx(Spreadsheet.Grid, {}) });
2640
+ }
2641
+ Sheet.displayName = "Sheet";
2642
+ function SheetWorkbook({
2643
+ hideToolbar = false,
2644
+ hideTabs = false,
2645
+ toolbarExtra,
2646
+ contextMenuItems,
2647
+ ...props
2648
+ }) {
2649
+ return /* @__PURE__ */ jsxs(Spreadsheet, { ...props, contextMenuItems, children: [
2650
+ !hideToolbar && /* @__PURE__ */ jsx(Spreadsheet.Toolbar, { extra: toolbarExtra }),
2651
+ /* @__PURE__ */ jsx(Spreadsheet.Grid, {}),
2652
+ !hideTabs && /* @__PURE__ */ jsx(Spreadsheet.SheetTabs, {})
2653
+ ] });
2654
+ }
2655
+ SheetWorkbook.displayName = "SheetWorkbook";
2591
2656
 
2592
2657
  // src/engine/csv.ts
2593
2658
  function parseCSV(text) {
@@ -2685,6 +2750,6 @@ function workbookToCSV(workbook, sheetId) {
2685
2750
  return stringifyCSV(data);
2686
2751
  }
2687
2752
 
2688
- export { Spreadsheet, columnToLetter, createEmptySheet, createEmptyWorkbook, csvToWorkbook, letterToColumn, parseAddress, parseCSV, registerFunction, stringifyCSV, toAddress, useSpreadsheet, workbookToCSV };
2753
+ export { Sheet, SheetWorkbook, Spreadsheet, columnToLetter, createEmptySheet, createEmptyWorkbook, csvToWorkbook, letterToColumn, parseAddress, parseCSV, registerFunction, stringifyCSV, toAddress, useSpreadsheet, workbookToCSV };
2689
2754
  //# sourceMappingURL=index.js.map
2690
2755
  //# sourceMappingURL=index.js.map