bs5 0.0.13 → 0.0.18
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 +4 -4
- data/README.md +1 -1
- data/app/components/bs5/accordion_component.html.erb +4 -11
- data/app/components/bs5/accordion_component.rb +1 -0
- data/app/components/bs5/alert_component.html.erb +1 -1
- data/app/components/bs5/button_group_component.html.erb +3 -0
- data/app/components/bs5/button_group_component.rb +49 -0
- data/app/components/bs5/button_toolbar_component.html.erb +3 -0
- data/app/components/bs5/button_toolbar_component.rb +21 -0
- data/app/helpers/bs5/components_helper.rb +12 -8
- data/app/service/bs5/collapse_service.rb +49 -0
- data/app/service/bs5/popover_service.rb +31 -0
- data/app/service/bs5/tooltip_service.rb +31 -0
- data/app/views/bs5/examples/button_group/button_toolbar/_example.html.erb +3 -0
- data/app/views/bs5/examples/button_group/button_toolbar/snippet.html.erb +18 -0
- data/app/views/bs5/examples/button_group/button_toolbar/snippet2.html.erb +27 -0
- data/app/views/bs5/examples/button_group/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/button_group/default/snippet.html.erb +5 -0
- data/app/views/bs5/examples/button_group/sizing/_example.html.erb +2 -0
- data/app/views/bs5/examples/button_group/sizing/snippet.html.erb +17 -0
- data/app/views/bs5/examples/button_group/vertical/_example.html.erb +2 -0
- data/app/views/bs5/examples/button_group/vertical/snippet.html.erb +8 -0
- data/app/views/bs5/examples/collapse/default/_example.html.erb +4 -0
- data/app/views/bs5/examples/collapse/default/multiple_targets.html.erb +21 -0
- data/app/views/bs5/examples/collapse/default/snippet.html.erb +9 -0
- data/app/views/bs5/examples/popovers/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/popovers/default/snippet.html.erb +1 -0
- data/app/views/bs5/examples/popovers/disabled_elements/_example.html.erb +2 -0
- data/app/views/bs5/examples/popovers/disabled_elements/snippet.html.erb +3 -0
- data/app/views/bs5/examples/popovers/dismissable_on_next_click/_example.html.erb +2 -0
- data/app/views/bs5/examples/popovers/dismissable_on_next_click/snippet.html.erb +1 -0
- data/app/views/bs5/examples/popovers/four_directions/_example.html.erb +2 -0
- data/app/views/bs5/examples/popovers/four_directions/snippet.html.erb +7 -0
- data/app/views/bs5/pages/button_group.html.erb +5 -0
- data/app/views/bs5/pages/collapse.html.erb +2 -0
- data/app/views/bs5/pages/popovers.html.erb +5 -0
- data/app/views/layouts/bs5/application.html.erb +1 -0
- data/app/views/layouts/bs5/pages.html.erb +4 -0
- data/config/initializers/hash_refinement.rb +9 -0
- data/lib/bs5/version.rb +1 -1
- data/lib/generators/bs5/install/install_generator.rb +2 -1
- data/lib/generators/bs5/install/templates/bs5.js +11 -1
- metadata +33 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e7ed0ecd3b82a680eae723045c2c24020920a4942b4dfa5460951042be2a5c1
|
4
|
+
data.tar.gz: 4217f3cd7e572d702deb22988f772c0653da8709c39c8a2bff3796747990a4b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e520e4f93b185a7aa46cba4bf5c43b24655c03b8d75576eca3edf2b6740e0384caff3b413e9a3b18abadfda4edf1464be4ea4fb21eb66a67617b0f5268ed49c
|
7
|
+
data.tar.gz: 38fd799067d2148b0cd44f323dc41d0a4130771edc2e8de6fade8af6aaab4f2a19c22d5dba6abc77f84d1189a9e6f5529c471f903796f07dc47cc40dab769b2a
|
data/README.md
CHANGED
@@ -6,22 +6,15 @@
|
|
6
6
|
id="<%= item.header_id %>"
|
7
7
|
class="accordion-header"
|
8
8
|
>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
data-toggle="collapse"
|
13
|
-
data-target="#<%= item.collapse_id %>"
|
14
|
-
aria-expanded="true"
|
15
|
-
aria-controls="<%= item.collapse_id %>"
|
16
|
-
>
|
17
|
-
<%= item.title %>
|
18
|
-
</button>
|
9
|
+
<%= button_tag item.title,
|
10
|
+
bs5_collapse(target: "##{item.collapse_id}", expanded: !item.collapsed?)
|
11
|
+
.merge(type: :button, class: item.button_class) %>
|
19
12
|
</h2>
|
20
13
|
<div
|
21
14
|
id="<%= item.collapse_id %>"
|
22
15
|
class="<%= item.collapse_class %>"
|
23
16
|
aria-labelledby="<%= item.header_id %>"
|
24
|
-
data-parent="#<%= id %>"
|
17
|
+
data-bs-parent="#<%= id %>"
|
25
18
|
>
|
26
19
|
<div class="accordion-body">
|
27
20
|
<%= item.content %>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class ButtonGroupComponent < ViewComponent::Base
|
5
|
+
SIZES = { small: :sm, large: :lg }.with_indifferent_access.freeze
|
6
|
+
CLASS_PREFIX = 'btn-group'
|
7
|
+
|
8
|
+
attr_reader :vertical, :size
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
@options = options.symbolize_keys
|
12
|
+
@vertical = @options.delete(:vertical)
|
13
|
+
@size = @options.delete(:size)
|
14
|
+
end
|
15
|
+
|
16
|
+
def render?
|
17
|
+
content.present?
|
18
|
+
end
|
19
|
+
|
20
|
+
def component_attributes
|
21
|
+
default_options = { role: 'group' }
|
22
|
+
@options[:class] = component_class
|
23
|
+
@options.merge(default_options)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def component_class
|
29
|
+
class_names = Array(@options[:class])
|
30
|
+
class_names << vertical_class
|
31
|
+
class_names << size_class
|
32
|
+
class_names
|
33
|
+
end
|
34
|
+
|
35
|
+
def vertical_class
|
36
|
+
@vertical ? "#{CLASS_PREFIX}-vertical" : CLASS_PREFIX
|
37
|
+
end
|
38
|
+
|
39
|
+
def size_class
|
40
|
+
return unless size?
|
41
|
+
|
42
|
+
[CLASS_PREFIX, SIZES[size]].join('-')
|
43
|
+
end
|
44
|
+
|
45
|
+
def size?
|
46
|
+
!!size
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class ButtonToolbarComponent < ViewComponent::Base
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def render?
|
10
|
+
content.present?
|
11
|
+
end
|
12
|
+
|
13
|
+
def component_attributes
|
14
|
+
default_options = { role: 'toolbar' }
|
15
|
+
@options[:class] = Array(@options[:class])
|
16
|
+
@options[:class] << 'btn-toolbar'
|
17
|
+
|
18
|
+
@options.merge(default_options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
module Bs5
|
4
4
|
module ComponentsHelper
|
5
|
-
COMPONENTS = %w[accordion alert badge close_button breadcrumb button_tag button_to
|
5
|
+
COMPONENTS = %w[accordion alert badge close_button breadcrumb button_group button_tag button_to button_toolbar
|
6
|
+
list_group].freeze
|
6
7
|
|
7
8
|
COMPONENTS.each do |name|
|
8
9
|
define_method("bs5_#{name}") do |*args, &block|
|
@@ -11,13 +12,16 @@ module Bs5
|
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
|
-
def bs5_tooltip(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def bs5_tooltip(*args)
|
16
|
+
TooltipService.new(*args).to_hash
|
17
|
+
end
|
18
|
+
|
19
|
+
def bs5_popover(*args)
|
20
|
+
PopoverService.new(*args).to_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def bs5_collapse(*args)
|
24
|
+
CollapseService.new(*args).to_hash
|
21
25
|
end
|
22
26
|
|
23
27
|
private
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class CollapseService
|
5
|
+
using HashRefinement
|
6
|
+
|
7
|
+
CONTROLS_ERR_MSG = 'Please provide either a `controls` option' \
|
8
|
+
' containing the id of the collapsible element' \
|
9
|
+
' or an ID selector as `target` options.'
|
10
|
+
|
11
|
+
attr_reader :expanded, :target, :controls
|
12
|
+
|
13
|
+
def initialize(expanded: false, target: nil, controls: nil)
|
14
|
+
@expanded = expanded
|
15
|
+
@target = target
|
16
|
+
@controls = controls
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_hash
|
20
|
+
{
|
21
|
+
data: data_options,
|
22
|
+
aria: aria_options
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def data_options
|
29
|
+
options = { toggle: :collapse }
|
30
|
+
options[:target] = target if target
|
31
|
+
|
32
|
+
options.prefix_keys_with_bs
|
33
|
+
end
|
34
|
+
|
35
|
+
def aria_options
|
36
|
+
options = { expanded: expanded }
|
37
|
+
|
38
|
+
if controls
|
39
|
+
options[:controls] = controls
|
40
|
+
elsif target&.start_with?('#')
|
41
|
+
options[:controls] = target.delete_prefix('#')
|
42
|
+
else
|
43
|
+
raise CONTROLS_ERR_MSG
|
44
|
+
end
|
45
|
+
|
46
|
+
options
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class PopoverService
|
5
|
+
using HashRefinement
|
6
|
+
|
7
|
+
attr_reader :title
|
8
|
+
|
9
|
+
def initialize(options = {})
|
10
|
+
@title = options.delete(:title)
|
11
|
+
@options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
{
|
16
|
+
title: title,
|
17
|
+
data: options
|
18
|
+
}.compact
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def options
|
24
|
+
@options.symbolize_keys.merge(default_options).prefix_keys_with_bs
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_options
|
28
|
+
{ toggle: :popover }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class TooltipService
|
5
|
+
using HashRefinement
|
6
|
+
|
7
|
+
attr_reader :title
|
8
|
+
|
9
|
+
def initialize(title, options = {})
|
10
|
+
@title = title
|
11
|
+
@options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
{
|
16
|
+
title: title,
|
17
|
+
data: options
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def options
|
24
|
+
@options.symbolize_keys.merge(default_options).prefix_keys_with_bs
|
25
|
+
end
|
26
|
+
|
27
|
+
def default_options
|
28
|
+
{ toggle: :tooltip }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= bs5_button_toolbar(aria: { label: 'Toolbar with button groups' }) do %>
|
2
|
+
<%= bs5_button_group(class: 'me-2', aria: { label: 'First group' }) do %>
|
3
|
+
<%= bs5_button_tag('1', type: 'button') %>
|
4
|
+
<%= bs5_button_tag('2', type: 'button') %>
|
5
|
+
<%= bs5_button_tag('3', type: 'button') %>
|
6
|
+
<%= bs5_button_tag('4', type: 'button') %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= bs5_button_group(class: 'me-2', aria: { label: 'Second group' }) do %>
|
10
|
+
<%= bs5_button_tag('5', type: 'button', style: :secondary) %>
|
11
|
+
<%= bs5_button_tag('6', type: 'button', style: :secondary) %>
|
12
|
+
<%= bs5_button_tag('7', type: 'button', style: :secondary) %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= bs5_button_group(aria: { label: 'Third group' }) do %>
|
16
|
+
<%= bs5_button_tag('8', type: 'button', style: :info) %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= bs5_button_toolbar(class: 'mb-3', aria: { label: 'Toolbar with button groups' }) do %>
|
2
|
+
<%= bs5_button_group(class: 'me-2', aria: { label: 'First group' }) do %>
|
3
|
+
<%= bs5_button_tag('1', type: 'button', outline: true, style: :secondary) %>
|
4
|
+
<%= bs5_button_tag('2', type: 'button', outline: true, style: :secondary) %>
|
5
|
+
<%= bs5_button_tag('3', type: 'button', outline: true, style: :secondary) %>
|
6
|
+
<%= bs5_button_tag('4', type: 'button', outline: true, style: :secondary) %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<div class="input-group">
|
10
|
+
<div class="input-group-text" id="btnGroupAddon">@</div>
|
11
|
+
<input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon">
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= bs5_button_toolbar(class: 'justify-content-between', aria: { label: 'Toolbar with button groups' }) do %>
|
16
|
+
<%= bs5_button_group(aria: { label: 'First group' }) do %>
|
17
|
+
<%= bs5_button_tag('1', type: 'button', outline: true, style: :secondary) %>
|
18
|
+
<%= bs5_button_tag('2', type: 'button', outline: true, style: :secondary) %>
|
19
|
+
<%= bs5_button_tag('3', type: 'button', outline: true, style: :secondary) %>
|
20
|
+
<%= bs5_button_tag('4', type: 'button', outline: true, style: :secondary) %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<div class="input-group">
|
24
|
+
<div class="input-group-text" id="btnGroupAddon2">@</div>
|
25
|
+
<input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon2">
|
26
|
+
</div>
|
27
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= bs5_button_group(size: 'large', class: 'mb-2', aria: { label: 'Large button group' }) do %>
|
2
|
+
<%= bs5_button_tag('Left', type: 'button', style: :dark, outline: true) %>
|
3
|
+
<%= bs5_button_tag('Middle', type: 'button', style: :dark, outline: true) %>
|
4
|
+
<%= bs5_button_tag('Right', type: 'button', style: :dark, outline: true) %>
|
5
|
+
<% end %>
|
6
|
+
<br/>
|
7
|
+
<%= bs5_button_group(class: 'mb-2', aria: { label: 'Default button group' }) do %>
|
8
|
+
<%= bs5_button_tag('Left', type: 'button', style: :dark, outline: true) %>
|
9
|
+
<%= bs5_button_tag('Middle', type: 'button', style: :dark, outline: true) %>
|
10
|
+
<%= bs5_button_tag('Right', type: 'button', style: :dark, outline: true) %>
|
11
|
+
<% end %>
|
12
|
+
<br/>
|
13
|
+
<%= bs5_button_group(size: :small, aria: { label: 'Small button group' }) do %>
|
14
|
+
<%= bs5_button_tag('Left', type: 'button', style: :dark, outline: true) %>
|
15
|
+
<%= bs5_button_tag('Middle', type: 'button', style: :dark, outline: true) %>
|
16
|
+
<%= bs5_button_tag('Right', type: 'button', style: :dark, outline: true) %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= bs5_button_group(vertical: :true, aria: { label: 'Vertical button group' }) do %>
|
2
|
+
<%= bs5_button_tag('Button', type: 'button', style: :dark) %>
|
3
|
+
<%= bs5_button_tag('Button', type: 'button', style: :dark) %>
|
4
|
+
<%= bs5_button_tag('Button', type: 'button', style: :dark) %>
|
5
|
+
<%= bs5_button_tag('Button', type: 'button', style: :dark) %>
|
6
|
+
<%= bs5_button_tag('Button', type: 'button', style: :dark) %>
|
7
|
+
<%= bs5_button_tag('Button', type: 'button', style: :dark) %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<p>
|
2
|
+
<%= link_to 'Toggle first element', '#multiCollapseExample1', bs5_collapse(controls: 'multiCollapseExample1 multiCollapseExample2').merge(class: 'btn btn-primary', role: :button) %>
|
3
|
+
<%= bs5_button_tag 'Toggle second element', bs5_collapse(target: '#multiCollapseExample2', controls: 'multiCollapseExample1 multiCollapseExample2') %>
|
4
|
+
<%= bs5_button_tag 'Toggle both elements', bs5_collapse(target: '.multi-collapse', controls: 'multiCollapseExample1 multiCollapseExample2') %>
|
5
|
+
</p>
|
6
|
+
<div class="row">
|
7
|
+
<div class="col">
|
8
|
+
<div class="collapse multi-collapse" id="multiCollapseExample1">
|
9
|
+
<div class="card card-body">
|
10
|
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<div class="col">
|
15
|
+
<div class="collapse multi-collapse" id="multiCollapseExample2">
|
16
|
+
<div class="card card-body">
|
17
|
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<p>
|
2
|
+
<%= link_to 'Link with href', '#collapseExample', bs5_collapse(controls: 'collapseExample').merge(class: 'btn btn-primary', role: :button) %>
|
3
|
+
<%= bs5_button_tag 'Button with data-target', bs5_collapse(target: '#collapseExample').merge(type: :button) %>
|
4
|
+
</p>
|
5
|
+
<div class="collapse" id="collapseExample">
|
6
|
+
<div class="card card-body">
|
7
|
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
|
8
|
+
</div>
|
9
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= bs5_button_tag('Click to toggle popover', bs5_popover(title: 'Popover title', content: "And here's some amazing content. It's very engaging. Right?").merge(type: 'button', style: :danger, size: :large)) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= tag.a 'Dismissible popover', bs5_popover(title: 'Dismissible popover', content: "And here's some amazing content. It's very engaging. Right?", trigger: :focus).merge(class: 'btn btn-lg btn-danger', role: :button, tabindex: 0) %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<%= bs5_button_tag('Popover on top', bs5_popover(content: "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", container: :body, placement: :top).merge(type: 'button', style: :secondary)) %>
|
2
|
+
|
3
|
+
<%= bs5_button_tag('Popover on right', bs5_popover(content: "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", container: :body, placement: :right).merge(type: 'button', style: :secondary)) %>
|
4
|
+
|
5
|
+
<%= bs5_button_tag('Popover on bottom', bs5_popover(content: "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", container: :body, placement: :bottom).merge(type: 'button', style: :secondary)) %>
|
6
|
+
|
7
|
+
<%= bs5_button_tag('Popover on left', bs5_popover(content: "Vivamus sagittis lacus vel augue laoreet rutrum faucibus.", container: :body, placement: :left).merge(type: 'button', style: :secondary)) %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<h1>Popovers</h1>
|
2
|
+
<%= render 'bs5/examples/popovers/default/example' %>
|
3
|
+
<%= render 'bs5/examples/popovers/four_directions/example' %>
|
4
|
+
<%= render 'bs5/examples/popovers/dismissable_on_next_click/example' %>
|
5
|
+
<%= render 'bs5/examples/popovers/disabled_elements/example' %>
|
@@ -2,6 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Bs5</title>
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
6
|
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
6
7
|
<%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
|
7
8
|
<style><%= Rouge::Themes::Github.render(scope: '.highlight') %></style>
|
@@ -2,6 +2,7 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Bs5</title>
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
6
|
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
6
7
|
<%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
|
7
8
|
<style><%= Rouge::Themes::Github.render(scope: '.highlight') %></style>
|
@@ -17,8 +18,11 @@
|
|
17
18
|
<% lg.slot(:item, active: current_page?(pages_path('badge'))) do %><%= link_to 'Badge', pages_path('badge') %><% end %>
|
18
19
|
<% lg.slot(:item, active: current_page?(pages_path('breadcrumb'))) do %><%= link_to 'Breadcrumb', pages_path('breadcrumb') %><% end %>
|
19
20
|
<% lg.slot(:item, active: current_page?(pages_path('buttons'))) do %><%= link_to 'Buttons', pages_path('buttons') %><% end %>
|
21
|
+
<% lg.slot(:item, active: current_page?(pages_path('button_group'))) do %><%= link_to 'Button group', pages_path('button_group') %><% end %>
|
20
22
|
<% lg.slot(:item, active: current_page?(pages_path('close_button'))) do %><%= link_to 'Close button', pages_path('close_button') %><% end %>
|
23
|
+
<% lg.slot(:item, active: current_page?(pages_path('collapse'))) do %><%= link_to 'Collapse', pages_path('collapse') %><% end %>
|
21
24
|
<% lg.slot(:item, active: current_page?(pages_path('list_group'))) do %><%= link_to 'List group', pages_path('list_group') %><% end %>
|
25
|
+
<% lg.slot(:item, active: current_page?(pages_path('popovers'))) do %><%= link_to 'Popovers', pages_path('popovers') %><% end %>
|
22
26
|
<% lg.slot(:item, active: current_page?(pages_path('tooltips'))) do %><%= link_to 'Tooltips', pages_path('tooltips') %><% end %>
|
23
27
|
<%- end %>
|
24
28
|
</div>
|
data/lib/bs5/version.rb
CHANGED
@@ -5,7 +5,7 @@ module Bs5
|
|
5
5
|
source_root File.expand_path('templates', __dir__)
|
6
6
|
|
7
7
|
def add_bootstrap # rubocop:disable Metrics/MethodLength
|
8
|
-
run 'yarn add bootstrap@next
|
8
|
+
run 'yarn add bootstrap@next @popperjs/core'
|
9
9
|
|
10
10
|
create_file 'app/javascript/packs/styles.scss', <<~HEREDOC
|
11
11
|
@import "~bootstrap/scss/bootstrap";
|
@@ -24,6 +24,7 @@ module Bs5
|
|
24
24
|
inject_into_file 'app/views/layouts/application.html.erb', before: '</head>' do
|
25
25
|
<<~HEREDOC
|
26
26
|
<%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
|
27
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
27
28
|
HEREDOC
|
28
29
|
end
|
29
30
|
|
@@ -2,13 +2,23 @@ import * as bootstrap from "bootstrap";
|
|
2
2
|
|
3
3
|
function tooltipify() {
|
4
4
|
const tooltipTriggerList = [].slice.call(
|
5
|
-
document.querySelectorAll('[data-toggle="tooltip"]')
|
5
|
+
document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
6
6
|
);
|
7
7
|
tooltipTriggerList.map(function (tooltipTriggerEl) {
|
8
8
|
return new bootstrap.Tooltip(tooltipTriggerEl);
|
9
9
|
});
|
10
10
|
}
|
11
11
|
|
12
|
+
function popoverify() {
|
13
|
+
const popoverTriggerList = [].slice.call(
|
14
|
+
document.querySelectorAll('[data-bs-toggle="popover"]')
|
15
|
+
);
|
16
|
+
popoverTriggerList.map(function (popoverTriggerEl) {
|
17
|
+
return new bootstrap.Popover(popoverTriggerEl);
|
18
|
+
});
|
19
|
+
}
|
20
|
+
|
12
21
|
export function start() {
|
22
|
+
popoverify();
|
13
23
|
tooltipify();
|
14
24
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bs5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Baselier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -148,8 +148,12 @@ files:
|
|
148
148
|
- app/components/bs5/badge_component.rb
|
149
149
|
- app/components/bs5/breadcrumb_component.html.erb
|
150
150
|
- app/components/bs5/breadcrumb_component.rb
|
151
|
+
- app/components/bs5/button_group_component.html.erb
|
152
|
+
- app/components/bs5/button_group_component.rb
|
151
153
|
- app/components/bs5/button_tag_component.rb
|
152
154
|
- app/components/bs5/button_to_component.rb
|
155
|
+
- app/components/bs5/button_toolbar_component.html.erb
|
156
|
+
- app/components/bs5/button_toolbar_component.rb
|
153
157
|
- app/components/bs5/close_button_component.html.erb
|
154
158
|
- app/components/bs5/close_button_component.rb
|
155
159
|
- app/components/bs5/example_component.html.erb
|
@@ -162,6 +166,9 @@ files:
|
|
162
166
|
- app/helpers/bs5/components_helper.rb
|
163
167
|
- app/helpers/bs5/examples_helper.rb
|
164
168
|
- app/models/bs5/application_record.rb
|
169
|
+
- app/service/bs5/collapse_service.rb
|
170
|
+
- app/service/bs5/popover_service.rb
|
171
|
+
- app/service/bs5/tooltip_service.rb
|
165
172
|
- app/validators/style_validator.rb
|
166
173
|
- app/views/bs5/examples/accordion/default/_example.html.erb
|
167
174
|
- app/views/bs5/examples/accordion/default/snippet.html.erb
|
@@ -183,6 +190,15 @@ files:
|
|
183
190
|
- app/views/bs5/examples/badge/style/snippet.html.erb
|
184
191
|
- app/views/bs5/examples/breadcrumb/default/_example.html.erb
|
185
192
|
- app/views/bs5/examples/breadcrumb/default/snippet.html.erb
|
193
|
+
- app/views/bs5/examples/button_group/button_toolbar/_example.html.erb
|
194
|
+
- app/views/bs5/examples/button_group/button_toolbar/snippet.html.erb
|
195
|
+
- app/views/bs5/examples/button_group/button_toolbar/snippet2.html.erb
|
196
|
+
- app/views/bs5/examples/button_group/default/_example.html.erb
|
197
|
+
- app/views/bs5/examples/button_group/default/snippet.html.erb
|
198
|
+
- app/views/bs5/examples/button_group/sizing/_example.html.erb
|
199
|
+
- app/views/bs5/examples/button_group/sizing/snippet.html.erb
|
200
|
+
- app/views/bs5/examples/button_group/vertical/_example.html.erb
|
201
|
+
- app/views/bs5/examples/button_group/vertical/snippet.html.erb
|
186
202
|
- app/views/bs5/examples/buttons/button_tag/block_buttons/_example.html.erb
|
187
203
|
- app/views/bs5/examples/buttons/button_tag/block_buttons/block_buttons.html.erb
|
188
204
|
- app/views/bs5/examples/buttons/button_tag/block_buttons/responsive_block_buttons_1.html.erb
|
@@ -207,6 +223,9 @@ files:
|
|
207
223
|
- app/views/bs5/examples/close_button/disabled/snippet.html.erb
|
208
224
|
- app/views/bs5/examples/close_button/white/_example.html.erb
|
209
225
|
- app/views/bs5/examples/close_button/white/snippet.html.erb
|
226
|
+
- app/views/bs5/examples/collapse/default/_example.html.erb
|
227
|
+
- app/views/bs5/examples/collapse/default/multiple_targets.html.erb
|
228
|
+
- app/views/bs5/examples/collapse/default/snippet.html.erb
|
210
229
|
- app/views/bs5/examples/list_group/actionable/_example.html.erb
|
211
230
|
- app/views/bs5/examples/list_group/actionable/button.html.erb
|
212
231
|
- app/views/bs5/examples/list_group/actionable/snippet.html.erb
|
@@ -230,6 +249,14 @@ files:
|
|
230
249
|
- app/views/bs5/examples/list_group/style/default.html.erb
|
231
250
|
- app/views/bs5/examples/list_group/with_badges/_example.html.erb
|
232
251
|
- app/views/bs5/examples/list_group/with_badges/default.html.erb
|
252
|
+
- app/views/bs5/examples/popovers/default/_example.html.erb
|
253
|
+
- app/views/bs5/examples/popovers/default/snippet.html.erb
|
254
|
+
- app/views/bs5/examples/popovers/disabled_elements/_example.html.erb
|
255
|
+
- app/views/bs5/examples/popovers/disabled_elements/snippet.html.erb
|
256
|
+
- app/views/bs5/examples/popovers/dismissable_on_next_click/_example.html.erb
|
257
|
+
- app/views/bs5/examples/popovers/dismissable_on_next_click/snippet.html.erb
|
258
|
+
- app/views/bs5/examples/popovers/four_directions/_example.html.erb
|
259
|
+
- app/views/bs5/examples/popovers/four_directions/snippet.html.erb
|
233
260
|
- app/views/bs5/examples/tooltips/default/_example.html.erb
|
234
261
|
- app/views/bs5/examples/tooltips/default/buttons.html.erb
|
235
262
|
- app/views/bs5/examples/tooltips/default/disabled_elements.html.erb
|
@@ -238,13 +265,17 @@ files:
|
|
238
265
|
- app/views/bs5/pages/alert.html.erb
|
239
266
|
- app/views/bs5/pages/badge.html.erb
|
240
267
|
- app/views/bs5/pages/breadcrumb.html.erb
|
268
|
+
- app/views/bs5/pages/button_group.html.erb
|
241
269
|
- app/views/bs5/pages/buttons.html.erb
|
242
270
|
- app/views/bs5/pages/close_button.html.erb
|
271
|
+
- app/views/bs5/pages/collapse.html.erb
|
243
272
|
- app/views/bs5/pages/list_group.html.erb
|
273
|
+
- app/views/bs5/pages/popovers.html.erb
|
244
274
|
- app/views/bs5/pages/tooltips.html.erb
|
245
275
|
- app/views/layouts/bs5/application.html.erb
|
246
276
|
- app/views/layouts/bs5/pages.html.erb
|
247
277
|
- config/definitions.rb
|
278
|
+
- config/initializers/hash_refinement.rb
|
248
279
|
- config/locales/en.yml
|
249
280
|
- config/routes.rb
|
250
281
|
- lib/bs5.rb
|