@ebay/ebayui-core
Version:
Collection of core eBay components; considered to be the building blocks for all composite structures, pages & apps.
30 lines (29 loc) • 750 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class SelectionChip {
onCreate(input) {
this.state = {
mounted: false,
selected: input.selected || false,
};
}
onMount() {
this.state.mounted = true;
}
handleButtonClick(originalEvent) {
if (!this.input.disabled) {
const selected = !this.state.selected;
this.state.selected = selected;
this.emit("click", {
selected,
originalEvent,
});
}
}
onInput(input) {
if (input.selected !== undefined) {
this.state.selected = input.selected;
}
}
}
module.exports = SelectionChip;