bs5 0.0.22 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/bs5_manifest.js +1 -0
  3. data/app/assets/javascripts/bs5/application.js +13 -0
  4. data/app/components/bs5/alert_component.html.erb +1 -1
  5. data/app/components/bs5/alert_component.rb +1 -0
  6. data/app/components/bs5/button_tag_component.rb +10 -1
  7. data/app/components/bs5/close_button_component.rb +14 -6
  8. data/app/components/bs5/dropdown/item_component.html.erb +1 -0
  9. data/app/components/bs5/dropdown/item_component.rb +39 -0
  10. data/app/components/bs5/dropdown_component.html.erb +22 -0
  11. data/app/components/bs5/dropdown_component.rb +154 -0
  12. data/app/components/bs5/example_component.html.erb +2 -1
  13. data/app/components/bs5/modal/body_component.html.erb +3 -0
  14. data/app/components/bs5/modal/body_component.rb +8 -0
  15. data/app/components/bs5/modal/controller_component.html.erb +1 -0
  16. data/app/components/bs5/modal/controller_component.rb +40 -0
  17. data/app/components/bs5/modal/footer_component.html.erb +4 -0
  18. data/app/components/bs5/modal/footer_component.rb +8 -0
  19. data/app/components/bs5/modal/header_component.html.erb +4 -0
  20. data/app/components/bs5/modal/header_component.rb +18 -0
  21. data/app/components/bs5/modal_component.html.erb +11 -0
  22. data/app/components/bs5/modal_component.rb +80 -0
  23. data/app/components/bs5/toast/body_component.html.erb +3 -0
  24. data/app/components/bs5/toast/body_component.rb +8 -0
  25. data/app/components/bs5/toast/header_component.html.erb +4 -0
  26. data/app/components/bs5/toast/header_component.rb +9 -0
  27. data/app/components/bs5/toast_component.html.erb +8 -0
  28. data/app/components/bs5/toast_component.rb +72 -0
  29. data/app/components/bs5/toast_container_component.html.erb +3 -0
  30. data/app/components/bs5/toast_container_component.rb +19 -0
  31. data/app/helpers/bs5/components_helper.rb +2 -2
  32. data/app/views/bs5/examples/alert/color/snippet.html.erb +8 -24
  33. data/app/views/bs5/examples/alert/default/snippet.html.erb +1 -3
  34. data/app/views/bs5/examples/dropdowns/dark/_example.html.erb +2 -0
  35. data/app/views/bs5/examples/dropdowns/dark/snippet.html.erb +7 -0
  36. data/app/views/bs5/examples/dropdowns/directions/_example.html.erb +7 -0
  37. data/app/views/bs5/examples/dropdowns/directions/snippet1.html.erb +17 -0
  38. data/app/views/bs5/examples/dropdowns/directions/snippet2.html.erb +17 -0
  39. data/app/views/bs5/examples/dropdowns/directions/snippet3.html.erb +17 -0
  40. data/app/views/bs5/examples/dropdowns/menu_alignment/_example.html.erb +5 -0
  41. data/app/views/bs5/examples/dropdowns/menu_alignment/snippet1.html.erb +5 -0
  42. data/app/views/bs5/examples/dropdowns/menu_alignment/snippet2.html.erb +7 -0
  43. data/app/views/bs5/examples/dropdowns/menu_alignment/snippet3.html.erb +7 -0
  44. data/app/views/bs5/examples/dropdowns/menu_content/_example.html.erb +9 -0
  45. data/app/views/bs5/examples/dropdowns/menu_content/snippet1.html.erb +5 -0
  46. data/app/views/bs5/examples/dropdowns/menu_content/snippet2.html.erb +7 -0
  47. data/app/views/bs5/examples/dropdowns/menu_content/snippet3.html.erb +10 -0
  48. data/app/views/bs5/examples/dropdowns/menu_content/snippet4.html.erb +24 -0
  49. data/app/views/bs5/examples/dropdowns/menu_items/_example.html.erb +7 -0
  50. data/app/views/bs5/examples/dropdowns/menu_items/snippet1.html.erb +5 -0
  51. data/app/views/bs5/examples/dropdowns/menu_items/snippet2.html.erb +6 -0
  52. data/app/views/bs5/examples/dropdowns/menu_items/snippet3.html.erb +5 -0
  53. data/app/views/bs5/examples/dropdowns/menu_items/snippet4.html.erb +5 -0
  54. data/app/views/bs5/examples/dropdowns/single/_example.html.erb +4 -0
  55. data/app/views/bs5/examples/dropdowns/single/snippet1.html.erb +5 -0
  56. data/app/views/bs5/examples/dropdowns/single/snippet2.html.erb +47 -0
  57. data/app/views/bs5/examples/dropdowns/single/snippet3.html.erb +47 -0
  58. data/app/views/bs5/examples/dropdowns/sizing/_example.html.erb +3 -0
  59. data/app/views/bs5/examples/dropdowns/sizing/snippet1.html.erb +17 -0
  60. data/app/views/bs5/examples/dropdowns/sizing/snippet2.html.erb +17 -0
  61. data/app/views/bs5/examples/dropdowns/split/_example.html.erb +3 -0
  62. data/app/views/bs5/examples/dropdowns/split/snippet1.html.erb +35 -0
  63. data/app/views/bs5/examples/dropdowns/split/snippet2.html.erb +47 -0
  64. data/app/views/bs5/examples/list_group/active/snippet.html.erb +5 -5
  65. data/app/views/bs5/examples/list_group/default/snippet.html.erb +5 -5
  66. data/app/views/bs5/examples/list_group/disabled/snippet.html.erb +5 -5
  67. data/app/views/bs5/examples/list_group/flush/snippet.html.erb +5 -5
  68. data/app/views/bs5/examples/list_group/horizontal/snippet.html.erb +18 -18
  69. data/app/views/bs5/examples/list_group/style/default.html.erb +8 -8
  70. data/app/views/bs5/examples/modal/_examples.html.erb +9 -0
  71. data/app/views/bs5/examples/modal/_fullscreen.html.erb +2 -0
  72. data/app/views/bs5/examples/modal/_optional_sizes.html.erb +2 -0
  73. data/app/views/bs5/examples/modal/examples/snippet1.html.erb +12 -0
  74. data/app/views/bs5/examples/modal/examples/snippet2.html.erb +12 -0
  75. data/app/views/bs5/examples/modal/examples/snippet3.html.erb +14 -0
  76. data/app/views/bs5/examples/modal/examples/snippet4.html.erb +12 -0
  77. data/app/views/bs5/examples/modal/fullscreen/snippet1.html.erb +55 -0
  78. data/app/views/bs5/examples/modal/optional_sizes/snippet1.html.erb +23 -0
  79. data/app/views/bs5/examples/toasts/color_schemes/_example.html.erb +2 -0
  80. data/app/views/bs5/examples/toasts/color_schemes/snippet.html.erb +33 -0
  81. data/app/views/bs5/examples/toasts/custom_content/_example.html.erb +3 -0
  82. data/app/views/bs5/examples/toasts/custom_content/snippet1.html.erb +3 -0
  83. data/app/views/bs5/examples/toasts/custom_content/snippet2.html.erb +9 -0
  84. data/app/views/bs5/examples/toasts/default/_example.html.erb +2 -0
  85. data/app/views/bs5/examples/toasts/default/snippet.html.erb +17 -0
  86. data/app/views/bs5/examples/toasts/js_options/_example.html.erb +2 -0
  87. data/app/views/bs5/examples/toasts/js_options/snippet.html.erb +23 -0
  88. data/app/views/bs5/examples/toasts/placement/_example.html.erb +3 -0
  89. data/app/views/bs5/examples/toasts/placement/snippet1.html.erb +44 -0
  90. data/app/views/bs5/examples/toasts/placement/snippet2.html.erb +24 -0
  91. data/app/views/bs5/examples/toasts/stacking/_example.html.erb +2 -0
  92. data/app/views/bs5/examples/toasts/stacking/snippet.html.erb +37 -0
  93. data/app/views/bs5/pages/dropdowns.html.erb +10 -0
  94. data/app/views/bs5/pages/modal.html.erb +4 -0
  95. data/app/views/bs5/pages/toasts.html.erb +7 -0
  96. data/app/views/layouts/bs5/pages.html.erb +4 -0
  97. data/lib/bs5/engine.rb +6 -0
  98. data/lib/bs5/version.rb +1 -1
  99. data/lib/generators/bs5/install/templates/bs5.js +24 -13
  100. metadata +81 -16
@@ -0,0 +1,14 @@
1
+ <%= bs5_modal(scroll: true) do |m| %>
2
+ <%= m.controller do %>
3
+ <%= bs5_button_tag('Launch demo modal', type: 'button') %>
4
+ <% end %>
5
+ <%= m.header { 'Modal title' } %>
6
+ <%= m.body do %>
7
+ <% 15.times do %>
8
+ <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
9
+ <% end %>
10
+ <% end %>
11
+ <%= m.footer do %>
12
+ <%= bs5_button_tag('Save changes', type: 'button') %>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= bs5_modal(center: true) do |m| %>
2
+ <%= m.controller do %>
3
+ <%= bs5_button_tag('Launch demo modal', type: 'button') %>
4
+ <% end %>
5
+ <%= m.header { 'Modal title' } %>
6
+ <%= m.body do %>
7
+ <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
8
+ <% end %>
9
+ <%= m.footer do %>
10
+ <%= bs5_button_tag('Save changes', type: 'button') %>
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,55 @@
1
+ <%= bs5_modal(fullscreen: true) do |m| %>
2
+ <%= m.controller do %>
3
+ <%= bs5_button_tag('Full screen', type: 'button') %>
4
+ <% end %>
5
+ <%= m.header { 'Full screen modal' } %>
6
+ <%= m.body do %>
7
+ <p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
8
+ <% end %>
9
+ <%= m.footer {} %>
10
+ <% end %>
11
+
12
+ <%= bs5_modal(fullscreen: :sm) do |m| %>
13
+ <%= m.controller do %>
14
+ <%= bs5_button_tag('Full screen below sm', type: 'button') %>
15
+ <% end %>
16
+ <%= m.header { 'Full screen below sm' } %>
17
+ <%= m.body { '...'} %>
18
+ <%= m.footer {} %>
19
+ <% end %>
20
+
21
+ <%= bs5_modal(fullscreen: :md) do |m| %>
22
+ <%= m.controller do %>
23
+ <%= bs5_button_tag('Full screen below md', type: 'button') %>
24
+ <% end %>
25
+ <%= m.header { 'Full screen below md' } %>
26
+ <%= m.body { '...'} %>
27
+ <%= m.footer {} %>
28
+ <% end %>
29
+
30
+ <%= bs5_modal(fullscreen: :lg) do |m| %>
31
+ <%= m.controller do %>
32
+ <%= bs5_button_tag('Full screen below lg', type: 'button') %>
33
+ <% end %>
34
+ <%= m.header { 'Full screen below lg' } %>
35
+ <%= m.body { '...'} %>
36
+ <%= m.footer {} %>
37
+ <% end %>
38
+
39
+ <%= bs5_modal(fullscreen: :xl) do |m| %>
40
+ <%= m.controller do %>
41
+ <%= bs5_button_tag('Full screen below xl', type: 'button') %>
42
+ <% end %>
43
+ <%= m.header { 'Full screen below xl' } %>
44
+ <%= m.body { '...'} %>
45
+ <%= m.footer {} %>
46
+ <% end %>
47
+
48
+ <%= bs5_modal(fullscreen: :xxl) do |m| %>
49
+ <%= m.controller do %>
50
+ <%= bs5_button_tag('Full screen below xxl', type: 'button') %>
51
+ <% end %>
52
+ <%= m.header { 'Full screen below xxl' } %>
53
+ <%= m.body { '...'} %>
54
+ <%= m.footer {} %>
55
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%= bs5_modal(size: :xl) do |m| %>
2
+ <%= m.controller do %>
3
+ <%= bs5_button_tag('Extra large modal', type: 'button') %>
4
+ <% end %>
5
+ <%= m.header { 'Extra large modal' } %>
6
+ <%= m.body { '...' } %>
7
+ <% end %>
8
+
9
+ <%= bs5_modal(size: :lg) do |m| %>
10
+ <%= m.controller do %>
11
+ <%= bs5_button_tag('Large modal', type: 'button') %>
12
+ <% end %>
13
+ <%= m.header { 'Large modal' } %>
14
+ <%= m.body { '...' } %>
15
+ <% end %>
16
+
17
+ <%= bs5_modal(size: :sm) do |m| %>
18
+ <%= m.controller do %>
19
+ <%= bs5_button_tag('Small modal', type: 'button') %>
20
+ <% end %>
21
+ <%= m.header { 'Small modal' } %>
22
+ <%= m.body { '...' } %>
23
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h2>Color schemes</h2>
2
+ <%= bs5_example(snippet: 'toasts/color_schemes/snippet') %>
@@ -0,0 +1,33 @@
1
+ <%= bs5_toast_container do %>
2
+ <%= bs5_toast(color: :primary, class: 'd-flex align-items-center') do |t| %>
3
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
4
+ <% end %>
5
+
6
+ <%= bs5_toast(color: :secondary, class: 'd-flex align-items-center') do |t| %>
7
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
8
+ <% end %>
9
+
10
+ <%= bs5_toast(color: :success, class: 'd-flex align-items-center') do |t| %>
11
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
12
+ <% end %>
13
+
14
+ <%= bs5_toast(color: :danger, class: 'd-flex align-items-center') do |t| %>
15
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
16
+ <% end %>
17
+
18
+ <%= bs5_toast(color: :warning, class: 'd-flex align-items-center') do |t| %>
19
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
20
+ <% end %>
21
+
22
+ <%= bs5_toast(color: :info, class: 'd-flex align-items-center') do |t| %>
23
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
24
+ <% end %>
25
+
26
+ <%= bs5_toast(color: :light, class: 'd-flex align-items-center') do |t| %>
27
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
28
+ <% end %>
29
+
30
+ <%= bs5_toast(color: :dark, class: 'd-flex align-items-center') do |t| %>
31
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
32
+ <% end %>
33
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h2>Custom content</h2>
2
+ <%= bs5_example(snippet: 'toasts/custom_content/snippet1') %>
3
+ <%= bs5_example(snippet: 'toasts/custom_content/snippet2') %>
@@ -0,0 +1,3 @@
1
+ <%= bs5_toast(class: 'd-flex align-items-center') do |t| %>
2
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
3
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= bs5_toast(close_button: false) do |t| %>
2
+ <%= t.body do %>
3
+ Hello, world! This is a toast message.
4
+ <div class="mt-2 pt-2 border-top">
5
+ <%= bs5_button_tag('Take action', color: :primary, size: :small) %>
6
+ <%= bs5_button_tag('Close', color: :secondary, size: :small, dismiss: :toast) %>
7
+ </div>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h2>Default</h2>
2
+ <%= bs5_example(snippet: 'toasts/default/snippet') %>
@@ -0,0 +1,17 @@
1
+ <%= bs5_toast do |t| %>
2
+ <%= t.header do %>
3
+ <svg
4
+ class="bd-placeholder-img rounded me-2"
5
+ width="20"
6
+ height="20"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ aria-hidden="true"
9
+ focusable="false"
10
+ >
11
+ <rect width="100%" height="100%" fill="#007aff"></rect>
12
+ </svg>
13
+ <strong class="me-auto">Bootstrap</strong>
14
+ <small>11 mins ago</small>
15
+ <% end %>
16
+ <%= t.body { "Hello, world! This is a toast message." } %>
17
+ <% end %>
@@ -0,0 +1,2 @@
1
+ <h2>Options</h2>
2
+ <%= bs5_example(snippet: 'toasts/js_options/snippet') %>
@@ -0,0 +1,23 @@
1
+ <%= bs5_toast_container do %>
2
+ <%= bs5_toast(autohide: true, delay: 10_000, animation: false) do |t| %>
3
+ <%= t.header do %>
4
+ <svg
5
+ class="bd-placeholder-img rounded me-2"
6
+ width="20"
7
+ height="20"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ aria-hidden="true"
10
+ focusable="false"
11
+ >
12
+ <rect width="100%" height="100%" fill="#007aff"></rect>
13
+ </svg>
14
+ <strong class="me-auto">Bootstrap</strong>
15
+ <small>11 mins ago</small>
16
+ <% end %>
17
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
18
+ <% end %>
19
+
20
+ <%= bs5_toast(close_button: false, autohide: true, delay: 11_000) do |t| %>
21
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
22
+ <% end %>
23
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h2>Placement</h2>
2
+ <%= bs5_example(snippet: 'toasts/placement/snippet1') %>
3
+ <%= bs5_example(snippet: 'toasts/placement/snippet2') %>
@@ -0,0 +1,44 @@
1
+ <div
2
+ aria-live="polite"
3
+ aria-atomic="true"
4
+ class="position-relative"
5
+ style="min-height: 240px"
6
+ >
7
+ <%= bs5_toast_container(class: 'position-absolute top-0 end-0') do %>
8
+ <%= bs5_toast do |t| %>
9
+ <%= t.header do %>
10
+ <svg
11
+ class="bd-placeholder-img rounded me-2"
12
+ width="20"
13
+ height="20"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ aria-hidden="true"
16
+ focusable="false"
17
+ >
18
+ <rect width="100%" height="100%" fill="#007aff"></rect>
19
+ </svg>
20
+ <strong class="me-auto">Bootstrap</strong>
21
+ <small>just now</small>
22
+ <% end %>
23
+ <%= t.body do %>See? Just like this.<% end %>
24
+ <% end %>
25
+
26
+ <%= bs5_toast do |t| %>
27
+ <%= t.header do %>
28
+ <svg
29
+ class="bd-placeholder-img rounded me-2"
30
+ width="20"
31
+ height="20"
32
+ xmlns="http://www.w3.org/2000/svg"
33
+ aria-hidden="true"
34
+ focusable="false"
35
+ >
36
+ <rect width="100%" height="100%" fill="#007aff"></rect>
37
+ </svg>
38
+ <strong class="me-auto">Bootstrap</strong>
39
+ <small>2 seconds ago</small>
40
+ <% end %>
41
+ <%= t.body do %>Heads up, toasts will stack automatically<% end %>
42
+ <% end %>
43
+ <% end %>
44
+ </div>
@@ -0,0 +1,24 @@
1
+ <div
2
+ aria-live="polite"
3
+ aria-atomic="true"
4
+ class="d-flex justify-content-center align-items-center w-100"
5
+ style="min-height: 240px"
6
+ >
7
+ <%= bs5_toast do |t| %>
8
+ <%= t.header do %>
9
+ <svg
10
+ class="bd-placeholder-img rounded me-2"
11
+ width="20"
12
+ height="20"
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ aria-hidden="true"
15
+ focusable="false"
16
+ >
17
+ <rect width="100%" height="100%" fill="#007aff"></rect>
18
+ </svg>
19
+ <strong class="me-auto">Bootstrap</strong>
20
+ <small>11 mins ago</small>
21
+ <% end %>
22
+ <%= t.body do %>Hello, world! This is a toast message.<% end %>
23
+ <% end %>
24
+ </div>
@@ -0,0 +1,2 @@
1
+ <h2>Stacking</h2>
2
+ <%= bs5_example(snippet: 'toasts/stacking/snippet') %>
@@ -0,0 +1,37 @@
1
+ <%= bs5_toast_container do %>
2
+ <%= bs5_toast do |t| %>
3
+ <%= t.header do %>
4
+ <svg
5
+ class="bd-placeholder-img rounded me-2"
6
+ width="20"
7
+ height="20"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ aria-hidden="true"
10
+ focusable="false"
11
+ >
12
+ <rect width="100%" height="100%" fill="#007aff"></rect>
13
+ </svg>
14
+ <strong class="me-auto">Bootstrap</strong>
15
+ <small>just now</small>
16
+ <% end %>
17
+ <%= t.body do %>See? Just like this.<% end %>
18
+ <% end %>
19
+
20
+ <%= bs5_toast do |t| %>
21
+ <%= t.header do %>
22
+ <svg
23
+ class="bd-placeholder-img rounded me-2"
24
+ width="20"
25
+ height="20"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ aria-hidden="true"
28
+ focusable="false"
29
+ >
30
+ <rect width="100%" height="100%" fill="#007aff"></rect>
31
+ </svg>
32
+ <strong class="me-auto">Bootstrap</strong>
33
+ <small>2 seconds ago</small>
34
+ <% end %>
35
+ <%= t.body do %>Heads up, toasts will stack automatically<% end %>
36
+ <% end %>
37
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <h1>Dropdowns</h1>
2
+ <h2>Examples</h2>
3
+ <%= render 'bs5/examples/dropdowns/single/example' %>
4
+ <%= render 'bs5/examples/dropdowns/split/example' %>
5
+ <%= render 'bs5/examples/dropdowns/sizing/example' %>
6
+ <%= render 'bs5/examples/dropdowns/dark/example' %>
7
+ <%= render 'bs5/examples/dropdowns/directions/example' %>
8
+ <%= render 'bs5/examples/dropdowns/menu_items/example' %>
9
+ <%= render 'bs5/examples/dropdowns/menu_alignment/example' %>
10
+ <%= render 'bs5/examples/dropdowns/menu_content/example' %>
@@ -0,0 +1,4 @@
1
+ <h1>Modal</h1>
2
+ <%= render 'bs5/examples/modal/examples' %>
3
+ <%= render 'bs5/examples/modal/optional_sizes' %>
4
+ <%= render 'bs5/examples/modal/fullscreen' %>
@@ -0,0 +1,7 @@
1
+ <h1>Toasts</h1>
2
+ <%= render 'bs5/examples/toasts/default/example' %>
3
+ <%= render 'bs5/examples/toasts/stacking/example' %>
4
+ <%= render 'bs5/examples/toasts/custom_content/example' %>
5
+ <%= render 'bs5/examples/toasts/color_schemes/example' %>
6
+ <%= render 'bs5/examples/toasts/placement/example' %>
7
+ <%= render 'bs5/examples/toasts/js_options/example' %>
@@ -4,6 +4,7 @@
4
4
  <title>Bs5</title>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
7
+ <%= javascript_include_tag 'bs5/application', 'data-turbolinks-track': 'reload' %>
7
8
  <%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
8
9
  <style><%= Rouge::Themes::Github.render(scope: '.highlight') %></style>
9
10
  </head>
@@ -21,9 +22,12 @@
21
22
  <% lg.item(active: current_page?(pages_path('button_group'))) do %><%= link_to 'Button group', pages_path('button_group') %><% end %>
22
23
  <% lg.item(active: current_page?(pages_path('close_button'))) do %><%= link_to 'Close button', pages_path('close_button') %><% end %>
23
24
  <% lg.item(active: current_page?(pages_path('collapse'))) do %><%= link_to 'Collapse', pages_path('collapse') %><% end %>
25
+ <% lg.item(active: current_page?(pages_path('dropdowns'))) do %><%= link_to 'Dropdowns', pages_path('dropdowns') %><% end %>
24
26
  <% lg.item(active: current_page?(pages_path('list_group'))) do %><%= link_to 'List group', pages_path('list_group') %><% end %>
27
+ <% lg.item(active: current_page?(pages_path('modal'))) do %><%= link_to 'Modal', pages_path('modal') %><% end %>
25
28
  <% lg.item(active: current_page?(pages_path('popovers'))) do %><%= link_to 'Popovers', pages_path('popovers') %><% end %>
26
29
  <% lg.item(active: current_page?(pages_path('spinners'))) do %><%= link_to 'Spinners', pages_path('spinners') %><% end %>
30
+ <% lg.item(active: current_page?(pages_path('toasts'))) do %><%= link_to 'Toasts', pages_path('toasts') %><% end %>
27
31
  <% lg.item(active: current_page?(pages_path('tooltips'))) do %><%= link_to 'Tooltips', pages_path('tooltips') %><% end %>
28
32
  <%- end %>
29
33
  </div>
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'view_component/engine'
4
+ require 'sprockets/railtie'
4
5
  module Bs5
5
6
  class Engine < ::Rails::Engine
6
7
  isolate_namespace Bs5
@@ -9,5 +10,10 @@ module Bs5
9
10
  config.before_configuration do |app|
10
11
  app.config.view_component.preview_paths << "#{Bs5::Engine.root}/spec/components/previews"
11
12
  end
13
+
14
+ initializer 'bs5.assets.precompile' do |app|
15
+ app.config.assets.paths << Rails.root.join('app/assets/javascripts')
16
+ app.config.assets.precompile << 'bs5/application.js'
17
+ end
12
18
  end
13
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bs5
4
- VERSION = '0.0.22'
4
+ VERSION = '0.0.27'
5
5
  end
@@ -1,24 +1,35 @@
1
1
  import * as bootstrap from "bootstrap";
2
2
 
3
- function tooltipify() {
4
- const tooltipTriggerList = [].slice.call(
5
- document.querySelectorAll('[data-bs-toggle="tooltip"]')
6
- );
7
- tooltipTriggerList.map(function (tooltipTriggerEl) {
8
- return new bootstrap.Tooltip(tooltipTriggerEl);
9
- });
3
+ function popoverify() {
4
+ document
5
+ .querySelectorAll('[data-bs-toggle="popover"]')
6
+ .forEach(function (popoverTriggerEl) {
7
+ new bootstrap.Popover(popoverTriggerEl);
8
+ });
10
9
  }
11
10
 
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);
11
+ function toastify() {
12
+ document.querySelectorAll(".toast").forEach(function (toastNode) {
13
+ let autohide = new RegExp("true", "i").test(
14
+ toastNode.dataset["bsAutohide"] || "false"
15
+ );
16
+ let toast = new bootstrap.Toast(toastNode, {
17
+ autohide,
18
+ });
19
+ toast.show();
18
20
  });
19
21
  }
20
22
 
23
+ function tooltipify() {
24
+ document
25
+ .querySelectorAll('[data-bs-toggle="tooltip"]')
26
+ .forEach(function (tooltipTriggerEl) {
27
+ new bootstrap.Tooltip(tooltipTriggerEl);
28
+ });
29
+ }
30
+
21
31
  export function start() {
22
32
  popoverify();
33
+ toastify();
23
34
  tooltipify();
24
35
  }