@namespace Connected.Components
@using Connected.Annotations;
@inherits BooleanInput<T>
@typeparam T

<label class="@Classname" @onkeydown="@HandleKeyDown" id="@_elementId">
    <span class="switch-span mud-flip-x-rtl">
        <span tabindex="0" class="@SwitchClassname">
            <span class="switch-button">
                <input tabindex="-1" @attributes="CustomAttributes" aria-checked="@((BoolValue == true).ToString().ToLower())" aria-readonly="@(Disabled.ToString().ToLower())" type="checkbox" class="switch-input" checked="@BoolValue" @onchange="@OnChange" disabled="@Disabled" @onclick:preventDefault="@ReadOnly"/>
                <span class="switch-thumb d-flex align-center justify-center">
                    @if (!string.IsNullOrEmpty(ThumbIcon))
                    {
                        <Icon Color="@ThumbIconColor" Icon="@ThumbIcon" Style=" height:16px; width:16px;" />
                    }
                </span>
            </span>
        </span>
        <span class="@TrackClassname"></span>
    </span>
    @if (!String.IsNullOrEmpty(Label))
    {
        <Text>@Label</Text>
    }
    @if (ChildContent != null)
    {
        <Text>
            @ChildContent
        </Text>
    }
</label>

@code
{
    [Parameter]
    [Category(CategoryTypes.FormComponent.Behavior)]
    public RenderFragment ChildContent { get; set; }
}

