Files
WRNexusJSDoc/app/pages/components/file-upload-progress.wrn
T

73 lines
8.6 KiB
Plaintext

page FileUploadProgresscomponent {
seo {
title = "FileUploadProgress component"
description = "Theme-aware, responsive file upload progress 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">FileUploadProgress</span></nav><section class="doc-intro"><span class="eyebrow">base component</span><h1>FileUploadProgress</h1><p>Theme-aware, responsive file upload progress component.</p><div class="doc-meta"><span>@wrnexus/ui 0.5.0</span><span>13 props</span><span>0 slots</span><span>3 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;FileUploadProgress
size=&quot;default&quot;
color=&quot;primary&quot;
label=&quot;Progress&quot;
value=&quot;50&quot;
max=&quot;100&quot;
/&gt;</code></pre><p>Legacy mount name: <code>data-component=&quot;FileUploadProgress&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>size</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;default&quot;</code></td></tr><tr><td><code>color</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;primary&quot;</code></td></tr><tr><td><code>label</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;Progress&quot;</code></td></tr><tr><td><code>value</code></td><td><code>number</code></td><td>Optional</td><td><code>50</code></td></tr><tr><td><code>max</code></td><td><code>number</code></td><td>Optional</td><td><code>100</code></td></tr><tr><td><code>showValue</code></td><td><code>boolean</code></td><td>Optional</td><td><code>true</code></td></tr><tr><td><code>fileName</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>fileSize</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>uploadedSize</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;&quot;</code></td></tr><tr><td><code>status</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;uploading&quot;</code></td></tr><tr><td><code>cancelLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;Cancel upload&quot;</code></td></tr><tr><td><code>retryLabel</code></td><td><code>string</code></td><td>Optional</td><td><code>&quot;Retry upload&quot;</code></td></tr><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>cancel</code></li><li><code>retry</code></li><li><code>complete</code></li></ul></section><section id="source"><h2>Source contract</h2><p>Installed source: <code>components/FileUploadProgress.wrn</code></p><pre data-language="wrn"><code>component FileUploadProgress &#123;
props &#123;
@event cancel = function
@event retry = function
@event complete = function
size = &quot;default&quot;
color = &quot;primary&quot;
label = &quot;Progress&quot;
value = 50
max = 100
showValue = true
fileName = &quot;&quot;
fileSize = &quot;&quot;
uploadedSize = &quot;&quot;
status = &quot;uploading&quot;
cancelLabel = &quot;Cancel upload&quot;
retryLabel = &quot;Retry upload&quot;
class = &quot;&quot;
&#125;
state currentValue = value
state currentStatus = status
functions &#123;
function percent() &#123; if (!Number(max)) &#123; return 0 &#125; return Math.max(0, Math.min(100, Math.round(Number(currentValue) / Number(max) * 100))) &#125;
function detail(sourceEvent) &#123; return &#123; value: currentValue, max: max, percent: percent(), status: currentStatus, fileName: fileName, sourceEvent: sourceEvent &#125; &#125;
function cancelUpload(sourceEvent) &#123; currentStatus = &quot;cancelled&quot;; $emit(&quot;cancel&quot;, detail(sourceEvent)) &#125;
function retryUpload(sourceEvent) &#123; currentValue = 0; currentStatus = &quot;uploading&quot;; $emit(&quot;retry&quot;, detail(sourceEvent)) &#125;
function completeUpload(sourceEvent) &#123; currentValue = max; currentStatus = &quot;complete&quot;; $emit(&quot;complete&quot;, detail(sourceEvent)) &#125;
&#125;
view &#123;
&lt;div &#123;...attrs&#125; class=&quot;wire-next wire-next--color-&#123;color&#125; wire-next--size-&#123;size&#125; wire-next--file-upload-progress &#123;class&#125;&quot; data-status=&quot;&#123;currentStatus&#125;&quot; aria-live=&quot;polite&quot;&gt;
&lt;div class=&quot;wire-next__row&quot;&gt;
&lt;span&gt;&#123;#if fileName&#125;&lt;strong&gt;&#123;fileName&#125;&lt;/strong&gt;
&lt;small&gt;&#123;#if uploadedSize || fileSize&#125;&#123;uploadedSize&#125;&#123;#if uploadedSize &amp;&amp; fileSize&#125; of &#123;/if&#125;&#123;fileSize&#125;&#123;:else&#125;&#123;label&#125;&#123;/if&#125;&lt;/small&gt;&#123;:else&#125;&lt;strong&gt;&#123;label&#125;&lt;/strong&gt;&#123;/if&#125;&lt;/span&gt;&#123;#if showValue&#125;&lt;strong&gt;&#123;percent()&#125;%&lt;/strong&gt;&#123;/if&#125;&lt;/div&gt;
&lt;progress value=&quot;&#123;currentValue&#125;&quot; max=&quot;&#123;max&#125;&quot; aria-label=&quot;&#123;label&#125;&quot;&gt;
&lt;/progress&gt;
&lt;div class=&quot;wire-next__upload-status&quot;&gt;
&lt;span class=&quot;wire-next__upload-status-icon&quot; aria-hidden=&quot;true&quot;&gt;
&lt;/span&gt;
&lt;span&gt;&#123;#if currentStatus === &quot;uploading&quot;&#125;Uploading securely…&#123;:else if currentStatus === &quot;complete&quot;&#125;Upload complete&#123;:else if currentStatus === &quot;error&quot;&#125;Upload failed&#123;:else&#125;Upload cancelled&#123;/if&#125;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;wire-next__upload-actions&quot;&gt;&#123;#if currentStatus === &quot;uploading&quot;&#125;&lt;button type=&quot;button&quot; @click=&quot;cancelUpload(event)&quot;&gt;&#123;cancelLabel&#125;&lt;/button&gt;
&lt;button type=&quot;button&quot; @click=&quot;completeUpload(event)&quot;&gt;Complete&lt;/button&gt;&#123;/if&#125;&#123;#if currentStatus === &quot;error&quot; || currentStatus === &quot;cancelled&quot;&#125;&lt;button type=&quot;button&quot; @click=&quot;retryUpload(event)&quot;&gt;&#123;retryLabel&#125;&lt;/button&gt;&#123;/if&#125;&lt;/div&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.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>
}
}