{ "version": 3, "sources": ["../../src/elements/forms/FormElement.ts"], "sourcesContent": ["import { AKElement } from \"@goauthentik/elements/Base\";\n\nimport { CSSResult } from \"lit\";\nimport { TemplateResult, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\n\nimport PFForm from \"@patternfly/patternfly/components/Form/form.css\";\nimport PFFormControl from \"@patternfly/patternfly/components/FormControl/form-control.css\";\nimport PFBase from \"@patternfly/patternfly/patternfly-base.css\";\n\nimport { ErrorDetail } from \"@goauthentik/api\";\n\n/**\n * This is used in two places outside of Flow, and in both cases is used primarily to\n * display content, not take input. It displays the TOTP QR code, and the static\n * recovery tokens. But it's used a lot in Flow.\n */\n\n@customElement(\"ak-form-element\")\nexport class FormElement extends AKElement {\n static get styles(): CSSResult[] {\n return [PFBase, PFForm, PFFormControl];\n }\n\n @property()\n label?: string;\n\n @property({ type: Boolean })\n required = false;\n\n @property({ attribute: false })\n set errors(value: ErrorDetail[] | undefined) {\n this._errors = value;\n const hasError = (value || []).length > 0;\n this.querySelectorAll(\"input\").forEach((input) => {\n input.setAttribute(\"aria-invalid\", hasError.toString());\n });\n this.requestUpdate();\n }\n\n _errors?: ErrorDetail[];\n\n updated(): void {\n this.querySelectorAll(\"input[autofocus]\").forEach((input) => {\n input.focus();\n });\n }\n\n render(): TemplateResult {\n return html`
\n \n \n ${(this._errors || []).map((error) => {\n return html`

\n \n ${error.string}\n

`;\n })}\n
`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ak-form-element\": FormElement;\n }\n}\n"], "mappings": "4LAmBO,IAAMA,EAAN,cAA0BC,CAAU,CAApC,kCASH,cAAW,GARX,WAAW,QAAsB,CAC7B,MAAO,CAACC,EAAQC,EAAQC,CAAa,CACzC,CASA,IAAI,OAAOC,EAAkC,CACzC,KAAK,QAAUA,EACf,IAAMC,GAAYD,GAAS,CAAC,GAAG,OAAS,EACxC,KAAK,iBAAiB,OAAO,EAAE,QAASE,GAAU,CAC9CA,EAAM,aAAa,eAAgBD,EAAS,SAAS,CAAC,CAC1D,CAAC,EACD,KAAK,cAAc,CACvB,CAIA,SAAgB,CACZ,KAAK,iBAAmC,kBAAkB,EAAE,QAASC,GAAU,CAC3EA,EAAM,MAAM,CAChB,CAAC,CACL,CAEA,QAAyB,CACrB,OAAOC;AAAA;AAAA,sDAEuC,KAAK,KAAK;AAAA,kBAC9C,KAAK,SACDA,uEACAA,GAAM;AAAA;AAAA;AAAA,eAGb,KAAK,SAAW,CAAC,GAAG,IAAKC,GACjBD;AAAA;AAAA;AAAA,uBAGAC,EAAM,MAAM;AAAA,qBAEtB,CAAC;AAAA,eAEV,CACJ,EAzCIC,EAAA,CADCC,EAAS,GALDX,EAMT,qBAGAU,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,CAAC,GARlBX,EAST,wBAGIU,EAAA,CADHC,EAAS,CAAE,UAAW,EAAM,CAAC,GAXrBX,EAYL,sBAZKA,EAANU,EAAA,CADNE,EAAc,iBAAiB,GACnBZ", "names": ["FormElement", "AKElement", "patternfly_base_default", "form_default", "form_control_default", "value", "hasError", "input", "ke", "error", "__decorateClass", "n", "t"] }