Module: UI::SelectScrollUpButtonBehavior
- Included in:
- SelectScrollUpButton, SelectScrollUpButtonComponent
- Defined in:
- app/helpers/ui/select_scroll_up_button_behavior.rb,
app/behaviors/ui/select_scroll_up_button_behavior.rb
Overview
UI::SelectScrollUpButtonBehavior
Shared behavior for Select scroll up button across ERB, ViewComponent, and Phlex implementations. This module provides consistent HTML attribute generation and styling.
Instance Method Summary collapse
-
#select_scroll_up_button_classes ⇒ Object
Returns combined CSS classes.
-
#select_scroll_up_button_data_attributes ⇒ Object
Returns data attributes for Stimulus.
-
#select_scroll_up_button_html_attributes ⇒ Object
Returns HTML attributes for the select scroll up button element.
Instance Method Details
#select_scroll_up_button_classes ⇒ Object
Returns combined CSS classes
34 35 36 37 38 39 40 |
# File 'app/helpers/ui/select_scroll_up_button_behavior.rb', line 34 def classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ , classes_value ].compact.join(" ")) end |
#select_scroll_up_button_data_attributes ⇒ Object
Returns data attributes for Stimulus
22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/ui/select_scroll_up_button_behavior.rb', line 22 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes base_data = { ui__select_target: "scrollUpButton", action: "mouseenter->ui--select#scrollUp mouseleave->ui--select#stopScroll", slot: "select-scroll-up-button" # ADDED: data-slot attribute } (attributes_value&.fetch(:data, {}) || {}).merge(base_data) end |
#select_scroll_up_button_html_attributes ⇒ Object
Returns HTML attributes for the select scroll up button element
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/ui/select_scroll_up_button_behavior.rb', line 9 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes { class: , "aria-hidden": "true", # FIXED: Removed display: none - visibility controlled by JavaScript/aria-hidden # ADDED: flex-shrink: 0 as per shadcn implementation style: "flex-shrink: 0;", data: }.merge(attributes_value || {}) end |