web: move form element
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -3,7 +3,7 @@ import { css, CSSResult, customElement, html, property, TemplateResult } from "l
|
||||
import { WithUserInfoChallenge } from "../../../api/Flows";
|
||||
import { COMMON_STYLES } from "../../../common/styles";
|
||||
import { BaseStage } from "../base";
|
||||
import "../form";
|
||||
import "../../../elements/forms/FormElement";
|
||||
import "../../../elements/utils/LoadingState";
|
||||
|
||||
export interface AuthenticatorStaticChallenge extends WithUserInfoChallenge {
|
||||
|
||||
@ -4,7 +4,7 @@ import { WithUserInfoChallenge } from "../../../api/Flows";
|
||||
import { COMMON_STYLES } from "../../../common/styles";
|
||||
import { BaseStage } from "../base";
|
||||
import "webcomponent-qr-code";
|
||||
import "../form";
|
||||
import "../../../elements/forms/FormElement";
|
||||
import { showMessage } from "../../../elements/messages/MessageContainer";
|
||||
import "../../../elements/utils/LoadingState";
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { CSSResult, customElement, html, property, TemplateResult } from "lit-el
|
||||
import { COMMON_STYLES } from "../../../common/styles";
|
||||
import { BaseStage } from "../base";
|
||||
import { AuthenticatorValidateStage, AuthenticatorValidateStageChallenge, DeviceChallenge } from "./AuthenticatorValidateStage";
|
||||
import "../form";
|
||||
import "../../../elements/forms/FormElement";
|
||||
import "../../../elements/utils/LoadingState";
|
||||
import { PasswordManagerPrefill } from "../identification/IdentificationStage";
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import { WithUserInfoChallenge } from "../../../api/Flows";
|
||||
import { COMMON_STYLES } from "../../../common/styles";
|
||||
import { SpinnerSize } from "../../../elements/Spinner";
|
||||
import { BaseStage } from "../base";
|
||||
import "../form";
|
||||
import "../../../elements/forms/FormElement";
|
||||
import "../../../elements/utils/LoadingState";
|
||||
|
||||
export interface CaptchaChallenge extends WithUserInfoChallenge {
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
import { customElement, LitElement, CSSResult, property, css } from "lit-element";
|
||||
import { TemplateResult, html } from "lit-html";
|
||||
import { Error } from "../../api/Flows";
|
||||
import { COMMON_STYLES } from "../../common/styles";
|
||||
|
||||
@customElement("ak-form-element")
|
||||
export class FormElement extends LitElement {
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
return COMMON_STYLES.concat(
|
||||
css`
|
||||
slot {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
`
|
||||
);
|
||||
}
|
||||
|
||||
@property()
|
||||
label?: string;
|
||||
|
||||
@property({ type: Boolean })
|
||||
required = false;
|
||||
|
||||
@property({ attribute: false })
|
||||
errors?: Error[];
|
||||
|
||||
updated(): void {
|
||||
this.querySelectorAll<HTMLInputElement>("input[autofocus]").forEach(input => {
|
||||
input.focus();
|
||||
});
|
||||
}
|
||||
|
||||
render(): TemplateResult {
|
||||
return html`<div class="pf-c-form__group">
|
||||
<label class="pf-c-form__label">
|
||||
<span class="pf-c-form__label-text">${this.label}</span>
|
||||
${this.required ? html`<span class="pf-c-form__label-required" aria-hidden="true">*</span>` : html``}
|
||||
</label>
|
||||
<slot></slot>
|
||||
${(this.errors || []).map((error) => {
|
||||
return html`<p class="pf-c-form__helper-text pf-m-error">${error.string}</p>`;
|
||||
})}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,7 +2,7 @@ import { gettext } from "django";
|
||||
import { css, CSSResult, customElement, html, property, TemplateResult } from "lit-element";
|
||||
import { COMMON_STYLES } from "../../../common/styles";
|
||||
import { BaseStage } from "../base";
|
||||
import "../form";
|
||||
import "../../../elements/forms/FormElement";
|
||||
import "../../../elements/utils/LoadingState";
|
||||
import { Challenge } from "../../../api/Flows";
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { CSSResult, customElement, html, property, TemplateResult } from "lit-el
|
||||
import { WithUserInfoChallenge } from "../../../api/Flows";
|
||||
import { COMMON_STYLES } from "../../../common/styles";
|
||||
import { BaseStage } from "../base";
|
||||
import "../form";
|
||||
import "../../../elements/forms/FormElement";
|
||||
import "../../../elements/utils/LoadingState";
|
||||
import { PasswordManagerPrefill } from "../identification/IdentificationStage";
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { CSSResult, customElement, html, property, TemplateResult } from "lit-el
|
||||
import { unsafeHTML } from "lit-html/directives/unsafe-html";
|
||||
import { COMMON_STYLES } from "../../../common/styles";
|
||||
import { BaseStage } from "../base";
|
||||
import "../form";
|
||||
import "../../../elements/forms/FormElement";
|
||||
import "../../../elements/utils/LoadingState";
|
||||
import { Challenge } from "../../../api/Flows";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user