@namespace Lumeo

<div class="@CssClass"
     aria-expanded="@Context.IsOpen"
     @onmouseenter="() => Context.RequestOpen.InvokeAsync()"
     @onmouseleave="() => Context.RequestClose.InvokeAsync()"
     @onclick="() => Context.RequestTogglePin.InvokeAsync()"
     @attributes="AdditionalAttributes">
    @ChildContent
</div>

@code {
    [CascadingParameter] public HoverCard.HoverCardContext Context { get; set; } = default!;
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public string? Class { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object>? AdditionalAttributes { get; set; }

    private string CssClass => $"inline-flex {Class}".Trim();
}
