-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
395 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class ComboboxCheckbox < Base | ||
def view_template | ||
input(type: "checkbox", **attrs) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: [ | ||
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background accent-primary", | ||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", | ||
"disabled:cursor-not-allowed disabled:opacity-50" | ||
], | ||
data: { | ||
ruby_ui__combobox_target: "input", | ||
action: "ruby-ui--combobox#inputChanged" | ||
} | ||
} | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class ComboboxListGroup < Base | ||
LABEL_CLASSES = "before:content-[attr(label)] before:px-2 before:py-1.5 before:text-xs before:font-medium before:text-muted-foreground before:not-italic" | ||
|
||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: ["hidden has-[label:not(.hidden)]:flex flex-col py-1 gap-1 border-b", LABEL_CLASSES], | ||
role: "group" | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class ComboboxPopover < Base | ||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: "inset-auto m-0 absolute border bg-background shadow-lg rounded-lg", | ||
role: "popover", | ||
autofocus: true, | ||
popover: true, | ||
data: { | ||
ruby_ui__combobox_target: "popover", | ||
action: %w[ | ||
keydown.down->ruby-ui--combobox#keyDownPressed | ||
keydown.up->ruby-ui--combobox#keyUpPressed | ||
keydown.enter->ruby-ui--combobox#keyEnterPressed | ||
keydown.esc->ruby-ui--combobox#closeDialog:prevent | ||
resize@window->ruby-ui--combobox#updatePopoverWidth | ||
] | ||
} | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class ComboboxRadio < Base | ||
def view_template | ||
input(type: "radio", **attrs) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: "aspect-square h-4 w-4 rounded-full border border-primary accent-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", | ||
data: { | ||
ruby_ui__combobox_target: "input", | ||
ruby_ui__form_field_target: "input", | ||
action: %w[ | ||
ruby-ui--combobox#inputChanged | ||
input->ruby-ui--form-field#onInput | ||
invalid->ruby-ui--form-field#onInvalid | ||
] | ||
} | ||
} | ||
end | ||
end | ||
end |
Oops, something went wrong.