Class: Maglev::Uikit::Form::ColorFieldComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Maglev::Uikit::Form::ColorFieldComponent
- Defined in:
- app/components/maglev/uikit/form/color_field_component.rb
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #dom_id ⇒ Object
- #error ⇒ Object
- #hint ⇒ Object
-
#initialize(name:, options: {}, html_options: {}) ⇒ ColorFieldComponent
constructor
A new instance of ColorFieldComponent.
- #input_action ⇒ Object
- #input_data ⇒ Object
- #label ⇒ Object
- #presets ⇒ Object
- #presets? ⇒ Boolean
- #value ⇒ Object
- #value? ⇒ Boolean
Constructor Details
#initialize(name:, options: {}, html_options: {}) ⇒ ColorFieldComponent
Returns a new instance of ColorFieldComponent.
9 10 11 12 13 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 9 def initialize(name:, options: {}, html_options: {}) @name = name @options = @html_options = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
7 8 9 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 7 def @html_options end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 7 def @options end |
Instance Method Details
#dom_id ⇒ Object
15 16 17 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 15 def dom_id name.to_s.parameterize.underscore end |
#error ⇒ Object
43 44 45 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 43 def error [:error] end |
#hint ⇒ Object
39 40 41 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 39 def hint [:hint] end |
#input_action ⇒ Object
51 52 53 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 51 def input_action @input_action ||= input_data.delete(:action) || {} end |
#input_data ⇒ Object
47 48 49 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 47 def input_data @input_data ||= .delete(:data) || {} end |
#label ⇒ Object
19 20 21 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 19 def label [:label] || name.humanize end |
#presets ⇒ Object
31 32 33 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 31 def presets [:presets] end |
#presets? ⇒ Boolean
35 36 37 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 35 def presets? presets&.any? end |
#value ⇒ Object
23 24 25 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 23 def value [:value] end |
#value? ⇒ Boolean
27 28 29 |
# File 'app/components/maglev/uikit/form/color_field_component.rb', line 27 def value? value.present? end |