bs5 0.0.28 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215200d1f6820e7e163cbd6b214f9952645e225f535c45a34254ef53f445480a
4
- data.tar.gz: cc2f9daf0107719ee613670620ddb42e42a08b995bb32a7348003f9b74761584
3
+ metadata.gz: 572bc52747b6782ec18bc492cd9dbbfafe73161d682c7371af575475bee11bec
4
+ data.tar.gz: 743fdecb48cd81b5f6146b00ed3cd9f964b28eb40190127e263072201dd3e3e9
5
5
  SHA512:
6
- metadata.gz: 8361ad156b1c5aa5a2e8d2e85482a891792fe28693aff0ab0de36a7acc258d1818934512a7b9c76d4be17de2e96f0c6207affa1f5765add53cff6bc83e999b74
7
- data.tar.gz: 978c438199e216476b87a1eef92dcab0b9b8d828daca289c4eb7cc8b97fa802f75ef4620c06541870caeca578845303eb874fde87988036bea462918e5d0fc97
6
+ metadata.gz: 14c0c986d58aba68cee014a6a2baa5924031da3233454b0516561a9d5987c624f45f614296ca3d8abeed54e136d08bfb8be9144c4c2243b7b50b0fb72ca54f89
7
+ data.tar.gz: 21e2d70ee2395bf91679771fd812f68953093fc04b78f8f9744a0835a99a203332922a711fd2d29d61336cdc9c72cbc1cdae4f42f6207e66e2c7e315d1b88467
@@ -0,0 +1 @@
1
+ <div class="<%= bar_class %>" role="progressbar" style="width: <%= value %>%" aria-valuenow="<%= value %>" aria-valuemin="0" aria-valuemax="100"><%= label %></div>
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bs5
4
+ module Progress
5
+ class BarComponent < ViewComponent::Base
6
+ attr_reader :value, :color
7
+
8
+ def initialize(value, label: nil, color: nil, striped: false, animated: false)
9
+ @value = value
10
+ @label = label
11
+ @color = color
12
+ @striped = striped
13
+ @animated = animated
14
+ end
15
+
16
+ def label
17
+ return unless @label
18
+
19
+ case @label
20
+ when String
21
+ @label
22
+ else
23
+ "#{value}%"
24
+ end
25
+ end
26
+
27
+ def bar_class
28
+ class_names = %w[progress-bar]
29
+ class_names << contextual_class
30
+ class_names << striped_class
31
+ class_names << animated_class
32
+ class_names.flatten.uniq.join(' ')
33
+ end
34
+
35
+ def contextual_class
36
+ return unless color?
37
+
38
+ "bg-#{color}"
39
+ end
40
+
41
+ def striped_class
42
+ return unless striped?
43
+
44
+ 'progress-bar-striped'
45
+ end
46
+
47
+ def animated_class
48
+ return unless animated?
49
+
50
+ %w[progress-bar-striped progress-bar-animated]
51
+ end
52
+
53
+ %i[color striped animated].each do |name|
54
+ define_method("#{name}?") do
55
+ !!instance_variable_get("@#{name}")
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,9 @@
1
+ <div class="progress">
2
+ <% if bars.any? %>
3
+ <% bars.each do |bar| %>
4
+ <%= bar %>
5
+ <% end %>
6
+ <% else %>
7
+ <%= render Bs5::Progress::BarComponent.new(value, options) %>
8
+ <% end %>
9
+ </div>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bs5
4
+ class ProgressComponent < ViewComponent::Base
5
+ include ViewComponent::SlotableV2
6
+ renders_many :bars, Bs5::Progress::BarComponent
7
+
8
+ attr_reader :value, :options
9
+
10
+ def initialize(value = nil, options = {})
11
+ @options = options.symbolize_keys
12
+ @value = value
13
+ end
14
+ end
15
+ end
@@ -4,7 +4,9 @@ module Bs5
4
4
  module ComponentsHelper
5
5
  COMPONENTS = %w[accordion alert badge breadcrumb button_group button_tag button_to button_toolbar
6
6
  carousel close_button
7
- dropdown list_group modal spinner toast toast_container].freeze
7
+ dropdown list_group modal spinner
8
+ progress
9
+ toast toast_container].freeze
8
10
 
9
11
  COMPONENTS.each do |name|
10
12
  define_method("bs5_#{name}") do |*args, &block|
@@ -0,0 +1,2 @@
1
+ <h2>Animated stripes</h2>
2
+ <%= bs5_example(snippet: 'progress/animated/snippet1') %>
@@ -0,0 +1,2 @@
1
+ <h2>Backgrounds</h2>
2
+ <%= bs5_example(snippet: 'progress/backgrounds/snippet1') %>
@@ -0,0 +1,2 @@
1
+ <h2>Examples</h2>
2
+ <%= bs5_example(snippet: 'progress/examples/snippet1') %>
@@ -0,0 +1,2 @@
1
+ <h2>Labels</h2>
2
+ <%= bs5_example(snippet: 'progress/labels/snippet1') %>
@@ -0,0 +1,2 @@
1
+ <h2>Multiple bars</h2>
2
+ <%= bs5_example(snippet: 'progress/multiple_bars/snippet1') %>
@@ -0,0 +1,2 @@
1
+ <h2>Striped</h2>
2
+ <%= bs5_example(snippet: 'progress/striped/snippet1') %>
@@ -0,0 +1,13 @@
1
+ <div class="mb-3">
2
+ <%= bs5_progress(25, animated: true, color: :success) %>
3
+ </div>
4
+
5
+ <div class="mb-3">
6
+ <%= bs5_progress(50, animated: true, color: :info) %>
7
+ </div>
8
+
9
+ <div class="mb-3">
10
+ <%= bs5_progress(75, animated: true, color: :warning) %>
11
+ </div>
12
+
13
+ <%= bs5_progress(100, animated: true, color: :danger) %>
@@ -0,0 +1,13 @@
1
+ <div class="mb-3">
2
+ <%= bs5_progress(25, color: :success) %>
3
+ </div>
4
+
5
+ <div class="mb-3">
6
+ <%= bs5_progress(50, color: :info) %>
7
+ </div>
8
+
9
+ <div class="mb-3">
10
+ <%= bs5_progress(75, color: :warning) %>
11
+ </div>
12
+
13
+ <%= bs5_progress(100, color: :danger) %>
@@ -0,0 +1,17 @@
1
+ <div class="mb-3">
2
+ <%= bs5_progress(0) %>
3
+ </div>
4
+
5
+ <div class="mb-3">
6
+ <%= bs5_progress(25) %>
7
+ </div>
8
+
9
+ <div class="mb-3">
10
+ <%= bs5_progress(50) %>
11
+ </div>
12
+
13
+ <div class="mb-3">
14
+ <%= bs5_progress(75) %>
15
+ </div>
16
+
17
+ <%= bs5_progress(100) %>
@@ -0,0 +1,5 @@
1
+ <div class="mb-3">
2
+ <%= bs5_progress(25, label: true) %>
3
+ </div>
4
+
5
+ <%= bs5_progress(50, label: "Woah, we're half way there.") %>
@@ -0,0 +1,5 @@
1
+ <%= bs5_progress do |p| %>
2
+ <%= p.bar(15) %>
3
+ <%= p.bar(30, color: :success) %>
4
+ <%= p.bar(20, color: :info) %>
5
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <div class="mb-3">
2
+ <%= bs5_progress(25, striped: true, color: :success) %>
3
+ </div>
4
+
5
+ <div class="mb-3">
6
+ <%= bs5_progress(50, striped: true, color: :info) %>
7
+ </div>
8
+
9
+ <div class="mb-3">
10
+ <%= bs5_progress(75, striped: true, color: :warning) %>
11
+ </div>
12
+
13
+ <%= bs5_progress(100, striped: true, color: :danger) %>
@@ -0,0 +1,7 @@
1
+ <h1>Progress</h1>
2
+ <%= render 'bs5/examples/progress/examples' %>
3
+ <%= render 'bs5/examples/progress/labels' %>
4
+ <%= render 'bs5/examples/progress/backgrounds' %>
5
+ <%= render 'bs5/examples/progress/multiple_bars' %>
6
+ <%= render 'bs5/examples/progress/striped' %>
7
+ <%= render 'bs5/examples/progress/animated' %>
@@ -27,6 +27,7 @@
27
27
  <% lg.item(active: current_page?(pages_path('list_group'))) do %><%= link_to 'List group', pages_path('list_group') %><% end %>
28
28
  <% lg.item(active: current_page?(pages_path('modal'))) do %><%= link_to 'Modal', pages_path('modal') %><% end %>
29
29
  <% lg.item(active: current_page?(pages_path('popovers'))) do %><%= link_to 'Popovers', pages_path('popovers') %><% end %>
30
+ <% lg.item(active: current_page?(pages_path('progress'))) do %><%= link_to 'Progress', pages_path('progress') %><% end %>
30
31
  <% lg.item(active: current_page?(pages_path('spinners'))) do %><%= link_to 'Spinners', pages_path('spinners') %><% end %>
31
32
  <% lg.item(active: current_page?(pages_path('toasts'))) do %><%= link_to 'Toasts', pages_path('toasts') %><% end %>
32
33
  <% lg.item(active: current_page?(pages_path('tooltips'))) do %><%= link_to 'Tooltips', pages_path('tooltips') %><% end %>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bs5
4
- VERSION = '0.0.28'
4
+ VERSION = '0.0.29'
5
5
  end
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.28
4
+ version: 0.0.29
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-28 00:00:00.000000000 Z
11
+ date: 2020-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -167,6 +167,10 @@ files:
167
167
  - app/components/bs5/modal/header_component.rb
168
168
  - app/components/bs5/modal_component.html.erb
169
169
  - app/components/bs5/modal_component.rb
170
+ - app/components/bs5/progress/bar_component.html.erb
171
+ - app/components/bs5/progress/bar_component.rb
172
+ - app/components/bs5/progress_component.html.erb
173
+ - app/components/bs5/progress_component.rb
170
174
  - app/components/bs5/spinner_component.html.erb
171
175
  - app/components/bs5/spinner_component.rb
172
176
  - app/components/bs5/toast/body_component.html.erb
@@ -323,6 +327,18 @@ files:
323
327
  - app/views/bs5/examples/popovers/dismissable_on_next_click/snippet.html.erb
324
328
  - app/views/bs5/examples/popovers/four_directions/_example.html.erb
325
329
  - app/views/bs5/examples/popovers/four_directions/snippet.html.erb
330
+ - app/views/bs5/examples/progress/_animated.html.erb
331
+ - app/views/bs5/examples/progress/_backgrounds.html.erb
332
+ - app/views/bs5/examples/progress/_examples.html.erb
333
+ - app/views/bs5/examples/progress/_labels.html.erb
334
+ - app/views/bs5/examples/progress/_multiple_bars.html.erb
335
+ - app/views/bs5/examples/progress/_striped.html.erb
336
+ - app/views/bs5/examples/progress/animated/snippet1.html.erb
337
+ - app/views/bs5/examples/progress/backgrounds/snippet1.html.erb
338
+ - app/views/bs5/examples/progress/examples/snippet1.html.erb
339
+ - app/views/bs5/examples/progress/labels/snippet1.html.erb
340
+ - app/views/bs5/examples/progress/multiple_bars/snippet1.html.erb
341
+ - app/views/bs5/examples/progress/striped/snippet1.html.erb
326
342
  - app/views/bs5/examples/spinners/border/_example.html.erb
327
343
  - app/views/bs5/examples/spinners/border/snippet.html.erb
328
344
  - app/views/bs5/examples/spinners/buttons/_example.html.erb
@@ -372,6 +388,7 @@ files:
372
388
  - app/views/bs5/pages/list_group.html.erb
373
389
  - app/views/bs5/pages/modal.html.erb
374
390
  - app/views/bs5/pages/popovers.html.erb
391
+ - app/views/bs5/pages/progress.html.erb
375
392
  - app/views/bs5/pages/spinners.html.erb
376
393
  - app/views/bs5/pages/toasts.html.erb
377
394
  - app/views/bs5/pages/tooltips.html.erb