import Button from "./button.wrn" import Checkbox from "./Checkbox.wrn" import Input from "./Input.wrn" import PinInput from "./PinInput.wrn" component AuthForm { outputs { submit(payload: { event: Event; mode: string; action: string }) change(payload: { value?: string | number | boolean | null; values?: Array; sourceEvent?: Event; [key: string]: string | number | boolean | null | object } | string | number | boolean | null) input(payload: { value?: string | number | boolean | null; values?: Array; sourceEvent?: Event; [key: string]: string | number | boolean | null | object } | string | number | boolean | null) focus(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) blur(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object }) } props { size: string = "default" color: string = "primary" mode: string = "sign-in" action: string = "/api/auth/login" method: string = "post" title: string = "Sign in" description: string = "" returnTo: string = "" schema: string = "" showRemember: boolean = true showName: boolean = true submitLabel: string = "Continue" class: string = "" } functions { shared function schemaName() { if (schema) return schema if (mode === "sign-in") return "auth-login" if (mode === "register") return "auth-register" if (mode === "recover") return "auth-password-request" if (mode === "reset") return "auth-password-reset" if (mode === "mfa") return "auth-mfa" return "auth-empty" } client function submitForm(event) { output.submit({ event: event, mode: mode, action: action }) } client function fieldEvent(type, payload) { const detail = payload || {} output[type]({ sourceEvent: detail.sourceEvent, name: detail.name || "", value: detail.value || "" }) } } view {

{title}

{#if description}

{description}

{/if}
{#if returnTo}{/if} {#if mode === "register" && showName} {/if} {#if mode === "sign-in" || mode === "register" || mode === "recover"} {/if} {#if mode === "sign-in" || mode === "register" || mode === "reset"} {/if} {#if mode === "register" || mode === "reset"} {/if} {#if mode === "mfa"} {/if} {#if mode === "sign-in" && showRemember} {/if}