@namespace Connected.Components
@typeparam T
@inherits DebouncedInput<T>

<CascadingValue Name="SubscribeToParentForm" Value="@SubscribeToParentForm" IsFixed="true">
    <InputControl Label="@Label"
                     Variant="@Variant"
                     HelperText="@HelperText"
                     HelperTextOnFocus="@HelperTextOnFocus"
                     CounterText="@GetCounterText()"
                     FullWidth="@FullWidth"
                     Class="@ClassList"
                     Error="@HasErrors"
                     ErrorText="@GetErrorText()"
                     ErrorId="@ErrorId"
                     Disabled="@Disabled"
                     Margin="@Margin"
                     Required="@Required"
                     ForId="@FieldId">
        <InputContent>
            <CascadingValue Name="SubscribeToParentForm" Value="false" IsFixed="true">
                @if (_mask == null)
                {
                    <Input T="string"
                              @ref="InputReference"
                              @attributes="CustomAttributes"
                              InputType="@InputType"
                              Lines="@Lines"
                              Variant="@Variant"
                              TextUpdateSuppression="@TextUpdateSuppression"
                              Value="@Text"
                              ValueChanged="(s) => SetTextAsync(s)"
                              Placeholder="@Placeholder"
                              Disabled=@Disabled
                              DisableUnderLine="@DisableUnderLine"
                              ReadOnly="@ReadOnly"
                              MaxLength="@MaxLength"
                              Adornment="@Adornment"
                              AdornmentText="@AdornmentText"
                              AdornmentIcon="@AdornmentIcon"
                              AdornmentColor="@AdornmentColor"
                              AdornmentAriaLabel="@AdornmentAriaLabel"
                              IconSize="@IconSize"
                              OnAdornmentClick="@OnAdornmentClick"
                              Error="@HasError"
                              ErrorId="@ErrorId"
                              Immediate="@Immediate"
                              Margin="@Margin"
                              OnBlur="@OnBlurred"
                              OnKeyDown="@InvokeKeyDown"
                              OnInternalInputChanged="OnChange"
                              OnKeyPress="@InvokeKeyPress"
                              OnKeyUp="@InvokeKeyUp"
                              KeyDownPreventDefault="KeyDownPreventDefault"
                              KeyPressPreventDefault="KeyPressPreventDefault"
                              KeyUpPreventDefault="KeyUpPreventDefault"
                              HideSpinButtons="true"
                              Clearable="@Clearable"
                              OnClearButtonClick="@OnClearButtonClick"
                              Pattern="@Pattern"/>
                }
                else
                {
                    <Mask @ref="_maskReference"
                             @attributes="CustomAttributes"
                             Mask="@_mask"
                             InputType="@InputType"
                             Lines="@Lines"
                             Variant="@Variant"
                             TextUpdateSuppression="@TextUpdateSuppression"
                             Value="@Text"
                             ValueChanged="OnMaskedValueChanged"
                             Placeholder="@Placeholder"
                             Disabled=@Disabled
                             DisableUnderLine="@DisableUnderLine"
                             ReadOnly="@ReadOnly"
                             MaxLength="@MaxLength"
                             Adornment="@Adornment"
                             AdornmentText="@AdornmentText"
                             AdornmentIcon="@AdornmentIcon"
                             AdornmentColor="@AdornmentColor"
                             IconSize="@IconSize"
                             OnAdornmentClick="@OnAdornmentClick"
                             Error="@HasError"
                             Immediate="@Immediate"
                             Margin="@Margin" OnBlur="@OnBlurred"
                             Clearable="@Clearable"
                             OnClearButtonClick="@OnClearButtonClick"/>
                }
            </CascadingValue>
        </InputContent>
    </InputControl>
</CascadingValue>