Class: Shadcn::Combobox::Content::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Combobox::Content::Component
- Defined in:
- app/components/shadcn/combobox/content/component.rb
Overview
The panel. Its class string is where Base UI's conventions are most
visible — data-open:, data-closed:, --anchor-width,
--available-width, --transform-origin — and reproducing it is why
the controller asks popper.js to publish those four unprefixed names
beside the --radix-* ones it already computes.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#align ⇒ Object
readonly
Returns the value of attribute align.
-
#align_offset ⇒ Object
readonly
Returns the value of attribute align_offset.
-
#side ⇒ Object
readonly
Returns the value of attribute side.
-
#side_offset ⇒ Object
readonly
Returns the value of attribute side_offset.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(side: :bottom, align: :start, side_offset: 6, align_offset: 0, **attributes) ⇒ Component
constructor
A new instance of Component.
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(side: :bottom, align: :start, side_offset: 6, align_offset: 0, **attributes) ⇒ Component
Returns a new instance of Component.
35 36 37 38 39 40 41 |
# File 'app/components/shadcn/combobox/content/component.rb', line 35 def initialize(side: :bottom, align: :start, side_offset: 6, align_offset: 0, **attributes) @side = side&.to_sym || :bottom @align = align&.to_sym || :start @side_offset = side_offset @align_offset = align_offset super(**attributes) end |
Instance Attribute Details
#align ⇒ Object (readonly)
Returns the value of attribute align.
33 34 35 |
# File 'app/components/shadcn/combobox/content/component.rb', line 33 def align @align end |
#align_offset ⇒ Object (readonly)
Returns the value of attribute align_offset.
33 34 35 |
# File 'app/components/shadcn/combobox/content/component.rb', line 33 def align_offset @align_offset end |
#side ⇒ Object (readonly)
Returns the value of attribute side.
33 34 35 |
# File 'app/components/shadcn/combobox/content/component.rb', line 33 def side @side end |
#side_offset ⇒ Object (readonly)
Returns the value of attribute side_offset.
33 34 35 |
# File 'app/components/shadcn/combobox/content/component.rb', line 33 def side_offset @side_offset end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/components/shadcn/combobox/content/component.rb', line 43 def element_attributes(**defaults) super(**{ role: "listbox", hidden: true, "data-closed" => "", "data-side" => side, "data-shadcn--combobox-target" => "content", "data-shadcn--combobox-side-value" => side, "data-shadcn--combobox-align-value" => align, "data-shadcn--combobox-side-offset-value" => side_offset, "data-shadcn--combobox-align-offset-value" => align_offset }.merge(defaults)) end |