Class: HakumiComponents::Collapse::Component

Inherits:
BaseComponent
  • Object
show all
Extended by:
T::Sig
Defined in:
app/components/hakumi_components/collapse/component.rb

Constant Summary collapse

COLLAPSIBLES =
T.let([ nil, :header, :icon, :disabled ].freeze, T::Array[T.nilable(Symbol)])

Constants inherited from BaseComponent

BaseComponent::ControllerOptions, BaseComponent::DateInput, BaseComponent::DateLikeValue, BaseComponent::DimensionInput, BaseComponent::HtmlPayloadInput, BaseComponent::I18nOptionValue, BaseComponent::PresenceArray, BaseComponent::PresenceScalar, BaseComponent::PresenceValue, BaseComponent::RawHtmlInput, BaseComponent::SIZES, BaseComponent::SizeValue, BaseComponent::SymbolInput

Instance Method Summary collapse

Methods inherited from BaseComponent

#append_data_token, boolean_html_param, #build_inline_style, cast_boolean, #cast_boolean, #class_names, #component_classes, #data_attributes_from, #dimension_to_css, #ensure_dom_id!, float_html_param, #generate_id, #html_classes, html_param, html_primitive_param, #html_style, #i18n_scope, integer_html_param, #merge_attributes, #render_value, #size_to_pixels, #stimulus_attrs, string_html_param, string_or_symbol_array_html_param, symbol_html_param, #t_default, #translate_with_default, #validate_inclusion!, #validate_required!, #value_present?

Constructor Details

#initialize(size: :default, accordion: false, bordered: true, ghost: false, collapsible: nil, active_keys: nil, default_active_keys: nil, **html_options) ⇒ Component

Returns a new instance of Component.



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/components/hakumi_components/collapse/component.rb', line 48

def initialize(
  size: :default,
  accordion: false,
  bordered: true,
  ghost: false,
  collapsible: nil,
  active_keys: nil,
  default_active_keys: nil,
  **html_options
)
  @size = T.let(size, Symbol)
  @accordion = T.let(accordion, T::Boolean)
  @bordered = T.let(bordered, T::Boolean)
  @ghost = T.let(ghost, T::Boolean)
  @collapsible = T.let(collapsible, T.nilable(Symbol))
  @active_keys = T.let(normalize_keys(active_keys), T.nilable(T::Array[String]))
  @default_active_keys = T.let(normalize_keys(default_active_keys), T.nilable(T::Array[String]))
  @html_options = T.let(html_options, Types::HtmlAttributes)

  validate_props!
end