@namespace Lumeo
@typeparam TItem

@* No Expandable gate here — when consumers place this component inside <ToolbarContent>
   they've already opted in; the Expandable flag on DataGrid only gates the default auto-render. *@
@if (Context is not null)
{
    <Button Variant="Button.ButtonVariant.Ghost" Size="Button.ButtonSize.Icon"
            OnClick="@(() => Context.OnToggleExpanded.InvokeAsync())"
            title="@(Context.IsExpanded ? Context.Localizer["DataGrid.ExitFullscreen"] : Context.Localizer["DataGrid.ExpandFullscreen"])"
            aria-label="@(Context.IsExpanded ? Context.Localizer["DataGrid.ExitFullscreen"] : Context.Localizer["DataGrid.ExpandFullscreen"])">
        @if (Context.IsExpanded)
        {
            <Blazicon Svg="Lucide.Minimize2" class="h-4 w-4" />
        }
        else
        {
            <Blazicon Svg="Lucide.Maximize2" class="h-4 w-4" />
        }
    </Button>
}

@code {
    [CascadingParameter] public DataGridToolbarContext<TItem>? Context { get; set; }
}
