Class: Shadcn::MessageScroller::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::MessageScroller::Component
- Defined in:
- app/components/shadcn/message_scroller/component.rb
Overview
Port of registry/new-york-v4/ui/message-scroller.tsx, which is a thin
wrapper over @shadcn/react/message-scroller — vendored at
vendor/shadcn-react/ so the Stimulus port has a source to answer to.
Upstream's MessageScrollerProvider renders no DOM at all: it is pure
context holding the five options below (components.tsx:89-107). There is
nothing to reproduce, so the options are Stimulus values and the
controller lives on this element — the same answer useSidebar got.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary collapse
-
#auto_scroll ⇒ Object
readonly
Returns the value of attribute auto_scroll.
-
#default_scroll_position ⇒ Object
readonly
Returns the value of attribute default_scroll_position.
-
#scroll_edge_threshold ⇒ Object
readonly
Returns the value of attribute scroll_edge_threshold.
-
#scroll_margin ⇒ Object
readonly
Returns the value of attribute scroll_margin.
-
#scroll_previous_item_peek ⇒ Object
readonly
Returns the value of attribute scroll_previous_item_peek.
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
- #element_attributes(**defaults) ⇒ Object
-
#initialize(auto_scroll: false, default_scroll_position: :end, scroll_edge_threshold: nil, scroll_margin: nil, scroll_previous_item_peek: nil, **attributes) ⇒ Component
constructor
Defaults are upstream's own (components.tsx:89-96).
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Constructor Details
#initialize(auto_scroll: false, default_scroll_position: :end, scroll_edge_threshold: nil, scroll_margin: nil, scroll_previous_item_peek: nil, **attributes) ⇒ Component
Defaults are upstream's own (components.tsx:89-96). scrollEdgeThreshold,
scrollMargin and scrollPreviousItemPeek are undefined there and fall
back inside the primitive; passing nil here leaves the value off the
element so the controller's own default applies, rather than baking a
number this file cannot check.
30 31 32 33 34 35 36 37 38 39 |
# File 'app/components/shadcn/message_scroller/component.rb', line 30 def initialize(auto_scroll: false, default_scroll_position: :end, scroll_edge_threshold: nil, scroll_margin: nil, scroll_previous_item_peek: nil, **attributes) @auto_scroll = auto_scroll @default_scroll_position = default_scroll_position @scroll_edge_threshold = scroll_edge_threshold @scroll_margin = scroll_margin @scroll_previous_item_peek = scroll_previous_item_peek super(**attributes) end |
Instance Attribute Details
#auto_scroll ⇒ Object (readonly)
Returns the value of attribute auto_scroll.
22 23 24 |
# File 'app/components/shadcn/message_scroller/component.rb', line 22 def auto_scroll @auto_scroll end |
#default_scroll_position ⇒ Object (readonly)
Returns the value of attribute default_scroll_position.
22 23 24 |
# File 'app/components/shadcn/message_scroller/component.rb', line 22 def default_scroll_position @default_scroll_position end |
#scroll_edge_threshold ⇒ Object (readonly)
Returns the value of attribute scroll_edge_threshold.
22 23 24 |
# File 'app/components/shadcn/message_scroller/component.rb', line 22 def scroll_edge_threshold @scroll_edge_threshold end |
#scroll_margin ⇒ Object (readonly)
Returns the value of attribute scroll_margin.
22 23 24 |
# File 'app/components/shadcn/message_scroller/component.rb', line 22 def scroll_margin @scroll_margin end |
#scroll_previous_item_peek ⇒ Object (readonly)
Returns the value of attribute scroll_previous_item_peek.
22 23 24 |
# File 'app/components/shadcn/message_scroller/component.rb', line 22 def scroll_previous_item_peek @scroll_previous_item_peek end |
Instance Method Details
#element_attributes(**defaults) ⇒ Object
41 42 43 |
# File 'app/components/shadcn/message_scroller/component.rb', line 41 def element_attributes(**defaults) super(**values.merge(defaults)) end |