Files
WRNexusJSDoc/app/pages/components/toast-host.wrn
T

227 lines
14 KiB
Plaintext

page ToastHostcomponent {
seo {
title = "ToastHost component"
description = "Reusable toast host component."
}
view {
<div class="docs-shell">
<SkipLink label="Skip to content" href="#main" class="docs-skip-link" />
<header class="topbar">
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
<nav aria-label="Primary"><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="/components">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.2.78</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
</header>
<div class="mobile-doc-nav"><details><summary>Browse documentation</summary><nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="/components">Components</a><a href="/language">Language</a><a href="/architecture">Architecture</a><a href="/tutorial">Tutorial</a><a href="/guides/project-structure">Guides</a><a href="/examples">Examples</a><a href="/search">Search</a></nav></details></div>
<main class="portal-main docs-layout component-detail-page"><article id="main" class="documentation prose standalone"><nav class="breadcrumbs" aria-label="Breadcrumb"><a href="/">Home</a><span>/</span><a href="/components">Components</a><span>/</span><span aria-current="page">ToastHost</span></nav><section class="doc-intro"><span class="eyebrow">core component</span><h1>ToastHost</h1><p>Reusable toast host component.</p><div class="doc-meta"><span>@wrnexus/ui 0.2.78</span><span>1 props</span><span>0 slots</span><span>1 events</span></div></section><section id="usage"><h2>Usage</h2><p>Components are auto-discovered. Use the component directly in any <code>.wrn</code> view:</p><pre data-language="wrn"><code>&lt;ToastHost /&gt;</code></pre><p>Legacy mount name: <code>data-component=&quot;ToastHost&quot;</code>.</p></section><section id="props"><h2>Props and attributes</h2><div class="table-wrap"><table><thead><tr><th>Prop</th><th>Type</th><th>Requirement</th><th>Default</th></tr></thead><tbody><tr><td><code>class</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr></tbody></table></div></section><section id="slots"><h2>Slots</h2><p>This component does not declare a slot.</p></section><section id="events"><h2>Events</h2><ul><li><code>click</code></li></ul></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/ToastHost.wrn</code></p><pre data-language="wrn"><code>component ToastHost &#123;
props &#123;
class: string = &quot;&quot;
&#125;
state successOpen = false
state errorOpen = false
state warningOpen = false
state infoOpen = false
state successTitle = &quot;Changes saved&quot;
state successMessage = &quot;Your changes were saved successfully.&quot;
state errorTitle = &quot;Something went wrong&quot;
state errorMessage = &quot;We could not complete your request. Please try again.&quot;
state warningTitle = &quot;Action required&quot;
state warningMessage = &quot;Review the highlighted information before continuing.&quot;
state infoTitle = &quot;New update available&quot;
state infoMessage = &quot;A newer version of this feature is now available.&quot;
view &#123;
&lt;div
data-toast-host
aria-live=&quot;polite&quot;
aria-relevant=&quot;additions text&quot;
class=&quot;pointer-events-none fixed inset-x-0 top-0 z-[120] flex flex-col items-end gap-3 p-4 sm:left-auto sm:right-0 sm:w-full sm:max-w-md sm:p-6 &#123;class&#125;&quot;
&gt;
&lt;!-- Success toast --&gt;
&lt;article
role=&quot;status&quot;
class=&quot;pointer-events-auto relative w-full overflow-hidden rounded-2xl border border-emerald-200 bg-white shadow-2xl shadow-slate-950/15 dark:border-emerald-500/20 dark:bg-slate-900 dark:shadow-black/40&quot;
class:hidden=&quot;!successOpen&quot;
class:block=&quot;successOpen&quot;
&gt;
&lt;div class=&quot;absolute inset-y-0 left-0 w-1 bg-emerald-500&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;flex items-start gap-3 p-4 pl-5&quot;&gt;
&lt;span
class=&quot;grid h-10 w-10 shrink-0 place-items-center rounded-xl bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300&quot;
&gt;
&lt;span class=&quot;icon-[lucide--circle-check] h-5 w-5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;div class=&quot;min-w-0 flex-1 pt-0.5&quot;&gt;
&lt;h3 class=&quot;text-sm font-bold text-slate-950 dark:text-white&quot;&gt;
&#123;successTitle&#125;
&lt;/h3&gt;
&lt;p class=&quot;mt-1 text-sm leading-5 text-slate-600 dark:text-slate-400&quot;&gt;
&#123;successMessage&#125;
&lt;/p&gt;
&lt;/div&gt;
&lt;button
type=&quot;button&quot;
@click=&quot;successOpen = false&quot;
aria-label=&quot;Dismiss notification&quot;
class=&quot;grid h-8 w-8 shrink-0 place-items-center rounded-lg text-slate-400 transition hover:bg-slate-100 hover:text-slate-950 focus:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500 dark:hover:bg-white/10 dark:hover:text-white&quot;
&gt;
&lt;span class=&quot;icon-[lucide--x] h-4 w-4&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;div class=&quot;h-1 w-full bg-emerald-100 dark:bg-emerald-500/10&quot;&gt;
&lt;div class=&quot;h-full w-full origin-left bg-emerald-500&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/article&gt;
&lt;!-- Error toast --&gt;
&lt;article
role=&quot;alert&quot;
class=&quot;pointer-events-auto relative w-full overflow-hidden rounded-2xl border border-rose-200 bg-white shadow-2xl shadow-slate-950/15 dark:border-rose-500/20 dark:bg-slate-900 dark:shadow-black/40&quot;
class:hidden=&quot;!errorOpen&quot;
class:block=&quot;errorOpen&quot;
&gt;
&lt;div class=&quot;absolute inset-y-0 left-0 w-1 bg-rose-500&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;flex items-start gap-3 p-4 pl-5&quot;&gt;
&lt;span
class=&quot;grid h-10 w-10 shrink-0 place-items-center rounded-xl bg-rose-100 text-rose-700 dark:bg-rose-500/15 dark:text-rose-300&quot;
&gt;
&lt;span class=&quot;icon-[lucide--circle-x] h-5 w-5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;div class=&quot;min-w-0 flex-1 pt-0.5&quot;&gt;
&lt;h3 class=&quot;text-sm font-bold text-slate-950 dark:text-white&quot;&gt;
&#123;errorTitle&#125;
&lt;/h3&gt;
&lt;p class=&quot;mt-1 text-sm leading-5 text-slate-600 dark:text-slate-400&quot;&gt;
&#123;errorMessage&#125;
&lt;/p&gt;
&lt;button
type=&quot;button&quot;
class=&quot;mt-3 inline-flex items-center gap-1.5 text-xs font-bold text-rose-700 transition hover:text-rose-900 dark:text-rose-300 dark:hover:text-rose-200&quot;
&gt;
Try again
&lt;span class=&quot;icon-[lucide--rotate-cw] h-3.5 w-3.5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;button
type=&quot;button&quot;
@click=&quot;errorOpen = false&quot;
aria-label=&quot;Dismiss notification&quot;
class=&quot;grid h-8 w-8 shrink-0 place-items-center rounded-lg text-slate-400 transition hover:bg-slate-100 hover:text-slate-950 focus:outline-none focus-visible:ring-2 focus-visible:ring-rose-500 dark:hover:bg-white/10 dark:hover:text-white&quot;
&gt;
&lt;span class=&quot;icon-[lucide--x] h-4 w-4&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;div class=&quot;h-1 w-full bg-rose-100 dark:bg-rose-500/10&quot;&gt;
&lt;div class=&quot;h-full w-full origin-left bg-rose-500&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/article&gt;
&lt;!-- Warning toast --&gt;
&lt;article
role=&quot;status&quot;
class=&quot;pointer-events-auto relative w-full overflow-hidden rounded-2xl border border-amber-200 bg-white shadow-2xl shadow-slate-950/15 dark:border-amber-500/20 dark:bg-slate-900 dark:shadow-black/40&quot;
class:hidden=&quot;!warningOpen&quot;
class:block=&quot;warningOpen&quot;
&gt;
&lt;div class=&quot;absolute inset-y-0 left-0 w-1 bg-amber-500&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;flex items-start gap-3 p-4 pl-5&quot;&gt;
&lt;span
class=&quot;grid h-10 w-10 shrink-0 place-items-center rounded-xl bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300&quot;
&gt;
&lt;span class=&quot;icon-[lucide--triangle-alert] h-5 w-5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;div class=&quot;min-w-0 flex-1 pt-0.5&quot;&gt;
&lt;h3 class=&quot;text-sm font-bold text-slate-950 dark:text-white&quot;&gt;
&#123;warningTitle&#125;
&lt;/h3&gt;
&lt;p class=&quot;mt-1 text-sm leading-5 text-slate-600 dark:text-slate-400&quot;&gt;
&#123;warningMessage&#125;
&lt;/p&gt;
&lt;/div&gt;
&lt;button
type=&quot;button&quot;
@click=&quot;warningOpen = false&quot;
aria-label=&quot;Dismiss notification&quot;
class=&quot;grid h-8 w-8 shrink-0 place-items-center rounded-lg text-slate-400 transition hover:bg-slate-100 hover:text-slate-950 focus:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 dark:hover:bg-white/10 dark:hover:text-white&quot;
&gt;
&lt;span class=&quot;icon-[lucide--x] h-4 w-4&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;div class=&quot;h-1 w-full bg-amber-100 dark:bg-amber-500/10&quot;&gt;
&lt;div class=&quot;h-full w-full origin-left bg-amber-500&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/article&gt;
&lt;!-- Information toast --&gt;
&lt;article
role=&quot;status&quot;
class=&quot;pointer-events-auto relative w-full overflow-hidden rounded-2xl border border-indigo-200 bg-white shadow-2xl shadow-slate-950/15 dark:border-indigo-500/20 dark:bg-slate-900 dark:shadow-black/40&quot;
class:hidden=&quot;!infoOpen&quot;
class:block=&quot;infoOpen&quot;
&gt;
&lt;div class=&quot;absolute inset-y-0 left-0 w-1 bg-indigo-500&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;flex items-start gap-3 p-4 pl-5&quot;&gt;
&lt;span
class=&quot;grid h-10 w-10 shrink-0 place-items-center rounded-xl bg-indigo-100 text-indigo-700 dark:bg-indigo-500/15 dark:text-indigo-300&quot;
&gt;
&lt;span class=&quot;icon-[lucide--info] h-5 w-5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/span&gt;
&lt;div class=&quot;min-w-0 flex-1 pt-0.5&quot;&gt;
&lt;h3 class=&quot;text-sm font-bold text-slate-950 dark:text-white&quot;&gt;
&#123;infoTitle&#125;
&lt;/h3&gt;
&lt;p class=&quot;mt-1 text-sm leading-5 text-slate-600 dark:text-slate-400&quot;&gt;
&#123;infoMessage&#125;
&lt;/p&gt;
&lt;a
href=&quot;/changelog&quot;
class=&quot;mt-3 inline-flex items-center gap-1.5 text-xs font-bold text-indigo-700 transition hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-200&quot;
&gt;
View update
&lt;span class=&quot;icon-[lucide--arrow-up-right] h-3.5 w-3.5&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;button
type=&quot;button&quot;
@click=&quot;infoOpen = false&quot;
aria-label=&quot;Dismiss notification&quot;
class=&quot;grid h-8 w-8 shrink-0 place-items-center rounded-lg text-slate-400 transition hover:bg-slate-100 hover:text-slate-950 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 dark:hover:bg-white/10 dark:hover:text-white&quot;
&gt;
&lt;span class=&quot;icon-[lucide--x] h-4 w-4&quot; aria-hidden=&quot;true&quot; &gt;
&lt;/span&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;div class=&quot;h-1 w-full bg-indigo-100 dark:bg-indigo-500/10&quot;&gt;
&lt;div class=&quot;h-full w-full origin-left bg-indigo-500&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/article&gt;
&lt;/div&gt;
&#125;
&#125;
</code></pre></section></article><aside class="on-this-page"><h2>On this page</h2><nav><a href="#usage">Usage</a><a href="#props">Props and attributes</a><a href="#slots">Slots</a><a href="#events">Events</a><a href="#source">Source contract</a></nav></aside></main>
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.2.78</strong><span>Complete API documentation generated from installed package declarations.</span></p></div><nav aria-label="Footer"><a href="/packages">All packages</a><a href="/getting-started">Get started</a><a href="/security">Security</a><a href="/support">Support</a><a href="/llms.txt">AI guide</a></nav><p class="footer-meta">Private Developer Preview · Bun-native</p></footer>
<BackToTop />
</div>
}
}