2021-09-21 09:19:26 +00:00
|
|
|
import { css, CSSResult, html, LitElement, TemplateResult } from "lit";
|
|
|
|
import { customElement, property } from "lit/decorators";
|
2021-04-02 09:27:49 +00:00
|
|
|
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
|
|
|
import PFForm from "@patternfly/patternfly/components/Form/form.css";
|
|
|
|
import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css";
|
|
|
|
import AKGlobal from "../../authentik.css";
|
|
|
|
import PFButton from "@patternfly/patternfly/components/Button/button.css";
|
|
|
|
|
|
|
|
@customElement("ak-form-group")
|
|
|
|
export class FormGroup extends LitElement {
|
|
|
|
@property({ type: Boolean })
|
|
|
|
expanded = false;
|
|
|
|
|
|
|
|
static get styles(): CSSResult[] {
|
2021-08-03 15:52:21 +00:00
|
|
|
return [
|
|
|
|
PFBase,
|
|
|
|
PFForm,
|
|
|
|
PFButton,
|
|
|
|
PFFormControl,
|
|
|
|
AKGlobal,
|
|
|
|
css`
|
|
|
|
slot[name="body"][hidden] {
|
|
|
|
display: none !important;
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
];
|
2021-04-02 09:27:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render(): TemplateResult {
|
|
|
|
return html`<div class="pf-c-form__field-group ${this.expanded ? "pf-m-expanded" : ""}">
|
|
|
|
<div class="pf-c-form__field-group-toggle">
|
|
|
|
<div class="pf-c-form__field-group-toggle-button">
|
2021-08-03 15:52:21 +00:00
|
|
|
<button
|
|
|
|
class="pf-c-button pf-m-plain"
|
|
|
|
type="button"
|
|
|
|
aria-expanded="${this.expanded}"
|
|
|
|
aria-label="Details"
|
|
|
|
@click=${() => {
|
|
|
|
this.expanded = !this.expanded;
|
|
|
|
}}
|
|
|
|
>
|
2021-04-02 09:27:49 +00:00
|
|
|
<span class="pf-c-form__field-group-toggle-icon">
|
|
|
|
<i class="fas fa-angle-right" aria-hidden="true"></i>
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="pf-c-form__field-group-header">
|
|
|
|
<div class="pf-c-form__field-group-header-main">
|
|
|
|
<div class="pf-c-form__field-group-header-title">
|
|
|
|
<div class="pf-c-form__field-group-header-title-text">
|
|
|
|
<slot name="header"></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="pf-c-form__field-group-header-description">
|
|
|
|
<slot name="description"></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<slot ?hidden=${!this.expanded} class="pf-c-form__field-group-body" name="body"></slot>
|
|
|
|
</div>`;
|
|
|
|
}
|
|
|
|
}
|