UNPKG

@postnord/web-components

Version:
45 lines (40 loc) 1.52 kB
/*! * Built with Stencil * By PostNord. */ 'use strict'; var index = require('./index-DWu-2oJc.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", 7); } 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(`${index.transformTag("pn-progress-indicator-step")}`)); children.forEach((child, i) => { child.activeStep = this.activeStep; child.index = i; }); } render() { return (index.h("div", { key: '55eb279175a09345ebcb087ac6b0f819d5032a1e', class: "pn-progress-indicator" }, index.h("slot", { key: '70f0273b605df274663752dadde8585411a74bd7' }))); } }; PnProgressIndicator.style = pnProgressIndicatorCss(); exports.pn_progress_indicator = PnProgressIndicator;