v4web-components
Version:
Stencil Component Starter
124 lines (123 loc) • 3.28 kB
JavaScript
import { h } from '@stencil/core';
export class LabDsChipGroup {
constructor() {
this.size = 'medium';
this.avatar = false;
this.chips = [];
}
handleClickChip(id) {
id && this.handleCloseChip.emit(id);
}
handleClickClearAll() {
this.handleClearAll.emit();
}
render() {
return (h("div", { class: "chip-group" }, this.chips.map(chip => (h("lab-ds-chip", { onHandleCloseChip: () => this.handleClickChip(chip.id), key: chip.id, avatar: this.avatar, size: this.size, label: chip.label }))), this.chips.length > 0 && h("lab-ds-button", { variant: "link-button", label: "Limpar op\u00E7\u00F5es", onHandleButton: () => this.handleClickClearAll() })));
}
static get is() { return "lab-ds-chip-group"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["lab-ds-chip-group.css"]
};
}
static get styleUrls() {
return {
"$": ["lab-ds-chip-group.css"]
};
}
static get properties() {
return {
"size": {
"type": "string",
"mutable": false,
"complexType": {
"original": "'medium' | 'small'",
"resolved": "\"medium\" | \"small\"",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "size",
"reflect": false,
"defaultValue": "'medium'"
},
"avatar": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "avatar",
"reflect": false,
"defaultValue": "false"
},
"chips": {
"type": "unknown",
"mutable": false,
"complexType": {
"original": "Array<{ label: string; id: string; nameAvatar: string; imageSRCAvatar: string }>",
"resolved": "{ label: string; id: string; nameAvatar: string; imageSRCAvatar: string; }[]",
"references": {
"Array": {
"location": "global"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"defaultValue": "[]"
}
};
}
static get events() {
return [{
"method": "handleCloseChip",
"name": "handleCloseChip",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}, {
"method": "handleClearAll",
"name": "handleClearAll",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}];
}
}
//# sourceMappingURL=lab-ds-chip-group.js.map