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AE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAiB;AAlBjD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc","sourcesContent":["import type { PropertyValues, TemplateResult } from 'lit';\nimport type { PfProgressStepper } from './pf-progress-stepper.js';\n\nimport { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\n\nimport style from './pf-progress-step.css';\n\nconst ICONS = new Map(Object.entries({\n success: { icon: 'check-circle' },\n danger: { icon: 'exclamation-circle' },\n warning: { icon: 'exclamation-triangle' },\n info: { icon: 'resources-full', set: 'patternfly' },\n}));\n\n/**\n * @slot -\n * Short description of the current step.\n * @slot description\n * Longer description of the current step.\n * @slot icon\n * Overrides the icon property\n */\n@customElement('pf-progress-step')\nexport class PfProgressStep extends LitElement {\n protected static parentTagName = 'pf-progress-stepper';\n\n static readonly styles: CSSStyleSheet[] = [style];\n\n /** Optional extended description of the step */\n @property() description?: string;\n\n /** Step Icon */\n @property() icon?: string;\n\n /** Step icon set */\n @property({ attribute: 'icon-set' }) iconSet?: string;\n\n /** Describes the state of the current item */\n @property({ reflect: true }) variant?: 'pending' | 'info' | 'success' | 'warning' | 'danger';\n\n /** Indicates if this item is the current active item. */\n @property({ type: Boolean, reflect: true }) current = false;\n\n #slots = new SlotController(this, 'title', 'description');\n\n #internals = InternalsController.of(this, { role: 'listitem' });\n\n render(): TemplateResult<1> {\n const hasDescription = !!(this.description ?? this.#slots.hasSlotted('description'));\n const icon = this.icon ?? ICONS.get(this.variant ?? 'default')?.icon;\n const set = this.iconSet ?? ICONS.get(this.variant ?? 'default')?.set;\n const { parentTagName } = (this.constructor as typeof PfProgressStep);\n const { compact = false } = this.closest?.<PfProgressStepper>(parentTagName) ?? {};\n return html`\n <div id=\"connector\" class=\"${classMap({ compact })}\">\n <slot id=\"icon\" name=\"icon\">\n <pf-icon ?hidden=\"${!icon}\"\n icon=\"${ifDefined(icon)}\"\n set=\"${ifDefined(set)}\"></pf-icon>\n </slot>\n </div>\n <div id=\"main\" class=\"${classMap({ compact })}\">\n <slot id=\"title\"></slot>\n <slot id=\"description\" name=\"description\" ?hidden=\"${!hasDescription}\">${this.description}</slot>\n </div>\n `;\n }\n\n updated(changed: PropertyValues<this>): void {\n if (changed.has('current')) {\n this.#internals.ariaCurrent = String(!!this.current);\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-progress-step': PfProgressStep;\n }\n}\n"]}