Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

2.6 KB
Raw Blame
<main class="flex flex-col h-full w-full p-6" role="main" aria-label="Slider task interface">
  <div class="max-w-md mx-auto w-full">
    <h1 class="text-xl font-semibold text-gray-900 mb-6">Adjust the slider</h1>

    <div class="flex flex-col gap-4">
      <div class="flex items-center justify-between">
        <label for="slider" class="text-sm font-medium text-gray-700"> {{LABEL}} </label>
        <span
          id="value-display"
          class="text-lg font-semibold text-blue-600 min-w-[3rem] text-right"
        >
          50
        </span>
      </div>

      <input
        type="range"
        id="slider"
        min="0"
        max="100"
        value="50"
        class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider"
        aria-label="Slider control"
        aria-valuemin="0"
        aria-valuemax="100"
        aria-valuenow="50"
      />

      <div class="flex justify-between text-xs text-gray-500">
        <span>0</span>
        <span>50</span>
        <span>100</span>
      </div>
    </div>

    <div class="mt-6 p-3 bg-blue-50 border border-blue-200 rounded">
      <p class="text-sm text-blue-800">
        <iconify-icon icon="mdi:information" class="text-blue-600"></iconify-icon>
        Drag the slider to set the value
      </p>
    </div>
  </div>

  <style>
    /* Custom slider styling */
    .slider::-webkit-slider-thumb {
      appearance: none;
      width: 20px;
      height: 20px;
      background: #3b82f6;
      cursor: pointer;
      border-radius: 50%;
    }

    .slider::-moz-range-thumb {
      width: 20px;
      height: 20px;
      background: #3b82f6;
      cursor: pointer;
      border-radius: 50%;
      border: none;
    }

    .slider::-webkit-slider-thumb:hover {
      background: #2563eb;
    }

    .slider::-moz-range-thumb:hover {
      background: #2563eb;
    }
  </style>

  <script>
    // Store slider value globally for evaluation
    window.__sliderValue = 50;

    const slider = document.getElementById('slider');
    const valueDisplay = document.getElementById('value-display');

    // Update the display and global value when slider changes
    slider.addEventListener('input', function () {
      const value = parseInt(this.value);
      window.__sliderValue = value;
      valueDisplay.textContent = value;
      this.setAttribute('aria-valuenow', value);
    });

    // Also update on change event
    slider.addEventListener('change', function () {
      const value = parseInt(this.value);
      window.__sliderValue = value;
      valueDisplay.textContent = value;
    });
  </script>
</main>