Class: HakumiComponents::Space::Component

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

Defined Under Namespace

Classes: ItemComponent

Constant Summary collapse

Direction =
T.type_alias { T.any(Symbol, String) }
Size =
T.type_alias { T.any(Symbol, Integer) }
DIRECTIONS =
T.let(%i[horizontal vertical].freeze, T::Array[Symbol])
ALIGNMENTS =
T.let(%i[start center end baseline].freeze, T::Array[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 Attribute Summary collapse

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(direction: :horizontal, size: :small, align: nil, wrap: false, block: false, split: nil, **html_options) ⇒ Component

Returns a new instance of Component.



28
29
30
31
32
33
34
35
36
37
38
# File 'app/components/hakumi_components/space/component.rb', line 28

def initialize(direction: :horizontal, size: :small, align: nil, wrap: false, block: false, split: nil, **html_options)
  @direction = T.let(direction.to_sym, Symbol)
  @size = T.let(size, Size)
  @align = T.let(align&.to_sym, T.nilable(Symbol))
  @wrap = T.let(wrap, T::Boolean)
  @block = T.let(block, T::Boolean)
  @split = T.let(split, HakumiComponents::Types::Renderable)
  @html_options = T.let(html_options, HakumiComponents::Types::HtmlAttributes)

  validate_props!
end

Instance Attribute Details

#splitObject (readonly)

Returns the value of attribute split.



41
42
43
# File 'app/components/hakumi_components/space/component.rb', line 41

def split
  @split
end