{% extends 'forms/base_widget.html' %}

{% block html %}
    <div class="time-widget">
        {# the hidden field has autofocus on purpose to prevent our JS from focusing the time picker #}
        <input type="hidden" name="{{ field.name }}" id="{{ field.id }}-timestorage" autofocus
               {% if field.data is not none %}value="{{ field._value() }}"{% endif %}
               {{ input_args | html_params }}>
        <span id="{{ field.id }}"></span>
    </div>
{% endblock %}

{% block javascript %}
    <script>
        setupDurationWidget({
            fieldId: {{ field.id | tojson }},
            required: {{ input_args.required | default(false) | tojson }},
            disabled: {{ input_args.disabled | default(false) | tojson }},
        });
    </script>
{% endblock %}
