Skip to content
Merged
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
2 changes: 2 additions & 0 deletions docs/app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
@plugin "@tailwindcss/forms";
@plugin "@tailwindcss/typography";

/* Safelist classes from RubyUI gem components rendered by the docs app. */
@source inline("dark:inline-block");

@import "tw-animate-css";

Expand Down
8 changes: 7 additions & 1 deletion docs/app/components/shared/logo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ def view_template
img(src: image_url("logo.svg"), class: "h-4 block dark:hidden")
img(src: image_url("logo_dark.svg"), class: "h-4 hidden dark:block")
span(class: "sr-only") { "RubyUI" }
Badge(class: "ml-2 whitespace-nowrap bg-black text-white hover:bg-black/90 px-1.5 py-0.5 rounded-full text-xs font-semibold") { "1.0" }
Badge(class: "ml-2 whitespace-nowrap bg-black text-white hover:bg-black/90 px-1.5 py-0.5 rounded-full text-xs font-semibold") { ruby_ui_version }
}
end
end

private

def ruby_ui_version
RubyUI::VERSION.split(".").first(2).join(".")
end
end
end
end
18 changes: 15 additions & 3 deletions docs/app/javascript/controllers/ruby_ui/command_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,30 @@ export default class extends Controller {
};

connect() {
this.selectedIndex = -1;

if (!this.hasInputTarget) {
return;
}

this.inputTarget.focus();
this.searchIndex = this.buildSearchIndex();
this.toggleVisibility(this.emptyTargets, false);
this.selectedIndex = -1;

if (this.openValue) {
if (this.openValue && this.hasContentTarget) {
this.open();
}
}

open(e) {
e.preventDefault();
if (e) {
e.preventDefault();
}

if (!this.hasContentTarget) {
return;
}

document.body.insertAdjacentHTML("beforeend", this.contentTarget.innerHTML);
// prevent scroll on body
document.body.classList.add("overflow-hidden");
Expand Down
18 changes: 15 additions & 3 deletions gem/lib/ruby_ui/command/command_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,30 @@ export default class extends Controller {
};

connect() {
this.selectedIndex = -1;

if (!this.hasInputTarget) {
return;
}

this.inputTarget.focus();
this.searchIndex = this.buildSearchIndex();
this.toggleVisibility(this.emptyTargets, false);
this.selectedIndex = -1;

if (this.openValue) {
if (this.openValue && this.hasContentTarget) {
this.open();
}
}

open(e) {
e.preventDefault();
if (e) {
e.preventDefault();
}

if (!this.hasContentTarget) {
return;
}

document.body.insertAdjacentHTML("beforeend", this.contentTarget.innerHTML);
// prevent scroll on body
document.body.classList.add("overflow-hidden");
Expand Down