{# ================================================================================ Wrapper Components (Kida-Native) ================================================================================ Slot-based wrapper components using {% def %} with {% slot %}. Use with {% call %} to inject custom content. Components: - card_wrapper(css_class, href, show_border): Flexible card wrapper - panel(variant, title, icon_name, collapsible): Callouts/alerts - section_wrapper(title, icon_name, collapsible, open, id): Section with header - details_card(summary, css_class, open, data_attrs): Collapsible details card ================================================================================ #} {# ============================================================================= CARD WRAPPER COMPONENT A flexible wrapper using Kida's {% slot %} pattern. ============================================================================= #} {% def card_wrapper(css_class='', href=none, show_border=true) %} {% let border_class = 'gradient-border' if show_border else '' %}
{% if href %} {% slot %} {% else %}
{% slot %}
{% end %}
{% end %} {# ============================================================================= PANEL COMPONENT Styled panel/callout for alerts, notes, tips, warnings. ============================================================================= #} {% def panel(variant='info', title=none, icon_name=none, collapsible=false) %} {% let icons = {'info': 'info', 'warning': 'warning', 'danger': 'x-circle', 'success': 'check-circle', 'tip': 'lightbulb'} %} {% let panel_icon = icon_name ?? icons[variant] ?? 'info' %} {% let panel_title = (title ?? variant) | title %} {% if collapsible %}
{{ icon(panel_icon, size=18, css_class='panel-icon') }} {{ panel_title }}
{% slot %}
{% else %} {% end %} {% end %} {# ============================================================================= SECTION WRAPPER COMPONENT Wraps content in a section with optional header, icon, and collapsible behavior. ============================================================================= #} {% def section_wrapper(title, icon_name=none, css_class='', collapsible=false, open=true, id=none) %} {% let id_attr = ' id="' ~ id ~ '"' if id else '' %} {% if collapsible %}
{% if icon_name %}{{ icon(icon_name, size=20, css_class='section-wrapper-icon') }}{% end %} {{ title }} {{ icon('chevron-down', size=16) }}
{% slot %}
{% else %}
{% if icon_name %}{{ icon(icon_name, size=20, css_class='section-wrapper-icon') }}{% end %}

{{ title }}

{% slot %}
{% end %} {% end %} {# ============================================================================= DETAILS CARD COMPONENT Collapsible card with summary/details pattern. ============================================================================= #} {% def details_card(summary, css_class='', open=false, data_attrs=none) %} {% let data_str = '' %} {% if data_attrs %} {% for k, v in data_attrs.items() %} {% let data_str = data_str ~ ' data-' ~ k ~ '="' ~ v ~ '"' %} {% end %} {% end %}
{{ summary | safe }}
{% slot %}
{% end %}