Skip to content

Commit f3403ea

Browse files
authored
Regenerate ruby_ui components after gem bump (#437)
* Regenerate ruby_ui components after gem bump Run `rails g ruby_ui:component:all --force true` to sync generated components with the updated ruby_ui gem (f882429 → 755b288). * Remove generated ruby_ui/docs stubs that conflict with existing components The docs component stubs (base, component_setup_tabs, etc.) generated by ruby_ui:component:all conflict with the app's existing Components::ComponentSetup namespace, causing a superclass mismatch TypeError.
1 parent 0417b35 commit f3403ea

11 files changed

Lines changed: 118 additions & 8 deletions

app/components/ruby_ui/combobox/combobox_toggle_all_checkbox.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ def default_attrs
1212
{
1313
class: [
1414
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background accent-primary",
15-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1615
"disabled:cursor-not-allowed disabled:opacity-50",
17-
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
16+
"checked:bg-primary checked:text-primary-foreground",
17+
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none",
18+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
1819
],
1920
data: {
2021
ruby_ui__combobox_target: "toggleAll",

app/components/ruby_ui/form/form_field.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def default_attrs
1313
data: {
1414
controller: "ruby-ui--form-field"
1515
},
16-
class: "space-y-2"
16+
class: "flex flex-col gap-2"
1717
}
1818
end
1919
end

app/components/ruby_ui/form/form_field_error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def default_attrs
1313
data: {
1414
ruby_ui__form_field_target: "error"
1515
},
16-
class: "text-xs font-medium text-destructive"
16+
class: "empty:hidden text-sm font-medium text-destructive"
1717
}
1818
end
1919
end

app/components/ruby_ui/form/form_field_hint.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def view_template(&)
99
private
1010

1111
def default_attrs
12-
{class: "text-sm text-muted-foreground"}
12+
{class: "empty:hidden text-sm text-muted-foreground"}
1313
end
1414
end
1515
end

app/components/ruby_ui/form/form_field_label.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def view_template(&)
1111
def default_attrs
1212
{
1313
class: [
14-
"text-sm font-medium leading-none inline-block",
14+
"empty:hidden text-sm font-medium leading-none",
1515
"peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
1616
"peer-aria-disabled:cursor-not-allowed peer-aria-disabled:opacity-70 peer-aria-disabled:pointer-events-none"
1717
]

app/components/ruby_ui/input/input.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ def default_attrs
2424
"placeholder:text-muted-foreground",
2525
"disabled:cursor-not-allowed disabled:opacity-50",
2626
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
27+
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none",
2728
"focus-visible:outline-none focus-visible:ring-ring/50 focus-visible:ring-2 focus-visible:border-ring focus-visible:shadow-sm",
28-
"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:pointer-events-none"
29+
(@type.to_s == "file") ? "pt-[7px]" : ""
2930
]
3031
}
3132
end
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class NativeSelect < Base
5+
def initialize(size: :default, **attrs)
6+
@size = size
7+
super(**attrs)
8+
end
9+
10+
def view_template(&block)
11+
div(
12+
class: "group/native-select relative w-fit has-[select:disabled]:opacity-50"
13+
) do
14+
select(**attrs, &block)
15+
render RubyUI::NativeSelectIcon.new
16+
end
17+
end
18+
19+
private
20+
21+
def default_attrs
22+
{
23+
data: {
24+
ruby_ui__form_field_target: "input",
25+
action: "change->ruby-ui--form-field#onChange invalid->ruby-ui--form-field#onInvalid"
26+
},
27+
class: [
28+
"border-border bg-transparent text-sm w-full min-w-0 appearance-none rounded-md border py-1 pr-8 pl-2.5 shadow-xs transition-[color,box-shadow] outline-none select-none ring-0 ring-ring/0",
29+
"placeholder:text-muted-foreground",
30+
"selection:bg-primary selection:text-primary-foreground",
31+
"focus-visible:outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-2",
32+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
33+
"aria-invalid:ring-destructive/20 aria-invalid:border-destructive aria-invalid:ring-2",
34+
(@size == :sm) ? "h-7 rounded-md py-0.5" : "h-9"
35+
]
36+
}
37+
end
38+
end
39+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class NativeSelectGroup < Base
5+
def view_template(&)
6+
optgroup(**attrs, &)
7+
end
8+
9+
private
10+
11+
def default_attrs
12+
{}
13+
end
14+
end
15+
end
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class NativeSelectIcon < Base
5+
def view_template(&block)
6+
span(**attrs) do
7+
if block
8+
block.call
9+
else
10+
icon
11+
end
12+
end
13+
end
14+
15+
private
16+
17+
def icon
18+
svg(
19+
xmlns: "http://www.w3.org/2000/svg",
20+
viewbox: "0 0 24 24",
21+
fill: "none",
22+
stroke: "currentColor",
23+
stroke_width: "2",
24+
stroke_linecap: "round",
25+
stroke_linejoin: "round",
26+
class: "size-4",
27+
aria_hidden: "true"
28+
) do |s|
29+
s.path(d: "m6 9 6 6 6-6")
30+
end
31+
end
32+
33+
def default_attrs
34+
{
35+
class: "text-muted-foreground pointer-events-none absolute top-1/2 right-2.5 -translate-y-1/2 select-none"
36+
}
37+
end
38+
end
39+
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
module RubyUI
4+
class NativeSelectOption < Base
5+
def view_template(&)
6+
option(**attrs, &)
7+
end
8+
9+
private
10+
11+
def default_attrs
12+
{}
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)