Class: Daisy::DataInput::CallyInputComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::DataInput::CallyInputComponent
- Includes:
- LocoMotion::Concerns::LabelableComponent, ViewComponent::SlotableDefault
- Defined in:
- app/components/daisy/data_input/cally_input_component.rb
Overview
A specialized input component that combines a text input with a calendar picker. The calendar appears in a popover when the input is focused or clicked.
Defined Under Namespace
Classes: CallyCalendarComponent, CallyTextInputComponent
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary collapse
-
#anchor ⇒ Object
readonly
Returns the value of attribute anchor.
-
#auto_scroll_padding ⇒ Object
readonly
Returns the value of attribute auto_scroll_padding.
-
#calendar_id ⇒ Object
readonly
Returns the value of attribute calendar_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#input_id ⇒ Object
readonly
Returns the value of attribute input_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#popover_id ⇒ Object
readonly
Returns the value of attribute popover_id.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
-
#before_render ⇒ void
Sets up the component before rendering.
-
#default_calendar ⇒ CallyCalendarComponent
Provides a default calendar component instance.
-
#default_input ⇒ CallyTextInputComponent
Provides a default input component instance.
-
#initialize(**kws) ⇒ CallyInputComponent
constructor
Initializes a new CallyInputComponent.
Methods included from LocoMotion::Concerns::LabelableComponent
#has_any_label?, #has_end_label?, #has_floating_label?, #has_start_label?
Methods inherited from LocoMotion::BaseComponent
build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces
Constructor Details
#initialize(**kws) ⇒ CallyInputComponent
Initializes a new CallyInputComponent.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 102 def initialize(**kws) super(**kws) @id = config_option(:id, SecureRandom.uuid) @name = config_option(:name) @value = config_option(:value) @auto_scroll_padding = config_option(:auto_scroll_padding, 100) # Input ID should match our ID @input_id = @id # Other IDs / options are generated @calendar_id = "#{@id}-calendar" @popover_id = "#{@id}-popover" @anchor = "#{@id}-anchor" end |
Instance Attribute Details
#anchor ⇒ Object (readonly)
Returns the value of attribute anchor.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def anchor @anchor end |
#auto_scroll_padding ⇒ Object (readonly)
Returns the value of attribute auto_scroll_padding.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def auto_scroll_padding @auto_scroll_padding end |
#calendar_id ⇒ Object (readonly)
Returns the value of attribute calendar_id.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def calendar_id @calendar_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def id @id end |
#input_id ⇒ Object (readonly)
Returns the value of attribute input_id.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def input_id @input_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def name @name end |
#popover_id ⇒ Object (readonly)
Returns the value of attribute popover_id.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def popover_id @popover_id end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
92 93 94 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 92 def value @value end |
Instance Method Details
#before_render ⇒ void
This method returns an undefined value.
Sets up the component before rendering. Calls the parent’s before_render and then runs the component setup.
123 124 125 126 127 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 123 def before_render super setup_component end |
#default_calendar ⇒ CallyCalendarComponent
Provides a default calendar component instance. This is used when no custom calendar component is provided.
133 134 135 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 133 def default_calendar CallyCalendarComponent.new end |
#default_input ⇒ CallyTextInputComponent
Provides a default input component instance. This is used when no custom input component is provided.
141 142 143 |
# File 'app/components/daisy/data_input/cally_input_component.rb', line 141 def default_input CallyTextInputComponent.new end |