New changes
This commit is contained in:
+152
-34
@@ -1,7 +1,7 @@
|
||||
page Buttoncomponent {
|
||||
seo {
|
||||
title = "Button component"
|
||||
description = "Reusable button component."
|
||||
description = "Theme-aware, responsive button component."
|
||||
}
|
||||
|
||||
view {
|
||||
@@ -10,60 +10,178 @@ page Buttoncomponent {
|
||||
<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.3.4</a><button data-wire-theme-toggle class="theme-button" aria-label="Toggle color theme" title="Toggle color theme">◐</button></div>
|
||||
<div class="topbar-actions"><a class="preview-pill" href="/access">Private preview · v0.3.5</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">Button</span></nav><section class="doc-intro"><span class="eyebrow">actions component</span><h1>Button</h1><p>Reusable button component.</p><div class="doc-meta"><span>@wrnexus/ui 0.3.4</span><span>10 props</span><span>1 slots</span><span>0 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><Button
|
||||
<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">Button</span></nav><section class="doc-intro"><span class="eyebrow">base component</span><h1>Button</h1><p>Theme-aware, responsive button component.</p><div class="doc-meta"><span>@wrnexus/ui 0.3.5</span><span>25 props</span><span>1 slots</span><span>0 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><Button
|
||||
label="Button"
|
||||
type="button"
|
||||
variant="primary"
|
||||
size="md"
|
||||
disabled="false"
|
||||
/></code></pre><p>Legacy mount name: <code>data-component="Button"</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>label</code></td><td><code>string</code></td><td>Optional</td><td><code>"Button"</code></td></tr><tr><td><code>type</code></td><td><code>string</code></td><td>Optional</td><td><code>"button"</code></td></tr><tr><td><code>variant</code></td><td><code>string</code></td><td>Optional</td><td><code>"primary"</code></td></tr><tr><td><code>size</code></td><td><code>string</code></td><td>Optional</td><td><code>"md"</code></td></tr><tr><td><code>disabled</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>loading</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>icon</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>iconPosition</code></td><td><code>string</code></td><td>Optional</td><td><code>"start"</code></td></tr><tr><td><code>fullWidth</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>className</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr></tbody></table></div></section><section id="slots"><h2>Slots</h2><ul><li><code>default</code></li></ul></section><section id="events"><h2>Events</h2><p>This component does not declare a custom event.</p></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/Button.wrn</code></p><pre data-language="wrn"><code>component Button {
|
||||
loadingLabel="Loading…"
|
||||
description="description"
|
||||
as="as"
|
||||
href="href"
|
||||
/></code></pre><p>Legacy mount name: <code>data-component="Button"</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>label</code></td><td><code>string</code></td><td>Optional</td><td><code>"Button"</code></td></tr><tr><td><code>loadingLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>"Loading…"</code></td></tr><tr><td><code>description</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>as</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>href</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>target</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>rel</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>type</code></td><td><code>string</code></td><td>Optional</td><td><code>"button"</code></td></tr><tr><td><code>variant</code></td><td><code>string</code></td><td>Optional</td><td><code>"default"</code></td></tr><tr><td><code>color</code></td><td><code>string</code></td><td>Optional</td><td><code>"primary"</code></td></tr><tr><td><code>size</code></td><td><code>string</code></td><td>Optional</td><td><code>"default"</code></td></tr><tr><td><code>disabled</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>loading</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>pill</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>fullWidth</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>icon</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>iconPosition</code></td><td><code>string</code></td><td>Optional</td><td><code>"start"</code></td></tr><tr><td><code>ariaLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>ariaPressed</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>ariaExpanded</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>ariaControls</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>title</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>autofocus</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>controlClass</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>class</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr></tbody></table></div></section><section id="slots"><h2>Slots</h2><ul><li><code>default</code></li></ul></section><section id="events"><h2>Events</h2><p>This component does not declare a custom event.</p></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/Button.wrn</code></p><pre data-language="wrn"><code>component Button {
|
||||
props {
|
||||
label = "Button"
|
||||
loadingLabel = "Loading…"
|
||||
description = ""
|
||||
as = ""
|
||||
href = ""
|
||||
target = ""
|
||||
rel = ""
|
||||
type = "button"
|
||||
variant = "primary"
|
||||
size = "md"
|
||||
variant = "default"
|
||||
color = "primary"
|
||||
size = "default"
|
||||
disabled = false
|
||||
loading = false
|
||||
pill = false
|
||||
fullWidth = false
|
||||
icon = ""
|
||||
iconPosition = "start"
|
||||
fullWidth = false
|
||||
className = ""
|
||||
ariaLabel = ""
|
||||
ariaPressed = ""
|
||||
ariaExpanded = ""
|
||||
ariaControls = ""
|
||||
title = ""
|
||||
autofocus = false
|
||||
controlClass = ""
|
||||
class = ""
|
||||
}
|
||||
|
||||
view {
|
||||
<button
|
||||
type="{type}"
|
||||
disabled="{disabled || loading}"
|
||||
aria-busy="{loading}"
|
||||
class="wire-btn wire-btn--{variant} wire-btn--{size} {className}"
|
||||
class:w-full='{fullWidth}'
|
||||
<span
|
||||
class="wire-action {fullWidth ? 'w-full' : ''} {class}"
|
||||
>
|
||||
{#if loading}
|
||||
<span class="wire-spinner" aria-hidden="true">
|
||||
{#if as === "a" || (as === "" && href)}
|
||||
<a
|
||||
{...attrs}
|
||||
href="{disabled || loading ? '' : href}"
|
||||
target="{target}"
|
||||
rel="{rel}"
|
||||
title="{title}"
|
||||
aria-label="{ariaLabel || ((size === 'icon' || size === 'icon-xs' || size === 'icon-sm' || size === 'icon-lg') ? label : '')}"
|
||||
aria-disabled="{disabled || loading}"
|
||||
aria-busy="{loading}"
|
||||
aria-pressed="{ariaPressed}"
|
||||
aria-expanded="{ariaExpanded}"
|
||||
aria-controls="{ariaControls}"
|
||||
tabindex="{disabled || loading ? '-1' : '0'}"
|
||||
class="wire-btn wire-btn--variant-{variant} wire-btn--color-{color} wire-btn--size-{size} {pill ? 'wire-btn--pill' : ''} {description ? 'wire-btn--with-description' : ''} {fullWidth ? 'w-full' : ''} {controlClass}"
|
||||
>
|
||||
{#if loading}
|
||||
<span
|
||||
class="wire-spinner wire-spinner--inline"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if icon && !loading && iconPosition === "start"}
|
||||
<span class="{icon} size-4 shrink-0" aria-hidden="true">
|
||||
{/if}
|
||||
{#if icon && !loading && iconPosition === "start"}
|
||||
<span
|
||||
class="wire-btn__icon {icon}"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<span>{label}</span>
|
||||
|
||||
{#if icon && !loading && iconPosition === "end"}
|
||||
<span class="{icon} size-4 shrink-0" aria-hidden="true">
|
||||
{/if}
|
||||
<span
|
||||
class="wire-btn__copy {(size === 'icon' || size === 'icon-xs' || size === 'icon-sm' || size === 'icon-lg') ? 'wire-visually-hidden' : ''}"
|
||||
>
|
||||
<span
|
||||
class="wire-btn__label"
|
||||
>
|
||||
<slot>{loading ? loadingLabel : label}</slot>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<slot />
|
||||
{#if description && !loading}
|
||||
<span
|
||||
class="wire-btn__description"
|
||||
>
|
||||
{description}
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
{#if icon && !loading && iconPosition === "end"}
|
||||
<span
|
||||
class="wire-btn__icon {icon}"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</span>
|
||||
{/if}
|
||||
{#if (size === "icon" || size === "icon-xs" || size === "icon-sm" || size === "icon-lg") && (ariaLabel || label)}
|
||||
<span
|
||||
class="wire-btn__tooltip"
|
||||
role="tooltip"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{ariaLabel || label}
|
||||
</span>
|
||||
{/if}
|
||||
</a>
|
||||
{:else}
|
||||
<button
|
||||
{...attrs}
|
||||
type="{type}"
|
||||
title="{title}"
|
||||
autofocus="{autofocus}"
|
||||
disabled="{disabled || loading}"
|
||||
aria-label="{ariaLabel || ((size === 'icon' || size === 'icon-xs' || size === 'icon-sm' || size === 'icon-lg') ? label : '')}"
|
||||
aria-busy="{loading}"
|
||||
aria-pressed="{ariaPressed}"
|
||||
aria-expanded="{ariaExpanded}"
|
||||
aria-controls="{ariaControls}"
|
||||
class="wire-btn wire-btn--variant-{variant} wire-btn--color-{color} wire-btn--size-{size} {pill ? 'wire-btn--pill' : ''} {description ? 'wire-btn--with-description' : ''} {fullWidth ? 'w-full' : ''} {controlClass}"
|
||||
>
|
||||
{#if loading}
|
||||
<span
|
||||
class="wire-spinner wire-spinner--inline"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</span>
|
||||
{/if}
|
||||
{#if icon && !loading && iconPosition === "start"}
|
||||
<span
|
||||
class="wire-btn__icon {icon}"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</span>
|
||||
{/if}
|
||||
<span
|
||||
class="wire-btn__copy {(size === 'icon' || size === 'icon-xs' || size === 'icon-sm' || size === 'icon-lg') ? 'wire-visually-hidden' : ''}"
|
||||
>
|
||||
<span
|
||||
class="wire-btn__label"
|
||||
>
|
||||
<slot>{loading ? loadingLabel : label}</slot>
|
||||
</span>
|
||||
{#if description && !loading}
|
||||
<span
|
||||
class="wire-btn__description"
|
||||
>
|
||||
{description}
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
{#if icon && !loading && iconPosition === "end"}
|
||||
<span
|
||||
class="wire-btn__icon {icon}"
|
||||
aria-hidden="true"
|
||||
>
|
||||
</span>
|
||||
{/if}
|
||||
{#if (size === "icon" || size === "icon-xs" || size === "icon-sm" || size === "icon-lg") && (ariaLabel || label)}
|
||||
<span
|
||||
class="wire-btn__tooltip"
|
||||
role="tooltip"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{ariaLabel || label}
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
}
|
||||
}
|
||||
</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.3.4</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>
|
||||
<footer><div class="footer-brand"><span class="footer-mark" aria-hidden="true">W</span><p><strong>WRNexusJS 0.3.5</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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user