arara 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.
- checksums.yaml +7 -0
- data/README.md +38 -0
- data/Rakefile +32 -0
- data/app/assets/config/arara_manifest.js +1 -0
- data/app/assets/javascripts/arara.js +603 -0
- data/app/assets/stylesheets/arara/application.css +15 -0
- data/app/components/arara.rb +2 -0
- data/app/components/arara/base_component.rb +62 -0
- data/app/components/arara/button_component.html.erb +7 -0
- data/app/components/arara/button_component.rb +50 -0
- data/app/components/arara/card_action_buttons_component.html.erb +3 -0
- data/app/components/arara/card_action_buttons_component.rb +15 -0
- data/app/components/arara/card_action_icons_component.html.erb +3 -0
- data/app/components/arara/card_action_icons_component.rb +15 -0
- data/app/components/arara/card_actions_component.html.erb +3 -0
- data/app/components/arara/card_actions_component.rb +15 -0
- data/app/components/arara/card_component.html.erb +3 -0
- data/app/components/arara/card_component.rb +15 -0
- data/app/components/arara/card_media_component.html.erb +3 -0
- data/app/components/arara/card_media_component.rb +20 -0
- data/app/components/arara/card_media_content_component.html.erb +3 -0
- data/app/components/arara/card_media_content_component.rb +15 -0
- data/app/components/arara/card_primary_content_component.html.erb +3 -0
- data/app/components/arara/card_primary_content_component.rb +18 -0
- data/app/components/arara/checkbox_component.html.erb +22 -0
- data/app/components/arara/checkbox_component.rb +25 -0
- data/app/components/arara/chip_component.html.erb +13 -0
- data/app/components/arara/chip_component.rb +22 -0
- data/app/components/arara/chipset_component.html.erb +6 -0
- data/app/components/arara/chipset_component.rb +23 -0
- data/app/components/arara/data_table_body_cell_component.html.erb +3 -0
- data/app/components/arara/data_table_body_cell_component.rb +18 -0
- data/app/components/arara/data_table_body_checkbox_component.html.erb +11 -0
- data/app/components/arara/data_table_body_checkbox_component.rb +25 -0
- data/app/components/arara/data_table_body_component.html.erb +3 -0
- data/app/components/arara/data_table_body_component.rb +15 -0
- data/app/components/arara/data_table_body_row_component.html.erb +3 -0
- data/app/components/arara/data_table_body_row_component.rb +27 -0
- data/app/components/arara/data_table_component.html.erb +5 -0
- data/app/components/arara/data_table_component.rb +36 -0
- data/app/components/arara/data_table_header_cell_component.html.erb +3 -0
- data/app/components/arara/data_table_header_cell_component.rb +24 -0
- data/app/components/arara/data_table_header_checkbox_component.html.erb +11 -0
- data/app/components/arara/data_table_header_checkbox_component.rb +25 -0
- data/app/components/arara/data_table_header_component.html.erb +3 -0
- data/app/components/arara/data_table_header_component.rb +11 -0
- data/app/components/arara/data_table_header_row_component.html.erb +3 -0
- data/app/components/arara/data_table_header_row_component.rb +15 -0
- data/app/components/arara/dialog_button_component.html.erb +4 -0
- data/app/components/arara/dialog_button_component.rb +31 -0
- data/app/components/arara/dialog_component.html.erb +8 -0
- data/app/components/arara/dialog_component.rb +34 -0
- data/app/components/arara/dialog_content_component.html.erb +3 -0
- data/app/components/arara/dialog_content_component.rb +15 -0
- data/app/components/arara/dialog_footer_component.html.erb +3 -0
- data/app/components/arara/dialog_footer_component.rb +15 -0
- data/app/components/arara/dialog_title_component.html.erb +3 -0
- data/app/components/arara/dialog_title_component.rb +16 -0
- data/app/components/arara/elevation_component.html.erb +3 -0
- data/app/components/arara/elevation_component.rb +19 -0
- data/app/components/arara/fab_component.html.erb +13 -0
- data/app/components/arara/fab_component.rb +42 -0
- data/app/components/arara/fab_icon_component.html.erb +3 -0
- data/app/components/arara/fab_icon_component.rb +15 -0
- data/app/components/arara/form_builder.rb +142 -0
- data/app/components/arara/form_field_component.html.erb +3 -0
- data/app/components/arara/form_field_component.rb +15 -0
- data/app/components/arara/google_calendar/menu_item_component.html.erb +11 -0
- data/app/components/arara/google_calendar/menu_item_component.rb +34 -0
- data/app/components/arara/google_calendar/nav_bar_component.html.erb +176 -0
- data/app/components/arara/google_calendar/nav_bar_component.rb +6 -0
- data/app/components/arara/icon_button_component.html.erb +3 -0
- data/app/components/arara/icon_button_component.rb +42 -0
- data/app/components/arara/icon_toggle_component.html.erb +3 -0
- data/app/components/arara/icon_toggle_component.rb +18 -0
- data/app/components/arara/material_icon_component.html.erb +3 -0
- data/app/components/arara/material_icon_component.rb +18 -0
- data/app/components/arara/menu_component.html.erb +5 -0
- data/app/components/arara/menu_component.rb +19 -0
- data/app/components/arara/menu_divider_component.html.erb +1 -0
- data/app/components/arara/menu_divider_component.rb +19 -0
- data/app/components/arara/menu_item_component.html.erb +3 -0
- data/app/components/arara/menu_item_component.rb +22 -0
- data/app/components/arara/nav_bar_component.html.erb +293 -0
- data/app/components/arara/nav_bar_component.rb +7 -0
- data/app/components/arara/radio_button_component.html.erb +8 -0
- data/app/components/arara/radio_button_component.rb +35 -0
- data/app/components/arara/select_component.html.erb +22 -0
- data/app/components/arara/select_component.rb +27 -0
- data/app/components/arara/select_item_component.html.erb +3 -0
- data/app/components/arara/select_item_component.rb +45 -0
- data/app/components/arara/step_component.html.erb +27 -0
- data/app/components/arara/step_component.rb +100 -0
- data/app/components/arara/step_connector_component.html.erb +4 -0
- data/app/components/arara/step_connector_component.rb +31 -0
- data/app/components/arara/stepper_component.html.erb +3 -0
- data/app/components/arara/stepper_component.rb +20 -0
- data/app/components/arara/switch_component.html.erb +8 -0
- data/app/components/arara/switch_component.rb +35 -0
- data/app/components/arara/tags.rb +2 -0
- data/app/components/arara/tags/check_box.rb +63 -0
- data/app/components/arara/tags/chip_choice.rb +81 -0
- data/app/components/arara/tags/chipset.rb +39 -0
- data/app/components/arara/tags/country_select.rb +110 -0
- data/app/components/arara/tags/label.rb +78 -0
- data/app/components/arara/tags/password_field.rb +16 -0
- data/app/components/arara/tags/radio_button.rb +31 -0
- data/app/components/arara/tags/select.rb +120 -0
- data/app/components/arara/tags/text_area.rb +25 -0
- data/app/components/arara/tags/text_field.rb +31 -0
- data/app/components/arara/text_field_component.html.erb +47 -0
- data/app/components/arara/text_field_component.rb +101 -0
- data/app/components/arara/typography_component.html.erb +1 -0
- data/app/components/arara/typography_component.rb +51 -0
- data/app/controllers/arara/application_controller.rb +5 -0
- data/app/helpers/arara/application_helper.rb +4 -0
- data/app/javascript/arara/controllers/body_class_toggler_controller.js +20 -0
- data/app/javascript/arara/controllers/counter_controller.js +22 -0
- data/app/javascript/arara/controllers/demo_dialog_controller.js +24 -0
- data/app/javascript/arara/controllers/mdc_chip_set_controller.js +18 -0
- data/app/javascript/arara/controllers/mdc_data_table_controller.js +18 -0
- data/app/javascript/arara/controllers/mdc_form_field_controller.js +40 -0
- data/app/javascript/arara/controllers/mdc_icon_toggle_controller.js +18 -0
- data/app/javascript/arara/controllers/mdc_linear_progress_controller.js +18 -0
- data/app/javascript/arara/controllers/mdc_list_controller.js +23 -0
- data/app/javascript/arara/controllers/mdc_menu_controller.js +25 -0
- data/app/javascript/arara/controllers/mdc_ripple_controller.js +18 -0
- data/app/javascript/arara/controllers/mdc_select_controller.js +27 -0
- data/app/javascript/arara/controllers/mdc_slider_controller.js +21 -0
- data/app/javascript/arara/controllers/mdc_snackbar_controller.js +38 -0
- data/app/javascript/arara/controllers/mdc_switch_controller.js +18 -0
- data/app/javascript/arara/controllers/mdc_tab_bar_controller.js +18 -0
- data/app/javascript/arara/controllers/mdc_text_field_controller.js +35 -0
- data/app/javascript/arara/controllers/mdc_top_app_bar_controller.js +18 -0
- data/app/javascript/arara/controllers/rails_chip_set_choice_controller.js +31 -0
- data/app/javascript/arara/controllers/rails_chip_set_filter_controller.js +39 -0
- data/app/javascript/arara/controllers/remote_form_controller.js +79 -0
- data/app/javascript/arara/helpers/sum.js +5 -0
- data/app/javascript/arara/index.js +65 -0
- data/app/javascript/arara/scss/_material_design.scss +34 -0
- data/app/javascript/arara/scss/_tailwind.scss +4 -0
- data/app/javascript/arara/scss/arara.scss +5 -0
- data/app/javascript/arara/scss/material_design/_custom.scss +61 -0
- data/app/javascript/arara/scss/tailwind/_ripple_workaround.scss +22 -0
- data/app/jobs/arara/application_job.rb +4 -0
- data/app/mailers/arara/application_mailer.rb +6 -0
- data/app/models/arara/application_record.rb +5 -0
- data/app/views/layouts/arara/application.html.erb +15 -0
- data/config/routes.rb +2 -0
- data/lib/arara.rb +5 -0
- data/lib/arara/engine.rb +7 -0
- data/lib/arara/version.rb +3 -0
- data/lib/tasks/arara_tasks.rake +4 -0
- metadata +238 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
module BaseComponent
|
|
3
|
+
class MissingTag < StandardError; end
|
|
4
|
+
|
|
5
|
+
def self.included(mod)
|
|
6
|
+
attr_reader :user_content, :user_variant, :user_tag, :user_data, :id, :options
|
|
7
|
+
|
|
8
|
+
def initialize(tag: nil, content: nil, variant: nil, id: nil, data: nil, **options)
|
|
9
|
+
@user_tag = tag.try(:to_s) || default_html_tag
|
|
10
|
+
@user_variant = variant.try(:to_s)
|
|
11
|
+
@user_content = content
|
|
12
|
+
@user_data = data || {}
|
|
13
|
+
@html_class = options.fetch(:class, "")
|
|
14
|
+
@options = options
|
|
15
|
+
@id = id
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def html_content
|
|
19
|
+
return content if content
|
|
20
|
+
user_content
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def html_class
|
|
24
|
+
classes = default_html_class ? [default_html_class] : []
|
|
25
|
+
classes.push(@html_class) unless @html_class.try(:empty?)
|
|
26
|
+
classes.empty? ? [] : classes
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def html_tag
|
|
30
|
+
raise MissingTag.new('You need to specify a tag') if @user_tag.nil?
|
|
31
|
+
@user_tag
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def html_options
|
|
35
|
+
opts = options.dup
|
|
36
|
+
opts[:class] = html_class unless html_class.empty?
|
|
37
|
+
opts[:data] = html_data unless html_data.empty?
|
|
38
|
+
opts[:id] = id if id
|
|
39
|
+
opts
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def html_data
|
|
43
|
+
data_controller = default_data_controller ? [default_data_controller] : []
|
|
44
|
+
data_controller.push(user_data[:controller]) if user_data.has_key?(:controller)
|
|
45
|
+
data_controller = (data_controller.empty? ? nil : data_controller.join(" "))
|
|
46
|
+
|
|
47
|
+
data = user_data.dup
|
|
48
|
+
data.merge!({controller: data_controller})
|
|
49
|
+
data
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def default_data_controller
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def default_html_class
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def default_html_tag
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class ButtonComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
attr_reader :type, :name, :value
|
|
5
|
+
|
|
6
|
+
def initialize(variant: "text", content: "Label", dense: false, icon: nil, type: nil, name: nil, value: nil, tag: "button", **kw)
|
|
7
|
+
@dense = dense
|
|
8
|
+
@icon = icon
|
|
9
|
+
@html_class = html_class
|
|
10
|
+
@type = type
|
|
11
|
+
@name = name
|
|
12
|
+
@value = value
|
|
13
|
+
super(tag: tag, variant: variant, content: content, **kw)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# private
|
|
17
|
+
attr_reader :icon, :data
|
|
18
|
+
|
|
19
|
+
def html_class
|
|
20
|
+
klass = ["mdc-button"]
|
|
21
|
+
klass.push("mdc-button--dense") if @dense
|
|
22
|
+
klass.push("mdc-button--raised") if @user_variant == "raised"
|
|
23
|
+
klass.push("mdc-button--unelevated") if @user_variant == "unelevated"
|
|
24
|
+
klass.push("mdc-button--outlined") if @user_variant == "outlined"
|
|
25
|
+
klass.push("#{@html_class}") if @html_class
|
|
26
|
+
klass
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def has_icon?
|
|
30
|
+
@icon.present?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def default_data_controller
|
|
34
|
+
"mdc-ripple"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def html_options
|
|
38
|
+
opts = super
|
|
39
|
+
opts.merge!(
|
|
40
|
+
class: html_class, data: html_data, type: type, name: name, value: value
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def html_content
|
|
45
|
+
return content if content
|
|
46
|
+
return value if value
|
|
47
|
+
user_content
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CardActionButtonsComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
validates :content, presence: true
|
|
6
|
+
|
|
7
|
+
def initialize(**kw)
|
|
8
|
+
super(tag: "div", **kw)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def default_html_class
|
|
12
|
+
"mdc-card__action-buttons"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CardActionIconsComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
validates :content, presence: true
|
|
6
|
+
|
|
7
|
+
def initialize(**kw)
|
|
8
|
+
super(tag: "div", **kw)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def default_html_class
|
|
12
|
+
"mdc-card__action-icons"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CardActionsComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
validates :content, presence: true
|
|
6
|
+
|
|
7
|
+
def initialize(**kw)
|
|
8
|
+
super(tag: "div", **kw)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def default_html_class
|
|
12
|
+
"mdc-card__actions"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CardComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
validates :content, presence: true
|
|
6
|
+
|
|
7
|
+
def initialize(**kw)
|
|
8
|
+
super(tag: "div", **kw)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def default_html_class
|
|
12
|
+
"mdc-card"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CardMediaComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
def initialize(variant:, image_url:, content_html_class: "", **kw)
|
|
6
|
+
super(tag: "div", variant: variant, **kw)
|
|
7
|
+
|
|
8
|
+
@image_url = image_url
|
|
9
|
+
@content_html_class = content_html_class
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr_reader :image_url, :content_html_class
|
|
13
|
+
|
|
14
|
+
def default_html_class
|
|
15
|
+
return "mdc-card__media mdc-card__media--16-9" if user_variant == "wide"
|
|
16
|
+
return "mdc-card__media mdc-card__media--square" if user_variant == "square"
|
|
17
|
+
"mdc-card__media"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CardMediaContentComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
def initialize(**kw)
|
|
6
|
+
super(tag: "div", **kw)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
attr_reader :image_url, :content_html_class
|
|
10
|
+
|
|
11
|
+
def default_html_class
|
|
12
|
+
"mdc-card__media-content"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CardPrimaryContentComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
validates :content, presence: true
|
|
6
|
+
|
|
7
|
+
def initialize(tabindex: 0, **kw)
|
|
8
|
+
super(tag: "div", **kw)
|
|
9
|
+
@tabindex = tabindex
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr_reader :tabindex
|
|
13
|
+
|
|
14
|
+
def default_html_class
|
|
15
|
+
"mdc-card__primary-action"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<%= content_tag(html_tag, html_options) do %>
|
|
2
|
+
<input
|
|
3
|
+
type="checkbox"
|
|
4
|
+
class="mdc-checkbox__native-control"
|
|
5
|
+
id="<%= id %>"
|
|
6
|
+
name="<%= name %>"
|
|
7
|
+
value="<%= value %>"
|
|
8
|
+
<% if checked %>
|
|
9
|
+
checked
|
|
10
|
+
<% end %>
|
|
11
|
+
/>
|
|
12
|
+
<div class="mdc-checkbox__background">
|
|
13
|
+
<svg class="mdc-checkbox__checkmark"
|
|
14
|
+
viewBox="0 0 24 24">
|
|
15
|
+
<path class="mdc-checkbox__checkmark-path"
|
|
16
|
+
fill="none"
|
|
17
|
+
d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
|
|
18
|
+
</svg>
|
|
19
|
+
<div class="mdc-checkbox__mixedmark"></div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="mdc-checkbox__ripple"></div>
|
|
22
|
+
<% end %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class CheckboxComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
attr_reader :id, :name, :value, :checked, :indeterminate
|
|
5
|
+
|
|
6
|
+
def initialize(id:, name:, value: 1, checked: false, indeterminate: false, **kw)
|
|
7
|
+
super(tag: "div", **kw)
|
|
8
|
+
@checked = checked
|
|
9
|
+
@indeterminate = indeterminate
|
|
10
|
+
@id = id
|
|
11
|
+
@name = name
|
|
12
|
+
@value = value
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def html_data
|
|
16
|
+
data = super
|
|
17
|
+
data.merge!(checked: checked, indeterminate: indeterminate)
|
|
18
|
+
data
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def default_html_class
|
|
22
|
+
'mdc-checkbox'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%= content_tag(html_tag, html_options, role: "row", id: id) do %>
|
|
2
|
+
<div class="mdc-chip__ripple"></div>
|
|
3
|
+
<%= leading_icon %>
|
|
4
|
+
<% if user_variant == "filter" %>
|
|
5
|
+
<div class="mdc-chip__checkmark">
|
|
6
|
+
<svg class="mdc-chip__checkmark-svg" viewBox="-2 -3 30 30">
|
|
7
|
+
<path class="mdc-chip__checkmark-path" fill="none" stroke="black" d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
|
|
8
|
+
</svg>
|
|
9
|
+
</div>
|
|
10
|
+
<% end %>
|
|
11
|
+
<span role="button" tabindex="0" class="mdc-chip__text"><%= label %></span>
|
|
12
|
+
<%= trailing_icon %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class ChipComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
with_content_areas :leading_icon, :trailing_icon
|
|
6
|
+
|
|
7
|
+
def initialize(id:, label:, variant: "choice", selected: false, should_remove_on_trailing_icon_click: false, **kw)
|
|
8
|
+
@id = id
|
|
9
|
+
@label = label
|
|
10
|
+
@selected = selected
|
|
11
|
+
@should_remove_on_trailing_icon_click = should_remove_on_trailing_icon_click
|
|
12
|
+
super(tag: "div", variant: variant, **kw)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
attr_reader :id, :label, :selected, :user_variant
|
|
16
|
+
|
|
17
|
+
def default_html_class
|
|
18
|
+
return "mdc-chip mdc-chip--selected" if selected
|
|
19
|
+
"mdc-chip"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class ChipsetComponent < ActionView::Component::Base
|
|
3
|
+
include Arara::BaseComponent
|
|
4
|
+
|
|
5
|
+
validates :content, presence: true
|
|
6
|
+
|
|
7
|
+
def initialize(variant: "", selected_chip_ids: [], **kw)
|
|
8
|
+
@variant = variant
|
|
9
|
+
@selected_chip_ids = selected_chip_ids
|
|
10
|
+
super(tag: "div", variant: variant, **kw)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def default_data_controller
|
|
14
|
+
"mdc-chip-set"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def default_html_class
|
|
18
|
+
return "mdc-chip-set mdc-chip-set--choice" if user_variant == "choice"
|
|
19
|
+
return "mdc-chip-set mdc-chip-set--filter" if user_variant == "filter"
|
|
20
|
+
"mdc-chip-set"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Arara
|
|
2
|
+
class DataTableBodyCellComponent < 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: "td", **kw)
|
|
10
|
+
@numeric = numeric
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def default_html_class
|
|
14
|
+
return "mdc-data-table__cell mdc-data-table__cell--numeric" if numeric
|
|
15
|
+
"mdc-data-table__cell"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|