@@ -14,7 +14,7 @@ class SidebarMenuButton < Base
1414 lg : "h-12 text-sm group-data-[collapsible=icon]:!p-0"
1515 } . freeze
1616
17- def initialize ( as : " button" , variant : :default , size : :default , active : false , **attrs )
17+ def initialize ( as : : button, variant : :default , size : :default , active : false , **attrs )
1818 raise ArgumentError , "Invalid variant: #{ variant } " unless VARIANT_CLASSES . key? ( variant )
1919 raise ArgumentError , "Invalid size: #{ size } " unless SIZE_CLASSES . key? ( size )
2020
@@ -26,15 +26,29 @@ def initialize(as: "button", variant: :default, size: :default, active: false, *
2626 end
2727
2828 def view_template ( &)
29- public_send ( @as , **attrs , &)
29+ tag ( @as , **attrs , &)
3030 end
3131
3232 private
3333
3434 def default_attrs
3535 {
3636 class : [
37- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0" ,
37+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden" ,
38+ "rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring" ,
39+ "transition-[width,height,padding] hover:bg-sidebar-accent" ,
40+ "hover:text-sidebar-accent-foreground focus-visible:ring-2" ,
41+ "active:bg-sidebar-accent active:text-sidebar-accent-foreground" ,
42+ "disabled:pointer-events-none disabled:opacity-50" ,
43+ "group-has-[[data-sidebar=menu-action]]/menu-item:pr-8" ,
44+ "aria-disabled:pointer-events-none aria-disabled:opacity-50" ,
45+ "data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium" ,
46+ "data-[active=true]:text-sidebar-accent-foreground" ,
47+ "data-[state=open]:hover:bg-sidebar-accent" ,
48+ "data-[state=open]:hover:text-sidebar-accent-foreground" ,
49+ "group-data-[collapsible=icon]:!size-8" ,
50+ "group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate" ,
51+ "[&>svg]:size-4 [&>svg]:shrink-0" ,
3852 VARIANT_CLASSES [ @variant ] ,
3953 SIZE_CLASSES [ @size ]
4054 ] ,
0 commit comments