import { CocoComponent } from "@assets/js/base/coco"; import { getData } from "@helpers/alpine"; export default CocoComponent("layoutPickerButton", ({ selected }) => { return { selectedLayout: selected, getPicker() { return getData( this.$root.querySelector("[data-role='layout-picker']") .firstElementChild ); }, getButton() { return getData(this.$root.querySelector(".layout-picker-trigger")); }, init() { this.$watch("selectedLayout", () => this.getButton().hideDropdown()); }, }; });