An output only reaches a parent @binding when the component calls output.<name>(). Two separate faults meant most of the library never got there, and both failed silently at each end. HTML lowercases attribute names, so a parent's @sizeChange registered under "sizechange" while the component emitted "sizeChange". The lookup missed, fell through to a DOM dispatch, and the binding was never invoked. That made all 17 camelCase outputs undeliverable -- DataTable.pageChange and .rowClick, Map.markerClick, ChatBubble.messageClick, LayoutSplitter.sizeChange and the rest. invokeComponentOutput now falls back to a case-insensitive lookup, and a csr test fails without it. Separately, 18 components dispatched hand-built CustomEvents rather than calling output.*. A bubbling event on the component's own root never reaches a binding, because parent handlers live in a registry only the output proxy reads. Card, Footer, Breadcrumb, Accordion, alert, Badge, AnnouncementBar, AvatarGroup, ToggleCount and InputNumber now emit properly; Marquee, Map, Timeline, List and SearchBox additionally declare the outputs they were already firing. Dispatches on window are left alone -- that is how Toaster, Modal and DataTable signal across component boundaries. Verified in a browser both ways before and after: an AnnouncementBar dispatching its own bubbling "dismiss" never reached a page-level @dismiss, and reached it immediately once it called output.dismiss(). This corrects the audit, which called the LayoutSplitter failure "narrow and unexplained" and read 32 dead outputs as 16 components needing a rebuild. "Outputs work elsewhere" was an assumption; the components that worked happened to use lowercase names and output.*. The dead-output ratchet drops from 32 to 22, and a new test forbids the raw-CustomEvent pattern outright. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
151 lines
4.4 KiB
Plaintext
151 lines
4.4 KiB
Plaintext
component AvatarGroup {
|
|
outputs {
|
|
overflow(payload: { sourceEvent?: Event; value: string | number | boolean | null | object; [key: string]: string | number | boolean | null | object } | string | number | boolean | null | object[])
|
|
}
|
|
|
|
props {
|
|
items: unknown[] = []
|
|
size: string = "md"
|
|
color: string = "primary"
|
|
variant: string = "solid"
|
|
shape: string = "circle"
|
|
layout: string = "stack"
|
|
maxVisible: number = 4
|
|
columns: number = 3
|
|
borderColor: string = ""
|
|
showTooltips: boolean = true
|
|
overflowLabel: string = "Show remaining members"
|
|
class: string = ""
|
|
|
|
}
|
|
|
|
state overflowOpen: boolean = false
|
|
|
|
functions {
|
|
shared function visibleMembers() {
|
|
return items.slice(0, Number(maxVisible))
|
|
}
|
|
|
|
shared function hiddenMembers() {
|
|
return items.slice(Number(maxVisible))
|
|
}
|
|
|
|
client function toggleOverflow() {
|
|
overflowOpen = !overflowOpen
|
|
output.overflow({
|
|
component: "AvatarGroup",
|
|
open: overflowOpen,
|
|
hiddenCount: hiddenMembers().length
|
|
})
|
|
}
|
|
}
|
|
|
|
view {
|
|
<div
|
|
{...attrs}
|
|
class="wire-next wire-next--avatar-group {class}"
|
|
data-wrn-avatar-group
|
|
data-layout="{layout}"
|
|
data-shape="{shape}"
|
|
data-size="{size}"
|
|
style="--wire-avatar-group-columns:{columns}; --wire-avatar-group-ring:{borderColor || 'var(--wire-color-bg)'}"
|
|
role="group"
|
|
aria-label="Avatar group"
|
|
>
|
|
<div
|
|
class="wire-next__avatar-group-members"
|
|
>
|
|
{#each visibleMembers() as item}
|
|
<span
|
|
class="wire-next__avatar-group-member"
|
|
data-size="{item.size || size}"
|
|
data-shape="{item.shape || shape}"
|
|
data-color="{item.color || color}"
|
|
data-variant="{item.variant || variant}"
|
|
tabindex="{showTooltips && (item.tooltip || item.name) ? '0' : '-1'}"
|
|
aria-label="{item.name || item.alt || item.initials || 'Group member'}"
|
|
>
|
|
<span
|
|
class="wire-next__avatar-group-avatar"
|
|
>
|
|
{#if item.src}
|
|
<img
|
|
src="{item.src}"
|
|
alt="{item.alt || item.name || ''}"
|
|
loading="lazy"
|
|
/>
|
|
{:else if item.initials}
|
|
<span
|
|
aria-hidden="true"
|
|
>
|
|
{item.initials}
|
|
</span>
|
|
{:else}
|
|
<span
|
|
class="icon-[lucide--user-round]"
|
|
aria-hidden="true"
|
|
>
|
|
</span>
|
|
{/if}
|
|
</span>
|
|
|
|
{#if showTooltips && (item.tooltip || item.name)}
|
|
<span
|
|
class="wire-next__avatar-group-tooltip"
|
|
role="tooltip"
|
|
>
|
|
{item.tooltip || item.name}
|
|
</span>
|
|
{/if}
|
|
</span>
|
|
{/each}
|
|
|
|
{#if hiddenMembers().length > 0}
|
|
<span
|
|
class="wire-next__avatar-group-overflow"
|
|
>
|
|
<button
|
|
type="button"
|
|
class="wire-next__avatar-group-overflow-button"
|
|
aria-label="{overflowLabel}"
|
|
aria-expanded="{overflowOpen ? 'true' : 'false'}"
|
|
@click="toggleOverflow(event)"
|
|
>
|
|
+{hiddenMembers().length}
|
|
</button>
|
|
|
|
<span
|
|
class="wire-next__avatar-group-menu"
|
|
role="menu"
|
|
data-show="overflowOpen"
|
|
aria-hidden="{overflowOpen ? 'false' : 'true'}"
|
|
>
|
|
{#each hiddenMembers() as item}
|
|
<span
|
|
class="wire-next__avatar-group-menu-item"
|
|
role="menuitem"
|
|
>
|
|
<span
|
|
class="wire-next__avatar-group-menu-avatar"
|
|
>
|
|
{#if item.src}
|
|
<img
|
|
src="{item.src}"
|
|
alt=""
|
|
loading="lazy"
|
|
/>
|
|
{:else}
|
|
<span>{item.initials || '?'}</span>
|
|
{/if}
|
|
</span>
|
|
<span>{item.name || item.alt || item.initials || 'Team member'}</span>
|
|
</span>
|
|
{/each}
|
|
</span>
|
|
</span>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|