{# API #}
{%- set props = props | default([]) -%}
{%- set _breakpoint = props.breakpoint | default(null) -%}
{%- set _elementType = props.elementType | default('div') -%}
{%- set _id = props.id -%}
{%- set _isOpen = props.isOpen | default(false) -%}
{%- set _parent = props.parent | default(null) -%}

{# Class names #}
{%- set _rootClassName = _spiritClassPrefix ~ 'Collapse' -%}
{%- set _isOpenClassName = _isOpen ? 'is-open' : null -%}
{%- set _contentClassName = _spiritClassPrefix ~ 'Collapse__content' -%}

{# Attributes #}
{%- set _idAttr = _id ? 'id="' ~ _id | escape('html_attr') ~ '"' : null -%}
{%- set _dataBreakpointAttr = _breakpoint ? 'data-spirit-breakpoint="' ~ _breakpoint | escape('html_attr') ~ '"' : null -%}
{%- set _dataParentAttr = _parent ? 'data-spirit-parent="' ~ _parent | escape('html_attr') ~ '"' : null -%}

{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
{%- set _classNames = [ _rootClassName, _isOpenClassName, _styleProps.className ] -%}
{%- set _mainPropsWithoutId = props | filter((value, prop) => prop is not same as('id')) -%}

<{{ _elementType }}
    {{ mainProps(_mainPropsWithoutId) }}
    {{ styleProp(_styleProps) }}
    {{ _idAttr | raw }}
    {{ _dataBreakpointAttr | raw }}
    {{ _dataParentAttr | raw }}
    {{ classProp(_classNames) }}
>
    <{{ _elementType }} class="{{ _contentClassName }}">
        {%- block content %}{% endblock %}
    </{{ _elementType }}>
</{{ _elementType }}>
