From 7fe0a90d809f09bdec120b74ac11e025c8ba7f88 Mon Sep 17 00:00:00 2001 From: Jean Pierry Date: Tue, 12 Aug 2025 14:10:36 -0300 Subject: [PATCH] [RUBY_UI] FIX Table + DELETE DropdownMenu strategy --- lib/ruby_ui/dropdown_menu/dropdown_menu.rb | 10 +--------- lib/ruby_ui/dropdown_menu/dropdown_menu_content.rb | 5 +---- lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js | 2 +- lib/ruby_ui/table/table.rb | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/ruby_ui/dropdown_menu/dropdown_menu.rb b/lib/ruby_ui/dropdown_menu/dropdown_menu.rb index 628d167f..12e1a70e 100644 --- a/lib/ruby_ui/dropdown_menu/dropdown_menu.rb +++ b/lib/ruby_ui/dropdown_menu/dropdown_menu.rb @@ -15,11 +15,7 @@ def view_template(&) def default_attrs { - class: [ - "z-50", - "group/dropdown-menu", - (strategy == "absolute") ? "is-absolute" : "is-fixed" - ], + class: "z-50", data: { controller: "ruby-ui--dropdown-menu", action: "click@window->ruby-ui--dropdown-menu#onClickOutside", @@ -27,9 +23,5 @@ def default_attrs } } end - - def strategy - @_strategy ||= @options[:strategy] || "absolute" - end end end diff --git a/lib/ruby_ui/dropdown_menu/dropdown_menu_content.rb b/lib/ruby_ui/dropdown_menu/dropdown_menu_content.rb index 664f89e2..5ef2f038 100644 --- a/lib/ruby_ui/dropdown_menu/dropdown_menu_content.rb +++ b/lib/ruby_ui/dropdown_menu/dropdown_menu_content.rb @@ -21,10 +21,7 @@ def default_attrs def wrapper_attrs { - class: [ - "z-50 hidden group-[.is-absolute]/dropdown-menu:absolute", - "group-[.is-fixed]/dropdown-menu:fixed" - ], + class: "z-50 hidden absolute", data: {ruby_ui__dropdown_menu_target: "content"}, style: { width: "max-content", diff --git a/lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js b/lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js index d624eaf5..e9160b30 100644 --- a/lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js +++ b/lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js @@ -45,7 +45,7 @@ export default class extends Controller { computePosition(this.triggerTarget, this.contentTarget, { placement: this.optionsValue.placement || "top", middleware: [flip(), shift(), offset(8)], - strategy: this.optionsValue.strategy || "absolute", + strategy: "absolute", }).then(({ x, y }) => { Object.assign(this.contentTarget.style, { left: `${x}px`, diff --git a/lib/ruby_ui/table/table.rb b/lib/ruby_ui/table/table.rb index d3f2c373..0d9b97c7 100644 --- a/lib/ruby_ui/table/table.rb +++ b/lib/ruby_ui/table/table.rb @@ -3,7 +3,7 @@ module RubyUI class Table < Base def view_template(&block) - div(class: "relative w-full overflow-auto") do + div(class: "relative w-full overflow-x-auto") do table(**attrs, &block) end end