@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) • 746 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class Accordion {
onCreate() {
this.state = {
index: -1,
interacted: false,
};
}
onInput(input) {
this.state = {
index: -1,
interacted: this.state.interacted,
};
}
handleToggle(index, event) {
const { autoCollapse } = this.input;
this.state.interacted = true;
if (autoCollapse && event.open) {
this.state.index = index;
}
this.emit("toggle", {
originalEvent: event.originalEvent,
open: event.originalEvent.target.open,
index: index,
});
}
}
module.exports = Accordion;