Module: UI::SliderRangeBehavior

Included in:
SliderRange, SliderRangeComponent
Defined in:
app/behaviors/ui/slider_range_behavior.rb

Overview

Shared behavior for Slider Range component The range is the filled portion of the track showing the selected value

Instance Method Summary collapse

Instance Method Details

#slider_range_html_attributesObject

Build complete HTML attributes hash for slider range



7
8
9
10
11
12
13
14
15
16
17
# File 'app/behaviors/ui/slider_range_behavior.rb', line 7

def slider_range_html_attributes
  base_attrs = @attributes&.except(:data) || {}
  user_data = @attributes&.fetch(:data, {}) || {}

  base_attrs.merge(
    class: "bg-primary absolute rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full #{@classes}".strip,
    "data-slot": "slider-range",
    "data-ui--slider-target": "range",
    data: user_data
  )
end