heroicon-rails 0.2.3 → 0.2.4

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: 0fd24c0a8c60585d43fd4a309683be26a7d35acf5dbb03fe15954e82fbc0f0fb
4
- data.tar.gz: 7b826a26b7d0d63344d440f1d2a1fe9ba5a186459811715a3abecb34ae37988f
3
+ metadata.gz: 8820c098919ed4af32d5ecc5ea1a9cbd95e7a74df97ec39bfb6715780c98aabf
4
+ data.tar.gz: 31a5b0e1341816ba51febdcb30e1566eb356c76e83b72323af26f877d778d25d
5
5
  SHA512:
6
- metadata.gz: 2e0cf0ea42905ff83e9b421ef5c4bc4aec5561391badd97cacaf97668b662650dd494c6096fbf48c5eaa4ebcf39213e832ddd080885e43dc2db77d4667ec5da8
7
- data.tar.gz: 433d722e0d39c230365b3be72081749ee36ff063515f26854675adeae71e4167b1f193c237004b4c4e1c2f5a61192d85e94dc842295a0047e3d0329ff6964e4d
6
+ metadata.gz: 000b02270077ea813bb8597d765f1d006bcade49eb6466871f86fce48dbf7dbf870481afaa5260f043d00b096f1c63a6baa073eba4b37eed8bacf288c64c1956
7
+ data.tar.gz: f7b3573e6df57e4385365960f51dd94de4759a0e3bcb58ab1401837b40332e6b0ef6960faf97b869377bd3551f40a923481c494b4f220b8aac5ddff5a15cf473
@@ -10,6 +10,11 @@ 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
+
14
+ # Remove and separately handle data- attributes to avoid unintended deletions
15
+ data_attributes = options.select { |key, _| key.to_s.start_with?('data-') }
16
+ options.except!(*data_attributes.keys)
17
+
13
18
  gem_root = Gem::Specification.find_by_name("heroicon-rails").gem_dir
14
19
  icon_path = File.join(gem_root, "lib", "heroicon", "rails", "assets", "heroicons", type, "#{name}.svg")
15
20
  icon_content = File.read(icon_path)
@@ -34,6 +39,11 @@ module HeroiconHelper
34
39
  title_element[:id] = "#{name}-icon"
35
40
  svg.prepend_child(title_element)
36
41
 
42
+ # Add custom data- attributes
43
+ data_attributes.each do |key, value|
44
+ svg[key] = value
45
+ end
46
+
37
47
  icon_doc.to_html.html_safe
38
48
  rescue StandardError => e
39
49
  "Icon '#{name}' not found. Error: #{e.message}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Heroicon
4
4
  module Rails
5
- VERSION = "0.2.3"
5
+ VERSION = "0.2.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroicon-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl Weis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-16 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport