Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions lib/ruby_ui/dropdown_menu/dropdown_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,13 @@ 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",
ruby_ui__dropdown_menu_options_value: @options.to_json
}
}
end

def strategy
@_strategy ||= @options[:strategy] || "absolute"
end
end
end
5 changes: 1 addition & 4 deletions lib/ruby_ui/dropdown_menu/dropdown_menu_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_ui/dropdown_menu/dropdown_menu_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_ui/table/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading