UNPKG

@postnord/web-components

Version:
46 lines (41 loc) 1.54 kB
/*! * Built with Stencil * By PostNord. */ 'use strict'; var index = require('./index-DVv2io0H.js'); const pnProgressIndicatorCss = ".pn-progress-indicator{display:flex;padding:2.8em 1em 0}"; const PnProgressIndicator = class { constructor(hostRef) { index.registerInstance(this, hostRef); this.progresschange = index.createEvent(this, "progresschange"); } get hostElement() { return index.getElement(this); } /** Takes the index of the active step */ activeStep = 0; /** This will emit when progress is changed and is the value you want to bind to your VM state */ progresschange; setActiveStepHandler({ detail }) { this.activeStep = detail; this.progresschange.emit(this.activeStep); } componentWillLoad() { this.passPropsToChildren(); } componentDidUpdate() { this.passPropsToChildren(); } passPropsToChildren() { const children = Array.from(this.hostElement.querySelectorAll('pn-progress-indicator-step')); children.forEach((child, i) => { child.activeStep = this.activeStep; child.index = i; }); } render() { return (index.h("div", { key: '1108f70edf525c6e7e0e45d34a6d58e69c5b9ab2', class: "pn-progress-indicator" }, index.h("slot", { key: 'c4035cf9fadb46f4e573c0225bebb2f8f7187da6' }))); } }; PnProgressIndicator.style = pnProgressIndicatorCss; exports.pn_progress_indicator = PnProgressIndicator; //# sourceMappingURL=pn-progress-indicator.entry.cjs.js.map