%
options = {}
options[:heading_level] = heading_level ||= 2
steps ||= false
small ||= false
show_step ||= false
remember_last_step ||= false
step_nav_url ||= false
highlight_step ||= false
tracking_id ||= false
step_nav_content_id ||= tracking_id
step_count = 0
step_number = 0
step_nav_helper = GovukPublishingComponents::Presenters::StepByStepNavHelper.new
ga4_tracking ||= false
%>
<% if steps %>
class="gem-c-step-nav js-hidden <% if small %>govuk-!-display-none-print<% end %> <% unless small %>gem-c-step-nav--large<% end %>"
<%= "data-remember" if remember_last_step %>
<%= "data-id=#{tracking_id}" if tracking_id %>
data-show-text="<%= t("components.step_by_step_nav.show") %>"
data-hide-text="<%= t("components.step_by_step_nav.hide") %>"
data-show-all-text="<%= t("components.step_by_step_nav.show_all") %>"
data-hide-all-text="<%= t("components.step_by_step_nav.hide_all") %>"
>
<% steps.each_with_index do |step, step_index| %>
<%
step_is_active = step_index + 1 == highlight_step
step_count += 1
id = step_nav_helper.generate_step_nav_id(step[:title])
logic = false
logic = step[:logic] if ["and", "or"].include? step[:logic]
circle_class = "gem-c-step-nav__circle--number"
circle_class = "gem-c-step-nav__circle--logic" if logic
%>
- "
<% if step_is_active %>aria-current="step"<% end %>
<%= "data-show" if step_count == show_step %>
id="<%= id %>"
data-track-count="stepNavSection"
<%= "data-optional" if step[:optional] %>
>
<%
in_substep = false
options[:step_nav_content_id] = step_nav_content_id
options[:step_index] = step_index
options[:link_index] = 0
%>
<% step[:contents].each do |element| %>
<%= step_nav_helper.render_step_nav_element(element, options) %>
<%
if element[:type] == 'list'
options[:link_index] += element[:contents].length
end
%>
<% end %>
<% end %>
<% end %>