Class: StimulusPlumbers::Components::ProgressBar
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::ProgressBar
- Defined in:
- lib/stimulus_plumbers/components/progress_bar.rb
Constant Summary
Constants included from StimulusPlumbers::Components::Progress::Shared
StimulusPlumbers::Components::Progress::Shared::FORMATS
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
- #render ⇒ Object
- #render_segmented(value:, segments:, min: 0, max: 100, mode: :discrete, indeterminate: false, ramp: nil, format: nil, **kwargs) ⇒ Object
Methods inherited from Plumber::Base
Methods included from Plumber::Renderer
#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?
Methods included from Plumber::Options::Aria
Methods included from Plumber::Options::Html
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Base
Instance Method Details
#render ⇒ Object
8 9 10 |
# File 'lib/stimulus_plumbers/components/progress_bar.rb', line 8 def render(...) (...) end |
#render_segmented(value:, segments:, min: 0, max: 100, mode: :discrete, indeterminate: false, ramp: nil, format: nil, **kwargs) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/stimulus_plumbers/components/progress_bar.rb', line 12 def render_segmented( value:, segments:, min: 0, max: 100, mode: :discrete, indeterminate: false, ramp: nil, format: nil, **kwargs ) validate_segments!(segments, format) current = clamp(value, min, max) = ( theme.resolve(:progress_segment_group), kwargs, segmented_stimulus_data(current, min, max, mode, indeterminate), { role: "progressbar", aria: progress_aria(value: current, min: min, max: max, indeterminate: indeterminate) } ) slots = ramp_intents(ramp, segments).map { |intent| render_segment(intent: intent) } template.content_tag(:div, template.safe_join(slots), **) end |