115 lines
5.1 KiB
Plaintext
115 lines
5.1 KiB
Plaintext
component Timeline {
|
|
outputs {
|
|
select(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
|
|
}
|
|
|
|
props {
|
|
size: string = "default"
|
|
color: string = "primary"
|
|
title: string = "Timeline"
|
|
description: string = ""
|
|
items: unknown[] = []
|
|
variant: string = "default"
|
|
class: string = ""
|
|
}
|
|
|
|
view {
|
|
<section
|
|
data-ui-component="Timeline"
|
|
aria-label='{title}'
|
|
class='wrn-timeline {class}'
|
|
>
|
|
{#if title || description}
|
|
<header class="wrn-timeline__header">
|
|
{#if title}
|
|
<h3 class="wrn-timeline__title">{title}</h3>
|
|
{/if}
|
|
{#if description}
|
|
<p class="wrn-timeline__description">{description}</p>
|
|
{/if}
|
|
</header>
|
|
{/if}
|
|
|
|
<ol class="wrn-timeline__list">
|
|
{#each items as item, index}
|
|
<li
|
|
class="wrn-timeline__item"
|
|
@click='output.select({ item: item, index: index })'
|
|
>
|
|
<span
|
|
class="wrn-timeline__marker"
|
|
data-status='{item.status || "default"}'
|
|
>
|
|
<span class='{item.icon || "icon-[lucide--circle]"}' aria-hidden="true"></span>
|
|
</span>
|
|
|
|
<article
|
|
class="wrn-timeline__card"
|
|
data-variant='{variant}'
|
|
>
|
|
<div class="wrn-timeline__card-header">
|
|
<div>
|
|
<h4 class="wrn-timeline__item-title">{item.title || item.label}</h4>
|
|
{#if item.subtitle}
|
|
<p class="wrn-timeline__subtitle">{item.subtitle}</p>
|
|
{/if}
|
|
</div>
|
|
{#if item.date || item.meta}
|
|
<time class="wrn-timeline__time">{item.date || item.meta}</time>
|
|
{/if}
|
|
</div>
|
|
|
|
{#if item.description}
|
|
<p class="wrn-timeline__copy">{item.description}</p>
|
|
{/if}
|
|
|
|
{#if item.href}
|
|
<a href='{item.href}' class="wrn-timeline__action">
|
|
<span>{item.actionLabel || "View details"}</span>
|
|
<span class="icon-[lucide--arrow-right] wrn-timeline__action-icon" aria-hidden="true"></span>
|
|
</a>
|
|
{/if}
|
|
</article>
|
|
</li>
|
|
{:empty}
|
|
<li class="wrn-timeline__empty">No timeline items available.</li>
|
|
{/each}
|
|
</ol>
|
|
|
|
<slot></slot>
|
|
</section>
|
|
}
|
|
|
|
style {
|
|
.wrn-timeline { width: 100%; }
|
|
.wrn-timeline__header { margin-bottom: 1.5rem; }
|
|
.wrn-timeline__title { color: var(--wrn-color-text); font-size: 1.25rem; font-weight: 700; }
|
|
.wrn-timeline__description { max-width: 42rem; margin-top: 0.5rem; color: var(--wrn-color-text-muted); line-height: 1.75rem; }
|
|
.wrn-timeline__list { position: relative; margin-left: 1rem; border-left: 1px solid var(--wrn-color-border); }
|
|
.wrn-timeline__item { position: relative; padding: 0 0 2rem 2rem; cursor: pointer; }
|
|
.wrn-timeline__item:last-child { padding-bottom: 0; }
|
|
.wrn-timeline__marker {
|
|
position: absolute; top: 0; left: -1.05rem; display: flex; width: 2rem; height: 2rem;
|
|
align-items: center; justify-content: center; border: 4px solid var(--wrn-color-background);
|
|
border-radius: 50%; color: var(--wrn-color-on-primary); background: var(--wrn-color-primary); box-shadow: var(--wrn-shadow-1);
|
|
}
|
|
.wrn-timeline__marker:is([data-status="complete"], [data-status="success"]) { background: var(--wrn-color-success); }
|
|
.wrn-timeline__marker:is([data-status="warning"], [data-status="pending"]) { background: var(--wrn-color-warning); }
|
|
.wrn-timeline__marker:is([data-status="danger"], [data-status="failed"]) { background: var(--wrn-color-danger); }
|
|
.wrn-timeline__card { padding: 1.25rem; border: 1px solid var(--wrn-color-border); border-radius: calc(var(--wrn-radius) * 1.5); background: var(--wrn-color-surface-raised); box-shadow: var(--wrn-shadow-1); }
|
|
.wrn-timeline__card[data-variant="minimal"] { padding: 0; border-color: transparent; background: transparent; box-shadow: none; }
|
|
.wrn-timeline__card-header { display: flex; flex-direction: column; gap: 0.5rem; }
|
|
.wrn-timeline__item-title { color: var(--wrn-color-text); font-weight: 700; }
|
|
.wrn-timeline__subtitle { margin-top: 0.25rem; color: var(--wrn-color-primary); font-size: 0.875rem; font-weight: 500; }
|
|
.wrn-timeline__time { flex: none; color: var(--wrn-color-text-muted); font-size: 0.875rem; }
|
|
.wrn-timeline__copy { margin-top: 0.75rem; color: var(--wrn-color-text-muted); font-size: 0.875rem; line-height: 1.5rem; }
|
|
.wrn-timeline__action { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1rem; color: var(--wrn-color-primary); font-size: 0.875rem; font-weight: 600; }
|
|
.wrn-timeline__action:hover { color: var(--wrn-color-primary-hover); }
|
|
.wrn-timeline__action-icon { width: 1rem; height: 1rem; }
|
|
.wrn-timeline__empty { padding-left: 2rem; color: var(--wrn-color-text-muted); font-size: 0.875rem; }
|
|
@media (min-width: 40rem) {
|
|
.wrn-timeline__card-header { flex-direction: row; align-items: flex-start; justify-content: space-between; }
|
|
}
|
|
}
|
|
}
|