-
Notifications
You must be signed in to change notification settings - Fork 16
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
209 changed files
with
6,225 additions
and
2,321 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
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 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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class Accordion < Base | ||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: "w-full" | ||
} | ||
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,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AccordionContent < Base | ||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
data: { | ||
ruby_ui__accordion_target: "content" | ||
}, | ||
class: "overflow-y-hidden", | ||
style: "height: 0px;" | ||
} | ||
end | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
app/components/ruby_ui/accordion/accordion_default_content.rb
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AccordionDefaultContent < Base | ||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: "pb-4 pt-0 text-sm" | ||
} | ||
end | ||
end | ||
end |
19 changes: 19 additions & 0 deletions
19
app/components/ruby_ui/accordion/accordion_default_trigger.rb
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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AccordionDefaultTrigger < Base | ||
def view_template(&block) | ||
div(class: "flex items-center justify-between w-full") do | ||
p(&block) | ||
RubyUI.AccordionIcon | ||
end | ||
end | ||
|
||
def default_attrs | ||
{ | ||
data: {action: "click->ruby-ui--accordion#toggle"}, | ||
class: "w-full flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline" | ||
} | ||
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AccordionIcon < Base | ||
def view_template(&block) | ||
span(**attrs) do | ||
if block | ||
block.call | ||
else | ||
icon | ||
end | ||
end | ||
end | ||
|
||
def icon | ||
svg( | ||
xmlns: "http://www.w3.org/2000/svg", | ||
viewbox: "0 0 20 20", | ||
fill: "currentColor", | ||
class: "w-4 h-4" | ||
) do |s| | ||
s.path( | ||
fill_rule: "evenodd", | ||
d: | ||
"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", | ||
clip_rule: "evenodd" | ||
) | ||
end | ||
end | ||
|
||
def default_attrs | ||
{ | ||
class: "opacity-50", | ||
data: {ruby_ui__accordion_target: "icon"} | ||
} | ||
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,28 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AccordionItem < Base | ||
def initialize(open: false, rotate_icon: 180, **attrs) | ||
@open = open | ||
@rotate_icon = rotate_icon | ||
super(**attrs) | ||
end | ||
|
||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
data: { | ||
controller: "ruby-ui--accordion", | ||
ruby_ui__accordion_open_value: @open, | ||
ruby_ui__accordion_rotate_icon_value: @rotate_icon | ||
}, | ||
class: "border-b" | ||
} | ||
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AccordionTrigger < Base | ||
def view_template(&) | ||
button(**attrs, &) | ||
end | ||
|
||
def default_attrs | ||
{ | ||
type: "button", | ||
data: {action: "click->ruby-ui--accordion#toggle"}, | ||
class: "w-full flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline" | ||
} | ||
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,36 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class Alert < Base | ||
def initialize(variant: nil, **attrs) | ||
@variant = variant | ||
super(**attrs) # must be called after variant is set | ||
end | ||
|
||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def colors | ||
case @variant | ||
when nil | ||
"ring-border bg-muted/20 text-foreground [&>svg]:opacity-80" | ||
when :warning | ||
"ring-warning/20 bg-warning/5 text-warning [&>svg]:text-warning/80" | ||
when :success | ||
"ring-success/20 bg-success/5 text-success [&>svg]:text-success/80" | ||
when :destructive | ||
"ring-destructive/20 bg-destructive/5 text-destructive [&>svg]:text-destructive/80" | ||
end | ||
end | ||
|
||
def default_attrs | ||
base_classes = "backdrop-blur relative w-full ring-1 ring-inset rounded-lg px-4 py-4 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-8" | ||
{ | ||
class: [base_classes, colors] | ||
} | ||
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AlertDescription < Base | ||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: "text-sm [&_p]:leading-relaxed" | ||
} | ||
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module RubyUI | ||
class AlertTitle < Base | ||
def view_template(&) | ||
h5(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
class: "mb-1 font-medium leading-none tracking-tight" | ||
} | ||
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 AlertDialog < Base | ||
def initialize(open: false, **attrs) | ||
@open = open | ||
super(**attrs) | ||
end | ||
|
||
def view_template(&) | ||
div(**attrs, &) | ||
end | ||
|
||
private | ||
|
||
def default_attrs | ||
{ | ||
data: { | ||
controller: "ruby-ui--alert-dialog", | ||
ruby_ui__alert_dialog_open_value: @open.to_s | ||
}, | ||
class: "inline-block" | ||
} | ||
end | ||
end | ||
end |
Oops, something went wrong.