Class: Polaris::OptionList::RadioButtonComponent
- Inherits:
-
Component
- Object
- Component
- Polaris::OptionList::RadioButtonComponent
- Defined in:
- app/components/polaris/option_list/radio_button_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label:, value:, wrapper_arguments: {}, **system_arguments) ⇒ RadioButtonComponent
constructor
A new instance of RadioButtonComponent.
- #radio_button ⇒ Object
- #system_arguments ⇒ Object
- #wrapper_arguments ⇒ Object
Constructor Details
#initialize(label:, value:, wrapper_arguments: {}, **system_arguments) ⇒ RadioButtonComponent
Returns a new instance of RadioButtonComponent.
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/components/polaris/option_list/radio_button_component.rb', line 2 def initialize( label:, value:, wrapper_arguments: {}, **system_arguments ) @label = label @value = value @wrapper_arguments = wrapper_arguments @system_arguments = system_arguments end |
Instance Method Details
#call ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/components/polaris/option_list/radio_button_component.rb', line 34 def call render(Polaris::BaseComponent.new(**wrapper_arguments)) do tag.label( class: "Polaris-OptionList-Option__SingleSelectOption", data: { polaris_option_list_target: "radioButton", action: "click->polaris-option-list#update" } ) do safe_join [ , @label ] end end end |
#radio_button ⇒ Object
51 52 53 |
# File 'app/components/polaris/option_list/radio_button_component.rb', line 51 def render Polaris::BaseRadioButton.new(value: @value, **system_arguments) end |
#system_arguments ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/components/polaris/option_list/radio_button_component.rb', line 25 def system_arguments @system_arguments.tap do |opts| opts[:classes] = class_names( @system_arguments[:classes], "Polaris--hidden" ) end end |
#wrapper_arguments ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/polaris/option_list/radio_button_component.rb', line 14 def wrapper_arguments @wrapper_arguments.tap do |opts| opts[:tag] = "li" opts[:tabindex] = "-1" opts[:classes] = class_names( @wrapper_arguments[:classes], "Polaris-OptionList-Option" ) end end |