{#
/**
 * @file
 * Vartheme BS5 Starter Kit implementation for the 'input' #type form element.
 *
 * Available properties:
 * - type: Specifies the type `<input>` element to display
 * - value: Specifies the value of the input element
 * - bs_form_control: Have class `.form-control` related to input type.
 * - bs_size: Set heights using classes like `.form-control-lg` and `.form-control-sm`.
 * - placeholder: The input placeholder attribute specifies a short hint that describes
 *                the expected value of an input field (a sample value or a short
 *                description of the expected format).
 * - input_utility_classes: An array of utility classes that can be used to add extra
 *                    Bootstrap utility classes or custom classes to this component.
 * 
 * Available attributes:
 * - attributes: HTML attributes for the input element.
 * - children: Optional additional rendered elements.
 *
 * Available slots:
 * - N/A
 *
 * @see template_preprocess_input()
 */
#}

{% set bs_form_control = bs_form_control ? ['form-control'] : [] %}
{% set bs_size = bs_size ? [bs_size] : [] %}
{% set input_utility_classes = input_utility_classes ?? [] %}
{% set classes = []|merge(bs_form_control)|merge(bs_size|merge(input_utility_classes)) %}

{# Change the type for the HTML <input> element. #}
{% if type %}
	{% set attributes = attributes.setAttribute('type', type) %}
{% endif %}

{# Set the value attribute with specifies an initial value for an input field. #}
{% if value %}
	{% set attributes = attributes.setAttribute('value', value) %}
{% endif %}

{# Set the placeholder attribute with specifies a short hint that describes the expected value of an input field. #}
{% if placeholder %}
	{% set attributes = attributes.setAttribute('placeholder', placeholder) %}
{% endif %}

<input{{ attributes.addClass(classes) }} />{{ children }}
