heroicon-rails 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8820c098919ed4af32d5ecc5ea1a9cbd95e7a74df97ec39bfb6715780c98aabf
4
- data.tar.gz: 31a5b0e1341816ba51febdcb30e1566eb356c76e83b72323af26f877d778d25d
3
+ metadata.gz: e112f0b760d1eb338db45f92aa4ccef920da43e7a9ce1b2bfc1cedd0fc702231
4
+ data.tar.gz: a3f4692f2b709f010a9a975ea5b106ebb63fe0b17b52379d71e52689f8c575f9
5
5
  SHA512:
6
- metadata.gz: 000b02270077ea813bb8597d765f1d006bcade49eb6466871f86fce48dbf7dbf870481afaa5260f043d00b096f1c63a6baa073eba4b37eed8bacf288c64c1956
7
- data.tar.gz: f7b3573e6df57e4385365960f51dd94de4759a0e3bcb58ab1401837b40332e6b0ef6960faf97b869377bd3551f40a923481c494b4f220b8aac5ddff5a15cf473
6
+ metadata.gz: 4ccaaef593336ce8d653472dfdbf20d5c3c395c5409b049c3f2ba2e808b118495f8028cda7af2ef451f004c83dfef16cdfd933ab1199165467fa4d379b33f187
7
+ data.tar.gz: '08252cf7db3518ddfbc585a3ceafd87674bf328bf6d1f2643b43efca62ae3445849253b31aa1f1fa580be961bf28b6a4c99b854fc5396a4956879510437ccb50'
@@ -10,8 +10,10 @@ module HeroiconHelper
10
10
  # @return [String] HTML safe string with the SVG content or error message
11
11
  def heroicon(name, type: "solid", **options)
12
12
  custom_class = options.delete(:class) || ""
13
+ # Handle style attribute separately to avoid unintended deletions
14
+ style_attribute = options.delete(:style)
13
15
 
14
- # Remove and separately handle data- attributes to avoid unintended deletions
16
+ # Handle data- attributes, filtering out anything that doesn't start with 'data-'
15
17
  data_attributes = options.select { |key, _| key.to_s.start_with?('data-') }
16
18
  options.except!(*data_attributes.keys)
17
19
 
@@ -21,16 +23,17 @@ module HeroiconHelper
21
23
  icon_doc = Nokogiri::HTML::DocumentFragment.parse(icon_content)
22
24
  svg = icon_doc.at_css("svg")
23
25
 
24
- # Identify custom width and height classes
26
+ # Apply custom classes
25
27
  custom_width_class = custom_class[/\bw-\d+/]
26
28
  custom_height_class = custom_class[/\bh-\d+/]
27
-
28
- # Define default classes, replace with custom if present
29
29
  default_width = custom_width_class ? '' : (type == "mini" ? "w-5" : "w-6")
30
30
  default_height = custom_height_class ? '' : (type == "mini" ? "h-5" : "h-6")
31
31
  css_classes = "#{default_width} #{default_height} #{custom_class}".strip
32
32
  svg[:class] = css_classes unless css_classes.empty?
33
33
 
34
+ # Apply style attribute if present
35
+ svg[:style] = style_attribute if style_attribute
36
+
34
37
  # Enhance accessibility
35
38
  svg[:role] = "img"
36
39
  svg["aria-labelledby"] = "#{name}-icon"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Heroicon
4
4
  module Rails
5
- VERSION = "0.2.4"
5
+ VERSION = "0.2.6"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroicon-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl Weis