Class: ViewComponent::Storybook::Controls::MultiOptionsConfig
- Inherits:
-
BaseOptionsConfig
- Object
- ControlConfig
- SimpleControlConfig
- BaseOptionsConfig
- ViewComponent::Storybook::Controls::MultiOptionsConfig
- Defined in:
- lib/view_component/storybook/controls/multi_options_config.rb
Constant Summary collapse
- TYPES =
%i[multi-select check inline-check].freeze
Instance Attribute Summary
Attributes inherited from BaseOptionsConfig
Attributes inherited from SimpleControlConfig
Instance Method Summary collapse
-
#initialize(type, options, default_value, labels: nil, param: nil, name: nil, description: nil) ⇒ MultiOptionsConfig
constructor
A new instance of MultiOptionsConfig.
- #to_csf_params ⇒ Object
- #value_from_params(params) ⇒ Object
Methods inherited from ControlConfig
#description, #name, #param, #prefix_param
Constructor Details
#initialize(type, options, default_value, labels: nil, param: nil, name: nil, description: nil) ⇒ MultiOptionsConfig
Returns a new instance of MultiOptionsConfig.
12 13 14 |
# File 'lib/view_component/storybook/controls/multi_options_config.rb', line 12 def initialize(type, , default_value, labels: nil, param: nil, name: nil, description: nil) super(type, , Array.wrap(default_value), labels: labels, param: param, name: name, description: description) end |
Instance Method Details
#to_csf_params ⇒ Object
26 27 28 |
# File 'lib/view_component/storybook/controls/multi_options_config.rb', line 26 def to_csf_params super.deep_merge(argTypes: { param => { options: } }) end |
#value_from_params(params) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/view_component/storybook/controls/multi_options_config.rb', line 16 def value_from_params(params) params_value = super(params) if params_value.is_a?(String) params_value = params_value.split(',') params_value = params_value.map(&:to_sym) if symbol_values end params_value end |