2024-08-05 19:12:52 +00:00
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
|
2024-08-21 06:30:01 +00:00
|
|
|
namespace AIStudio.Components;
|
2024-08-05 19:12:52 +00:00
|
|
|
|
|
|
|
|
public partial class MudTextSwitch : ComponentBase
|
|
|
|
|
{
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string Label { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool Disabled { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool Value { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback<bool> ValueChanged { get; set; }
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public Color Color { get; set; } = Color.Primary;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public Func<bool, string?> Validation { get; set; } = _ => null;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string LabelOn { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public string LabelOff { get; set; } = string.Empty;
|
2026-09-14 14:30:17 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether to render this switch in its compact form.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// For places which stack several of these switches above other content, such as the data source
|
|
|
|
|
/// selection the chat opens from its footer. The roomy form stays the default, so that nothing
|
|
|
|
|
/// changes where this was never asked for.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool Dense { get; set; }
|
|
|
|
|
|
|
|
|
|
private string FieldClasses => this.Dense ? "mb-2 text-switch-dense" : "mb-3";
|
|
|
|
|
|
|
|
|
|
private Size SwitchSize => this.Dense ? Size.Small : Size.Medium;
|
2024-08-05 19:12:52 +00:00
|
|
|
}
|