@molecule/app-data-table-ui-react 1.0.0 → 1.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.
Files changed (2) hide show
  1. package/README.md +294 -0
  2. package/package.json +14 -8
package/README.md ADDED
@@ -0,0 +1,294 @@
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-08-04T01:50:27.437Z
7
+ -->
8
+
9
+ # @molecule/app-data-table-ui-react
10
+
11
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
+ > It is written to be read by coding agents as much as by people, and is generated from this
13
+ > package's source — edit `src/index.ts` JSDoc, not this file.
14
+
15
+ React data-table UI primitives (standalone — they render plain table
16
+ elements and do not require `<Table>` from `@molecule/app-ui-react`).
17
+
18
+ Exports:
19
+
20
+ - `<DataTableCard>` — full polished-pattern data table (card wrapper +
21
+ title + uppercase headers + divided rows + loading skeleton + empty
22
+ state). Drop-in for the most common dashboard CRUD use case.
23
+ - `<TableToolbar>` — top chrome with left/right slots + optional filter row.
24
+ - `<TableEmpty>` — single full-width "no rows" cell for hand-rolled tables.
25
+ - `<TableFooter>` — bottom bar (left summary + right pagination).
26
+ - `<RowWithActions>` — `<tr>` wrapper with trailing actions cell and click handler.
27
+
28
+ Use `DataTableCard` for new screens; use the row-level primitives to
29
+ compose richer custom tables (group-by, expandable rows, etc.).
30
+
31
+ ## Quick Start
32
+
33
+ ```tsx
34
+ import { DataTableCard } from '@molecule/app-data-table-ui-react'
35
+
36
+ const columns = [
37
+ { key: 'name', header: t('members.name', {}, { defaultValue: 'Name' }), cell: (row) => row.name },
38
+ { key: 'email', header: t('members.email', {}, { defaultValue: 'Email' }), cell: (row) => row.email },
39
+ ]
40
+
41
+ <DataTableCard
42
+ title={t('members.title', {}, { defaultValue: 'Team members' })}
43
+ columns={columns}
44
+ rows={members}
45
+ rowKey={(row) => row.id}
46
+ onRowClick={(row) => navigate(`/members/${row.id}`)}
47
+ emptyMessage={t('members.empty', {}, { defaultValue: 'No members yet.' })}
48
+ />
49
+ ```
50
+
51
+ ## Type
52
+
53
+ `feature`
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ npm install @molecule/app-data-table-ui-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
59
+ npm install -D @types/react
60
+ ```
61
+
62
+ ## API
63
+
64
+ ### Interfaces
65
+
66
+ #### `DataTableCardProps`
67
+
68
+ Props for {@link DataTableCard}.
69
+
70
+ ```typescript
71
+ interface DataTableCardProps<Row> {
72
+ /** Optional title above the table chrome. */
73
+ title?: ReactNode
74
+ /** Right-aligned action / "View all" / link in the title row. */
75
+ titleAction?: ReactNode
76
+ /** Column definitions. */
77
+ columns: ReadonlyArray<DataTableColumn<Row>>
78
+ /** Rows to render. Falls back to `emptyMessage` if empty and not loading. */
79
+ rows: ReadonlyArray<Row>
80
+ /** Pull a stable React key from a row. */
81
+ rowKey: (row: Row) => string
82
+ /** When true, renders 5 skeleton rows instead of `rows`. */
83
+ loading?: boolean
84
+ /** Optional click handler per row. */
85
+ onRowClick?: (row: Row) => void
86
+ /** Empty-state content shown inside the tbody when not loading + rows is empty. */
87
+ emptyMessage?: ReactNode
88
+ /** Extra classes on the outer card. */
89
+ className?: string
90
+ /** `data-mol-id` for AI-agent selectors. */
91
+ dataMolId?: string
92
+ }
93
+ ```
94
+
95
+ #### `DataTableColumn`
96
+
97
+ Column definition for a DataTableCard — specifies key, header, and cell renderer.
98
+
99
+ ```typescript
100
+ interface DataTableColumn<Row> {
101
+ /** Stable key for React. */
102
+ key: string
103
+ /** Header label (usually `t('...')`). */
104
+ header: ReactNode
105
+ /** Render the cell for this column from a row. */
106
+ cell: (row: Row) => ReactNode
107
+ /** Optional extra `<th>` / `<td>` classes (e.g. `cm.textCenter`). */
108
+ cellClassName?: string
109
+ headerClassName?: string
110
+ }
111
+ ```
112
+
113
+ #### `RowWithActionsProps`
114
+
115
+ Props for {@link RowWithActions}.
116
+
117
+ ```typescript
118
+ interface RowWithActionsProps {
119
+ /** Row cells (each wrapped in `<td>`). */
120
+ children: ReactNode
121
+ /** Action buttons/menu to render in the trailing "actions" cell. */
122
+ actions?: ReactNode
123
+ /** Called when the row body is clicked (not the actions cell). */
124
+ onClick?: () => void
125
+ /** Whether the row should render in a "selected" visual state. */
126
+ selected?: boolean
127
+ /** Extra classes on the `<tr>`. */
128
+ className?: string
129
+ }
130
+ ```
131
+
132
+ #### `TableEmptyProps`
133
+
134
+ Props for {@link TableEmpty}.
135
+
136
+ ```typescript
137
+ interface TableEmptyProps {
138
+ /** Number of columns to span (for colspan on the td). */
139
+ colSpan: number
140
+ /** Empty-state content. */
141
+ children: ReactNode
142
+ /** Extra classes on the cell. */
143
+ className?: string
144
+ }
145
+ ```
146
+
147
+ #### `TableFooterProps`
148
+
149
+ Props for {@link TableFooter}.
150
+
151
+ ```typescript
152
+ interface TableFooterProps {
153
+ /** Left slot — typically a summary line ("5 rows selected"). */
154
+ left?: ReactNode
155
+ /** Right slot — typically `<PaginationBar>`. */
156
+ right?: ReactNode
157
+ /** Extra classes. */
158
+ className?: string
159
+ }
160
+ ```
161
+
162
+ #### `TableToolbarProps`
163
+
164
+ Props for {@link TableToolbar}.
165
+
166
+ ```typescript
167
+ interface TableToolbarProps {
168
+ /** Left-aligned content — usually a title or a results count. */
169
+ left?: ReactNode
170
+ /** Right-aligned actions — search input, filter button, export, etc. */
171
+ right?: ReactNode
172
+ /** Optional full-width filter / chip row rendered below the main row. */
173
+ below?: ReactNode
174
+ /** Extra classes. */
175
+ className?: string
176
+ }
177
+ ```
178
+
179
+ ### Functions
180
+
181
+ #### `DataTableCard(props)`
182
+
183
+ Drop-in card-shaped data table matching the polished flagship pattern.
184
+
185
+ Renders:
186
+
187
+ 1. Optional title + action row
188
+ 2. Card-wrapped table with:
189
+ - `bg-surface-container-lowest rounded-xl overflow-hidden shadow-sm` outer
190
+ - `bg-surface-container-low border-b border-outline-variant/10` thead
191
+ - `text-[10px] font-black text-on-surface-variant uppercase tracking-widest` th
192
+ - `divide-y divide-surface-container` tbody
193
+ - `hover:bg-surface-container-low transition-colors` rows (when `onRowClick` provided)
194
+ - 5-row pulsing skeleton when `loading`
195
+ - Single full-width cell with `emptyMessage` when empty
196
+
197
+ For complex per-column rendering, pass cells that compose
198
+ `<StatusBadge>`, `<Avatar>`, etc.
199
+
200
+ ```typescript
201
+ function DataTableCard({
202
+ title,
203
+ titleAction,
204
+ columns,
205
+ rows,
206
+ rowKey,
207
+ loading = false,
208
+ onRowClick,
209
+ emptyMessage,
210
+ className,
211
+ dataMolId,
212
+ }: DataTableCardProps<Row>): JSX.Element
213
+ ```
214
+
215
+ - `props` — Component props (see {@link DataTableCardProps}).
216
+
217
+ #### `RowWithActions(props)`
218
+
219
+ `<tr>` wrapper that adds a trailing actions cell plus a click handler
220
+ on the body. Useful for data tables where each row has a trailing
221
+ ellipsis-menu or a row of action buttons.
222
+
223
+ ```typescript
224
+ function RowWithActions({
225
+ children,
226
+ actions,
227
+ onClick,
228
+ selected,
229
+ className,
230
+ }: RowWithActionsProps): JSX.Element
231
+ ```
232
+
233
+ - `props` — Component props (see {@link RowWithActionsProps}).
234
+
235
+ #### `TableEmpty(props)`
236
+
237
+ Single full-width row shown when a `<Table>` has no data. Typically
238
+ wraps `<EmptyState>` from `@molecule/app-empty-state-react`.
239
+
240
+ ```typescript
241
+ function TableEmpty({ colSpan, children, className }: TableEmptyProps): JSX.Element
242
+ ```
243
+
244
+ - `props` — Component props (see {@link TableEmptyProps}).
245
+
246
+ #### `TableFooter(props)`
247
+
248
+ Footer bar rendered below an `<Table>`. Pass a pagination bar in `right`.
249
+
250
+ ```typescript
251
+ function TableFooter({ left, right, className }: TableFooterProps): JSX.Element
252
+ ```
253
+
254
+ - `props` — Component props (see {@link TableFooterProps}).
255
+
256
+ #### `TableToolbar(props)`
257
+
258
+ Table top-chrome row with left/right slots and an optional bottom
259
+ sub-row for active filter chips or tabs. Sits above an `<Table>`
260
+ from `@molecule/app-ui-react`.
261
+
262
+ ```typescript
263
+ function TableToolbar({ left, right, below, className }: TableToolbarProps): JSX.Element
264
+ ```
265
+
266
+ - `props` — Component props (see {@link TableToolbarProps}).
267
+
268
+ ## Injection Notes
269
+
270
+ ### Requirements
271
+
272
+ Peer dependencies:
273
+
274
+ - `@molecule/app-react` ^1.0.1
275
+ - `@molecule/app-ui` ^1.0.1
276
+ - `@molecule/app-ui-react` ^1.0.1
277
+ - `react` ^18.0.0 || ^19.0.0
278
+
279
+ ### Runtime Dependencies
280
+
281
+ - `@molecule/app-react`
282
+ - `@molecule/app-ui`
283
+ - `@molecule/app-ui-react`
284
+ - `react`
285
+
286
+ All text (`title`, column `header`s, `emptyMessage`) is consumer-provided —
287
+ pass translated strings; there is no built-in copy and no locale bond.
288
+ `DataTableCard`'s chrome uses Tailwind classes with Material-3 theme tokens
289
+ (`bg-surface-container-lowest`, `divide-surface-container`,
290
+ `text-on-surface-variant`, …) — the app's Tailwind theme must define those
291
+ tokens (molecule's default Tailwind ClassMap bond does); with a
292
+ non-Tailwind ClassMap the card surface, dividers, and skeleton styling
293
+ drop out. `onRowClick` makes rows pointer-clickable only — add your own
294
+ keyboard path (e.g. a link/button in a cell) where accessibility matters.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-data-table-ui-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "React row-level primitives for @molecule/app-ui-react Table (toolbar, row-with-actions, empty)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,8 @@
17
17
  }
18
18
  },
19
19
  "files": [
20
- "dist"
20
+ "dist",
21
+ "README.md"
21
22
  ],
22
23
  "keywords": [
23
24
  "molecule",
@@ -25,16 +26,21 @@
25
26
  "react"
26
27
  ],
27
28
  "license": "Apache-2.0",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/molecule-dev/molecule.git",
32
+ "directory": "packages/app/features/data-table-ui-react"
33
+ },
28
34
  "peerDependencies": {
29
- "@molecule/app-react": "^1.0.0",
30
- "@molecule/app-ui": "^1.0.0",
31
- "@molecule/app-ui-react": "^1.0.0",
35
+ "@molecule/app-react": "^1.0.1",
36
+ "@molecule/app-ui": "^1.0.1",
37
+ "@molecule/app-ui-react": "^1.0.1",
32
38
  "react": "^18.0.0 || ^19.0.0"
33
39
  },
34
40
  "devDependencies": {
35
- "@molecule/app-react": "1.0.0",
36
- "@molecule/app-ui": "1.0.0",
37
- "@molecule/app-ui-react": "1.0.0",
41
+ "@molecule/app-react": "1.0.1",
42
+ "@molecule/app-ui": "1.0.1",
43
+ "@molecule/app-ui-react": "1.0.1",
38
44
  "@types/node": "26.1.2",
39
45
  "@types/react": "19.2.17",
40
46
  "@types/react-dom": "19.2.3",