bulma_x 0.2.0

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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +22 -0
  4. data/CHANGELOG.md +30 -0
  5. data/CONTRIBUTING.md +50 -0
  6. data/LICENSE +661 -0
  7. data/README.md +315 -0
  8. data/Rakefile +12 -0
  9. data/lib/bulma_x/base_component.rb +125 -0
  10. data/lib/bulma_x/base_input.rb +37 -0
  11. data/lib/bulma_x/block.rb +7 -0
  12. data/lib/bulma_x/box.rb +7 -0
  13. data/lib/bulma_x/breadcrumbs.rb +35 -0
  14. data/lib/bulma_x/button.rb +42 -0
  15. data/lib/bulma_x/card.rb +55 -0
  16. data/lib/bulma_x/checkbox.rb +23 -0
  17. data/lib/bulma_x/columns.rb +81 -0
  18. data/lib/bulma_x/component_dsl.rb +19 -0
  19. data/lib/bulma_x/dropdown.rb +65 -0
  20. data/lib/bulma_x/dsl/options.rb +129 -0
  21. data/lib/bulma_x/dsl/slots.rb +234 -0
  22. data/lib/bulma_x/dsl/validations.rb +74 -0
  23. data/lib/bulma_x/field.rb +150 -0
  24. data/lib/bulma_x/figure.rb +27 -0
  25. data/lib/bulma_x/file.rb +54 -0
  26. data/lib/bulma_x/footer.rb +7 -0
  27. data/lib/bulma_x/form.rb +27 -0
  28. data/lib/bulma_x/grid.rb +90 -0
  29. data/lib/bulma_x/help.rb +7 -0
  30. data/lib/bulma_x/hero.rb +36 -0
  31. data/lib/bulma_x/icon.rb +66 -0
  32. data/lib/bulma_x/image.rb +42 -0
  33. data/lib/bulma_x/input.rb +53 -0
  34. data/lib/bulma_x/level.rb +43 -0
  35. data/lib/bulma_x/link.rb +44 -0
  36. data/lib/bulma_x/media.rb +19 -0
  37. data/lib/bulma_x/message.rb +27 -0
  38. data/lib/bulma_x/modal.rb +26 -0
  39. data/lib/bulma_x/navbar.rb +162 -0
  40. data/lib/bulma_x/notification.rb +15 -0
  41. data/lib/bulma_x/pagination.rb +86 -0
  42. data/lib/bulma_x/panel.rb +29 -0
  43. data/lib/bulma_x/paragraph.rb +7 -0
  44. data/lib/bulma_x/progress.rb +36 -0
  45. data/lib/bulma_x/radio.rb +33 -0
  46. data/lib/bulma_x/section.rb +35 -0
  47. data/lib/bulma_x/select.rb +57 -0
  48. data/lib/bulma_x/shared/aria_options.rb +19 -0
  49. data/lib/bulma_x/shared/data_options.rb +19 -0
  50. data/lib/bulma_x/shared/flex_options.rb +57 -0
  51. data/lib/bulma_x/shared/global_options.rb +49 -0
  52. data/lib/bulma_x/shared/spacing_options.rb +80 -0
  53. data/lib/bulma_x/shared/text_options.rb +31 -0
  54. data/lib/bulma_x/slot.rb +13 -0
  55. data/lib/bulma_x/subtitle.rb +9 -0
  56. data/lib/bulma_x/table.rb +78 -0
  57. data/lib/bulma_x/tabs.rb +43 -0
  58. data/lib/bulma_x/tag.rb +25 -0
  59. data/lib/bulma_x/textarea.rb +29 -0
  60. data/lib/bulma_x/title.rb +21 -0
  61. data/lib/bulma_x/version.rb +5 -0
  62. data/lib/bulma_x/vertical_menu.rb +71 -0
  63. data/lib/bulma_x.rb +9 -0
  64. metadata +123 -0
data/README.md ADDED
@@ -0,0 +1,315 @@
1
+ - [BulmaX](#bulmax)
2
+ - [Requirements](#requirements)
3
+ - [Installation](#installation)
4
+ - [Example of integration with Rails & Importmap](#rails-importmap)
5
+ - [Getting started](#getting-started)
6
+ - [Using BulmaX components](#using-bulmax)
7
+ - [Components may contains slots](#slots)
8
+ - [Create your own components](#custom-component)
9
+ - [Problems ?](#problems)
10
+ - [Contributing](#contributing)
11
+ - [Licence](#licence)
12
+ - [Authors](#authors)
13
+
14
+
15
+ <a id="bulmax"></a>
16
+
17
+ # BulmaX
18
+
19
+ Generate Bulma CSS components using the power of Phlex.
20
+
21
+ BulmaX is a Phlex component library that provides a set of components styled with Bulma CSS. It allows you to create responsive and modern web applications using the Bulma framework while leveraging the power of Phlex for building reusable components.
22
+
23
+ <a id="requirements"></a>
24
+
25
+ ## Features
26
+
27
+ BulmaX is based on [Phlex](https://github.com/yippee-fun/phlex) which is its only dependency.
28
+
29
+ BulmaX's ambition is to expose a DSL as simple as possible and the team will focus on keeping it that way.
30
+
31
+ We decided to make BulmaX's components deferred by default which makes sure component's markup is rendered in a consistent order.
32
+
33
+ ## Non-features
34
+
35
+ BulmaX aims only at generating HTML in regard to Bulma's components structure and classes but do not inject any css. All CSS handling is the developer's responsability.
36
+
37
+ BulmaX is a ruby only framework. There is no Rails integration and it's going to stay that way. We plan to add another interfacing layer BulmaX-rails later.
38
+
39
+ <a id="requirements"></a>
40
+
41
+ ## Requirements
42
+
43
+ - Ruby: 3.4+
44
+ - Phlex: 2.1+
45
+
46
+ BulmaX is still in a early stage, feel free to open issues or contributing.
47
+
48
+
49
+ <a id="installation"></a>
50
+
51
+ ## Installation
52
+
53
+ BulmaX only generates the HTML structure of components, adding Bulma CSS to the project is at the developer's discretion.
54
+
55
+ In your Gemfile:
56
+
57
+ ```rb
58
+ git_source(:gitlab) { |repo| "https://gitlab.com/#{repo}.git" }
59
+
60
+ gem 'bulma_x', gitlab: 'tftp/open/bulma_x'
61
+ ```
62
+
63
+ Then run
64
+
65
+ ```sh
66
+ bundle install
67
+ ```
68
+
69
+
70
+ <a id="rails-importmap"></a>
71
+
72
+ ### Example of integration with Rails & Importmap
73
+
74
+ Using importmap:
75
+
76
+ ```sh
77
+ yarn add bulma
78
+ ./bin/importmap pin bulma
79
+ ```
80
+
81
+ then in your application.scss
82
+
83
+ ```scss
84
+ @use "bulma";
85
+ ```
86
+
87
+
88
+ <a id="getting-started"></a>
89
+
90
+ ## Getting started
91
+
92
+
93
+ <a id="using-bulmax"></a>
94
+
95
+ ### Using BulmaX components
96
+
97
+ The complete list of components can be found below
98
+
99
+
100
+ <details>
101
+ <summary>List of components</summary>
102
+
103
+ ```
104
+ base_component.rb
105
+ base_input.rb
106
+ block.rb
107
+ box.rb
108
+ breadcrumbs.rb
109
+ button.rb
110
+ card.rb
111
+ checkbox.rb
112
+ columns.rb
113
+ component_dsl.rb
114
+ dropdown.rb
115
+ field.rb
116
+ figure.rb
117
+ file.rb
118
+ footer.rb
119
+ form.rb
120
+ grid.rb
121
+ help.rb
122
+ hero.rb
123
+ icon.rb
124
+ image.rb
125
+ input.rb
126
+ level.rb
127
+ link.rb
128
+ media.rb
129
+ message.rb
130
+ modal.rb
131
+ navbar.rb
132
+ notification.rb
133
+ pagination.rb
134
+ panel.rb
135
+ paragraph.rb
136
+ progress.rb
137
+ radio.rb
138
+ section.rb
139
+ select.rb
140
+ shared
141
+ slot.rb
142
+ subtitle.rb
143
+ table.rb
144
+ tabs.rb
145
+ tag.rb
146
+ textarea.rb
147
+ title.rb
148
+ version.rb
149
+ vertical_menu.rb
150
+ ```
151
+
152
+ </details>
153
+
154
+ An example of section could be as follows:
155
+
156
+ ```erb
157
+ <%= render BulmaX::Section.new(background_color: 'black') do %>
158
+ <%= render BulmaX::Title.new(text_modifier: 'primary') do %>
159
+ Section title
160
+ <% end %>
161
+
162
+ <%= render BulmaX::Paragraph.new do %>
163
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
164
+ <% end %>
165
+ <% end %>
166
+ ```
167
+
168
+
169
+ <a id="slots"></a>
170
+
171
+ ### Components may contains slots
172
+
173
+ As Bulma is based on order of classes in the DOM, BulmaX knows where each content should go in advance, but not what they contain. For that, it defines `slot` that you can fill during the rendering of the component.
174
+
175
+ For example, the `BulmaX::Card` component has a slot for the header and another for the footer. You can use them like this:
176
+
177
+ ```erb
178
+ <%= render BulmaX::Card.new do |card| %>
179
+ <%= card.content(:header) do |header| %>
180
+ <%= header.content(:title) do %>
181
+ Card title
182
+ <% end %>
183
+ <% end %>
184
+
185
+ <%= card.content(:body) do %>
186
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
187
+ <% end %>
188
+
189
+ <%= card.content(:footer) do |footer| %>
190
+ <%= footer.content(:item) do %>
191
+ <%= render BulmaX::Link.new(href: '#') do %>
192
+ Learn more
193
+ <% end %>
194
+ <% end %>
195
+ <% end %>
196
+ <% end %>
197
+ ```
198
+
199
+ As of today, the best way to know a component's slots is to look at the source code of the component.
200
+
201
+ <a id="custom-component"></a>
202
+
203
+ ### Create your own components
204
+
205
+ BulmaX allows you to create new components easily.
206
+
207
+ Either you can inherits the behaviour of existing components or create your own from scratch.
208
+
209
+ #### New component based on existing one
210
+
211
+ ```rb
212
+ class TwoColumns < BulmaX::Columns
213
+ slot :left
214
+ slot :right
215
+
216
+ def view_template
217
+ super do
218
+ content(:column) do
219
+ slot(:left)
220
+ end if slot?(:left)
221
+
222
+ content(:column) do
223
+ slot(:right)
224
+ end if slot?(:right)
225
+ end
226
+ end
227
+ end
228
+ ```
229
+
230
+ To find a complete reference to BulmaX DSL, until there is a proper documentation you can check for the files in the [dsl](<https://gitlab.com/tftp/open/bulma_x/-/tree/master/lib/bulma_x/dsl>) folder.
231
+
232
+ #### New component from scratch
233
+
234
+ When no components fits your needs, you can create a new one from scratch.
235
+
236
+ BulmaX has a basic component that is the root of all components named `BulmaX::BaseComponent`. It generates a simple div and provides the whole power of BulmaX DSL to it.
237
+
238
+ ```rb
239
+ class SpecificComponent < BulmaX::BaseComponent
240
+ # => Define your slots
241
+ # slot :slot_name, classes: ['class1', 'class2'], attributes: { turbo: 'something' }
242
+ # slot :slot_sub_component, component: 'NameOfSubComponent'
243
+ # slot :slot_other_component, component: OtherComponentClass
244
+
245
+ # => Define your options
246
+ # option :option # allows anything
247
+ # option :option_enum, values: [:enum, :value], default: :value
248
+
249
+ # => Define your validators
250
+ # validate :option, -> { it.is_a?(String) }, message: 'Must be a string'
251
+
252
+ def prepare
253
+ # => Prefill your slots if needed
254
+ #
255
+ # content(:slot_name) { content }
256
+ # content(:slot_other_component) do |other_component|
257
+ # other_component.content(:slot_name) { content }
258
+ # end
259
+ end
260
+
261
+ def view_template
262
+ super do
263
+ slot(:slot_name) if slot?(:slot_name)
264
+ slot(:slot_sub_component)
265
+ slot(:slot_other_component) if slot?(:slot_other_component)
266
+ end
267
+ end
268
+
269
+ def root_classes
270
+ super + [
271
+ @condition && 'custom-class' # => falsy values are removed from the classes
272
+ ]
273
+ end
274
+
275
+ def root_attributes
276
+ super.merge(
277
+ data: {
278
+ custom: 'value'
279
+ }
280
+ )
281
+ end
282
+ end
283
+ ```
284
+
285
+
286
+ <a id="problems"></a>
287
+
288
+ ## Problems ?
289
+
290
+ **Do not directly email any committers with questions or problems**. A community is best served when discussions are held in public.
291
+
292
+ If you have a problem, please open an issue on the [GitLab project](<https://gitlab.com/tftp/open/bulma_x/-/issues>).
293
+
294
+ Please note that BulmaX is still in early stages, its documentation is not complete yet and bugs may be present.
295
+
296
+
297
+ <a id="contributing"></a>
298
+
299
+ ## Contributing
300
+
301
+ See the [contributing guidelines](<https://gitlab.com/tftp/open/bulma_x/-/blob/master/CONTRIBUTING.md>) for more information on how to contribute to BulmaX.
302
+
303
+
304
+ <a id="licence"></a>
305
+
306
+ ## Licence
307
+
308
+ See [LICENCE](<https://gitlab.com/tftp/open/bulma_x/-/blob/master/LICENSE>) for more information on the licence of BulmaX.
309
+
310
+
311
+ <a id="authors"></a>
312
+
313
+ ## Authors
314
+
315
+ BulmaX is maintained by [Team for the Planet](<https://team-planet.com/>) and contributors.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'phlex'
4
+
5
+ module BulmaX
6
+ class BaseComponent < Phlex::HTML
7
+ BOOLEAN = [true, false].freeze
8
+
9
+ COLORS = %w[primary secondary link info success warning danger text].freeze
10
+ COLOR_MODIFIER = %w[light dark soft bold on-scheme].freeze
11
+ COLOR_PALETTE = (0..100).step(5).to_a.map { Kernel.format('%<value>02d', value: _1) }.freeze
12
+
13
+ MODIFIERS_PALETTE = COLORS +
14
+ COLORS
15
+ .product(COLOR_MODIFIER).map { _1.join('-') } +
16
+ COLORS
17
+ .product(COLOR_PALETTE).map { _1.join('-') } +
18
+ COLORS
19
+ .product(COLOR_MODIFIER, COLOR_PALETTE)
20
+ .map { _1.join('-') } +
21
+ [nil] +
22
+ COLORS + %w[light dark white black]
23
+
24
+ MODIFIERS_DECLINED = COLORS + COLORS.product(COLOR_MODIFIER).map { _1.join('-') } + [nil] + %w[light dark]
25
+ MODIFIERS = (COLORS + [nil])
26
+
27
+ BLANK_VALUES = [nil, false, '', [], {}].freeze
28
+
29
+ include ComponentDsl
30
+ include Shared::TextOptions
31
+ include Shared::SpacingOptions
32
+ include Shared::FlexOptions
33
+ include Shared::DataOptions
34
+ include Shared::GlobalOptions
35
+ include Shared::AriaOptions
36
+
37
+ spacing_options
38
+ data_options
39
+ aria_options
40
+ global_options
41
+ text_options
42
+ flex_options
43
+
44
+ root_slot # TODO: Root slot is an old concept that we'd like to remove soon
45
+
46
+ def initialize(**, &)
47
+ super(&)
48
+
49
+ build_from_options(**)
50
+ validate!(**)
51
+ end
52
+
53
+ def view_template(&) = render_root(&)
54
+
55
+ def render_root(&)
56
+ public_send(
57
+ root_tag,
58
+ **classes(root_classes),
59
+ **attributes(**root_attributes)
60
+ ) do
61
+ # NOTE: Returning nil in the block may return the generated HTML in some engines
62
+ # For instance in slim :
63
+ # = render BulmaX::Block.new do
64
+ # = 'void' if false
65
+ # Will render a block which content is the HTML of the BulmaX::Block
66
+ # To avoid this, capturing ensure we always return the same thing
67
+ capture(&) if block_given?
68
+ end
69
+ end
70
+
71
+ def base_classes
72
+ [
73
+ respond_to?(:spacing_classes) && spacing_classes,
74
+ respond_to?(:text_classes) && text_classes,
75
+ respond_to?(:flex_classes) && flex_classes,
76
+ respond_to?(:global_classes) && global_classes
77
+ ].flatten
78
+ end
79
+
80
+ def base_attributes
81
+ %i[data_attributes aria_attributes global_attributes].each_with_object({}) do |method, acc|
82
+ acc.merge!(public_send(method)) if respond_to?(method)
83
+ end
84
+ end
85
+
86
+ # NOTE: classes will remove all pairs having a falsy value, including false bool. Use "false" string to keep it.
87
+ def classes(*args)
88
+ compact_args = compact_blank(args.flatten)
89
+
90
+ return {} if compact_args.empty?
91
+
92
+ { class: compact_args.join(' ') }
93
+ end
94
+
95
+ # NOTE: attributes will remove all pairs having a falsy value, including false bool. Use "false" string to keep it.
96
+ def attributes(**kwargs)
97
+ compact_blank(kwargs)
98
+ end
99
+
100
+ def css(str) = str.to_s.tr('_', '-')
101
+
102
+ def compact_blank(obj)
103
+ case obj
104
+ when Array
105
+ obj.reject { BLANK_VALUES.include?(it) }
106
+ when Hash
107
+ obj.reject { |_, v| BLANK_VALUES.include?(v) }
108
+ else
109
+ obj
110
+ end
111
+ end
112
+
113
+ if defined?(Rails) && Rails.env.development?
114
+ def before_template
115
+ comment { "<#{self.class.name}>".html_safe }
116
+ super
117
+ end
118
+
119
+ def after_template
120
+ super
121
+ comment { "</#{self.class.name}>".html_safe }
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BulmaX
4
+ class BaseInput < BaseComponent
5
+ option :modifier, values: MODIFIERS, default: nil
6
+ option :size, values: %w[small normal medium large], default: 'normal'
7
+ option :disabled, values: BOOLEAN, default: false
8
+ option :readonly, values: BOOLEAN, default: false
9
+ option :static, values: BOOLEAN, default: false
10
+ option :html, default: {}
11
+ option :autofocus, values: BOOLEAN, default: false
12
+ option :required, values: BOOLEAN, default: false
13
+
14
+ root_slot tag: :input
15
+
16
+ def root_classes
17
+ super +
18
+ [
19
+ 'input',
20
+ @modifier && "is-#{@modifier}",
21
+ "is-#{@size}",
22
+ @disabled && 'is-disabled',
23
+ @static && 'is-static'
24
+ ]
25
+ end
26
+
27
+ def root_attributes
28
+ super.merge(
29
+ disabled: @disabled,
30
+ readonly: @readonly || @static,
31
+ autofocus: @autofocus,
32
+ required: @required,
33
+ **@html
34
+ )
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BulmaX
4
+ class Block < BaseComponent
5
+ root_slot classes: ['block']
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BulmaX
4
+ class Box < BaseComponent
5
+ root_slot classes: %w[box]
6
+ end
7
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BulmaX
4
+ class Breadcrumbs < BaseComponent
5
+ root_slot tag: :nav
6
+
7
+ option :alignment, values: %i[left centered right], default: :left
8
+
9
+ slot :breadcrumbs_ul, tag: :ul
10
+ slots :item, component: 'Item'
11
+
12
+ def view_template
13
+ super do
14
+ slot(:breadcrumbs_ul) do
15
+ slots(:item).each { render it }
16
+ end
17
+ end
18
+ end
19
+
20
+ def root_classes
21
+ super +
22
+ [
23
+ 'breadcrumb',
24
+ "is-#{@alignment}"
25
+ ]
26
+ end
27
+
28
+ class Item < BaseComponent
29
+ option :current, values: BOOLEAN, default: false
30
+
31
+ def root_classes = super + [@current && 'is-active']
32
+ def root_tag = :li
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BulmaX
4
+ class Button < BaseComponent
5
+ option :kind, values: MODIFIERS, default: :primary
6
+ option :rounded, values: BOOLEAN, default: false
7
+ option :type, values: %i[button submit reset], default: :button
8
+ option :size, values: [nil, :small, :medium, :large], default: nil
9
+ option :style, values: [nil, :outlined, :inverted, :rounded]
10
+ option :responsive, values: BOOLEAN, default: false
11
+ option :disabled, values: BOOLEAN, default: false
12
+ option :href
13
+ option :target
14
+ option :rel
15
+ option :static, values: BOOLEAN, default: false
16
+
17
+ def root_tag = @href ? :a : :button
18
+
19
+ def root_classes
20
+ super +
21
+ [
22
+ 'button',
23
+ "is-#{@kind}",
24
+ @size && "is-#{@size}",
25
+ @style && "is-#{@style}",
26
+ @responsive && 'is-responsive',
27
+ @rounded && 'is-rounded',
28
+ @static && 'is-static'
29
+ ]
30
+ end
31
+
32
+ def root_attributes
33
+ super.merge(
34
+ href: @href,
35
+ type: @type,
36
+ disabled: @disabled,
37
+ target: @target,
38
+ rel: @rel
39
+ )
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BulmaX
4
+ class Card < BulmaX::BaseComponent
5
+ root_slot classes: ['card']
6
+
7
+ slot :header, component: 'CardHead'
8
+ slot :content, component: 'CardContent'
9
+ slot :footer, component: 'CardFooter'
10
+
11
+ def view_template
12
+ super do
13
+ slot(:header) if slot?(:header)
14
+ slot(:content)
15
+ slot(:footer) if slot?(:footer)
16
+ end
17
+ end
18
+
19
+ class CardHead < BulmaX::BaseComponent
20
+ root_slot classes: ['card-header']
21
+
22
+ slot :figure, component: BulmaX::Figure
23
+ slot :image, classes: ['card-image']
24
+ slot :title, classes: ['card-header-title'], tag: :p
25
+
26
+ def view_template
27
+ super do
28
+ if slot?(:image)
29
+ slot(:figure, fullwidth: true, extra_classes: 'card-image', ratio: '16x9') do
30
+ slot(:image, fullwidth: true)
31
+ end
32
+ else
33
+ slot(:title)
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ class CardContent < BulmaX::BaseComponent
40
+ root_slot classes: ['card-content']
41
+ end
42
+
43
+ class CardFooter < BulmaX::BaseComponent
44
+ root_slot classes: ['card-footer']
45
+
46
+ slots :item, classes: ['card-footer-item'], tag: :div
47
+
48
+ def view_template
49
+ super do
50
+ slots(:item).each { render it }
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BulmaX
4
+ class Checkbox < BaseComponent
5
+ option :disabled, values: BOOLEAN, default: false
6
+ option :checked, values: BOOLEAN, default: false
7
+ option :name
8
+ option :value
9
+
10
+ root_slot tag: :label, classes: ['checkbox']
11
+
12
+ def view_template
13
+ super do
14
+ render Input.new(**input_attributes)
15
+
16
+ yield if block_given?
17
+ end
18
+ end
19
+
20
+ def root_attributes = super.merge(disabled: @disabled)
21
+ def input_attributes = { type: 'checkbox', disabled: @disabled, checked: @checked, name: @name, value: @value }
22
+ end
23
+ end