Class: ViewComponent::Storybook::Controls::OptionsConfig

Inherits:
BaseOptionsConfig show all
Defined in:
lib/view_component/storybook/controls/options_config.rb

Constant Summary collapse

TYPES =
%i[select radio inline-radio].freeze

Instance Attribute Summary

Attributes inherited from BaseOptionsConfig

#labels, #options, #type

Attributes inherited from SimpleControlConfig

#default_value

Instance Method Summary collapse

Methods inherited from BaseOptionsConfig

#initialize

Methods inherited from SimpleControlConfig

#initialize

Methods inherited from ControlConfig

#description, #initialize, #name, #param, #prefix_param

Constructor Details

This class inherits a constructor from ViewComponent::Storybook::Controls::BaseOptionsConfig

Instance Method Details

#to_csf_paramsObject



21
22
23
# File 'lib/view_component/storybook/controls/options_config.rb', line 21

def to_csf_params
  super.deep_merge(argTypes: { param => { options: options } })
end

#value_from_params(params) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/view_component/storybook/controls/options_config.rb', line 12

def value_from_params(params)
  params_value = super(params)
  if params_value.is_a?(String) && symbol_value
    params_value.to_sym
  else
    params_value
  end
end