import { ModalButton } from "@goauthentik/elements/buttons/ModalButton"; import { CustomEmitterElement } from "@goauthentik/elements/utils/eventEmitter"; import { msg } from "@lit/localize"; import { customElement, property, query } from "@lit/reactive-element/decorators.js"; import { TemplateResult, css, html, nothing } from "lit"; import { classMap } from "lit/directives/class-map.js"; import { map } from "lit/directives/map.js"; import PFWizard from "@patternfly/patternfly/components/Wizard/wizard.css"; import { type WizardButton, WizardStepLabel } from "./types"; /** * AKWizardFrame is the main container for displaying Wizard pages. * * AKWizardFrame is one component of a Wizard development environment. It provides the header, * titled navigation sidebar, and bottom row button bar. It takes its cues about what to render from * two data structure, `this.steps: WizardStep[]`, which lists all the current steps *in order* and * doesn't care otherwise about their structure, and `this.currentStep: WizardStep` which must be a * _reference_ to a member of `this.steps`. * * @element ak-wizard-frame * * @slot trigger - (Inherited from ModalButton) Define the "summon modal" button here * * @fires ak-wizard-nav - Tell the orchestrator what page the user wishes to move to. * */ @customElement("ak-wizard-frame") export class AkWizardFrame extends CustomEmitterElement(ModalButton) { static get styles() { return [ ...super.styles, PFWizard, css` .pf-c-modal-box { height: 75%; } `, ]; } /** * The text for the title of the wizard */ @property() header?: string; /** * The text for a descriptive subtitle for the wizard */ @property() description?: string; /** * The labels for all current steps, including their availability */ @property({ attribute: false, type: Array }) stepLabels!: WizardStepLabel[]; /** * What buttons to Show */ @property({ attribute: false, type: Array }) buttons: WizardButton[] = []; /** * Show the [Cancel] icon and offer the [Cancel] button */ @property({ type: Boolean, attribute: "can-cancel" }) canCancel = false; /** * The form renderer, passed as a function */ @property({ type: Object }) form!: () => TemplateResult; @query("#main-content *:first-child") content!: HTMLElement; constructor() { super(); this.renderButtons = this.renderButtons.bind(this); } renderModalInner() { // prettier-ignore return html`
${this.description}