@umriss-ui/table 0.7.1 → 0.7.2

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/docs/llms-full.md CHANGED
@@ -1,4 +1,4 @@
1
- # @umriss-ui/table 0.7.1
1
+ # @umriss-ui/table 0.7.2
2
2
 
3
3
  > React data table for data-dense applications - sorting, filtering, grouping, aggregates, virtualisation. Declared the way it reads: columns as JSX, typed against their rows.
4
4
 
@@ -3940,12 +3940,12 @@ export default function TwoActions() {
3940
3940
 
3941
3941
  ##### Act on a selection
3942
3942
 
3943
- Mark an action `bulk` and it receives a list: one row at the row, the selection in the toolbar that appears while rows are ticked.
3943
+ Mark an action `bulk` and it receives a list: one row at the row, the selection in the `Toolbar` while rows are ticked.
3944
3944
 
3945
3945
  ```tsx
3946
3946
  import { useState } from "react";
3947
3947
  import { Stack, Text } from "@umriss-ui/core";
3948
- import { useTable } from "@umriss-ui/table";
3948
+ import { Toolbar, useTable } from "@umriss-ui/table";
3949
3949
 
3950
3950
  interface Invoice {
3951
3951
  id: string;
@@ -3967,6 +3967,7 @@ export default function ActOnASelection() {
3967
3967
  return (
3968
3968
  <Stack gap={3}>
3969
3969
  <Table selectable ariaLabel="Invoices awaiting approval">
3970
+ <Toolbar />
3970
3971
  <Column value="id" label="Invoice" rowHeader />
3971
3972
  <Column value="supplier" label="Supplier" />
3972
3973
  <Column value="costCentre" label="Cost centre" />
@@ -5398,6 +5399,47 @@ export default function KeepAList() {
5398
5399
  }
5399
5400
  ```
5400
5401
 
5402
+ ##### Edit a dense table
5403
+
5404
+ `density="compact"` holds for a row draft too: its fields and buttons are a step smaller, and a row with actions stands as tall as one without.
5405
+
5406
+ ```tsx
5407
+ import { useState } from "react";
5408
+ import { useTable } from "@umriss-ui/table";
5409
+
5410
+ interface Room {
5411
+ id: string;
5412
+ name: string;
5413
+ seats: number;
5414
+ floor: number;
5415
+ }
5416
+
5417
+ const ROOMS: Room[] = [
5418
+ { id: "r1", name: "Harbour", seats: 8, floor: 2 },
5419
+ { id: "r2", name: "Orchard", seats: 12, floor: 3 },
5420
+ { id: "r3", name: "Lantern", seats: 4, floor: 3 },
5421
+ ];
5422
+
5423
+ export default function EditADenseTable() {
5424
+ const [rooms, setRooms] = useState(ROOMS);
5425
+ const { Table, Column } = useTable(rooms, { rowKey: (r) => r.id });
5426
+ return (
5427
+ <Table
5428
+ grid
5429
+ editMode="row"
5430
+ density="compact"
5431
+ ariaLabel="Meeting rooms"
5432
+ onRowSave={({ rowKey, changes }) => setRooms((all) => all.map((r) => (r.id === rowKey ? { ...r, ...changes } : r)))}
5433
+ onRowDelete={({ rowKey }) => setRooms((all) => all.filter((r) => r.id !== rowKey))}
5434
+ >
5435
+ <Column value="name" label="Room" rowHeader edit="text" />
5436
+ <Column value="seats" label="Seats" edit="number" width={120} />
5437
+ <Column value="floor" label="Floor" edit="number" width={120} />
5438
+ </Table>
5439
+ );
5440
+ }
5441
+ ```
5442
+
5401
5443
  #### Keyboard
5402
5444
 
5403
5445
  | Key | Action |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/table",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "React data table for data-dense applications - sorting, filtering, grouping, aggregates, virtualisation. Declared the way it reads: columns as JSX, typed against their rows.",
5
5
  "license": "MIT",
6
6
  "author": "Roman Händler",
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "react": ">=18",
53
53
  "react-dom": ">=18",
54
- "@umriss-ui/core": "^0.14.1"
54
+ "@umriss-ui/core": "^0.15.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@fontsource/geist-mono": "^5.3.0",
@@ -65,7 +65,7 @@
65
65
  "typescript": "^5.6.3",
66
66
  "vite": "^6.0.0",
67
67
  "vite-plugin-dts": "^4.3.0",
68
- "@umriss-ui/core": "0.14.1",
68
+ "@umriss-ui/core": "0.15.0",
69
69
  "@umriss-ui/demo": "0.0.0"
70
70
  },
71
71
  "scripts": {