bulmacomp 1.1.1 → 1.2.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: bbc691b1288ee63f446e52a4c1e63d904da8a711ea1a2c7fa954dc7322d74cee
4
- data.tar.gz: ed5ddd5efbb77ae7f043d0986a4b921de7fce26d0564eed932c0f9566e4e4d85
3
+ metadata.gz: 877729ecfd7e633da475e31fa48eb0abecbe108e6a25383447fe4ebf372171e8
4
+ data.tar.gz: 9ae0ef3d34e83d3242a38ff492b1230d9cda10e64dc79ef2b8b132e9705c76bd
5
5
  SHA512:
6
- metadata.gz: 72d3d47520541d484e6e4e61009aa3f66c0e3938cde163475e0a1f0f9c2cd5475ee906feacacd7ee8fb81623cfa5c7d7716ad9b2522e1978ae1410651597c44d
7
- data.tar.gz: 06f369343fc0d971773508c148cd497822055ac50024f094b348f6b67b1823ed96a69dc245f094fd9d87db2884a49f07047ee9be6f6ada14cce92322416d9443
6
+ metadata.gz: 15f0b9ac2fd9fc2cf746f21b80bb319fbf7d807db6c65ebaf2361d6ed50cde7705025898ba3faa87105e545fc7b3a255b169e15871ff23c780c2a14394d8443f
7
+ data.tar.gz: f0ffd454be1892d2cbcb4d63306903bba0d16684c93465be984f162289cecd45f3cbead60a2a0ca2ae759e3a6a3a2eedeeff851a677b16e0570e43407cbcdaeb
@@ -40,9 +40,8 @@ module Bulmacomp
40
40
  # each other key going as tag option, default is class: 'breadcrumb', aria_label: 'breadcrumbs'
41
41
  # @yield [optional] breadcrumb content
42
42
  def initialize(elements: [], **opts)
43
- super
44
43
  @elements = elements
45
- @opts = { class: 'breadcrumb', aria: { label: 'breadcrumbs' } }.merge(opts)
44
+ @opts = { class: "breadcrumb", aria: { label: "breadcrumbs" } }.merge(opts)
46
45
  end
47
46
 
48
47
  # @return [String] html_safe breadcrumb
@@ -22,16 +22,15 @@ module Bulmacomp
22
22
  # </div>
23
23
  class CardComponent < ViewComponent::Base
24
24
  def initialize(title: nil, image: nil, footer: nil, **opts)
25
- super
26
25
  @title = title
27
26
  @image = image
28
27
  @footer = footer
29
- @opts = { class: 'card' }.merge(opts)
28
+ @opts = { class: "card" }.merge(opts)
30
29
  end
31
30
 
32
31
  # @return [String] html_safe card
33
32
  def call
34
- tag.div safe_join([card_title, card_image, card_content, card_footer]), **@opts
33
+ tag.div safe_join([ card_title, card_image, card_content, card_footer ]), **@opts
35
34
  end
36
35
 
37
36
  # @return [String] title section if :title is set
@@ -40,7 +39,7 @@ module Bulmacomp
40
39
  #
41
40
  # <div class='card-header'><div class='card-header-title'>test</div></div>
42
41
  def card_title
43
- tag.div(tag.div(@title, class: 'card-header-title'), class: 'card-header') if @title
42
+ tag.div(tag.div(@title, class: "card-header-title"), class: "card-header") if @title
44
43
  end
45
44
 
46
45
  # return [String] image section if :image is set
@@ -49,7 +48,7 @@ module Bulmacomp
49
48
  #
50
49
  # <div class='card-image'><img src='test.jpg' alt='test'></div>
51
50
  def card_image
52
- tag.div(tag.figure(image_tag(@image, alt: @title), class: 'image'), class: 'card-image') if @image
51
+ tag.div(tag.figure(image_tag(@image, alt: @title), class: "image"), class: "card-image") if @image
53
52
  end
54
53
 
55
54
  # return [String] content section if yield is present
@@ -60,7 +59,7 @@ module Bulmacomp
60
59
  #
61
60
  # <div class="card-content"><div class="content"><p>test content</p></div>
62
61
  def card_content
63
- tag.div(tag.div(content, class: 'content'), class: 'card-content') if content
62
+ tag.div(tag.div(content, class: "content"), class: "card-content") if content
64
63
  end
65
64
 
66
65
  # return [String] footer section if a footer is present
@@ -69,7 +68,7 @@ module Bulmacomp
69
68
  #
70
69
  # <div class='card-footer'>test</div>
71
70
  def card_footer
72
- tag.div @footer, class: 'card-footer' if @footer
71
+ tag.div @footer, class: "card-footer" if @footer
73
72
  end
74
73
  end
75
74
  end
@@ -70,10 +70,9 @@ module Bulmacomp
70
70
  # each key going as content tag option, default is class: 'dropdown'
71
71
  # @yield [optional] dropdown content
72
72
  def initialize(title: nil, elements: [], icon: default_icon, button_options: {}, **opts)
73
- super
74
73
  @title = tag.span title if title.present?
75
74
  @elements = elements
76
- @icon = tag.span icon, class: 'icon is-small' if icon.present?
75
+ @icon = tag.span icon, class: "icon is-small" if icon.present?
77
76
  @button_options = default_button_options.merge(button_options)
78
77
  @opts = default_opts.merge(opts)
79
78
  end
@@ -85,31 +84,31 @@ module Bulmacomp
85
84
 
86
85
  # @return [Hash] default option for content tag
87
86
  def default_opts
88
- { class: 'dropdown' }
87
+ { class: "dropdown" }
89
88
  end
90
89
 
91
90
  # return [Hash] default option for button tag
92
91
  def default_button_options
93
- { class: 'button', aria: { haspopup: 'true', controls: 'dropdown-menu' } }
92
+ { class: "button", aria: { haspopup: "true", controls: "dropdown-menu" } }
94
93
  end
95
94
 
96
95
  # Generated html string for bulma dropdown
97
96
  # @return [String]
98
97
  def call
99
- tag.div safe_join([tag_trigger, tag_content]), **@opts
98
+ tag.div safe_join([ tag_trigger, tag_content ]), **@opts
100
99
  end
101
100
 
102
101
  # generated html for '.dropdown-trigger' div
103
102
  # @return [String]
104
103
  def tag_trigger
105
- tag.div tag.button(safe_join([@title, @icon]), **@button_options), class: 'dropdown-trigger'
104
+ tag.div tag.button(safe_join([ @title, @icon ]), **@button_options), class: "dropdown-trigger"
106
105
  end
107
106
 
108
107
  # generated html for '.dropdown-content' div.
109
108
  # Map each content of {elements} in a '.dropdown-item' div and add yield content
110
109
  # @return [String]
111
110
  def tag_content
112
- tag.div safe_join([@elements.map { |e| tag.div(e, class: 'dropdown-item') }, content]), class: 'dropdown-content'
111
+ tag.div safe_join([ @elements.map { |e| tag.div(e, class: "dropdown-item") }, content ]), class: "dropdown-content"
113
112
  end
114
113
  end
115
114
  end
@@ -67,9 +67,7 @@ module Bulmacomp
67
67
  # @option opts [String] :*
68
68
  # each key going as tag option, default is class: 'menu'
69
69
  def initialize(elements: [], **opts)
70
- super
71
- @elements = elements
72
- @opts = { class: 'menu' }.merge(opts)
70
+ @opts = { class: "menu" }.merge(opts)
73
71
  end
74
72
 
75
73
  # Generate an html safe string with full bulma menu.
@@ -91,7 +89,7 @@ module Bulmacomp
91
89
  # <p class='menu-label'>Uno</p><ul><li>Due</li><li>Tre<li></ul>
92
90
  def first_level(values = [])
93
91
  safe_join(
94
- values.map { |e| e.is_a?(Array) ? map_menu(e) : tag.p(e, class: 'menu-label') }
92
+ values.map { |e| e.is_a?(Array) ? map_menu(e) : tag.p(e, class: "menu-label") }
95
93
  )
96
94
  end
97
95
 
@@ -121,7 +119,7 @@ module Bulmacomp
121
119
  #
122
120
  # <li>Uno<ul><li>Due</li><li>Tre</li></ul></li>
123
121
  def sub_menu(values = [])
124
- tag.li safe_join([values.shift, map_menu(values)])
122
+ tag.li safe_join([ values.shift, map_menu(values) ])
125
123
  end
126
124
  end
127
125
  end
@@ -40,24 +40,23 @@ module Bulmacomp
40
40
  # each key going as article tag option, default is class: 'message'
41
41
  # @yield [optional] message content
42
42
  def initialize(title: nil, close: false, close_option: {}, **opts)
43
- super
44
43
  @title = title
45
44
  @close = close
46
45
  @close_option = close_option
47
- @opts = { class: 'message' }.merge opts
46
+ @opts = { class: "message" }.merge opts
48
47
  end
49
48
 
50
49
  # return [String] generated bulma message
51
50
  def call
52
- tag.article safe_join([header, tag.div(content, class: 'message-body')]), **@opts
51
+ tag.article safe_join([ header, tag.div(content, class: "message-body") ]), **@opts
53
52
  end
54
53
 
55
54
  # return [String] div.message-header if @title or @close is present
56
55
  def header
57
56
  ret = []
58
57
  ret << tag.p(@title) if @title.present?
59
- ret << tag.button(**{ class: 'delete', aria: { label: 'delete' } }.merge(@close_option)) if @close
60
- tag.div safe_join(ret), class: 'message-header' if ret.present?
58
+ ret << tag.button(**{ class: "delete", aria: { label: "delete" } }.merge(@close_option)) if @close
59
+ tag.div safe_join(ret), class: "message-header" if ret.present?
61
60
  end
62
61
  end
63
62
  end
@@ -26,16 +26,15 @@ module Bulmacomp
26
26
  # @option opts [String] :* each key going as tag option, default is class: 'modal'
27
27
  # @yield [optional] modal content
28
28
  def initialize(**opts)
29
- super
30
- @opts = { class: 'modal' }.merge opts
29
+ @opts = { class: "modal" }.merge opts
31
30
  end
32
31
 
33
32
  # return [String] html_safe generated bulma modal
34
33
  def call
35
34
  content_tag :div, safe_join([
36
- tag.div(class: 'modal-background'),
37
- tag.div(content, class: 'modal-content'),
38
- tag.button(class: 'modal-close is-large', aria_label: 'close')
35
+ tag.div(class: "modal-background"),
36
+ tag.div(content, class: "modal-content"),
37
+ tag.button(class: "modal-close is-large", aria_label: "close")
39
38
  ]), **@opts
40
39
  end
41
40
  end
@@ -49,37 +49,36 @@ module Bulmacomp
49
49
  # class: 'navbar', aria_label: 'main navigation', aria_role: 'navigation'
50
50
  # @yield [optional] navbar content
51
51
  def initialize(brand: nil, navbar_start: nil, navbar_end: nil, **opts)
52
- super
53
52
  @brand = brand
54
- @navbar_start = tag.div navbar_start, class: 'navbar-start' if navbar_start.present?
55
- @navbar_end = tag.div navbar_end, class: 'navbar-end' if navbar_end.present?
56
- @opts = { class: 'navbar', aria: { role: 'navigation', label: 'main navigation' } }.merge(opts)
53
+ @navbar_start = tag.div navbar_start, class: "navbar-start" if navbar_start.present?
54
+ @navbar_end = tag.div navbar_end, class: "navbar-end" if navbar_end.present?
55
+ @opts = { class: "navbar", aria: { role: "navigation", label: "main navigation" } }.merge(opts)
57
56
  end
58
57
 
59
58
  # @return [String] html_safe navbar
60
59
  def call
61
- tag.nav safe_join([navbar_brand, navbar_menu]), **@opts
60
+ tag.nav safe_join([ navbar_brand, navbar_menu ]), **@opts
62
61
  end
63
62
 
64
63
  # @return [String] html_safe navbar-brand tag
65
64
  def navbar_brand
66
65
  return if @brand.blank?
67
66
 
68
- tag.div safe_join([link_to(@brand, root_path, data_turbo_frame: 'yield', class: 'navbar-item'), navbar_burger]),
69
- class: 'navbar-brand'
67
+ tag.div safe_join([ link_to(@brand, root_path, data_turbo_frame: "yield", class: "navbar-item"), navbar_burger ]),
68
+ class: "navbar-brand"
70
69
  end
71
70
 
72
71
  # @return [String] html_safe navbar-menu tag
73
72
  def navbar_menu
74
- tag.div(safe_join([@navbar_start, content, @navbar_end]), class: 'navbar-menu', data: { page_target: 'menu' })
73
+ tag.div(safe_join([ @navbar_start, content, @navbar_end ]), class: "navbar-menu", data: { page_target: "menu" })
75
74
  end
76
75
 
77
76
  # @return [String] html_safe navbar-burger link
78
77
  def navbar_burger
79
- aria = {expanded: 'false', label: 'menu'}
80
- data = {action: 'click->page#toggleMenu'}
81
- role = 'button'
82
- tag.a tag.span(aria_hidden: true) * 3, class: 'navbar-burger', aria:, data:, role:
78
+ aria = { expanded: "false", label: "menu" }
79
+ data = { action: "click->page#toggleMenu" }
80
+ role = "button"
81
+ tag.a tag.span(aria_hidden: true) * 3, class: "navbar-burger", aria: aria, data: data, role: role
83
82
  end
84
83
  end
85
84
  end
@@ -76,22 +76,21 @@ module Bulmacomp
76
76
  # * aria_label: "pagination"
77
77
  # @yield [optional] modal content
78
78
  def initialize(elements: [], pre: [], **opts)
79
- super
80
79
  @elements = elements
81
80
  @pre = pre
82
- @opts = { class: 'pagination', role: 'navigation', aria_label: 'pagination' }.merge opts
81
+ @opts = { class: "pagination", role: "navigation", aria_label: "pagination" }.merge opts
83
82
  end
84
83
 
85
84
  # Generate safe string with bulma pagination
86
85
  # @return [String] html_safe generated bulma pagination
87
86
  def call
88
- tag.nav safe_join([@pre, ulify]), **@opts
87
+ tag.nav safe_join([ @pre, ulify ]), **@opts
89
88
  end
90
89
 
91
90
  # generate a ul tag with map_elements and content
92
91
  # @return [String]
93
92
  def ulify
94
- tag.ul safe_join([map_elements, content])
93
+ tag.ul safe_join([ map_elements, content ])
95
94
  end
96
95
 
97
96
  # Map elements in a li tag
@@ -33,19 +33,18 @@ module Bulmacomp
33
33
  # @yield [optional]
34
34
  # panel content
35
35
  def initialize(title: nil, **opts)
36
- super
37
36
  @title = title
38
- @opts = { class: 'panel' }.merge(opts)
37
+ @opts = { class: "panel" }.merge(opts)
39
38
  end
40
39
 
41
40
  # return [String] html_safe generated bulma panel
42
41
  def call
43
- content_tag :nav, safe_join([title, content]), **@opts
42
+ content_tag :nav, safe_join([ title, content ]), **@opts
44
43
  end
45
44
 
46
45
  # return [String] html_safe generated panel title
47
46
  def title
48
- tag.p @title, class: 'panel-heading' if @title
47
+ tag.p @title, class: "panel-heading" if @title
49
48
  end
50
49
  end
51
50
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Bulmacomp
4
2
  # Make an HTML strucrure for a bulma tabs
5
3
  #
@@ -10,61 +8,19 @@ module Bulmacomp
10
8
  # <ul></ul>
11
9
  # </div>
12
10
  #
13
- # @example tabs with elements
14
- # elements = [link_to('one','#'), link_to('two','#')]
15
- # render Bulmacomp::TabsComponent.new(elements: elements)
16
- #
17
- # <div class="tabs">
18
- # <ul>
19
- # <li><a href='#'>one</li>
20
- # <li><a href='#'>two</li>
21
- # </ul>
22
- # </div>
23
- #
24
- # @example tabs with yield content
25
- # = render Bulmacomp::TabsComponent.new() do
26
- # %li some text
11
+ # @example
12
+ # entries = [link_to('one','#'), link_to('two','#')]
13
+ # render Bulmacomp::TabsComponent.new(entries)
27
14
  #
28
15
  # <div class="tabs">
29
16
  # <ul>
30
- # <li>some text</li>
31
- # </ul>
32
- # </div>
33
- #
34
- # @example tabs with full options
35
- # elements = [link_to('one','#'), link_to('two','#')]
36
- # = render Bulmacomp::TabsComponent.new(elements: elements, id: 'ok') do
37
- # %li some text
38
- #
39
- # <div class="tabs" id="ok">
40
- # <ul>
41
17
  # <li><a href='#'>one</li>
42
18
  # <li><a href='#'>two</li>
43
- # <li>some text</li>
44
19
  # </ul>
45
20
  # </div>
46
21
  class TabsComponent < ViewComponent::Base
47
- # @param [Hash] opts
48
- # options to generate content
49
- # @param [Array<String>] elements
50
- # array of elements for tabs collection
51
- # @option opts [String] :*
52
- # each other key going as tag option, default is class: 'tabs'
53
- # @yield [optional] tabs content
54
- def initialize(elements: [], **opts)
55
- super
56
- @elements = elements
57
- @opts = { class: 'tabs' }.merge(opts)
58
- end
59
-
60
- # @return [String] html_safe tabs
61
22
  def call
62
- tag.div tag.ul(ul_content), **@opts
63
- end
64
-
65
- # @return [Text], safe join of elements arguments and proc content
66
- def ul_content
67
- safe_join([@elements.map { |e| tag.li(e) }, content])
23
+ return ''
68
24
  end
69
25
  end
70
26
  end
@@ -37,19 +37,18 @@ module Bulmacomp
37
37
  # each other key going as tag option
38
38
  # @yield [optional] turbo frame content
39
39
  def initialize(icon: default_icon, **opts)
40
- super
41
40
  @icon = icon
42
41
  @opts = opts
43
42
  end
44
43
 
45
44
  # @return [String] html turbo frame
46
45
  def call
47
- content_tag('turbo-frame', (content || @icon), **@opts)
46
+ content_tag("turbo-frame", content || @icon, **@opts)
48
47
  end
49
48
 
50
49
  # default value for icon
51
50
  def default_icon
52
- tag.span tag.i(class: 'fas fa-sync fa-spin fa-2x'), class: 'icon'
51
+ tag.span tag.i(class: "fas fa-sync fa-spin fa-2x"), class: "icon"
53
52
  end
54
53
  end
55
54
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulmacomp
4
- VERSION = '1.1.1' # Costant of bulmacomp version
4
+ VERSION = "1.2.0" # Costant of bulmacomp version
5
5
  end
data/lib/bulmacomp.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bulmacomp/version'
4
- require 'bulmacomp/engine'
5
- require 'view_component'
3
+ require "bulmacomp/version"
4
+ require "bulmacomp/engine"
5
+ require "view_component"
6
6
 
7
7
  # Bulmacomp module, contain all gem components
8
8
  module Bulmacomp
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # desc "Explaining what the task does"
3
4
  # task :bulmacomp do
4
5
  # # Task goes here
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulmacomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MDreW
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -30,14 +29,14 @@ dependencies:
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: 3.9.0
32
+ version: 4.0.0
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: 3.9.0
39
+ version: 4.0.0
41
40
  description: Collection of view components for bulma css framework
42
41
  email:
43
42
  - andrea.ranaldi@gmail.com
@@ -70,7 +69,6 @@ metadata:
70
69
  homepage_uri: https://github.com/isprambiente/bulmacomp
71
70
  source_code_uri: https://github.com/isprambiente/bulmacomp
72
71
  changelog_uri: https://github.com/isprambiente/bulmacomp
73
- post_install_message:
74
72
  rdoc_options: []
75
73
  require_paths:
76
74
  - lib
@@ -85,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
83
  - !ruby/object:Gem::Version
86
84
  version: '0'
87
85
  requirements: []
88
- rubygems_version: 3.5.3
89
- signing_key:
86
+ rubygems_version: 3.6.9
90
87
  specification_version: 4
91
88
  summary: Rails 'View Components' for Bulma
92
89
  test_files: []