@sheetwrite/react 0.5.0 → 0.5.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/dist/index.d.ts CHANGED
@@ -32,7 +32,21 @@ export interface SheetwriteGridProps<Id extends RowBridgeId = RowBridgeId> exten
32
32
  /** Fills the parent's available width and height, taking precedence over `height`. */
33
33
  fill?: true;
34
34
  }
35
- /** Advanced framework component with inferred row-bridge identity. */
35
+ /**
36
+ * Advanced framework component with inferred row-bridge identity.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * import { SheetwriteGrid } from "@sheetwrite/react";
41
+ * import type { Workbook } from "@sheetwrite/core";
42
+ *
43
+ * export function WorkbookView({ workbook }: { workbook: Workbook }) {
44
+ * return <SheetwriteGrid workbook={workbook} height={400} />;
45
+ * }
46
+ * ```
47
+ * @see Sheetwrite
48
+ * @see /docs/frameworks/react/
49
+ */
36
50
  export declare const SheetwriteGrid: <Id extends RowBridgeId = RowBridgeId>(props: SheetwriteGridProps<Id> & {
37
51
  ref?: ForwardedRef<Grid>;
38
52
  }) => ReactElement;
@@ -54,6 +68,21 @@ export type SheetwriteProps<Row extends Record<string, CellScalar>, Id extends R
54
68
  * `columns`, `defaultRows`, and `sheetName`, initializes Sheetwrite, and owns the `Grid`
55
69
  * through prop-driven resets and unmount cleanup. Pass a `ref` to access the live `Grid`;
56
70
  * use `SheetwriteGrid` when the host already owns a workbook or datasource.
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * import { Sheetwrite } from "@sheetwrite/react";
75
+ *
76
+ * export function Sales() {
77
+ * return <Sheetwrite
78
+ * columns={[{ key: "amount", title: "Amount", type: "number" }]}
79
+ * defaultRows={[{ amount: 12 }, { amount: 18 }]}
80
+ * height={400}
81
+ * />;
82
+ * }
83
+ * ```
84
+ * @see SheetwriteGrid
85
+ * @see /docs/frameworks/react/
57
86
  */
58
87
  export declare const Sheetwrite: <Row extends Record<string, CellScalar>, Id extends RowBridgeId = RowBridgeId>(props: SheetwriteProps<Row, Id> & {
59
88
  /** Receives the live Grid after readiness and `null` on reset or unmount. */
package/dist/index.js CHANGED
@@ -125,7 +125,21 @@ const SheetwriteGridComponent = forwardRef(function SheetwriteGrid(props, ref) {
125
125
  const hostStyle = { ...style, ...sizing };
126
126
  return (_jsx("div", { ...hostAttributes, ref: hostRef, className: hostClassName, style: hostStyle, children: initializationState === "ready" ? null : fallback }));
127
127
  });
128
- /** Advanced framework component with inferred row-bridge identity. */
128
+ /**
129
+ * Advanced framework component with inferred row-bridge identity.
130
+ *
131
+ * @example
132
+ * ```tsx
133
+ * import { SheetwriteGrid } from "@sheetwrite/react";
134
+ * import type { Workbook } from "@sheetwrite/core";
135
+ *
136
+ * export function WorkbookView({ workbook }: { workbook: Workbook }) {
137
+ * return <SheetwriteGrid workbook={workbook} height={400} />;
138
+ * }
139
+ * ```
140
+ * @see Sheetwrite
141
+ * @see /docs/frameworks/react/
142
+ */
129
143
  export const SheetwriteGrid = SheetwriteGridComponent;
130
144
  const SheetwriteComponent = forwardRef(function Sheetwrite({ columns, defaultRows, sheetName, getRowId, createRowId, ...props }, ref) {
131
145
  const input = useMemo(() => createSimpleGridInput({ columns, defaultRows, sheetName }), [columns, defaultRows, sheetName]);
@@ -142,6 +156,21 @@ const SheetwriteComponent = forwardRef(function Sheetwrite({ columns, defaultRow
142
156
  * `columns`, `defaultRows`, and `sheetName`, initializes Sheetwrite, and owns the `Grid`
143
157
  * through prop-driven resets and unmount cleanup. Pass a `ref` to access the live `Grid`;
144
158
  * use `SheetwriteGrid` when the host already owns a workbook or datasource.
159
+ *
160
+ * @example
161
+ * ```tsx
162
+ * import { Sheetwrite } from "@sheetwrite/react";
163
+ *
164
+ * export function Sales() {
165
+ * return <Sheetwrite
166
+ * columns={[{ key: "amount", title: "Amount", type: "number" }]}
167
+ * defaultRows={[{ amount: 12 }, { amount: 18 }]}
168
+ * height={400}
169
+ * />;
170
+ * }
171
+ * ```
172
+ * @see SheetwriteGrid
173
+ * @see /docs/frameworks/react/
145
174
  */
146
175
  export const Sheetwrite = SheetwriteComponent;
147
176
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheetwrite/react",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "description": "React adapter for Sheetwrite.",
6
6
  "license": "MIT",
@@ -49,6 +49,6 @@
49
49
  "react": ">=18"
50
50
  },
51
51
  "dependencies": {
52
- "@sheetwrite/core": "0.5.0"
52
+ "@sheetwrite/core": "0.5.1"
53
53
  }
54
54
  }