bulma_view_components 0.3.0 → 0.4.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 +4 -4
- data/README.md +4 -0
- data/app/components/bulma/button_component.html.erb +1 -1
- data/app/components/bulma/button_component.rb +11 -2
- data/app/components/bulma/buttons_component.html.erb +5 -0
- data/app/components/bulma/buttons_component.rb +16 -0
- data/app/components/bulma/content_component.rb +16 -0
- data/app/components/bulma/delete_component.rb +16 -0
- data/app/components/bulma/icon_component.html.erb +12 -0
- data/app/components/bulma/icon_component.rb +27 -0
- data/app/components/bulma/image_component.rb +13 -0
- data/app/components/bulma/notification_component.html.erb +4 -0
- data/app/components/bulma/notification_component.rb +20 -0
- data/app/components/bulma/progress_bar_component.rb +28 -0
- data/app/components/bulma/subtitle_component.rb +14 -0
- data/app/components/bulma/title_component.rb +3 -2
- data/app/helpers/bulma/components_helper.rb +7 -1
- data/lib/bulma/view_components/configuration.rb +8 -0
- data/lib/bulma/view_components/version.rb +1 -1
- metadata +16 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61373256bd5d7ed6e5deb4ae5787a97fe81a91819e300f8280b77765d1d5538c
|
4
|
+
data.tar.gz: f194eff7b8e88f91ff47ee9c6e64b96207d156f1f85d84b8aae6d791e1411ebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1491ab3d340c1bbd835f578415266cbd50e4c0effe5bd52ba0525b75d4553e3e986044f5b4397671d526c728a8088c8d42bf58320b9a2104e6bf61b07eb650bc
|
7
|
+
data.tar.gz: 2ed8d0e1ba061b8a0b71979b0484e19805d6ea75be799d1974e7b2a629a10a7b48189d290a8bcc8edc3f65769268325472852b0babf11c338a89db3df7b960e1
|
data/README.md
CHANGED
@@ -2,9 +2,18 @@
|
|
2
2
|
|
3
3
|
module Bulma
|
4
4
|
class ButtonComponent < Component
|
5
|
-
attr_reader :type
|
5
|
+
attr_reader :type, :value
|
6
6
|
|
7
|
-
def initialize(
|
7
|
+
def initialize(
|
8
|
+
value = nil,
|
9
|
+
type: "submit",
|
10
|
+
size: nil,
|
11
|
+
color: nil,
|
12
|
+
light: false,
|
13
|
+
fullwidth: false,
|
14
|
+
loading: false
|
15
|
+
)
|
16
|
+
@value = value
|
8
17
|
@type = type
|
9
18
|
@size = size
|
10
19
|
@color = color
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class ButtonsComponent < Component
|
5
|
+
renders_many :buttons, ButtonComponent
|
6
|
+
|
7
|
+
def initialize(attached: false, align: nil)
|
8
|
+
@attached = attached
|
9
|
+
@align = align
|
10
|
+
end
|
11
|
+
|
12
|
+
def classes
|
13
|
+
class_names("buttons", "has-addons" => @attached, "is-#{@align}" => @align.present?)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class ContentComponent < Component
|
5
|
+
def initialize(size: nil)
|
6
|
+
@size = size
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
content_tag :div, content, class: class_names(
|
11
|
+
"content",
|
12
|
+
"is-#{@size}" => @size.present?
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class DeleteComponent < Component
|
5
|
+
def initialize(size: nil)
|
6
|
+
@size = size
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
content_tag :button, nil, class: class_names(
|
11
|
+
"delete",
|
12
|
+
"is-#{@size}" => @size.present?
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class IoniconComponent < Component
|
5
|
+
def initialize(name)
|
6
|
+
@name = name
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
content_tag 'ion-icon', nil, name: @name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class IconComponent < Component
|
15
|
+
attr_reader :text
|
16
|
+
|
17
|
+
def initialize(icon, text: nil, color: nil, size: nil)
|
18
|
+
@text = text
|
19
|
+
@color = color
|
20
|
+
@icon = IoniconComponent.new(icon)
|
21
|
+
end
|
22
|
+
|
23
|
+
def classes
|
24
|
+
class_names("icon", "has-text-#{@color}" => @color.present?)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class ImageComponent < Component
|
5
|
+
def initialize(size: nil)
|
6
|
+
@size = size
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
content_tag :figure, content, class: class_names("image", "is-#{@size}" => @size.present?)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class NotificationComponent < Component
|
5
|
+
renders_one :delete, DeleteComponent
|
6
|
+
|
7
|
+
def initialize(color: nil, light: false)
|
8
|
+
@color = color
|
9
|
+
@light = light
|
10
|
+
end
|
11
|
+
|
12
|
+
def classes
|
13
|
+
class_names(
|
14
|
+
"notification",
|
15
|
+
"is-#{@color}" => @color.present?,
|
16
|
+
"is-light" => @light
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class ProgressBarComponent < Component
|
5
|
+
def initialize(value = nil, max: nil, color: nil, size: nil, **options)
|
6
|
+
@value = value
|
7
|
+
@max = max
|
8
|
+
@color = color
|
9
|
+
@size = size
|
10
|
+
@options = options
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
content_tag(
|
15
|
+
:progress,
|
16
|
+
content,
|
17
|
+
class: class_names(
|
18
|
+
"progress",
|
19
|
+
"is-#{@color}" => @color.present?,
|
20
|
+
"is-#{@size}" => @size.present?
|
21
|
+
),
|
22
|
+
value: @value,
|
23
|
+
max: @max,
|
24
|
+
**@options
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bulma
|
4
|
+
class SubtitleComponent < Component
|
5
|
+
def initialize(text = nil, size: nil)
|
6
|
+
@text = text
|
7
|
+
@size = size
|
8
|
+
end
|
9
|
+
|
10
|
+
def call
|
11
|
+
content_tag :p, @text || content, class: class_names("subtitle", "is-#{@size}" => @size.present?)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -2,15 +2,16 @@
|
|
2
2
|
|
3
3
|
module Bulma
|
4
4
|
class TitleComponent < Component
|
5
|
-
def initialize(as: :h1, size: 1)
|
5
|
+
def initialize(title = nil, as: :h1, size: 1)
|
6
6
|
raise ArgumentError, "invalid value to size" if size > 6
|
7
7
|
|
8
|
+
@title = title
|
8
9
|
@as = as
|
9
10
|
@size = size
|
10
11
|
end
|
11
12
|
|
12
13
|
def call
|
13
|
-
content_tag @as, content, class: class_names(
|
14
|
+
content_tag @as, @title || content, class: class_names(
|
14
15
|
"title",
|
15
16
|
"is-#{@size}"
|
16
17
|
)
|
@@ -6,8 +6,14 @@ module Bulma
|
|
6
6
|
block: Bulma::BlockComponent,
|
7
7
|
box: Bulma::BoxComponent,
|
8
8
|
button: Bulma::ButtonComponent,
|
9
|
+
buttons: Bulma::ButtonsComponent,
|
10
|
+
content: Bulma::ContentComponent,
|
11
|
+
delete: Bulma::DeleteComponent,
|
12
|
+
image: Bulma::ImageComponent,
|
9
13
|
tag: Bulma::TagComponent,
|
10
|
-
title: Bulma::TitleComponent
|
14
|
+
title: Bulma::TitleComponent,
|
15
|
+
progress_bar: Bulma::ProgressBarComponent,
|
16
|
+
notification: Bulma::NotificationComponent
|
11
17
|
}.freeze
|
12
18
|
|
13
19
|
BULMA_HELPER_COMPONENT_MAP.each do |name, component|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bulma_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego Toral
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -51,11 +51,23 @@ files:
|
|
51
51
|
- app/components/bulma/box_component.rb
|
52
52
|
- app/components/bulma/button_component.html.erb
|
53
53
|
- app/components/bulma/button_component.rb
|
54
|
+
- app/components/bulma/buttons_component.html.erb
|
55
|
+
- app/components/bulma/buttons_component.rb
|
54
56
|
- app/components/bulma/component.rb
|
57
|
+
- app/components/bulma/content_component.rb
|
58
|
+
- app/components/bulma/delete_component.rb
|
59
|
+
- app/components/bulma/icon_component.html.erb
|
60
|
+
- app/components/bulma/icon_component.rb
|
61
|
+
- app/components/bulma/image_component.rb
|
62
|
+
- app/components/bulma/notification_component.html.erb
|
63
|
+
- app/components/bulma/notification_component.rb
|
64
|
+
- app/components/bulma/progress_bar_component.rb
|
65
|
+
- app/components/bulma/subtitle_component.rb
|
55
66
|
- app/components/bulma/tag_component.rb
|
56
67
|
- app/components/bulma/title_component.rb
|
57
68
|
- app/helpers/bulma/components_helper.rb
|
58
69
|
- lib/bulma/view_components.rb
|
70
|
+
- lib/bulma/view_components/configuration.rb
|
59
71
|
- lib/bulma/view_components/engine.rb
|
60
72
|
- lib/bulma/view_components/version.rb
|
61
73
|
- lib/bulma_view_components.rb
|
@@ -74,14 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
86
|
requirements:
|
75
87
|
- - ">="
|
76
88
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
89
|
+
version: 3.0.0
|
78
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
91
|
requirements:
|
80
92
|
- - ">="
|
81
93
|
- !ruby/object:Gem::Version
|
82
94
|
version: '0'
|
83
95
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
96
|
+
rubygems_version: 3.5.17
|
85
97
|
signing_key:
|
86
98
|
specification_version: 4
|
87
99
|
summary: ViewComponents for Bulma
|