arara 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +38 -0
  3. data/Rakefile +32 -0
  4. data/app/assets/config/arara_manifest.js +1 -0
  5. data/app/assets/javascripts/arara.js +603 -0
  6. data/app/assets/stylesheets/arara/application.css +15 -0
  7. data/app/components/arara.rb +2 -0
  8. data/app/components/arara/base_component.rb +62 -0
  9. data/app/components/arara/button_component.html.erb +7 -0
  10. data/app/components/arara/button_component.rb +50 -0
  11. data/app/components/arara/card_action_buttons_component.html.erb +3 -0
  12. data/app/components/arara/card_action_buttons_component.rb +15 -0
  13. data/app/components/arara/card_action_icons_component.html.erb +3 -0
  14. data/app/components/arara/card_action_icons_component.rb +15 -0
  15. data/app/components/arara/card_actions_component.html.erb +3 -0
  16. data/app/components/arara/card_actions_component.rb +15 -0
  17. data/app/components/arara/card_component.html.erb +3 -0
  18. data/app/components/arara/card_component.rb +15 -0
  19. data/app/components/arara/card_media_component.html.erb +3 -0
  20. data/app/components/arara/card_media_component.rb +20 -0
  21. data/app/components/arara/card_media_content_component.html.erb +3 -0
  22. data/app/components/arara/card_media_content_component.rb +15 -0
  23. data/app/components/arara/card_primary_content_component.html.erb +3 -0
  24. data/app/components/arara/card_primary_content_component.rb +18 -0
  25. data/app/components/arara/checkbox_component.html.erb +22 -0
  26. data/app/components/arara/checkbox_component.rb +25 -0
  27. data/app/components/arara/chip_component.html.erb +13 -0
  28. data/app/components/arara/chip_component.rb +22 -0
  29. data/app/components/arara/chipset_component.html.erb +6 -0
  30. data/app/components/arara/chipset_component.rb +23 -0
  31. data/app/components/arara/data_table_body_cell_component.html.erb +3 -0
  32. data/app/components/arara/data_table_body_cell_component.rb +18 -0
  33. data/app/components/arara/data_table_body_checkbox_component.html.erb +11 -0
  34. data/app/components/arara/data_table_body_checkbox_component.rb +25 -0
  35. data/app/components/arara/data_table_body_component.html.erb +3 -0
  36. data/app/components/arara/data_table_body_component.rb +15 -0
  37. data/app/components/arara/data_table_body_row_component.html.erb +3 -0
  38. data/app/components/arara/data_table_body_row_component.rb +27 -0
  39. data/app/components/arara/data_table_component.html.erb +5 -0
  40. data/app/components/arara/data_table_component.rb +36 -0
  41. data/app/components/arara/data_table_header_cell_component.html.erb +3 -0
  42. data/app/components/arara/data_table_header_cell_component.rb +24 -0
  43. data/app/components/arara/data_table_header_checkbox_component.html.erb +11 -0
  44. data/app/components/arara/data_table_header_checkbox_component.rb +25 -0
  45. data/app/components/arara/data_table_header_component.html.erb +3 -0
  46. data/app/components/arara/data_table_header_component.rb +11 -0
  47. data/app/components/arara/data_table_header_row_component.html.erb +3 -0
  48. data/app/components/arara/data_table_header_row_component.rb +15 -0
  49. data/app/components/arara/dialog_button_component.html.erb +4 -0
  50. data/app/components/arara/dialog_button_component.rb +31 -0
  51. data/app/components/arara/dialog_component.html.erb +8 -0
  52. data/app/components/arara/dialog_component.rb +34 -0
  53. data/app/components/arara/dialog_content_component.html.erb +3 -0
  54. data/app/components/arara/dialog_content_component.rb +15 -0
  55. data/app/components/arara/dialog_footer_component.html.erb +3 -0
  56. data/app/components/arara/dialog_footer_component.rb +15 -0
  57. data/app/components/arara/dialog_title_component.html.erb +3 -0
  58. data/app/components/arara/dialog_title_component.rb +16 -0
  59. data/app/components/arara/elevation_component.html.erb +3 -0
  60. data/app/components/arara/elevation_component.rb +19 -0
  61. data/app/components/arara/fab_component.html.erb +13 -0
  62. data/app/components/arara/fab_component.rb +42 -0
  63. data/app/components/arara/fab_icon_component.html.erb +3 -0
  64. data/app/components/arara/fab_icon_component.rb +15 -0
  65. data/app/components/arara/form_builder.rb +142 -0
  66. data/app/components/arara/form_field_component.html.erb +3 -0
  67. data/app/components/arara/form_field_component.rb +15 -0
  68. data/app/components/arara/google_calendar/menu_item_component.html.erb +11 -0
  69. data/app/components/arara/google_calendar/menu_item_component.rb +34 -0
  70. data/app/components/arara/google_calendar/nav_bar_component.html.erb +176 -0
  71. data/app/components/arara/google_calendar/nav_bar_component.rb +6 -0
  72. data/app/components/arara/icon_button_component.html.erb +3 -0
  73. data/app/components/arara/icon_button_component.rb +42 -0
  74. data/app/components/arara/icon_toggle_component.html.erb +3 -0
  75. data/app/components/arara/icon_toggle_component.rb +18 -0
  76. data/app/components/arara/material_icon_component.html.erb +3 -0
  77. data/app/components/arara/material_icon_component.rb +18 -0
  78. data/app/components/arara/menu_component.html.erb +5 -0
  79. data/app/components/arara/menu_component.rb +19 -0
  80. data/app/components/arara/menu_divider_component.html.erb +1 -0
  81. data/app/components/arara/menu_divider_component.rb +19 -0
  82. data/app/components/arara/menu_item_component.html.erb +3 -0
  83. data/app/components/arara/menu_item_component.rb +22 -0
  84. data/app/components/arara/nav_bar_component.html.erb +293 -0
  85. data/app/components/arara/nav_bar_component.rb +7 -0
  86. data/app/components/arara/radio_button_component.html.erb +8 -0
  87. data/app/components/arara/radio_button_component.rb +35 -0
  88. data/app/components/arara/select_component.html.erb +22 -0
  89. data/app/components/arara/select_component.rb +27 -0
  90. data/app/components/arara/select_item_component.html.erb +3 -0
  91. data/app/components/arara/select_item_component.rb +45 -0
  92. data/app/components/arara/step_component.html.erb +27 -0
  93. data/app/components/arara/step_component.rb +100 -0
  94. data/app/components/arara/step_connector_component.html.erb +4 -0
  95. data/app/components/arara/step_connector_component.rb +31 -0
  96. data/app/components/arara/stepper_component.html.erb +3 -0
  97. data/app/components/arara/stepper_component.rb +20 -0
  98. data/app/components/arara/switch_component.html.erb +8 -0
  99. data/app/components/arara/switch_component.rb +35 -0
  100. data/app/components/arara/tags.rb +2 -0
  101. data/app/components/arara/tags/check_box.rb +63 -0
  102. data/app/components/arara/tags/chip_choice.rb +81 -0
  103. data/app/components/arara/tags/chipset.rb +39 -0
  104. data/app/components/arara/tags/country_select.rb +110 -0
  105. data/app/components/arara/tags/label.rb +78 -0
  106. data/app/components/arara/tags/password_field.rb +16 -0
  107. data/app/components/arara/tags/radio_button.rb +31 -0
  108. data/app/components/arara/tags/select.rb +120 -0
  109. data/app/components/arara/tags/text_area.rb +25 -0
  110. data/app/components/arara/tags/text_field.rb +31 -0
  111. data/app/components/arara/text_field_component.html.erb +47 -0
  112. data/app/components/arara/text_field_component.rb +101 -0
  113. data/app/components/arara/typography_component.html.erb +1 -0
  114. data/app/components/arara/typography_component.rb +51 -0
  115. data/app/controllers/arara/application_controller.rb +5 -0
  116. data/app/helpers/arara/application_helper.rb +4 -0
  117. data/app/javascript/arara/controllers/body_class_toggler_controller.js +20 -0
  118. data/app/javascript/arara/controllers/counter_controller.js +22 -0
  119. data/app/javascript/arara/controllers/demo_dialog_controller.js +24 -0
  120. data/app/javascript/arara/controllers/mdc_chip_set_controller.js +18 -0
  121. data/app/javascript/arara/controllers/mdc_data_table_controller.js +18 -0
  122. data/app/javascript/arara/controllers/mdc_form_field_controller.js +40 -0
  123. data/app/javascript/arara/controllers/mdc_icon_toggle_controller.js +18 -0
  124. data/app/javascript/arara/controllers/mdc_linear_progress_controller.js +18 -0
  125. data/app/javascript/arara/controllers/mdc_list_controller.js +23 -0
  126. data/app/javascript/arara/controllers/mdc_menu_controller.js +25 -0
  127. data/app/javascript/arara/controllers/mdc_ripple_controller.js +18 -0
  128. data/app/javascript/arara/controllers/mdc_select_controller.js +27 -0
  129. data/app/javascript/arara/controllers/mdc_slider_controller.js +21 -0
  130. data/app/javascript/arara/controllers/mdc_snackbar_controller.js +38 -0
  131. data/app/javascript/arara/controllers/mdc_switch_controller.js +18 -0
  132. data/app/javascript/arara/controllers/mdc_tab_bar_controller.js +18 -0
  133. data/app/javascript/arara/controllers/mdc_text_field_controller.js +35 -0
  134. data/app/javascript/arara/controllers/mdc_top_app_bar_controller.js +18 -0
  135. data/app/javascript/arara/controllers/rails_chip_set_choice_controller.js +31 -0
  136. data/app/javascript/arara/controllers/rails_chip_set_filter_controller.js +39 -0
  137. data/app/javascript/arara/controllers/remote_form_controller.js +79 -0
  138. data/app/javascript/arara/helpers/sum.js +5 -0
  139. data/app/javascript/arara/index.js +65 -0
  140. data/app/javascript/arara/scss/_material_design.scss +34 -0
  141. data/app/javascript/arara/scss/_tailwind.scss +4 -0
  142. data/app/javascript/arara/scss/arara.scss +5 -0
  143. data/app/javascript/arara/scss/material_design/_custom.scss +61 -0
  144. data/app/javascript/arara/scss/tailwind/_ripple_workaround.scss +22 -0
  145. data/app/jobs/arara/application_job.rb +4 -0
  146. data/app/mailers/arara/application_mailer.rb +6 -0
  147. data/app/models/arara/application_record.rb +5 -0
  148. data/app/views/layouts/arara/application.html.erb +15 -0
  149. data/config/routes.rb +2 -0
  150. data/lib/arara.rb +5 -0
  151. data/lib/arara/engine.rb +7 -0
  152. data/lib/arara/version.rb +3 -0
  153. data/lib/tasks/arara_tasks.rake +4 -0
  154. metadata +238 -0
@@ -0,0 +1,11 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <div class="<%= checkbox_class %>">
3
+ <input type="checkbox" class="mdc-checkbox__native-control" <%= selected ? "checked" : nil %> aria-labelledby="<%= id %>"/>
4
+ <div class="mdc-checkbox__background">
5
+ <svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
6
+ <path class="mdc-checkbox__checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59" />
7
+ </svg>
8
+ <div class="mdc-checkbox__mixedmark"></div>
9
+ </div>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,25 @@
1
+ module Arara
2
+ class DataTableBodyCheckboxComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+ attr_reader :selected, :id
5
+
6
+ def initialize(selected: false, id:, **kw)
7
+ super(tag: "td", **kw)
8
+ @selected = selected
9
+ @id = id
10
+ end
11
+
12
+ def default_html_class
13
+ "mdc-data-table__cell mdc-data-table__cell--checkbox"
14
+ end
15
+
16
+ def html_options
17
+ super.merge!({role: "columnheader", scope: "col"})
18
+ end
19
+
20
+ def checkbox_class
21
+ return "mdc-checkbox mdc-data-table__row-checkbox mdc-checkbox--selected" if selected
22
+ "mdc-checkbox mdc-data-table__row-checkbox"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ module Arara
2
+ class DataTableBodyComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+
5
+ validates :content, presence: true
6
+
7
+ def initialize(**kw)
8
+ super(tag: "tbody", **kw)
9
+ end
10
+
11
+ def default_html_class
12
+ "mdc-data-table__content"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,27 @@
1
+ module Arara
2
+ class DataTableBodyRowComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+ attr_reader :selected
5
+
6
+ validates :content, presence: true
7
+
8
+ def initialize(selected: false, **kw)
9
+ super(tag: "tr", **kw)
10
+ @selected = selected
11
+ end
12
+
13
+ def default_html_class
14
+ return "mdc-data-table__row mdc-data-table__row--selected" if selected
15
+ "mdc-data-table__row"
16
+ end
17
+
18
+ def html_options
19
+ opts = super
20
+ if selected
21
+ opts[:aria] = {} unless opts.has_key?(:aria)
22
+ opts[:aria][:selected] = true
23
+ end
24
+ opts
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <% content_tag(table_tag, table_options) do %>
3
+ <%= content %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,36 @@
1
+ module Arara
2
+ class DataTableComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+ attr_reader :label
5
+
6
+ validates :content, presence: true
7
+
8
+ def initialize(label: nil, **kw)
9
+ super(tag: "div", **kw)
10
+ @label = label
11
+ end
12
+
13
+ def default_html_class
14
+ "mdc-data-table"
15
+ end
16
+
17
+ def default_data_controller
18
+ "mdc-data-table"
19
+ end
20
+
21
+ def table_tag
22
+ "table"
23
+ end
24
+
25
+ def table_options
26
+ opts = {
27
+ class: "mdc-data-table__table"
28
+ }
29
+ unless label.empty?
30
+ opts[:aria] ||= {}
31
+ opts[:aria][:label] = label
32
+ end
33
+ opts
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,24 @@
1
+ module Arara
2
+ class DataTableHeaderCellComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+ attr_reader :numeric
5
+
6
+ validates :content, presence: true
7
+
8
+ def initialize(numeric: false, **kw)
9
+ super(tag: "th", **kw)
10
+ @numeric = numeric
11
+ end
12
+
13
+ def default_html_class
14
+ return "mdc-data-table__header-cell mdc-data-table__header-cell--numeric" if numeric
15
+ "mdc-data-table__header-cell"
16
+ end
17
+
18
+ def html_options
19
+ opts = super
20
+ opts.merge!(role: "columnheader", scope: "col")
21
+ opts
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,11 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <div class="<%= checkbox_class %>">
3
+ <input type="checkbox" class="mdc-checkbox__native-control" aria-label="<%= label %>%"/>
4
+ <div class="mdc-checkbox__background">
5
+ <svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
6
+ <path class="mdc-checkbox__checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59" />
7
+ </svg>
8
+ <div class="mdc-checkbox__mixedmark"></div>
9
+ </div>
10
+ </div>
11
+ <% end %>
@@ -0,0 +1,25 @@
1
+ module Arara
2
+ class DataTableHeaderCheckboxComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+ attr_reader :selected, :label
5
+
6
+ def initialize(selected: false, label:, **kw)
7
+ super(tag: "th", **kw)
8
+ @selected = selected
9
+ @label = label
10
+ end
11
+
12
+ def default_html_class
13
+ "mdc-data-table__header-cell mdc-data-table__header-cell--checkbox"
14
+ end
15
+
16
+ def html_options
17
+ super.merge!({role: "columnheader", scope: "col"})
18
+ end
19
+
20
+ def checkbox_class
21
+ return "mdc-checkbox mdc-data-table__header-row-checkbox mdc-checkbox--selected" if selected
22
+ "mdc-checkbox mdc-data-table__header-row-checkbox"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,11 @@
1
+ module Arara
2
+ class DataTableHeaderComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+
5
+ validates :content, presence: true
6
+
7
+ def initialize(**kw)
8
+ super(tag: "thead", **kw)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ module Arara
2
+ class DataTableHeaderRowComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+
5
+ validates :content, presence: true
6
+
7
+ def initialize(**kw)
8
+ super(tag: "tr", **kw)
9
+ end
10
+
11
+ def default_html_class
12
+ "mdc-data-table__header-row"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <div class="mdc-button__ripple"></div>
3
+ <span class="mdc-button__label"><%= content %></span>
4
+ <% end %>
@@ -0,0 +1,31 @@
1
+ module Arara
2
+ class DialogButtonComponent < ActionView::Component::Base
3
+ include Arara::BaseComponent
4
+ validates :content, presence: true
5
+
6
+ attr_reader :dialog_action
7
+
8
+ def initialize(dialog_action:, **kw)
9
+ super(tag: "button", **kw)
10
+
11
+ @dialog_action = dialog_action
12
+ end
13
+
14
+
15
+ def default_html_class
16
+ "mdc-button mdc-dialog__button"
17
+ end
18
+
19
+ def html_options
20
+ opts = super
21
+ opts.merge!({type: "button"})
22
+ opts
23
+ end
24
+
25
+ def html_data
26
+ data = super
27
+ data.merge!('mdc-dialog-action': dialog_action)
28
+ data
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,8 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <div class="mdc-dialog__container">
3
+ <%= content_tag("div", surface_options) do %>
4
+ <%= content %>
5
+ <% end %>
6
+ </div>
7
+ <div class="mdc-dialog__scrim"></div>
8
+ <% end %>
@@ -0,0 +1,34 @@
1
+ module Arara
2
+ class DialogComponent < ActionView::Component::Base
3
+ validates :content, presence: true
4
+
5
+ include Arara::BaseComponent
6
+
7
+ attr_reader :role, :labelledby, :describedby
8
+
9
+ def initialize(role: "alertdialog", labelledby:, describedby:, **kw)
10
+ super(tag: "div", role: role, **kw)
11
+
12
+ @role = role
13
+ @labelledby = labelledby
14
+ @describedby = describedby
15
+ end
16
+
17
+
18
+ def default_html_class
19
+ "mdc-dialog"
20
+ end
21
+
22
+ def surface_options
23
+ opts = {
24
+ class: "mdc-dialog__surface",
25
+ role: role,
26
+ aria: {
27
+ modal: "true",
28
+ labelledby: labelledby,
29
+ describedby: describedby
30
+ }
31
+ }
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ module Arara
2
+ class DialogContentComponent < ActionView::Component::Base
3
+ validates :content, presence: true
4
+
5
+ include Arara::BaseComponent
6
+
7
+ def initialize(id:, **kw)
8
+ super(tag: "div", id: id, **kw)
9
+ end
10
+
11
+ def default_html_class
12
+ "mdc-dialog__content"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ module Arara
2
+ class DialogFooterComponent < ActionView::Component::Base
3
+ validates :content, presence: true
4
+
5
+ include Arara::BaseComponent
6
+
7
+ def initialize(**kw)
8
+ super(tag: "footer", id: id, **kw)
9
+ end
10
+
11
+ def default_html_class
12
+ "mdc-dialog__actions"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %><!--
2
+ --><%= content %><!--
3
+ --><% end %>
@@ -0,0 +1,16 @@
1
+ module Arara
2
+ class DialogTitleComponent < ActionView::Component::Base
3
+ validates :content, presence: true
4
+
5
+ include Arara::BaseComponent
6
+
7
+ def initialize(id:, **kw)
8
+ super(tag: "h2", id: id, **kw)
9
+ end
10
+
11
+
12
+ def default_html_class
13
+ "mdc-dialog__title"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,19 @@
1
+ module Arara
2
+ class ElevationComponent < ActionView::Component::Base
3
+ validates :content, presence: true
4
+
5
+ include Arara::BaseComponent
6
+
7
+ attr_reader :depth
8
+
9
+ def initialize(depth:, **kw)
10
+ super(tag: "div", depth: depth, **kw)
11
+
12
+ @depth = depth
13
+ end
14
+
15
+ def default_html_class
16
+ "mdc-elevation--z#{depth}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ <%= content_tag(html_tag, html_options) do %>
2
+ <div class="mdc-fab__ripple"></div>
3
+ <% if user_variant == "extended" && label_before %>
4
+ <span class="mdc-fab__label"><%= extended_label %></span>
5
+ <% end %>
6
+ <%= content %>
7
+ <% if user_variant == "extended" && !label_before %>
8
+ <span class="mdc-fab__label"><%= extended_label %></span>
9
+ <% end %>
10
+ <% if user_variant == "extended_no_icon" %>
11
+ <span class="mdc-fab__label"><%= extended_label %></span>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1,42 @@
1
+ module Arara
2
+ class FabComponent < ActionView::Component::Base
3
+ class InvalidVariant < StandardError; end
4
+
5
+ include Arara::BaseComponent
6
+ VALID_VARIANTS = %w(default mini extended extended_no_icon)
7
+
8
+ attr_reader :label, :extended_label, :label_before
9
+ with_options if: -> { user_variant == "extended" } do |extended|
10
+ extended.validates :content, presence: true
11
+ extended.validates :extended_label, presence: true
12
+ end
13
+
14
+ def initialize(variant: "default", label:, extended_label: nil, label_before: false, **kw)
15
+ raise InvalidVariant.new("`#{variant}' is not a valid variant") unless VALID_VARIANTS.include?(variant.to_s)
16
+ super(tag: "button", variant: variant, **kw)
17
+
18
+ @variant = variant
19
+ @label = label
20
+ @extended_label = extended_label
21
+ @label_before = label_before
22
+ end
23
+
24
+ def default_html_class
25
+ return "mdc-fab mdc-fab--mini" if user_variant == "mini"
26
+ return "mdc-fab mdc-fab--extended" if user_variant == "extended"
27
+ return "mdc-fab mdc-fab--extended" if user_variant == "extended_no_icon"
28
+ "mdc-fab"
29
+ end
30
+
31
+ def html_options
32
+ opts = super
33
+ opts[:aria] = {} unless opts.has_key?(:aria)
34
+ opts[:aria][:label] = label
35
+ opts
36
+ end
37
+
38
+ def default_data_controller
39
+ "mdc-ripple"
40
+ end
41
+ end
42
+ end