From 6eb0583eeb19f140ccb4d06cc13e1c8b530ae838 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 17 Mar 2021 12:00:22 +0100 Subject: [PATCH] web: move form element Signed-off-by: Jens Langhammer --- .../form.ts => elements/forms/FormElement.ts} | 21 +++++++++---------- .../AuthenticatorStaticStage.ts | 2 +- .../AuthenticatorTOTPStage.ts | 2 +- .../AuthenticatorValidateStageCode.ts | 2 +- web/src/flows/stages/captcha/CaptchaStage.ts | 2 +- .../identification/IdentificationStage.ts | 2 +- .../flows/stages/password/PasswordStage.ts | 2 +- web/src/flows/stages/prompt/PromptStage.ts | 2 +- 8 files changed, 17 insertions(+), 18 deletions(-) rename web/src/{flows/stages/form.ts => elements/forms/FormElement.ts} (74%) diff --git a/web/src/flows/stages/form.ts b/web/src/elements/forms/FormElement.ts similarity index 74% rename from web/src/flows/stages/form.ts rename to web/src/elements/forms/FormElement.ts index db6aba755..b24c96e46 100644 --- a/web/src/flows/stages/form.ts +++ b/web/src/elements/forms/FormElement.ts @@ -1,22 +1,21 @@ 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"; +import PFForm from "@patternfly/patternfly/components/Form/form.css"; +import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; @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; - } - ` - ); + return [PFForm, PFFormControl, css` + slot { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-around; + } + `]; } @property() diff --git a/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts b/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts index 7d843bbde..ed4d32d89 100644 --- a/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts +++ b/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts @@ -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 { diff --git a/web/src/flows/stages/authenticator_totp/AuthenticatorTOTPStage.ts b/web/src/flows/stages/authenticator_totp/AuthenticatorTOTPStage.ts index fe303fc58..ac8b49ae0 100644 --- a/web/src/flows/stages/authenticator_totp/AuthenticatorTOTPStage.ts +++ b/web/src/flows/stages/authenticator_totp/AuthenticatorTOTPStage.ts @@ -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"; diff --git a/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts b/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts index 4e8441629..b734a4801 100644 --- a/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts +++ b/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts @@ -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"; diff --git a/web/src/flows/stages/captcha/CaptchaStage.ts b/web/src/flows/stages/captcha/CaptchaStage.ts index d302fcaed..3a4842baf 100644 --- a/web/src/flows/stages/captcha/CaptchaStage.ts +++ b/web/src/flows/stages/captcha/CaptchaStage.ts @@ -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 { diff --git a/web/src/flows/stages/identification/IdentificationStage.ts b/web/src/flows/stages/identification/IdentificationStage.ts index f1d632816..c663887f5 100644 --- a/web/src/flows/stages/identification/IdentificationStage.ts +++ b/web/src/flows/stages/identification/IdentificationStage.ts @@ -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"; diff --git a/web/src/flows/stages/password/PasswordStage.ts b/web/src/flows/stages/password/PasswordStage.ts index 1b2e6dc85..c6a47b1b1 100644 --- a/web/src/flows/stages/password/PasswordStage.ts +++ b/web/src/flows/stages/password/PasswordStage.ts @@ -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"; diff --git a/web/src/flows/stages/prompt/PromptStage.ts b/web/src/flows/stages/prompt/PromptStage.ts index b0994c2c5..852a59e98 100644 --- a/web/src/flows/stages/prompt/PromptStage.ts +++ b/web/src/flows/stages/prompt/PromptStage.ts @@ -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";