{% set slides = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] %}
{% set widths = ['w-96', 'w-80', 'w-72', 'w-64'] %}

<style type="text/css">
  .is-active {
    box-shadow: 0 0 0 3px rgb(59 130 246);
  }

  html {
    overflow: hidden;
  }
</style>

<div data-component="Slider"
  data-option-mode="right"
  data-option-fit-bounds
  class="space-y-4 p-10">
  <div data-component="SliderDrag"
    data-ref="wrapper"
    tabindex="0"
    class="space-x-12 whitespace-nowrap select-none">
    {% for slide in slides %}
      {% set width = widths[loop.index0 % widths|length] %}
      <div data-component="SliderItem" class="inline-block rounded" style="contain: content;">
        <div class="flex items-center justify-center {{ width }} h-48 bg-blue-200 rounded">
          {% include '@ui/atoms/Figure/Figure.twig' with {
            src: 'https://picsum.photos/400/400?rand=' ~ slide,
            width: 200,
            height: 200,
            absolute: true,
            fit: 'cover',
            attr: {
              data_option_enter_from: 'opacity-0 transform scale-110',
              data_option_enter_active: 'transition duration-1000 ease-out-expo'
            },
            inner_attr: { class: 'bg-vp-bg' },
            img_attr: { class: 'opacity-0 transform scale-110' }
          } only %}
        </div>
      </div>
    {% endfor %}
  </div>

  <div class="flex items-center gap-4">
    {% include '@ui/atoms/Button/StyledButton.twig' with {
      label: 'Previous',
      attr: { data_component: 'SliderBtn', data_option_prev: true }
    } %}
    {% include '@ui/atoms/Button/StyledButton.twig' with {
      label: 'Next',
      attr: { data_component: 'SliderBtn', data_option_next: true }
    } %}
    <div data-component="SliderProgress"
      class="w-full rounded bg-blue-200 overflow-hidden">
      <div class="w-full h-2 bg-blue-500 rounded origin-left transition ease-out"
        data-ref="progress"></div>
    </div>
    <div data-component="SliderCount" class="whitespace-nowrap">
      <span data-ref="current">1</span> / {{ slides|length }}
    </div>
  </div>
  <div data-component="SliderDots"
    data-option-enter-to="is-active"
    data-option-enter-keep
    class="space-x-4">
    {% for slide in slides %}
      <button type="button" data-ref="dots[]" class="rounded-full">
        <span class="block w-2 h-2 bg-blue-200 rounded-full"></span>
        <span class="sr-only">Go to slide #{{ loop.index }}</span>
      </button>
    {% endfor %}
  </div>
  <div class="relative">
    <div data-component="SliderProgress"
      class="w-full rounded bg-blue-200 overflow-hidden">
      <div class="w-full h-2 bg-blue-500 rounded origin-left transition duration-500 ease-out-expo"
        data-ref="progress"></div>
    </div>
    <div data-component="SliderDots"
      data-option-enter-to="is-active bg-blue-500 transform scale-150"
      data-option-enter-active="transition-all duration-500 ease-out-expo"
      data-option-leave-active="transition-all duration-500 ease-out-expo"
      data-option-enter-keep
      class="absolute top-0 left-0 w-full h-full flex items-center justify-between">
      {% for slide in slides %}
        <button type="button"
          data-ref="dots[]"
          class="block w-2 h-2 bg-gray-600 rounded-full">
          <span class="sr-only">Go to slide #{{ loop.index }}</span>
        </button>
      {% endfor %}
    </div>
  </div>
  <pre data-ref="debug"></pre>
</div>

<div class="h-screen"></div>
