Class: HakumiComponents::Grid::Col::Component

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

Constant Summary collapse

GRID_RANGE =
T.let((0..24).to_a.freeze, T::Array[Integer])
RESPONSIVE_PROPS =
T.let(%i[span offset order pull push].freeze, T::Array[Symbol])
BreakpointSettings =
T.type_alias { T::Hash[Symbol, Integer] }
BreakpointValue =
T.type_alias { T.any(Integer, BreakpointSettings) }
BreakpointInputs =
T.type_alias { T::Hash[Symbol, T.nilable(BreakpointValue)] }

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(span: nil, offset: nil, order: nil, pull: nil, push: nil, flex: nil, xs: nil, sm: nil, md: nil, lg: nil, xl: nil, xxl: nil, component: :div, **html_options) ⇒ Component

Returns a new instance of Component.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/components/hakumi_components/grid/col/component.rb', line 34

def initialize(
  span: nil,
  offset: nil,
  order: nil,
  pull: nil,
  push: nil,
  flex: nil,
  xs: nil,
  sm: nil,
  md: nil,
  lg: nil,
  xl: nil,
  xxl: nil,
  component: :div,
  **html_options
)
  @span = T.let(span, T.nilable(Integer))
  @offset = T.let(offset, T.nilable(Integer))
  @order = T.let(order, T.nilable(Integer))
  @pull = T.let(pull, T.nilable(Integer))
  @push = T.let(push, T.nilable(Integer))
  @flex = T.let(flex, BaseComponent::DimensionInput)
  @breakpoints = T.let(
    { xs: xs, sm: sm, md: md, lg: lg, xl: xl, xxl: xxl },
    BreakpointInputs
  )
  @component = T.let(component, Symbol)
  @html_options = T.let(html_options, HakumiComponents::Types::HtmlAttributes)

  validate_props!
end

Instance Method Details

#callObject



67
68
69
# File 'app/components/hakumi_components/grid/col/component.rb', line 67

def call
  (@component, content, wrapper_attributes)
end