@molecule/app-kanban-board-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.
- package/README.md +276 -0
- package/package.json +14 -8
package/README.md
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
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:51:09.466Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-kanban-board-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 Kanban board primitives (pure presentational — you own the data).
|
|
16
|
+
|
|
17
|
+
Exports:
|
|
18
|
+
|
|
19
|
+
- `<KanbanBoard>` — columns side-by-side with HTML5 drag-drop between columns.
|
|
20
|
+
Props: `columns`, `onCardMove?(cardId, fromColumnId, toColumnId)`,
|
|
21
|
+
`onCardClick?(card, column)`, `renderHeaderActions?(column)`,
|
|
22
|
+
`renderFooter?(column)`, `className?`.
|
|
23
|
+
- `<KanbanColumn>` / `<KanbanColumnHeader>` / `<KanbanCard>` — the building blocks,
|
|
24
|
+
usable standalone for custom board layouts.
|
|
25
|
+
- `KanbanColumnData` (`{ id, title, accent?, cards }`), `KanbanCardData`
|
|
26
|
+
(`{ id, title, body?, footer? }`) types.
|
|
27
|
+
|
|
28
|
+
This package is standalone UI: it does NOT use the headless
|
|
29
|
+
`@molecule/app-kanban` core or the `app-kanban-default` bond. Reach for those
|
|
30
|
+
when you want board STATE management (move/add/remove logic) behind a bond;
|
|
31
|
+
use this package when you just need the rendered board and will persist moves
|
|
32
|
+
yourself in `onCardMove`.
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { KanbanBoard } from '@molecule/app-kanban-board-react'
|
|
38
|
+
|
|
39
|
+
;<KanbanBoard
|
|
40
|
+
columns={[
|
|
41
|
+
{ id: 'todo', title: 'To Do', cards: [{ id: 'c1', title: 'Research API' }] },
|
|
42
|
+
{
|
|
43
|
+
id: 'doing',
|
|
44
|
+
title: 'In Progress',
|
|
45
|
+
accent: 'primary',
|
|
46
|
+
cards: [{ id: 'c2', title: 'Build UI' }],
|
|
47
|
+
},
|
|
48
|
+
{ id: 'done', title: 'Done', accent: 'success', cards: [] },
|
|
49
|
+
]}
|
|
50
|
+
onCardMove={(cardId, fromColumnId, toColumnId) => moveCard(cardId, toColumnId)}
|
|
51
|
+
onCardClick={(card, column) => openCardDetail(card.id)}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Type
|
|
56
|
+
|
|
57
|
+
`feature`
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install @molecule/app-kanban-board-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
|
|
63
|
+
npm install -D @types/react
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API
|
|
67
|
+
|
|
68
|
+
### Interfaces
|
|
69
|
+
|
|
70
|
+
#### `KanbanBoardProps`
|
|
71
|
+
|
|
72
|
+
Props for {@link KanbanBoard}.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
interface KanbanBoardProps {
|
|
76
|
+
columns: KanbanColumnData[]
|
|
77
|
+
/** Called when a card moves from one column to another. */
|
|
78
|
+
onCardMove?: (cardId: string, fromColumnId: string, toColumnId: string) => void
|
|
79
|
+
/** Called when a card is clicked. */
|
|
80
|
+
onCardClick?: (card: KanbanCardData, column: KanbanColumnData) => void
|
|
81
|
+
/** Optional per-column header action renderer. */
|
|
82
|
+
renderHeaderActions?: (column: KanbanColumnData) => ReactNode
|
|
83
|
+
/** Optional per-column footer renderer (e.g. "+ Add card"). */
|
|
84
|
+
renderFooter?: (column: KanbanColumnData) => ReactNode
|
|
85
|
+
/** Extra classes on the outer board wrapper. */
|
|
86
|
+
className?: string
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### `KanbanCardData`
|
|
91
|
+
|
|
92
|
+
Kanban board types.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
interface KanbanCardData {
|
|
96
|
+
/** Card id. */
|
|
97
|
+
id: string
|
|
98
|
+
/** Title / summary. */
|
|
99
|
+
title: ReactNode
|
|
100
|
+
/** Optional body / description. */
|
|
101
|
+
body?: ReactNode
|
|
102
|
+
/** Optional footer row (avatars, tags, timestamps). */
|
|
103
|
+
footer?: ReactNode
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### `KanbanCardProps`
|
|
108
|
+
|
|
109
|
+
Props for {@link KanbanCard}.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
interface KanbanCardProps {
|
|
113
|
+
card: KanbanCardData
|
|
114
|
+
/** Called when the card is clicked (e.g. open detail modal). */
|
|
115
|
+
onClick?: (card: KanbanCardData) => void
|
|
116
|
+
/** HTML5 drag start — integrate with `@molecule/app-drag-drop` bond. */
|
|
117
|
+
onDragStart?: (card: KanbanCardData, e: DragEvent<HTMLDivElement>) => void
|
|
118
|
+
/** Extra classes. */
|
|
119
|
+
className?: string
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### `KanbanColumnData`
|
|
124
|
+
|
|
125
|
+
Data for a single kanban column, including its heading, optional accent, and ordered card list.
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
interface KanbanColumnData {
|
|
129
|
+
/** Column id. */
|
|
130
|
+
id: string
|
|
131
|
+
/** Column heading. */
|
|
132
|
+
title: ReactNode
|
|
133
|
+
/** Optional accent color token. */
|
|
134
|
+
accent?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral'
|
|
135
|
+
/** Cards in the column, in display order. */
|
|
136
|
+
cards: KanbanCardData[]
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### `KanbanColumnHeaderProps`
|
|
141
|
+
|
|
142
|
+
Props for {@link KanbanColumnHeader}.
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
interface KanbanColumnHeaderProps {
|
|
146
|
+
title: ReactNode
|
|
147
|
+
/** Card count shown in parentheses. */
|
|
148
|
+
count?: number
|
|
149
|
+
/** Optional right-side actions (add card button, menu). */
|
|
150
|
+
actions?: ReactNode
|
|
151
|
+
/** Extra classes. */
|
|
152
|
+
className?: string
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### `KanbanColumnProps`
|
|
157
|
+
|
|
158
|
+
Props for {@link KanbanColumn}.
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
interface KanbanColumnProps {
|
|
162
|
+
column: KanbanColumnData
|
|
163
|
+
/** Called when a card is clicked. */
|
|
164
|
+
onCardClick?: (card: KanbanCardData, column: KanbanColumnData) => void
|
|
165
|
+
/** Called when a card is dragged into this column. */
|
|
166
|
+
onDrop?: (column: KanbanColumnData, e: React.DragEvent) => void
|
|
167
|
+
/** Called when a card drag-start fires. */
|
|
168
|
+
onCardDragStart?: (card: KanbanCardData, column: KanbanColumnData, e: React.DragEvent) => void
|
|
169
|
+
/** Optional header actions. */
|
|
170
|
+
headerActions?: ReactNode
|
|
171
|
+
/** Optional footer (e.g. "Add card" button). */
|
|
172
|
+
footer?: ReactNode
|
|
173
|
+
/** Extra classes. */
|
|
174
|
+
className?: string
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Functions
|
|
179
|
+
|
|
180
|
+
#### `KanbanBoard(props)`
|
|
181
|
+
|
|
182
|
+
Kanban board with HTML5 drag-drop between columns.
|
|
183
|
+
|
|
184
|
+
Pure UI — consumers own the card data and call back on `onCardMove`
|
|
185
|
+
to persist reorder. For fancier drag experiences, wire
|
|
186
|
+
`@molecule/app-drag-drop` at the column level instead.
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
function KanbanBoard({
|
|
190
|
+
columns,
|
|
191
|
+
onCardMove,
|
|
192
|
+
onCardClick,
|
|
193
|
+
renderHeaderActions,
|
|
194
|
+
renderFooter,
|
|
195
|
+
className,
|
|
196
|
+
}: KanbanBoardProps): JSX.Element
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
- `props` — Component props (see {@link KanbanBoardProps}).
|
|
200
|
+
|
|
201
|
+
#### `KanbanCard(props)`
|
|
202
|
+
|
|
203
|
+
Single card inside a Kanban column. Drag-drop is opt-in via the
|
|
204
|
+
`onDragStart` prop — wire it to the `@molecule/app-drag-drop` bond or
|
|
205
|
+
HTML5 drag-drop directly.
|
|
206
|
+
|
|
207
|
+
The outer `<div>` wrapper carries the drag handlers so we don't rely
|
|
208
|
+
on `<Card>` forwarding drag events (which it doesn't).
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
function KanbanCard({ card, onClick, onDragStart, className }: KanbanCardProps): JSX.Element
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
- `props` — Component props (see {@link KanbanCardProps}).
|
|
215
|
+
|
|
216
|
+
#### `KanbanColumn(props)`
|
|
217
|
+
|
|
218
|
+
One Kanban column — sticky header + scrollable card list + optional footer.
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
function KanbanColumn({
|
|
222
|
+
column,
|
|
223
|
+
onCardClick,
|
|
224
|
+
onDrop,
|
|
225
|
+
onCardDragStart,
|
|
226
|
+
headerActions,
|
|
227
|
+
footer,
|
|
228
|
+
className,
|
|
229
|
+
}: KanbanColumnProps): JSX.Element
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
- `props` — Component props (see {@link KanbanColumnProps}).
|
|
233
|
+
|
|
234
|
+
#### `KanbanColumnHeader(props)`
|
|
235
|
+
|
|
236
|
+
Kanban column heading row — title + count + right actions.
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
function KanbanColumnHeader({
|
|
240
|
+
title,
|
|
241
|
+
count,
|
|
242
|
+
actions,
|
|
243
|
+
className,
|
|
244
|
+
}: KanbanColumnHeaderProps): JSX.Element
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
- `props` — Component props (see {@link KanbanColumnHeaderProps}).
|
|
248
|
+
|
|
249
|
+
## Injection Notes
|
|
250
|
+
|
|
251
|
+
### Requirements
|
|
252
|
+
|
|
253
|
+
Peer dependencies:
|
|
254
|
+
|
|
255
|
+
- `@molecule/app-react` ^1.0.1
|
|
256
|
+
- `@molecule/app-ui` ^1.0.1
|
|
257
|
+
- `@molecule/app-ui-react` ^1.0.1
|
|
258
|
+
- `react` ^18.0.0 || ^19.0.0
|
|
259
|
+
|
|
260
|
+
### Runtime Dependencies
|
|
261
|
+
|
|
262
|
+
- `@molecule/app-react`
|
|
263
|
+
- `@molecule/app-ui`
|
|
264
|
+
- `@molecule/app-ui-react`
|
|
265
|
+
- `react`
|
|
266
|
+
|
|
267
|
+
- Drag-drop is native HTML5 DnD: it does not fire on touch devices — provide
|
|
268
|
+
an alternate affordance (e.g. a move menu in `renderHeaderActions`) for mobile.
|
|
269
|
+
- `onCardMove` fires only when a card is dropped on a DIFFERENT column, and no
|
|
270
|
+
insertion index is reported — same-column reordering is not supported; movers
|
|
271
|
+
can only append to the target column.
|
|
272
|
+
- Consumers own the data: update your `columns` state in `onCardMove` or the
|
|
273
|
+
board will snap back on re-render.
|
|
274
|
+
- `accent` on a column is currently cosmetic metadata only.
|
|
275
|
+
- Styling resolves through `getClassMap()`; `<KanbanCard>` uses `<Card>` from
|
|
276
|
+
`@molecule/app-ui-react` — wire a ClassMap bond first.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-kanban-board-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React Kanban board, column, and card primitives",
|
|
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/kanban-board-react"
|
|
33
|
+
},
|
|
28
34
|
"peerDependencies": {
|
|
29
|
-
"@molecule/app-react": "^1.0.
|
|
30
|
-
"@molecule/app-ui": "^1.0.
|
|
31
|
-
"@molecule/app-ui-react": "^1.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.
|
|
36
|
-
"@molecule/app-ui": "1.0.
|
|
37
|
-
"@molecule/app-ui-react": "1.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",
|