@@ -57,19 +57,19 @@ def initialize(html_attrs:)
5757 end
5858
5959 def icon_image_path ( icon )
60- ICONS . dig ( icon , :path ) || ""
60+ ICONS . dig ( icon . to_s , :path ) || ""
6161 end
6262
6363 def icon_alt_text ( icon )
64- base = ICONS . dig ( icon , :alt )
64+ base = ICONS . dig ( icon . to_s , :alt )
6565 base ? "#{ base } icon" : ""
6666 end
6767
6868 # Render the icon as a CSS-masked span so it inherits CSS `color`
6969 # via `background-color: currentColor`. Uses the same image-rasterization
7070 # path as `<img src=...>`, preserving pixel-perfect positioning.
7171 def inline_icon ( icon , size : 20 , css_class : nil , aria_hidden : false )
72- path = ICONS . dig ( icon , :path )
72+ path = ICONS . dig ( icon . to_s , :path )
7373 return "" . html_safe unless path
7474
7575 style = "--icon-url: url('#{ image_path ( path ) } '); width: #{ size } px; height: #{ size } px"
@@ -87,7 +87,7 @@ def required_class
8787 def checkbox_wrap ( checkbox_html , small : false )
8888 size = small ? 16 : 24
8989 box = small ? "h-4 w-4" : "h-6 w-6"
90- icon = inline_icon ( " check" , size :, aria_hidden : true , css_class : "absolute inset-0 pointer-events-none text-text-default" )
90+ icon = inline_icon ( : check, size :, aria_hidden : true , css_class : "absolute inset-0 pointer-events-none text-text-default" )
9191 content_tag :span , checkbox_html + icon , class : "cfa-checkbox-wrap relative inline-flex #{ box } "
9292 end
9393end
0 commit comments