bootstrap5_helper 1.1.0 → 1.1.1

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: 7ab8982347a3e4e8f5b3f295df1d32c1436c96f6a0e6ed7ebe49be9cb2030acf
4
- data.tar.gz: 1f0e37c6a736272b748fab3c8c00107d58d232f177d4fcbb812d212085670d6c
3
+ metadata.gz: 69fbf952577b44a22763e9f054dc768bb4a1ad7d2f47ba094dda42612dc2f5b7
4
+ data.tar.gz: 2d656ebf99bc33d65e49c4ef2f661266958e31366fdfb7730dc9ed08cc782996
5
5
  SHA512:
6
- metadata.gz: 81a56bd544a7aaa270adbde0e361e2c1bf206e9e39980eca8ad8af45295a430c2cb1b21d76af32eb320013715ca5545ba99c784f881786e1df967f9a6df1aad8
7
- data.tar.gz: 5aedd70cae3d0fce44b2457a1be9918b4e8c5cf95440970f6eb1dee8c4abb3be40af7b345a6312b7504f42f958304cf1be833fdde375a1bd21f9888888b1351f
6
+ metadata.gz: aab79e3287bea1f7cbb4d5ddd761840691d8cc319aa6eddfc89d5b87a5aedfe8ff8ce2ad271b75d6155a6e58586c305fb04db88bdfdaca240c9b3375663bca69
7
+ data.tar.gz: 992edacb8fd535b478cf3e4cfbf1191425d62ea9cf4b7093ce4a374fcb041feb294f96a21e252b2d14f9323b73cc863fe3869a542adad395917d1e3f87a76ac2
@@ -2,12 +2,20 @@ module Bootstrap5Helper
2
2
  class CardWithNavTab < Component # :nodoc:
3
3
  # Class constructor
4
4
  #
5
- # @param [ActionView] template
6
- # @param [Symbol|String|Hash] type_or_options
7
- # @param [Hash] opts
8
- # @option opts [String] :id
9
- # @option opts [String] :class
10
- # @option opts [Hash] :data
5
+ # @overload initialize(template, context, opts)
6
+ # @param [ActionView] template
7
+ # @param [Symbol|String] context
8
+ # @param [Hash] opts
9
+ # @option opts [String] :id
10
+ # @option opts [String] :class
11
+ # @option opts [Hash] :data
12
+ #
13
+ # @overload initialize(template, opts)
14
+ # @param [ActionView] template
15
+ # @param [Hash] opts
16
+ # @option opts [String] :id
17
+ # @option opts [String] :class
18
+ # @option opts [Hash] :data
11
19
  #
12
20
  def initialize(template, *context_or_options, &block)
13
21
  super(template)
@@ -42,12 +50,12 @@ module Bootstrap5Helper
42
50
  tag, args = parse_tag_or_options(*tag_or_options, {})
43
51
  args[:class] = (args[:class] || '') << 'nav-tabs card-header-tabs'
44
52
  args[:data] = (args[:data] || {}).merge('bs-toggle' => 'tab')
45
- args[:child] = {
53
+ args[:child] = (args[:child] || {}).merge(
46
54
  data: {
47
55
  'bs-toggle' => 'tab',
48
56
  'bs-display' => 'static'
49
57
  }
50
- }
58
+ )
51
59
 
52
60
  content_tag :div, class: 'card-header' do
53
61
  Nav.new(@template, tag, args, &block).to_s
@@ -10,6 +10,7 @@ module Bootstrap5Helper
10
10
  # @param [ActionView] template
11
11
  # @param [Hash] opts
12
12
  # @option opts [Symbol] :type
13
+ # @option opts [Symbol] :size
13
14
  # @option opts [String] :id
14
15
  # @option opts [String] :class
15
16
  # @option opts [Hash] :data
@@ -18,6 +19,7 @@ module Bootstrap5Helper
18
19
  super(template)
19
20
 
20
21
  @type = opts.fetch(:type, :border)
22
+ @size = opts.fetch(:size, nil)
21
23
  @id = opts.fetch(:id, uuid)
22
24
  @class = opts.fetch(:class, '')
23
25
  @data = opts.fetch(:data, {})
@@ -32,7 +34,7 @@ module Bootstrap5Helper
32
34
  content_tag(
33
35
  :span,
34
36
  id: @id,
35
- class: "spinner-#{@type} #{@class}",
37
+ class: component_classes,
36
38
  role: 'status',
37
39
  aria: { hidden: true },
38
40
  data: @data
@@ -40,5 +42,18 @@ module Bootstrap5Helper
40
42
  content_tag :span, 'Loading', class: 'visually-hidden'
41
43
  end
42
44
  end
45
+
46
+ private
47
+
48
+ # Cleaner way of getting the base component classes.
49
+ #
50
+ # @return [String]
51
+ #
52
+ def component_classes
53
+ string = "spinner-#{@type} #{@class}"
54
+ string << " spinner-#{@type}-#{@size}" if @size.present?
55
+
56
+ string
57
+ end
43
58
  end
44
59
  end
@@ -1,3 +1,3 @@
1
1
  module Bootstrap5Helper
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
@@ -165,15 +165,15 @@ module Bootstrap5Helper
165
165
  Card.new(self, opts, &block)
166
166
  end
167
167
 
168
- # @overload card_with_nav_tab_helper(type, opts)
169
- # @param [Symbol|String] type - :tabs, :pills
170
- # @param [Hash] opts
168
+ # @overload card_with_nav_tab_helper(context, opts)
169
+ # @param [Symbol|String] context
170
+ # @param [Hash] opts
171
171
  # @option opts [String] :id
172
172
  # @option opts [String] :class
173
173
  # @option opts [Hash] :data
174
174
  #
175
175
  # @overload card_with_nav_tab_helper(opts)
176
- # @param [Hash] opts
176
+ # @param [Hash] opts
177
177
  # @option opts [String] :id
178
178
  # @option opts [String] :class
179
179
  # @option opts [Hash] :data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap5_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert David
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-11 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap