Skip to content

Commit

Permalink
New combobox component
Browse files Browse the repository at this point in the history
  • Loading branch information
stephannv committed Nov 29, 2024
1 parent aa983e8 commit 1e28b5b
Show file tree
Hide file tree
Showing 20 changed files with 324 additions and 484 deletions.
4 changes: 0 additions & 4 deletions lib/generators/ruby_ui/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ codeblock:
gems:
- "rouge"

combobox:
js_packages:
- "@floating-ui/dom"

command:
js_packages:
- "fuse.js"
Expand Down
16 changes: 10 additions & 6 deletions lib/ruby_ui/combobox/combobox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

module RubyUI
class Combobox < Base
def initialize(multiple: false, term: "items", **)
@multiple = multiple
@term = term
super(**)
end

def view_template(&)
div(**attrs, &)
end
Expand All @@ -10,14 +16,12 @@ def view_template(&)

def default_attrs
{
role: "combobox",
data: {
controller: "ruby-ui--combobox",
ruby_ui__combobox_open_value: "false",
action: "click@window->ruby-ui--combobox#onClickOutside",
ruby_ui__combobox_ruby_ui__combobox_content_outlet: ".combobox-content",
ruby_ui__combobox_ruby_ui__combobox_item_outlet: ".combobox-item"
},
class: "group/combobox w-full relative"
ruby_ui__combobox_multiple_value: @multiple.to_s,
ruby_ui__combobox_term_value: @term.to_s
}
}
end
end
Expand Down
31 changes: 0 additions & 31 deletions lib/ruby_ui/combobox/combobox_content.rb

This file was deleted.

42 changes: 0 additions & 42 deletions lib/ruby_ui/combobox/combobox_content_controller.js

This file was deleted.

Loading

0 comments on commit 1e28b5b

Please sign in to comment.