@molecule/app-list-item-row-svelte 1.1.0 → 1.2.0
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 +19 -10
- package/dist/ListItemRow.svelte +39 -17
- package/dist/ListItemRow.svelte.d.ts.map +1 -1
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -7
- package/dist/types.d.ts +9 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
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-18T19:30:11.638Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-list-item-row-svelte
|
|
@@ -75,9 +75,15 @@ interface ListItemRowProps {
|
|
|
75
75
|
leading?: Snippet | string | number
|
|
76
76
|
/** Optional right-side actions (buttons, action menu). A snippet renders inline. */
|
|
77
77
|
actions?: Snippet | string | number
|
|
78
|
-
/**
|
|
78
|
+
/** Loaded boolean action rendered as its own native button, independently of read-only metadata. */
|
|
79
|
+
toggle?: OptimisticToggleButtonProps
|
|
80
|
+
/**
|
|
81
|
+
* Called when the row is activated. The whole row is clickable through a
|
|
82
|
+
* transparent native button over it, named by the title; the inner controls
|
|
83
|
+
* (the `actions` slot) sit above it and keep their own clicks.
|
|
84
|
+
*/
|
|
79
85
|
onClick?: () => void
|
|
80
|
-
/** When true, sets `aria-
|
|
86
|
+
/** When true, sets `aria-current="true"` on the row — no built-in visual highlight; style it via `className` or host CSS. */
|
|
81
87
|
selected?: boolean
|
|
82
88
|
/** When true, renders in a disabled visual state. */
|
|
83
89
|
disabled?: boolean
|
|
@@ -114,13 +120,16 @@ Peer dependencies:
|
|
|
114
120
|
- `@molecule/app-ui-svelte`
|
|
115
121
|
- `svelte`
|
|
116
122
|
|
|
117
|
-
- `selected` only sets the `aria-
|
|
118
|
-
Pass a highlight class via `className` (or target
|
|
119
|
-
host CSS) to make selection visible.
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
`
|
|
123
|
+
- `selected` only sets the `aria-current="true"` attribute — no built-in
|
|
124
|
+
highlight. Pass a highlight class via `className` (or target
|
|
125
|
+
`[aria-current="true"]` in host CSS) to make selection visible.
|
|
126
|
+
- With `onClick` the whole row is clickable through a transparent native
|
|
127
|
+
button over it, named by the title (`aria-labelledby`); Enter / Space on
|
|
128
|
+
that button run the same handler a click anywhere on the row runs, and the
|
|
129
|
+
inner controls (the `actions` slot) sit above the button and keep their
|
|
130
|
+
own clicks.
|
|
131
|
+
- `disabled` halves the opacity and disables the open button (no pointer
|
|
132
|
+
cursor, no activation); there is no `data-mol-id` prop.
|
|
124
133
|
- Styling resolves through `getClassMap()` — wire a ClassMap bond first.
|
|
125
134
|
- Node-valued props (`title`, `leading`, `actions`, …) take a snippet or a
|
|
126
135
|
plain value — both render inline.
|
package/dist/ListItemRow.svelte
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
ListItemRow: the Svelte counterpart of `@molecule/app-list-item-row-react`'s
|
|
3
3
|
`ListItemRow` — generic "thumbnail + text + actions" row: leading slot, up to
|
|
4
4
|
three text lines (title / subtitle / metadata), right-side actions. Same
|
|
5
|
-
props (React names), same DOM for the same input.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
with `onClick` the row is a clickable div WITHOUT button semantics — wrap it
|
|
9
|
-
in your own button/link (or add key handling) where keyboard access matters.
|
|
5
|
+
props (React names), same DOM for the same input. With `onClick` the whole
|
|
6
|
+
row is clickable through a transparent native button over it, named by the
|
|
7
|
+
title, and the `actions` slot sits above it and keeps its own clicks.
|
|
10
8
|
-->
|
|
11
9
|
<script lang="ts">
|
|
12
10
|
import { getClassMap } from '@molecule/app-ui'
|
|
11
|
+
import { OptimisticToggleButton } from '@molecule/app-ui-svelte'
|
|
13
12
|
|
|
14
13
|
import type { ListItemRowProps } from './types.js'
|
|
15
14
|
|
|
@@ -19,6 +18,7 @@
|
|
|
19
18
|
metadata,
|
|
20
19
|
leading,
|
|
21
20
|
actions,
|
|
21
|
+
toggle,
|
|
22
22
|
onClick,
|
|
23
23
|
selected,
|
|
24
24
|
disabled,
|
|
@@ -27,33 +27,51 @@
|
|
|
27
27
|
}: ListItemRowProps = $props()
|
|
28
28
|
|
|
29
29
|
const cm = $derived(getClassMap())
|
|
30
|
-
const
|
|
30
|
+
const nameId = $props.id()
|
|
31
31
|
const padY = $derived(density === 'compact' ? 2 : 3)
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
|
-
<!-- svelte-ignore a11y_no_noninteractive_tabindex, a11y_click_events_have_key_events, a11y_no_static_element_interactions -->
|
|
35
34
|
<div
|
|
36
|
-
|
|
37
|
-
tabindex={clickable ? 0 : undefined}
|
|
38
|
-
aria-selected={selected}
|
|
35
|
+
aria-current={selected ? 'true' : undefined}
|
|
39
36
|
aria-disabled={disabled}
|
|
40
|
-
onclick={disabled ? undefined : onClick}
|
|
41
37
|
class={cm.cn(
|
|
42
38
|
cm.flex({ align: 'center', gap: 'sm' }),
|
|
43
39
|
cm.sp('px', 3),
|
|
44
40
|
cm.sp('py', padY),
|
|
45
|
-
|
|
41
|
+
onClick ? cm.position('relative') : undefined,
|
|
46
42
|
className,
|
|
47
43
|
)}
|
|
48
44
|
style:opacity={disabled ? 0.5 : undefined}
|
|
49
45
|
>
|
|
46
|
+
{#if onClick}
|
|
47
|
+
<!-- mol-bespoke-button: the whole row is the hit area, not a CTA — an
|
|
48
|
+
empty, transparent button over the row; the inline background/border/
|
|
49
|
+
padding are native resets. React writes the shorthand `border: 'none'`
|
|
50
|
+
and `padding: 0`, which the CSSOM serializes as `border: medium` and
|
|
51
|
+
`0px` — Svelte writes the style attribute directly, so the port writes
|
|
52
|
+
that same serialized form (identical computed style). -->
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
aria-labelledby={nameId}
|
|
56
|
+
data-mol-id="list-item-row-open"
|
|
57
|
+
{disabled}
|
|
58
|
+
onclick={() => {
|
|
59
|
+
if (!disabled) onClick?.()
|
|
60
|
+
}}
|
|
61
|
+
class={cm.cn(cm.position('absolute'), cm.inset0, disabled ? undefined : cm.cursorPointer)}
|
|
62
|
+
style="background: transparent; border: medium; padding: 0px"
|
|
63
|
+
></button>
|
|
64
|
+
{/if}
|
|
50
65
|
{#if leading}
|
|
51
66
|
<div class={cm.shrink0}>
|
|
52
67
|
{#if typeof leading === 'function'}{@render leading()}{:else}{leading}{/if}
|
|
53
68
|
</div>
|
|
54
69
|
{/if}
|
|
55
70
|
<div class={cm.cn(cm.flex1, cm.stack(0))}>
|
|
56
|
-
<div
|
|
71
|
+
<div
|
|
72
|
+
id={onClick ? nameId : undefined}
|
|
73
|
+
class={cm.cn(cm.textSize('sm'), cm.fontWeight('semibold'))}
|
|
74
|
+
>
|
|
57
75
|
{#if typeof title === 'function'}{@render title()}{:else}{title}{/if}
|
|
58
76
|
</div>
|
|
59
77
|
{#if subtitle}
|
|
@@ -67,10 +85,14 @@
|
|
|
67
85
|
</div>
|
|
68
86
|
{/if}
|
|
69
87
|
</div>
|
|
70
|
-
{#if actions}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
{#if toggle || actions}
|
|
89
|
+
<div class={cm.cn(cm.shrink0, cm.position('relative'))}>
|
|
90
|
+
{#if toggle}
|
|
91
|
+
<OptimisticToggleButton {...toggle} />
|
|
92
|
+
{/if}
|
|
93
|
+
{#if actions}
|
|
94
|
+
{#if typeof actions === 'function'}{@render actions()}{:else}{actions}{/if}
|
|
95
|
+
{/if}
|
|
74
96
|
</div>
|
|
75
97
|
{/if}
|
|
76
98
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemRow.svelte.d.ts","sourceRoot":"","sources":["../src/ListItemRow.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ListItemRow.svelte.d.ts","sourceRoot":"","sources":["../src/ListItemRow.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA2EnD,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -32,13 +32,16 @@
|
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
34
|
* @remarks
|
|
35
|
-
* - `selected` only sets the `aria-
|
|
36
|
-
* Pass a highlight class via `className` (or target
|
|
37
|
-
* host CSS) to make selection visible.
|
|
38
|
-
* -
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `
|
|
35
|
+
* - `selected` only sets the `aria-current="true"` attribute — no built-in
|
|
36
|
+
* highlight. Pass a highlight class via `className` (or target
|
|
37
|
+
* `[aria-current="true"]` in host CSS) to make selection visible.
|
|
38
|
+
* - With `onClick` the whole row is clickable through a transparent native
|
|
39
|
+
* button over it, named by the title (`aria-labelledby`); Enter / Space on
|
|
40
|
+
* that button run the same handler a click anywhere on the row runs, and the
|
|
41
|
+
* inner controls (the `actions` slot) sit above the button and keep their
|
|
42
|
+
* own clicks.
|
|
43
|
+
* - `disabled` halves the opacity and disables the open button (no pointer
|
|
44
|
+
* cursor, no activation); there is no `data-mol-id` prop.
|
|
42
45
|
* - Styling resolves through `getClassMap()` — wire a ClassMap bond first.
|
|
43
46
|
* - Node-valued props (`title`, `leading`, `actions`, …) take a snippet or a
|
|
44
47
|
* plain value — both render inline.
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -32,13 +32,16 @@
|
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
34
|
* @remarks
|
|
35
|
-
* - `selected` only sets the `aria-
|
|
36
|
-
* Pass a highlight class via `className` (or target
|
|
37
|
-
* host CSS) to make selection visible.
|
|
38
|
-
* -
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `
|
|
35
|
+
* - `selected` only sets the `aria-current="true"` attribute — no built-in
|
|
36
|
+
* highlight. Pass a highlight class via `className` (or target
|
|
37
|
+
* `[aria-current="true"]` in host CSS) to make selection visible.
|
|
38
|
+
* - With `onClick` the whole row is clickable through a transparent native
|
|
39
|
+
* button over it, named by the title (`aria-labelledby`); Enter / Space on
|
|
40
|
+
* that button run the same handler a click anywhere on the row runs, and the
|
|
41
|
+
* inner controls (the `actions` slot) sit above the button and keep their
|
|
42
|
+
* own clicks.
|
|
43
|
+
* - `disabled` halves the opacity and disables the open button (no pointer
|
|
44
|
+
* cursor, no activation); there is no `data-mol-id` prop.
|
|
42
45
|
* - Styling resolves through `getClassMap()` — wire a ClassMap bond first.
|
|
43
46
|
* - Node-valued props (`title`, `leading`, `actions`, …) take a snippet or a
|
|
44
47
|
* plain value — both render inline.
|
package/dist/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import type { Snippet } from 'svelte';
|
|
7
|
+
import type { OptimisticToggleButtonProps } from '@molecule/app-ui-svelte';
|
|
7
8
|
/** Props accepted by the {@link ListItemRow} component. */
|
|
8
9
|
export interface ListItemRowProps {
|
|
9
10
|
/** Title — first line. A snippet renders inline. */
|
|
@@ -16,9 +17,15 @@ export interface ListItemRowProps {
|
|
|
16
17
|
leading?: Snippet | string | number;
|
|
17
18
|
/** Optional right-side actions (buttons, action menu). A snippet renders inline. */
|
|
18
19
|
actions?: Snippet | string | number;
|
|
19
|
-
/**
|
|
20
|
+
/** Loaded boolean action rendered as its own native button, independently of read-only metadata. */
|
|
21
|
+
toggle?: OptimisticToggleButtonProps;
|
|
22
|
+
/**
|
|
23
|
+
* Called when the row is activated. The whole row is clickable through a
|
|
24
|
+
* transparent native button over it, named by the title; the inner controls
|
|
25
|
+
* (the `actions` slot) sit above it and keep their own clicks.
|
|
26
|
+
*/
|
|
20
27
|
onClick?: () => void;
|
|
21
|
-
/** When true, sets `aria-
|
|
28
|
+
/** When true, sets `aria-current="true"` on the row — no built-in visual highlight; style it via `className` or host CSS. */
|
|
22
29
|
selected?: boolean;
|
|
23
30
|
/** When true, renders in a disabled visual state. */
|
|
24
31
|
disabled?: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACpC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACpC,uFAAuF;IACvF,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACnC,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACnC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AAE1E,2DAA2D;AAC3D,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACpC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACpC,uFAAuF;IACvF,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACnC,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IACnC,oGAAoG;IACpG,MAAM,CAAC,EAAE,2BAA2B,CAAA;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,6HAA6H;IAC7H,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;IACnC,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-list-item-row-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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-svelte",
|
|
6
6
|
"type": "module",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
58
58
|
"@molecule/app-i18n": "1.2.2",
|
|
59
59
|
"@molecule/app-icons": "1.0.4",
|
|
60
|
-
"@molecule/app-svelte": "3.7.
|
|
60
|
+
"@molecule/app-svelte": "3.7.2",
|
|
61
61
|
"@molecule/app-ui": "1.4.0",
|
|
62
|
-
"@molecule/app-ui-svelte": "1.1.
|
|
62
|
+
"@molecule/app-ui-svelte": "1.1.7",
|
|
63
63
|
"@sveltejs/package": "3.0.2",
|
|
64
64
|
"@sveltejs/vite-plugin-svelte": "7.1.2",
|
|
65
65
|
"@types/node": "26.6.5",
|