121 lines
12 KiB
Plaintext
121 lines
12 KiB
Plaintext
page Inputcomponent {
|
|
seo {
|
|
title = "Input component"
|
|
description = "Theme-aware, responsive input 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.5.0</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">Input</span></nav><section class="doc-intro"><span class="eyebrow">forms component</span><h1>Input</h1><p>Theme-aware, responsive input component.</p><div class="doc-meta"><span>@wrnexus/ui 0.5.0</span><span>28 props</span><span>0 slots</span><span>7 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><Input
|
|
size="default"
|
|
color="primary"
|
|
id="id"
|
|
name="name"
|
|
label="Input"
|
|
/></code></pre><p>Legacy mount name: <code>data-component="Input"</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>size</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>id</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>name</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>label</code></td><td><code>string</code></td><td>Optional</td><td><code>"Input"</code></td></tr><tr><td><code>hiddenLabel</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>placeholder</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>value</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>"text"</code></td></tr><tr><td><code>variant</code></td><td><code>string</code></td><td>Optional</td><td><code>"normal"</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>helperText</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>cornerHint</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>error</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>inline</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>readonly</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</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>required</code></td><td><code>boolean</code></td><td>Optional</td><td><code>false</code></td></tr><tr><td><code>autocomplete</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>inputmode</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>minlength</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>maxlength</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>pattern</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>min</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>max</code></td><td><code>string</code></td><td>Optional</td><td><code>""</code></td></tr><tr><td><code>step</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><p>This component does not declare a slot.</p></section><section id="events"><h2>Events</h2><ul><li><code>input</code></li><li><code>change</code></li><li><code>focus</code></li><li><code>blur</code></li><li><code>invalid</code></li><li><code>keydown</code></li><li><code>keyup</code></li></ul></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/Input.wrn</code></p><pre data-language="wrn"><code>component Input {
|
|
props {
|
|
@event input = function
|
|
@event change = function
|
|
@event focus = function
|
|
@event blur = function
|
|
@event invalid = function
|
|
@event keydown = function
|
|
@event keyup = function
|
|
size = "default"
|
|
color = "primary"
|
|
id = ""
|
|
name = ""
|
|
label = "Input"
|
|
hiddenLabel = false
|
|
placeholder = ""
|
|
value = ""
|
|
type = "text"
|
|
variant = "normal"
|
|
icon = ""
|
|
iconPosition = "start"
|
|
helperText = ""
|
|
cornerHint = ""
|
|
error = ""
|
|
inline = false
|
|
readonly = false
|
|
disabled = false
|
|
required = false
|
|
autocomplete = ""
|
|
inputmode = ""
|
|
minlength = ""
|
|
maxlength = ""
|
|
pattern = ""
|
|
min = ""
|
|
max = ""
|
|
step = ""
|
|
class = ""
|
|
}
|
|
functions {
|
|
function detail(sourceEvent) {
|
|
return { value: sourceEvent.currentTarget.value, name: name, sourceEvent: sourceEvent }
|
|
}
|
|
function handleInput(sourceEvent) { sourceEvent.stopPropagation(); $emit("input", detail(sourceEvent)) }
|
|
function handleChange(sourceEvent) { sourceEvent.stopPropagation(); $emit("change", detail(sourceEvent)) }
|
|
function handleFocus(sourceEvent) { sourceEvent.stopPropagation(); $emit("focus", detail(sourceEvent)) }
|
|
function handleBlur(sourceEvent) { sourceEvent.stopPropagation(); $emit("blur", detail(sourceEvent)) }
|
|
function handleInvalid(sourceEvent) { sourceEvent.stopPropagation(); $emit("invalid", { value: sourceEvent.currentTarget.value, name: name, message: sourceEvent.currentTarget.validationMessage, sourceEvent: sourceEvent }) }
|
|
function handleKeydown(sourceEvent) { sourceEvent.stopPropagation(); $emit("keydown", { key: sourceEvent.key, value: sourceEvent.currentTarget.value, name: name, sourceEvent: sourceEvent }) }
|
|
function handleKeyup(sourceEvent) { sourceEvent.stopPropagation(); $emit("keyup", { key: sourceEvent.key, value: sourceEvent.currentTarget.value, name: name, sourceEvent: sourceEvent }) }
|
|
}
|
|
view {
|
|
<div {...attrs} class="wire-next wire-next--color-{color} wire-next--size-{size} wire-next--field wire-next--input {class}" data-variant="{variant}" data-inline="{inline}" data-floating="{variant === 'floating'}" data-invalid="{error ? 'true' : 'false'}">
|
|
<div class="wire-next__field-heading">
|
|
<label class="{hiddenLabel ? 'wire-next__sr-only' : ''}" for="{id || name}">{label}</label>
|
|
{#if cornerHint}<span class="wire-next__field-hint">{cornerHint}</span>{/if}
|
|
</div>
|
|
<div class="wire-next__field-control" data-icon-position="{iconPosition}">
|
|
{#if icon}<span class="{icon} wire-next__field-icon" aria-hidden="true">
|
|
</span>{/if}
|
|
<input
|
|
id="{id || name}"
|
|
type="{type}"
|
|
name="{name}"
|
|
value="{value}"
|
|
placeholder="{variant === 'floating' ? ' ' : placeholder}"
|
|
readonly="{readonly}"
|
|
disabled="{disabled}"
|
|
required="{required}"
|
|
autocomplete="{autocomplete}"
|
|
inputmode="{inputmode}"
|
|
minlength="{minlength}"
|
|
maxlength="{maxlength}"
|
|
pattern="{pattern}"
|
|
min="{min}"
|
|
max="{max}"
|
|
step="{step}"
|
|
aria-invalid="{error ? 'true' : 'false'}"
|
|
aria-describedby="{error ? (id || name) + '-error' : (helperText ? (id || name) + '-help' : '')}"
|
|
@input="handleInput(event)"
|
|
@change="handleChange(event)"
|
|
@focus="handleFocus(event)"
|
|
@blur="handleBlur(event)"
|
|
@invalid="handleInvalid(event)"
|
|
@keydown="handleKeydown(event)"
|
|
@keyup="handleKeyup(event)"
|
|
/>
|
|
{#if variant === "floating"}<span class="wire-next__field-floating-label">{label}</span>{/if}
|
|
</div>
|
|
{#if helperText}<small id="{(id || name) + '-help'}" class="wire-next__field-help">{helperText}</small>{/if}
|
|
<small id="{(id || name) + '-error'}" class="wire-next__field-error" data-error="{name}">{error}</small>
|
|
</div>
|
|
}
|
|
}
|
|
</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.5.0</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>
|
|
}
|
|
}
|