@postnord/web-components
Version:
PostNord Web Components
66 lines (61 loc) • 2.38 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
const pnProgressIndicatorCss = ".pn-progress-indicator{display:flex;padding:2.8em 1em 0}";
const PnProgressIndicator$1 = /*@__PURE__*/ proxyCustomElement(class PnProgressIndicator extends HTMLElement {
constructor(registerHost) {
super();
if (registerHost !== false) {
this.__registerHost();
}
this.progresschange = createEvent(this, "progresschange", 7);
}
get hostElement() { return 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 (h("div", { key: '1108f70edf525c6e7e0e45d34a6d58e69c5b9ab2', class: "pn-progress-indicator" }, h("slot", { key: 'c4035cf9fadb46f4e573c0225bebb2f8f7187da6' })));
}
static get style() { return pnProgressIndicatorCss; }
}, [260, "pn-progress-indicator", {
"activeStep": [1026, "active-step"]
}, [[0, "setactivestep", "setActiveStepHandler"]]]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["pn-progress-indicator"];
components.forEach(tagName => { switch (tagName) {
case "pn-progress-indicator":
if (!customElements.get(tagName)) {
customElements.define(tagName, PnProgressIndicator$1);
}
break;
} });
}
const PnProgressIndicator = PnProgressIndicator$1;
const defineCustomElement = defineCustomElement$1;
export { PnProgressIndicator, defineCustomElement };
//# sourceMappingURL=pn-progress-indicator.js.map
//# sourceMappingURL=pn-progress-indicator.js.map