@postnord/web-components
Version:
PostNord Web Components
96 lines (95 loc) • 2.99 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { h } from "@stencil/core";
export class PnProgressIndicator {
constructor() {
this.activeStep = 0;
}
hostElement;
/** 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: 'c78f37115c48eaff800b2f372a78efa406f79f1f', class: "pn-progress-indicator" }, h("slot", { key: '0e6dea61f881561da76a6979451c29eea31ab119' })));
}
static get is() { return "pn-progress-indicator"; }
static get originalStyleUrls() {
return {
"$": ["pn-progress-indicator.scss"]
};
}
static get styleUrls() {
return {
"$": ["pn-progress-indicator.css"]
};
}
static get properties() {
return {
"activeStep": {
"type": "number",
"mutable": true,
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Takes the index of the active step"
},
"attribute": "active-step",
"reflect": false,
"defaultValue": "0"
}
};
}
static get events() {
return [{
"method": "progresschange",
"name": "progresschange",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": "This will emit when progress is changed and is the value you want to bind to your VM state"
},
"complexType": {
"original": "number",
"resolved": "number",
"references": {}
}
}];
}
static get elementRef() { return "hostElement"; }
static get listeners() {
return [{
"name": "setactivestep",
"method": "setActiveStepHandler",
"target": undefined,
"capture": false,
"passive": false
}];
}
}
//# sourceMappingURL=pn-progress-indicator.js.map