Class: ViewComponent::Storybook::Controls::BaseOptionsConfig

Inherits:
SimpleControlConfig show all
Defined in:
lib/view_component/storybook/controls/base_options_config.rb

Direct Known Subclasses

MultiOptionsConfig, OptionsConfig

Instance Attribute Summary collapse

Attributes inherited from SimpleControlConfig

#default_value

Instance Method Summary collapse

Methods inherited from SimpleControlConfig

#value_from_params

Methods inherited from ControlConfig

#description, #name, #param, #prefix_param, #value_from_params

Constructor Details

#initialize(type, options, default_value, labels: nil, param: nil, name: nil, description: nil) ⇒ BaseOptionsConfig

Returns a new instance of BaseOptionsConfig.



11
12
13
14
15
16
17
# File 'lib/view_component/storybook/controls/base_options_config.rb', line 11

def initialize(type, options, default_value, labels: nil, param: nil, name: nil, description: nil)
  super(default_value, param: param, name: name, description: description)
  @type = type
  @options = options
  @labels = labels
  normalize_options
end

Instance Attribute Details

#labelsObject (readonly)

Returns the value of attribute labels.



7
8
9
# File 'lib/view_component/storybook/controls/base_options_config.rb', line 7

def labels
  @labels
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/view_component/storybook/controls/base_options_config.rb', line 7

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/view_component/storybook/controls/base_options_config.rb', line 7

def type
  @type
end

Instance Method Details

#to_csf_paramsObject



19
20
21
# File 'lib/view_component/storybook/controls/base_options_config.rb', line 19

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