{%- set class_name = [
"f-checkbox",
"d-inline-flex align-items-center gap-2 u-posr",
props.type == "radio" ? "--radio" : "--checkbox",
props.disabled == true ? "--disabled" : null,
props.extra_class ? props.extra_class : null,
]|join(' ')|trim -%}
{%- set attrs = [
'class="' ~ class_name ~ '"',
] -%}
{%- set attrs = attrs|join(' ')|trim -%}
{# Input attrs #}
{%- set class_name_input = [
"f-checkbox__input",
"u-posa",
]|join(' ')|trim -%}
{%- set attrs_input = [
'class="' ~ class_name_input ~ '"',
] -%}
{% set type = props.type == "radio" ? "radio" : "checkbox" %}
{%- set attrs_input = attrs_input|merge(['type="' ~ type ~ '"']) -%}
{%- if props.id is defined %}
{%- set attrs_input = attrs_input|merge(['id="' ~ props.id ~ '"']) -%}
{%- endif -%}
{%- if props.required == true %}
{%- set attrs_input = attrs_input|merge(['required']) -%}
{%- endif -%}
{%- if props.value is defined %}
{%- set attrs_input = attrs_input|merge(['value="' ~ props.value ~ '"']) -%}
{%- endif -%}
{%- if props.checked == true %}
{% set attrs_input = attrs_input|merge(['checked="checked"']) %}
{%- endif -%}
{%- if props.disabled == true %}
{% set attrs_input = attrs_input|merge(['disabled']) %}
{%- endif -%}
{%- if props.name is defined %}
{% set attrs_input = attrs_input|merge(['name=' ~ props.name ~ '']) %}
{%- endif -%}
{%- if props.data is defined -%}
{%- set data_attrs = [] -%}
{%- for key, attribute in props.data -%}
{%- set data_attrs = data_attrs|merge(['data-' ~ key ~ '="' ~ attribute ~ '"']) -%}
{%- endfor -%}
{%- set data_attrs = data_attrs|join(' ')|trim -%}
{%- set attrs_input = attrs_input|merge([data_attrs]) -%}
{%- endif -%}
{%- set attrs_input = attrs_input|join(' ')|trim -%}
<label {{ attrs|raw }}>
<input {{ attrs_input|raw }}>
<span class="f-checkbox__visual flex-shrink-0 d-flex align-items-center justify-content-center">
{% include "@Images/svg/check.svg" %}
</span>
<div class="f-checkbox__body d-flex flex-column">
<span class="f-checkbox__title u-color-primary u-fz-sm u-fw-600">
{% block content %}
{% if props.label %}
{{ props.label|raw }}
{% endif %}
{% endblock %}
{% if props.count %}
<span class="f-checkbox__count u-fw-400">({{ props.count }})</span>
{% endif %}
</span>
{% if props.description %}
<div class="f-checkbox__description u-fz-xs">{{ props.description|raw }}</div>
{% endif %}
</div>
{% include "@Components/fields/error-field/error-field.twig" with {props: {}} %}
</label>