app/assets/js/libs/alpine/directives/dropdown.js in coveragebook_components-0.8.9 vs app/assets/js/libs/alpine/directives/dropdown.js in coveragebook_components-0.9.0

- old
+ new

@@ -14,19 +14,22 @@ const data = getData(el); const settings = buildConfig(modifiers); const result = expression ? evaluate(expression) : {}; const directiveConfig = isObject(result) ? result : {}; - let { triggerTarget, contentTarget, ...config } = directiveConfig; + let { triggerTarget, contentTarget, anchorTarget, ...config } = + directiveConfig; contentTarget = contentTarget || el.querySelector("[x-dropdown\\:content]"); content = isNode(contentTarget) ? contentTarget.firstElementChild : contentTarget; triggerTarget = triggerTarget || el.querySelector("[x-dropdown\\:trigger]") || el; + anchorTarget = + anchorTarget || el.querySelector("[x-dropdown\\:anchor]") || el; // Initialize the dropdown if (!el.__x_dropdown) { // Mix in some helper methods under the `.dropdown` @@ -48,10 +51,10 @@ }, }); setData(el, mixin); - const dropdown = (el.__x_dropdown = tippy(el, { + const dropdown = (el.__x_dropdown = tippy(anchorTarget, { theme: "coco-app-dropdown", placement: "bottom-start", offset: [0, 0], trigger: "click", interactive: true,