@namespace Lumeo

<CascadingValue Value="_groupContext" IsFixed="false">
    <div role="group" aria-labelledby="@_groupContext.LabelId" class="@CssClass" @attributes="AdditionalAttributes">
        @ChildContent
    </div>
</CascadingValue>

@code {
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public string? Class { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object>? AdditionalAttributes { get; set; }

    private readonly SelectGroupContext _groupContext = new($"select-label-{Guid.NewGuid():N}");

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

    public record SelectGroupContext(string LabelId);
}
