@molecule/app-list-item-row-react 4.0.0 → 4.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 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-12T04:40:56.809Z
6
+ Generated: 2026-11-17T04:21:39.669Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-list-item-row-react
@@ -68,11 +68,15 @@ interface ListItemRowProps {
68
68
  leading?: ReactNode
69
69
  /** Optional right-side actions (buttons, action menu). */
70
70
  actions?: ReactNode
71
- /** Called when the row body is clicked. */
71
+ /**
72
+ * Called when the row is activated. The whole row is clickable through a
73
+ * transparent native button over it, named by the title; the inner controls
74
+ * (the `actions` slot) sit above it and keep their own clicks.
75
+ */
72
76
  onClick?: () => void
73
- /** When true, sets `aria-selected` on the row — no built-in visual highlight; style it via `className` or host CSS. */
77
+ /** When true, sets `aria-current="true"` on the row — no built-in visual highlight; style it via `className` or host CSS. */
74
78
  selected?: boolean
75
- /** When true, renders in a disabled visual state. */
79
+ /** When true, renders in a disabled visual state and disables the open button. */
76
80
  disabled?: boolean
77
81
  /** Dense vs comfortable spacing. Defaults to `'comfortable'`. */
78
82
  density?: 'comfortable' | 'compact'
@@ -89,6 +93,15 @@ Generic "thumbnail + text + actions" row — used everywhere:
89
93
  navigation lists, mobile menus, inbox-style threads, search
90
94
  results, picker dialogs, bookmark lists, etc.
91
95
 
96
+ With `onClick` the whole row is clickable through a transparent native
97
+ `<button type="button">` stretched over it — named by the title
98
+ (`aria-labelledby`) — so mouse and keyboard users get the same action and
99
+ the hit area is the whole row, not just the text. The `actions` slot sits above that button (a
100
+ `position: relative` wrapper), so its clicks stay its own; everything else
101
+ sits under it, so a click anywhere else on the row runs the handler.
102
+ `disabled` disables the button and drops the pointer cursor.
103
+ Unstyled apart from the transparent button, so the row looks as it did.
104
+
92
105
  Different from `<RowWithActions>` in `@molecule/app-data-table-ui-react`
93
106
  in NOT being a `<tr>` — use this for non-table lists.
94
107
 
@@ -127,11 +140,14 @@ Peer dependencies:
127
140
  - `@molecule/app-ui-react`
128
141
  - `react`
129
142
 
130
- - `selected` only sets the `aria-selected` attribute — no built-in highlight.
131
- Pass a highlight class via `className` (or target `[aria-selected="true"]` in
132
- host CSS) to make selection visible.
133
- - Clicks inside `actions` are stopPropagation'd automatically, so action buttons
134
- never trigger the row `onClick`.
135
- - `disabled` halves the opacity and disables `onClick`; there is no
136
- `data-mol-id` prop.
143
+ - `selected` only sets the `aria-current="true"` attribute — no built-in
144
+ highlight. Pass a highlight class via `className` (or target
145
+ `[aria-current="true"]` in host CSS) to make selection visible.
146
+ - With `onClick` the whole row is clickable through a transparent native
147
+ button over it, named by the title (`aria-labelledby`); Enter / Space on
148
+ that button run the same handler a click anywhere on the row runs, and the
149
+ inner controls (the `actions` slot) sit above the button and keep their
150
+ own clicks.
151
+ - `disabled` halves the opacity and disables the open button (no pointer
152
+ cursor, no activation); there is no `data-mol-id` prop.
137
153
  - Styling resolves through `getClassMap()` — wire a ClassMap bond first.
@@ -1,4 +1,4 @@
1
- import type { JSX, ReactNode } from 'react';
1
+ import { type JSX, type ReactNode } from 'react';
2
2
  /** Props for {@link ListItemRow}. */
3
3
  export interface ListItemRowProps {
4
4
  /** Title — first line. */
@@ -11,11 +11,15 @@ export interface ListItemRowProps {
11
11
  leading?: ReactNode;
12
12
  /** Optional right-side actions (buttons, action menu). */
13
13
  actions?: ReactNode;
14
- /** Called when the row body is clicked. */
14
+ /**
15
+ * Called when the row is activated. The whole row is clickable through a
16
+ * transparent native button over it, named by the title; the inner controls
17
+ * (the `actions` slot) sit above it and keep their own clicks.
18
+ */
15
19
  onClick?: () => void;
16
- /** When true, sets `aria-selected` on the row — no built-in visual highlight; style it via `className` or host CSS. */
20
+ /** When true, sets `aria-current="true"` on the row — no built-in visual highlight; style it via `className` or host CSS. */
17
21
  selected?: boolean;
18
- /** When true, renders in a disabled visual state. */
22
+ /** When true, renders in a disabled visual state and disables the open button. */
19
23
  disabled?: boolean;
20
24
  /** Dense vs comfortable spacing. Defaults to `'comfortable'`. */
21
25
  density?: 'comfortable' | 'compact';
@@ -27,6 +31,15 @@ export interface ListItemRowProps {
27
31
  * navigation lists, mobile menus, inbox-style threads, search
28
32
  * results, picker dialogs, bookmark lists, etc.
29
33
  *
34
+ * With `onClick` the whole row is clickable through a transparent native
35
+ * `<button type="button">` stretched over it — named by the title
36
+ * (`aria-labelledby`) — so mouse and keyboard users get the same action and
37
+ * the hit area is the whole row, not just the text. The `actions` slot sits above that button (a
38
+ * `position: relative` wrapper), so its clicks stay its own; everything else
39
+ * sits under it, so a click anywhere else on the row runs the handler.
40
+ * `disabled` disables the button and drops the pointer cursor.
41
+ * Unstyled apart from the transparent button, so the row looks as it did.
42
+ *
30
43
  * Different from `<RowWithActions>` in `@molecule/app-data-table-ui-react`
31
44
  * in NOT being a `<tr>` — use this for non-table lists.
32
45
  * @param props - Component props (see {@link ListItemRowProps}).
@@ -1 +1 @@
1
- {"version":3,"file":"ListItemRow.d.ts","sourceRoot":"","sources":["../src/ListItemRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAA;IAChB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,2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;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAuB,EACvB,SAAS,GACV,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAoDhC"}
@@ -1,16 +1,34 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
2
3
  import { getClassMap } from '@molecule/app-ui';
3
4
  /**
4
5
  * Generic "thumbnail + text + actions" row — used everywhere:
5
6
  * navigation lists, mobile menus, inbox-style threads, search
6
7
  * results, picker dialogs, bookmark lists, etc.
7
8
  *
9
+ * With `onClick` the whole row is clickable through a transparent native
10
+ * `<button type="button">` stretched over it — named by the title
11
+ * (`aria-labelledby`) — so mouse and keyboard users get the same action and
12
+ * the hit area is the whole row, not just the text. The `actions` slot sits above that button (a
13
+ * `position: relative` wrapper), so its clicks stay its own; everything else
14
+ * sits under it, so a click anywhere else on the row runs the handler.
15
+ * `disabled` disables the button and drops the pointer cursor.
16
+ * Unstyled apart from the transparent button, so the row looks as it did.
17
+ *
8
18
  * Different from `<RowWithActions>` in `@molecule/app-data-table-ui-react`
9
19
  * in NOT being a `<tr>` — use this for non-table lists.
10
20
  * @param props - Component props (see {@link ListItemRowProps}).
11
21
  */
12
22
  export function ListItemRow({ title, subtitle, metadata, leading, actions, onClick, selected, disabled, density = 'comfortable', className, }) {
13
23
  const cm = getClassMap();
24
+ const nameId = useId();
14
25
  const padY = density === 'compact' ? 2 : 3;
15
- return (_jsxs("div", { role: onClick ? 'button' : undefined, tabIndex: onClick && !disabled ? 0 : undefined, "aria-selected": selected, "aria-disabled": disabled, onClick: disabled ? undefined : onClick, className: cm.cn(cm.flex({ align: 'center', gap: 'sm' }), cm.sp('px', 3), cm.sp('py', padY), onClick && !disabled ? cm.cursorPointer : undefined, className), style: disabled ? { opacity: 0.5 } : undefined, children: [leading && _jsx("div", { className: cm.shrink0, children: leading }), _jsxs("div", { className: cm.cn(cm.flex1, cm.stack(0)), children: [_jsx("div", { 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 && (_jsx("div", { onClick: (e) => e.stopPropagation(), className: cm.shrink0, children: actions }))] }));
26
+ return (_jsxs("div", { "aria-current": selected ? 'true' : undefined, "aria-disabled": disabled, className: cm.cn(cm.flex({ align: 'center', gap: 'sm' }), cm.sp('px', 3), cm.sp('py', padY), onClick ? cm.position('relative') : undefined, className), style: disabled ? { opacity: 0.5 } : undefined, children: [onClick && (_jsx("button", { type: "button", "aria-labelledby": nameId, "data-mol-id": "list-item-row-open", disabled: disabled, onClick: () => {
27
+ if (!disabled)
28
+ onClick();
29
+ },
30
+ /* mol-bespoke-button: the whole row is the hit area, not a CTA — an
31
+ empty, transparent button over the row; the inline background/
32
+ 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 && _jsx("div", { className: cm.cn(cm.shrink0, cm.position('relative')), children: actions })] }));
16
34
  }
package/dist/index.d.ts CHANGED
@@ -10,13 +10,16 @@
10
10
  * instead — this component is not a `<tr>`.
11
11
  *
12
12
  * @remarks
13
- * - `selected` only sets the `aria-selected` attribute — no built-in highlight.
14
- * Pass a highlight class via `className` (or target `[aria-selected="true"]` in
15
- * host CSS) to make selection visible.
16
- * - Clicks inside `actions` are stopPropagation'd automatically, so action buttons
17
- * never trigger the row `onClick`.
18
- * - `disabled` halves the opacity and disables `onClick`; there is no
19
- * `data-mol-id` prop.
13
+ * - `selected` only sets the `aria-current="true"` attribute — no built-in
14
+ * highlight. Pass a highlight class via `className` (or target
15
+ * `[aria-current="true"]` in host CSS) to make selection visible.
16
+ * - With `onClick` the whole row is clickable through a transparent native
17
+ * button over it, named by the title (`aria-labelledby`); Enter / Space on
18
+ * that button run the same handler a click anywhere on the row runs, and the
19
+ * inner controls (the `actions` slot) sit above the button and keep their
20
+ * own clicks.
21
+ * - `disabled` halves the opacity and disables the open button (no pointer
22
+ * cursor, no activation); there is no `data-mol-id` prop.
20
23
  * - Styling resolves through `getClassMap()` — wire a ClassMap bond first.
21
24
  *
22
25
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,cAAc,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -10,13 +10,16 @@
10
10
  * instead — this component is not a `<tr>`.
11
11
  *
12
12
  * @remarks
13
- * - `selected` only sets the `aria-selected` attribute — no built-in highlight.
14
- * Pass a highlight class via `className` (or target `[aria-selected="true"]` in
15
- * host CSS) to make selection visible.
16
- * - Clicks inside `actions` are stopPropagation'd automatically, so action buttons
17
- * never trigger the row `onClick`.
18
- * - `disabled` halves the opacity and disables `onClick`; there is no
19
- * `data-mol-id` prop.
13
+ * - `selected` only sets the `aria-current="true"` attribute — no built-in
14
+ * highlight. Pass a highlight class via `className` (or target
15
+ * `[aria-current="true"]` in host CSS) to make selection visible.
16
+ * - With `onClick` the whole row is clickable through a transparent native
17
+ * button over it, named by the title (`aria-labelledby`); Enter / Space on
18
+ * that button run the same handler a click anywhere on the row runs, and the
19
+ * inner controls (the `actions` slot) sit above the button and keep their
20
+ * own clicks.
21
+ * - `disabled` halves the opacity and disables the open button (no pointer
22
+ * cursor, no activation); there is no `data-mol-id` prop.
20
23
  * - Styling resolves through `getClassMap()` — wire a ClassMap bond first.
21
24
  *
22
25
  * @example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-list-item-row-react",
3
- "version": "4.0.0",
3
+ "version": "4.0.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",
@@ -39,9 +39,9 @@
39
39
  "react": "^18.0.0 || ^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@molecule/app-react": "4.0.0",
43
- "@molecule/app-ui": "1.3.9",
44
- "@molecule/app-ui-react": "4.0.0",
42
+ "@molecule/app-react": "4.7.3",
43
+ "@molecule/app-ui": "1.4.0",
44
+ "@molecule/app-ui-react": "4.1.5",
45
45
  "@types/node": "26.6.5",
46
46
  "@types/react": "19.3.0",
47
47
  "@types/react-dom": "19.3.0",