Class: Anchor::RadioButtonComponent

Inherits:
Component
  • Object
show all
Includes:
DescribableInput
Defined in:
app/components/anchor/radio_button_component.rb

Constant Summary collapse

INPUT_CLASSES =
%w(
  appearance-none
  w-4.5
  m-[3px]
  flex-shrink-0
  aspect-square
  rounded-full
  border-2
  hover:border-gray-600
  checked:bg-gradient-radial
  checked:from-blue-600
  checked:from-[50%]
  checked:to-transparent
  checked:to-[54%]
  checked:border-accent
  checked:hover:from-blue-800
  checked:hover:from-[50%]
  checked:hover:to-transparent
  checked:hover:to-[54%]
  checked:hover:border-accent-hover
  disabled:border-subdued
  disabled:checked:border-subdued
  disabled:checked:from-subdued
  disabled:checked:from-[50%]
  disabled:checked:to-transparent
  disabled:checked:to-[54%]
  disabled:checked:border-subdued
).freeze
DESCRIPTION_CLASSES =
%w(
  text-secondary
  text-sm
).freeze

Constants included from ViewHelper

ViewHelper::ANCHOR_HELPERS

Instance Method Summary collapse

Methods included from DescribableInput

#aria_description, #description, #description_id, #description_text, #description_translation_html_scope, #description_translation_scope, #human_attribute_description, #human_attribute_html_description, #i18n_model_key

Methods inherited from Component

generate_id

Methods included from ViewHelper

#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Constructor Details

#initialize(radio:, attribute:, form_builder:, **kwargs) ⇒ RadioButtonComponent

Returns a new instance of RadioButtonComponent.



39
40
41
42
43
44
45
# File 'app/components/anchor/radio_button_component.rb', line 39

def initialize(radio:, attribute:, form_builder:, **kwargs)
  @radio = radio
  @attribute = attribute
  @form_builder = form_builder

  super(**kwargs)
end