@molecule/app-list-item-row-react 4.0.1 → 4.1.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 +17 -6
- package/dist/ListItemRow.d.ts +4 -1
- package/dist/ListItemRow.d.ts.map +1 -1
- package/dist/ListItemRow.js +6 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-24T08:58:56.946Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-list-item-row-react
|
|
@@ -12,7 +12,7 @@ Generic list-item row.
|
|
|
12
12
|
|
|
13
13
|
Exports `<ListItemRow>` — leading slot (icon/avatar/thumbnail) + up to three
|
|
14
14
|
text lines (title / subtitle / metadata) + right-side actions. Props: `title`,
|
|
15
|
-
`subtitle?`, `metadata?`, `leading?`, `actions?`, `onClick?`, `selected?`,
|
|
15
|
+
`subtitle?`, `metadata?`, `leading?`, `actions?`, `toggle?`, `onClick?`, `selected?`,
|
|
16
16
|
`disabled?`, `density?` (`'comfortable'` default | `'compact'`), `className?`.
|
|
17
17
|
Use for nav lists, mobile menus, search results, picker dialogs, inbox threads.
|
|
18
18
|
For table rows use `<RowWithActions>` from `@molecule/app-data-table-ui-react`
|
|
@@ -32,7 +32,12 @@ import { ListItemRow } from '@molecule/app-list-item-row-react'
|
|
|
32
32
|
subtitle="Last edited 2 hours ago"
|
|
33
33
|
metadata="3 collaborators · 12 files"
|
|
34
34
|
leading={<img src="/icons/folder.svg" alt="" width={32} height={32} />}
|
|
35
|
-
|
|
35
|
+
toggle={{
|
|
36
|
+
value: project.pinned,
|
|
37
|
+
commit: async (desired) => (await setPinned(project.id, desired)).pinned,
|
|
38
|
+
activeLabel: t('projects.unpin', undefined, { defaultValue: 'Unpin project' }),
|
|
39
|
+
inactiveLabel: t('projects.pin', undefined, { defaultValue: 'Pin project' }),
|
|
40
|
+
}}
|
|
36
41
|
onClick={() => navigate('/projects/alpha')}
|
|
37
42
|
/>
|
|
38
43
|
```
|
|
@@ -68,6 +73,8 @@ interface ListItemRowProps {
|
|
|
68
73
|
leading?: ReactNode
|
|
69
74
|
/** Optional right-side actions (buttons, action menu). */
|
|
70
75
|
actions?: ReactNode
|
|
76
|
+
/** Loaded boolean action rendered as a native button, independently of read-only metadata. */
|
|
77
|
+
toggle?: OptimisticToggleButtonProps
|
|
71
78
|
/**
|
|
72
79
|
* Called when the row is activated. The whole row is clickable through a
|
|
73
80
|
* transparent native button over it, named by the title; the inner controls
|
|
@@ -110,8 +117,9 @@ function ListItemRow({
|
|
|
110
117
|
title,
|
|
111
118
|
subtitle,
|
|
112
119
|
metadata,
|
|
113
|
-
leading,
|
|
114
|
-
actions,
|
|
120
|
+
leading: leadingProp,
|
|
121
|
+
actions: actionsProp,
|
|
122
|
+
toggle,
|
|
115
123
|
onClick,
|
|
116
124
|
selected,
|
|
117
125
|
disabled,
|
|
@@ -128,7 +136,7 @@ function ListItemRow({
|
|
|
128
136
|
|
|
129
137
|
Peer dependencies:
|
|
130
138
|
|
|
131
|
-
- `@molecule/app-react` ^4.
|
|
139
|
+
- `@molecule/app-react` ^4.13.0
|
|
132
140
|
- `@molecule/app-ui` ^1.0.1
|
|
133
141
|
- `@molecule/app-ui-react` ^4.0.0
|
|
134
142
|
- `react` ^18.0.0 || ^19.0.0
|
|
@@ -150,4 +158,7 @@ Peer dependencies:
|
|
|
150
158
|
own clicks.
|
|
151
159
|
- `disabled` halves the opacity and disables the open button (no pointer
|
|
152
160
|
cursor, no activation); there is no `data-mol-id` prop.
|
|
161
|
+
- Pass `toggle` for a loaded server-backed action that belongs on the row.
|
|
162
|
+
It renders the real `OptimisticToggleButton` beside any read-only counts in
|
|
163
|
+
`metadata`. Key each row by record identity when rendering a collection.
|
|
153
164
|
- Styling resolves through `getClassMap()` — wire a ClassMap bond first.
|
package/dist/ListItemRow.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type JSX, type ReactNode } from 'react';
|
|
2
|
+
import { type OptimisticToggleButtonProps } from '@molecule/app-ui-react';
|
|
2
3
|
/** Props for {@link ListItemRow}. */
|
|
3
4
|
export interface ListItemRowProps {
|
|
4
5
|
/** Title — first line. */
|
|
@@ -11,6 +12,8 @@ export interface ListItemRowProps {
|
|
|
11
12
|
leading?: ReactNode;
|
|
12
13
|
/** Optional right-side actions (buttons, action menu). */
|
|
13
14
|
actions?: ReactNode;
|
|
15
|
+
/** Loaded boolean action rendered as a native button, independently of read-only metadata. */
|
|
16
|
+
toggle?: OptimisticToggleButtonProps;
|
|
14
17
|
/**
|
|
15
18
|
* Called when the row is activated. The whole row is clickable through a
|
|
16
19
|
* transparent native button over it, named by the title; the inner controls
|
|
@@ -44,5 +47,5 @@ export interface ListItemRowProps {
|
|
|
44
47
|
* in NOT being a `<tr>` — use this for non-table lists.
|
|
45
48
|
* @param props - Component props (see {@link ListItemRowProps}).
|
|
46
49
|
*/
|
|
47
|
-
export declare function ListItemRow({ title, subtitle, metadata, leading, actions, onClick, selected, disabled, density, className, }: ListItemRowProps): JSX.Element;
|
|
50
|
+
export declare function ListItemRow({ title, subtitle, metadata, leading: leadingProp, actions: actionsProp, toggle, onClick, selected, disabled, density, className, }: ListItemRowProps): JSX.Element;
|
|
48
51
|
//# sourceMappingURL=ListItemRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemRow.d.ts","sourceRoot":"","sources":["../src/ListItemRow.tsx"],"names":[],"mappings":"AAAA,OA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AAO,CAAC,EAAE,SAAS,CAAA;IACnB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,2BAA2B,CAAA;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,6HAA6H;IAC7H,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACnC,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAuB,EACvB,SAAS,GACV,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CA2DhC"}
|
package/dist/ListItemRow.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from 'react';
|
|
3
|
+
import { slot } from '@molecule/app-react/render';
|
|
3
4
|
import { getClassMap } from '@molecule/app-ui';
|
|
5
|
+
import { OptimisticToggleButton } from '@molecule/app-ui-react';
|
|
4
6
|
/**
|
|
5
7
|
* Generic "thumbnail + text + actions" row — used everywhere:
|
|
6
8
|
* navigation lists, mobile menus, inbox-style threads, search
|
|
@@ -19,7 +21,9 @@ import { getClassMap } from '@molecule/app-ui';
|
|
|
19
21
|
* in NOT being a `<tr>` — use this for non-table lists.
|
|
20
22
|
* @param props - Component props (see {@link ListItemRowProps}).
|
|
21
23
|
*/
|
|
22
|
-
export function ListItemRow({ title, subtitle, metadata, leading, actions, onClick, selected, disabled, density = 'comfortable', className, }) {
|
|
24
|
+
export function ListItemRow({ title, subtitle, metadata, leading: leadingProp, actions: actionsProp, toggle, onClick, selected, disabled, density = 'comfortable', className, }) {
|
|
25
|
+
const leading = slot(leadingProp);
|
|
26
|
+
const actions = slot(actionsProp);
|
|
23
27
|
const cm = getClassMap();
|
|
24
28
|
const nameId = useId();
|
|
25
29
|
const padY = density === 'compact' ? 2 : 3;
|
|
@@ -30,5 +34,5 @@ export function ListItemRow({ title, subtitle, metadata, leading, actions, onCli
|
|
|
30
34
|
/* mol-bespoke-button: the whole row is the hit area, not a CTA — an
|
|
31
35
|
empty, transparent button over the row; the inline background/
|
|
32
36
|
border/padding are native resets. */
|
|
33
|
-
className: cm.cn(cm.position('absolute'), cm.inset0, disabled ? undefined : cm.cursorPointer), style: { background: 'transparent', border: 'none', padding: 0 } })), leading && _jsx("div", { className: cm.shrink0, children: leading }), _jsxs("div", { className: cm.cn(cm.flex1, cm.stack(0)), children: [_jsx("div", { id: onClick ? nameId : undefined, className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: title }), subtitle && _jsx("div", { className: cm.textSize('sm'), children: subtitle }), metadata && _jsx("div", { className: cm.textSize('xs'), children: metadata })] }), actions &&
|
|
37
|
+
className: cm.cn(cm.position('absolute'), cm.inset0, disabled ? undefined : cm.cursorPointer), style: { background: 'transparent', border: 'none', padding: 0 } })), leading && _jsx("div", { className: cm.shrink0, children: leading }), _jsxs("div", { className: cm.cn(cm.flex1, cm.stack(0)), children: [_jsx("div", { id: onClick ? nameId : undefined, className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: title }), subtitle && _jsx("div", { className: cm.textSize('sm'), children: subtitle }), metadata && _jsx("div", { className: cm.textSize('xs'), children: metadata })] }), (toggle || actions) && (_jsxs("div", { className: cm.cn(cm.shrink0, cm.position('relative')), children: [toggle && _jsx(OptimisticToggleButton, { ...toggle }), actions] }))] }));
|
|
34
38
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Exports `<ListItemRow>` — leading slot (icon/avatar/thumbnail) + up to three
|
|
5
5
|
* text lines (title / subtitle / metadata) + right-side actions. Props: `title`,
|
|
6
|
-
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `onClick?`, `selected?`,
|
|
6
|
+
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `toggle?`, `onClick?`, `selected?`,
|
|
7
7
|
* `disabled?`, `density?` (`'comfortable'` default | `'compact'`), `className?`.
|
|
8
8
|
* Use for nav lists, mobile menus, search results, picker dialogs, inbox threads.
|
|
9
9
|
* For table rows use `<RowWithActions>` from `@molecule/app-data-table-ui-react`
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
* own clicks.
|
|
21
21
|
* - `disabled` halves the opacity and disables the open button (no pointer
|
|
22
22
|
* cursor, no activation); there is no `data-mol-id` prop.
|
|
23
|
+
* - Pass `toggle` for a loaded server-backed action that belongs on the row.
|
|
24
|
+
* It renders the real `OptimisticToggleButton` beside any read-only counts in
|
|
25
|
+
* `metadata`. Key each row by record identity when rendering a collection.
|
|
23
26
|
* - Styling resolves through `getClassMap()` — wire a ClassMap bond first.
|
|
24
27
|
*
|
|
25
28
|
* @example
|
|
@@ -31,7 +34,12 @@
|
|
|
31
34
|
* subtitle="Last edited 2 hours ago"
|
|
32
35
|
* metadata="3 collaborators · 12 files"
|
|
33
36
|
* leading={<img src="/icons/folder.svg" alt="" width={32} height={32} />}
|
|
34
|
-
*
|
|
37
|
+
* toggle={{
|
|
38
|
+
* value: project.pinned,
|
|
39
|
+
* commit: async (desired) => (await setPinned(project.id, desired)).pinned,
|
|
40
|
+
* activeLabel: t('projects.unpin', undefined, { defaultValue: 'Unpin project' }),
|
|
41
|
+
* inactiveLabel: t('projects.pin', undefined, { defaultValue: 'Pin project' }),
|
|
42
|
+
* }}
|
|
35
43
|
* onClick={() => navigate('/projects/alpha')}
|
|
36
44
|
* />
|
|
37
45
|
* ```
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,cAAc,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Exports `<ListItemRow>` — leading slot (icon/avatar/thumbnail) + up to three
|
|
5
5
|
* text lines (title / subtitle / metadata) + right-side actions. Props: `title`,
|
|
6
|
-
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `onClick?`, `selected?`,
|
|
6
|
+
* `subtitle?`, `metadata?`, `leading?`, `actions?`, `toggle?`, `onClick?`, `selected?`,
|
|
7
7
|
* `disabled?`, `density?` (`'comfortable'` default | `'compact'`), `className?`.
|
|
8
8
|
* Use for nav lists, mobile menus, search results, picker dialogs, inbox threads.
|
|
9
9
|
* For table rows use `<RowWithActions>` from `@molecule/app-data-table-ui-react`
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
* own clicks.
|
|
21
21
|
* - `disabled` halves the opacity and disables the open button (no pointer
|
|
22
22
|
* cursor, no activation); there is no `data-mol-id` prop.
|
|
23
|
+
* - Pass `toggle` for a loaded server-backed action that belongs on the row.
|
|
24
|
+
* It renders the real `OptimisticToggleButton` beside any read-only counts in
|
|
25
|
+
* `metadata`. Key each row by record identity when rendering a collection.
|
|
23
26
|
* - Styling resolves through `getClassMap()` — wire a ClassMap bond first.
|
|
24
27
|
*
|
|
25
28
|
* @example
|
|
@@ -31,7 +34,12 @@
|
|
|
31
34
|
* subtitle="Last edited 2 hours ago"
|
|
32
35
|
* metadata="3 collaborators · 12 files"
|
|
33
36
|
* leading={<img src="/icons/folder.svg" alt="" width={32} height={32} />}
|
|
34
|
-
*
|
|
37
|
+
* toggle={{
|
|
38
|
+
* value: project.pinned,
|
|
39
|
+
* commit: async (desired) => (await setPinned(project.id, desired)).pinned,
|
|
40
|
+
* activeLabel: t('projects.unpin', undefined, { defaultValue: 'Unpin project' }),
|
|
41
|
+
* inactiveLabel: t('projects.pin', undefined, { defaultValue: 'Pin project' }),
|
|
42
|
+
* }}
|
|
35
43
|
* onClick={() => navigate('/projects/alpha')}
|
|
36
44
|
* />
|
|
37
45
|
* ```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-list-item-row-react",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Thumbnail + title + subtitle + metadata + actions row (nav lists, mobile menus)",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-list-item-row-react",
|
|
6
6
|
"type": "module",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"directory": "packages/app/features/list-item-row-react"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@molecule/app-react": "^4.
|
|
36
|
+
"@molecule/app-react": "^4.13.0",
|
|
37
37
|
"@molecule/app-ui": "^1.0.1",
|
|
38
38
|
"@molecule/app-ui-react": "^4.0.0",
|
|
39
39
|
"react": "^18.0.0 || ^19.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@molecule/app-react": "4.
|
|
43
|
-
"@molecule/app-ui": "1.
|
|
44
|
-
"@molecule/app-ui-react": "4.
|
|
42
|
+
"@molecule/app-react": "4.13.0",
|
|
43
|
+
"@molecule/app-ui": "1.5.0",
|
|
44
|
+
"@molecule/app-ui-react": "4.3.2",
|
|
45
45
|
"@types/node": "26.6.5",
|
|
46
46
|
"@types/react": "19.3.0",
|
|
47
47
|
"@types/react-dom": "19.3.0",
|