Class: HakumiComponents::Typography::BaseComponent

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

Constant Summary collapse

TYPES =
T.let([ :secondary, :success, :warning, :danger ].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 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(type: nil, disabled: false, mark: false, code: false, keyboard: false, underline: false, delete: false, strong: false, italic: false, copyable: false, copied_text: nil, copy_error_text: nil, **html_options) ⇒ BaseComponent

Returns a new instance of BaseComponent.



28
29
30
31
32
33
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
# File 'app/components/hakumi_components/typography/base_component.rb', line 28

def initialize(
  type: nil,
  disabled: false,
  mark: false,
  code: false,
  keyboard: false,
  underline: false,
  delete: false,
  strong: false,
  italic: false,
  copyable: false,
  copied_text: nil,
  copy_error_text: nil,
  **html_options
)
  @type = T.let(type, T.nilable(Symbol))
  @disabled = T.let(disabled, T::Boolean)
  @mark = T.let(disabled ? false : mark, T::Boolean)
  @code = T.let(disabled ? false : code, T::Boolean)
  @keyboard = T.let(disabled ? false : keyboard, T::Boolean)
  @underline = T.let(disabled ? false : underline, T::Boolean)
  @delete = T.let(disabled ? false : delete, T::Boolean)
  @strong = T.let(strong, T::Boolean)
  @italic = T.let(italic, T::Boolean)
  @copyable = T.let(copyable, T::Boolean)
  @copied_text = T.let(copied_text, T.nilable(String))
  @copy_error_text = T.let(copy_error_text, T.nilable(String))
  @html_options = T.let(html_options, Types::HtmlAttributes)

  validate_props!
end

Instance Method Details

#callObject



61
62
63
# File 'app/components/hakumi_components/typography/base_component.rb', line 61

def call
  (tag_name, content_wrapper, wrapper_attributes)
end