Files
WRNexusJS/packages/ui/components/List.wrn
T
ClintchizandClaude Opus 5.5 1bed8e4b74 feat(ui): component redesign pass and fixes, release ui 0.8.87
Redesign
- Shared field foundation rules (duplicated across 15 form components and
  emitted globally) are now identical everywhere, so later copies no longer
  silently override earlier redesigns.
- Drawn checkbox and radio controls, white switch thumbs (the thumb was the
  text colour, a black blob in light mode), recessed field wells, keycap
  actions in Modal, Drawer, Popover, Toaster, Pagination, Stepper, DataTable.
- Menus (Dropdown, ContextMenu, Popover, Select dropdown, Navbar panels) share
  one flat raised panel with neutral hover rows and mono section labels.
- Alerts with an accent rail and icon chip; card headers without the grey
  band; accordion, collapse, list, list group, timeline, stats, metrics,
  chat, skeleton, avatar group, clipboard, splitter, section, sidebar,
  navbar and upload progress restyled.
- Chart rebuilt: nice y-axis ticks, gridlines, rounded bars, line and area
  modes, hover tooltips, hidden series leave the scale.

Fixes
- Checkbox and radio labels toggle their input again (empty for="" broke it).
- TimePicker kept every clicked time pressed; only the chosen hour and
  minute are pressed now, and nothing is pressed before a value exists.
- ColorPicker hex readout now follows the picked colour.
- Disabled FileInput no longer shows the native file-input text.
- Date and time panels float instead of pushing content.
- ContextMenu opened at the pointer closes on scroll.
- Drawer left/top/bottom placements slide from their own edge again.
- Image-only Card no longer renders an empty body strip.
- Timeline supports item.time, current/upcoming states, sizes and
  compact/alternate variants; showcase demos use distinct variants.
- ChatBubble: delivery receipts (sending/sent/delivered/read/failed/error)
  and meta aligned to its bubble.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 16:18:13 +05:30

227 lines
7.9 KiB
Plaintext

component List {
outputs {
select(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
}
props {
size: string = "default"
color: string = "primary"
title: string = "List"
description: string = ""
items: unknown[] = []
variant: string = "default"
class: string = ""
}
view {
<section
data-ui-component="List"
aria-label='{title}'
class='wrn-list {class}'
>
{#if title || description}
<header class="wrn-list__header">
{#if title}
<h3 class="wrn-list__title">{title}</h3>
{/if}
{#if description}
<p class="wrn-list__description">{description}</p>
{/if}
</header>
{/if}
<ul
class="wrn-list__items"
data-variant='{variant}'
>
{#each items as item, index}
<li
class="wrn-list__item"
data-variant='{variant}'
@click='if (!item.href) { output.select({ item: item, index: index }) }'
>
{#if item.href}
<a
href='{item.href}'
class="wrn-list__row"
data-size='{size}'
@click='output.select({ item: item, index: index })'
>
{#if item.icon}
<span class="wrn-list__leading-icon"><span class='{item.icon}' aria-hidden="true"></span>
</span>
{/if}
{#if item.imageSrc}
<img src='{item.imageSrc}' alt='{item.imageAlt || ""}' class="wrn-list__image" loading="lazy" />
{/if}
<div class="wrn-list__body">
<div class="wrn-list__heading">
<p class="wrn-list__item-title">{item.title || item.label}</p>
{#if item.meta}
<span class="wrn-list__meta">{item.meta}</span>
{/if}
</div>
{#if item.description}
<p class="wrn-list__item-description">{item.description}</p>
{/if}
{#if item.badge}
<span class="wrn-list__badge">{item.badge}</span>
{/if}
</div>
<span class="icon-[lucide--chevron-right] wrn-list__chevron" aria-hidden="true"></span>
</a>
{:else}
<div class="wrn-list__row" data-size='{size}'>
{#if item.icon}
<span class="wrn-list__leading-icon"><span class='{item.icon}' aria-hidden="true"></span>
</span>
{/if}
<div class="wrn-list__body">
<p class="wrn-list__item-title">{item.title || item.label}</p>
{#if item.description}
<p class="wrn-list__item-description">{item.description}</p>
{/if}
</div>
</div>
{/if}
</li>
{:empty}
<li class="wrn-list__empty">
No items available.
</li>
{/each}
</ul>
<slot></slot>
</section>
}
style {
.wrn-list { width: 100%; }
.wrn-list__header { margin-bottom: 1rem; }
.wrn-list__title {
color: var(--wrn-color-text);
font-size: 1.0625rem;
font-weight: 650;
letter-spacing: -0.015em;
}
.wrn-list__description { margin-top: 0.25rem; color: var(--wrn-color-text-muted); font-size: 0.875rem; line-height: 1.5rem; }
.wrn-list__items {
overflow: hidden;
}
.wrn-list__items:is([data-variant="default"], [data-variant="divided"]) > .wrn-list__item + .wrn-list__item {
border-top: 1px solid var(--wrn-color-border);
}
.wrn-list__items[data-variant="card"] {
border: 1px solid var(--wrn-color-border);
border-radius: var(--wrn-radius);
background: var(--wrn-color-surface-raised);
box-shadow: var(--wrn-shadow-1);
}
.wrn-list__items[data-variant="separated"] { display: grid; gap: 0.75rem; }
.wrn-list__item { min-width: 0; }
.wrn-list__item[data-variant="separated"] {
border: 1px solid var(--wrn-color-border);
border-radius: var(--wrn-radius);
background: var(--wrn-color-surface-raised);
box-shadow: var(--wrn-shadow-1);
}
.wrn-list__row {
display: flex;
min-width: 0;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 1rem;
outline: none;
color: inherit;
text-decoration: none;
background: var(--wrn-color-surface);
transition: background var(--wrn-motion-base);
}
a.wrn-list__row:hover {
background: var(--wrn-color-surface-soft);
}
.wrn-list__row:focus-visible { box-shadow: inset 0 0 0 2px var(--wrn-color-focus); }
.wrn-list__row[data-size="sm"] { padding: 0.625rem 0.75rem; }
.wrn-list__row[data-size="lg"] { padding: 1rem 1.25rem; }
.wrn-list__leading-icon {
display: flex;
width: 2.25rem;
height: 2.25rem;
flex: none;
align-items: center;
justify-content: center;
border-radius: var(--wrn-radius-sm);
color: var(--wrn-color-primary-text, var(--wrn-color-primary));
background: color-mix(in srgb, var(--wrn-color-primary) 10%, var(--wrn-color-surface));
border: 1px solid color-mix(in srgb, var(--wrn-color-primary) 16%, transparent);
}
.wrn-list__leading-icon > span { width: 1.25rem; height: 1.25rem; }
.wrn-list__image { width: 3rem; height: 3rem; flex: none; border-radius: var(--wrn-radius); object-fit: cover; }
.wrn-list__body { min-width: 0; flex: 1; }
.wrn-list__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.wrn-list__item-title {
overflow: hidden;
color: var(--wrn-color-text);
font-size: 0.875rem;
font-weight: 600;
text-overflow: ellipsis;
white-space: nowrap;
}
.wrn-list__meta {
flex: none;
color: var(--wrn-color-text-subtle, var(--wrn-color-text-muted));
font-size: 0.72rem;
font-variant-numeric: tabular-nums;
}
.wrn-list__item-description {
display: -webkit-box;
margin-top: 0.125rem;
overflow: hidden;
color: var(--wrn-color-text-muted);
font-size: 0.8125rem;
line-height: 1.25rem;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.wrn-list__badge {
display: inline-flex;
margin-top: 0.5rem;
padding: 0.125rem 0.5rem;
border-radius: 999px;
color: var(--wrn-color-primary-text, var(--wrn-color-primary));
background: color-mix(in srgb, var(--wrn-color-primary) 10%, var(--wrn-color-surface));
border: 1px solid color-mix(in srgb, var(--wrn-color-primary) 20%, transparent);
font-size: 0.6875rem;
font-weight: 650;
}
.wrn-list__chevron { width: 1rem; height: 1rem; flex: none; margin-top: 0.25rem; color: var(--wrn-color-text-muted); transition: color var(--wrn-motion-base), transform var(--wrn-motion-base); }
.wrn-list__row:hover .wrn-list__chevron {
color: var(--wrn-color-text);
transform: translateX(0.125rem);
}
.wrn-list__empty {
padding: 1.5rem;
border: 1px dashed var(--wrn-color-border-strong, var(--wrn-color-border));
border-radius: var(--wrn-radius);
color: var(--wrn-color-text-muted);
background: var(--wrn-color-surface-soft);
font-size: 0.8125rem;
text-align: center;
}
.wrn-list__items:is([data-variant="default"], [data-variant="divided"]) {
border: 1px solid var(--wrn-color-border);
border-radius: var(--wrn-radius);
background: var(--wrn-color-surface);
box-shadow: var(--wrn-shadow-1);
}
.wrn-list__item[aria-current="true"] > .wrn-list__row,
.wrn-list__item[data-active="true"] > .wrn-list__row {
background: color-mix(in srgb, var(--wrn-color-primary) 8%, var(--wrn-color-surface));
box-shadow: inset 2px 0 0 var(--wrn-color-primary);
}
}
}