f_components 0.2.1 → 0.5.0

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: 23b88d28e2e9948702351020207b6aff6fddbd01e54e9f4ebfdb0532e08eee06
4
- data.tar.gz: 90a0556f1bd62124ba52d0643cdd8274e6512f23e65bbabbdab239126f67d65c
3
+ metadata.gz: f27c8e0b1d7838f17aa6039ebac0be8174ec0318e55df6364f7f8fc1f43fe1dd
4
+ data.tar.gz: 6e4b33989e61277d68f1d76b96439d70ea08bb51215ccd8fa2116d8c4572981a
5
5
  SHA512:
6
- metadata.gz: db56d7fc4a18a99bac2bc3d70b650f1eb49df41dfd4305de745fa3f285c13673ac14a482db220349eee6d2e7820f31d5fbc016b539946befd67235210f1c3568
7
- data.tar.gz: 7a0d5d29de3e02f3ca7478477480fa65ea8ee68cc146d368a7e8d7f01fd3135bdba968e5846c1e340b328dc46ebfbfab6bf9d6c2fc31f56055fd3b8d0a06749f
6
+ metadata.gz: c05cf93ca574a4879fdd18ccea361c00a7963a186f30c484a29ed2cb79542a8270f2f8b167eab3036596eaf8f072638ffdbc72aa1de082924fb70218aeec0a8e
7
+ data.tar.gz: 6b8bf2d6916fd16b7ea6f6606d0403a0bc31fa45800bfc6fce446021232db93ee06ffe305af6902cec0e6c68b6fdd2c721113b1bb2f95f971874f69a1923cbef
@@ -1,16 +1,16 @@
1
1
  <div data-controller="f-table-component">
2
2
  <%=
3
- desktop_table(
3
+ render(FComponents::Table::Desktop::Component.(
4
4
  columns: columns,
5
5
  rows: rows,
6
6
  actions: @actions,
7
7
  check_boxes: @check_boxes,
8
8
  **@options
9
- )
9
+ ))
10
10
  %>
11
11
 
12
12
  <%=
13
- mobile_table(
13
+ render(FComponents::Table::Mobile::Component.(
14
14
  columns: columns,
15
15
  rows: rows,
16
16
  main_column: @main_column,
@@ -18,6 +18,6 @@
18
18
  check_boxes: @check_boxes,
19
19
  resources: @resources,
20
20
  **@options
21
- )
21
+ ))
22
22
  %>
23
23
  </div>
@@ -3,9 +3,6 @@
3
3
  module FComponents
4
4
  module Table
5
5
  class Component < Base
6
- renders_one :desktop_table, Table::Desktop::Component
7
- renders_one :mobile_table, Table::Mobile::Component
8
-
9
6
  def initialize(options)
10
7
  @options = options
11
8
  @values = {}
@@ -2,28 +2,58 @@
2
2
 
3
3
  module FComponents
4
4
  module IconsHelper
5
- # Public: Creates a icon tag
5
+ VALID_STYLES = {
6
+ solid: 'fa-solid',
7
+ regular: 'fa-regular',
8
+ light: 'fa-light',
9
+ thin: 'fa-thin',
10
+ duotone: 'fa-duotone',
11
+ brands: 'fa-brands'
12
+ }.freeze
13
+
14
+ # Public: Creates a Font Awesome icon tag
15
+ #
6
16
  # Examples:
7
17
  #
8
- # fa_icon('eye')
9
- # #=> <i class="fas fa-eye"></i>
18
+ # fa_icon('home')
19
+ # #=> <i class="fa-solid fa-home"></i>
20
+ #
21
+ # fa_icon('user', style: :regular)
22
+ # #=> <i class="fa-regular fa-user"></i>
23
+ #
24
+ # fa_icon('github', style: :brands)
25
+ # #=> <i class="fa-brands fa-github"></i>
10
26
  #
11
- # fa_icon('eye', prefix: 'far')
12
- # <i class="far fa-eye"></i>
27
+ # fa_icon('eye', class: 'strong space-x-2', text: 'my text')
28
+ # #=> <i class="fa-solid fa-eye strong space-x-2"></i> my text
13
29
  #
14
- # fa_icon('eye', class: 'strong space-x-2')
15
- # #=> <i class="fas fa-eye strong space-x-2"></i>
30
+ # Parameters:
31
+ # @param name [String] The icon name (e.g., 'home', 'user')
32
+ # @param options [Hash] Additional options
33
+ # - :style [Symbol] The icon style (:solid, :regular, :brands, etc.)
34
+ # - :class [String] Additional CSS classes
35
+ # - :text [String] Text to display after the icon
16
36
  #
17
- # fa_icon('eye', class: 'strong space-x-2', text: 'my text')
18
- # #=> <i class="fas fa-eye strong space-x-2"></i> my text
37
+ # Returns:
38
+ # @return [String] Safe HTML for rendering
19
39
  def fa_icon(name, options = {})
20
- fa_prefix = options.delete(:prefix) { 'fas' }
21
- icon_name = "fa-#{name}"
40
+ style = options.delete(:style) { :solid }
41
+ style_class = VALID_STYLES[style] || VALID_STYLES[:solid]
42
+
43
+ icon_class = "fa-#{name}"
22
44
  custom_classes = options[:class].presence
23
- options[:class] = [fa_prefix, icon_name, custom_classes].compact.join(' ')
45
+ options[:class] = [style_class, icon_class, custom_classes].compact.join(' ')
46
+
24
47
  f_icon(options)
25
48
  end
26
49
 
50
+ # Internal: Creates the <i> tag with the appropriate classes and adds text if necessary
51
+ #
52
+ # Parameters:
53
+ # @param options [Hash] Options for the <i> tag
54
+ #
55
+ # Returns:
56
+ # @return [String] Safe HTML for rendering
27
57
  def f_icon(options)
28
58
  text = options.delete(:text)
29
59
  tag = content_tag(:i, nil, options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FComponents
4
- VERSION = '0.2.1'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: f_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fretadao tech
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-06 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.27'
61
+ version: '3'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.27'
68
+ version: '3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webpacker
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.1.2
154
+ rubygems_version: 3.5.22
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Library of view_components