Class: Shadcn::Select::Search::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Select::Search::Component
- Defined in:
- app/components/shadcn/select/search/component.rb
Overview
The filter field, composing the already-ported InputGroup the way
shadcn's aria variant does — its popover renders data-slot="input-group"
around the control, with the magnifier as an addon.
Two things it does not copy from that variant, both with reasons in
decisions/01-architecture.md: the control keeps input-group-control
rather than being restamped select-input, because this port's group
raises its focus ring off that slot name and the aria one does not use
has-[[data-slot=…]] selectors at all; and the field carries an
accessible name, where upstream's has none — axe calls an unnamed one a
critical label violation.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label: nil, **attributes) ⇒ Component
constructor
A new instance of Component.
Methods inherited from ApplicationViewComponent
#css_classes, default_tag, #element_attributes, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(label: nil, **attributes) ⇒ Component
Returns a new instance of Component.
26 27 28 29 |
# File 'app/components/shadcn/select/search/component.rb', line 26 def initialize(label: nil, **attributes) @label = label super(**attributes) end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
24 25 26 |
# File 'app/components/shadcn/select/search/component.rb', line 24 def label @label end |
Instance Method Details
#call ⇒ Object
31 32 33 |
# File 'app/components/shadcn/select/search/component.rb', line 31 def call render_element(body: render(InputGroup::Component.new) { safe_join([ field, addon ]) }) end |