Skip to content

Commit

Permalink
Fixed checkbox colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Jangli authored and Jeffrey Jangli committed Oct 24, 2023
1 parent 5ab6c66 commit 6012b71
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
<MudCheckBox Class="mx-4" Dense
@bind-Checked="@_allSelected" @onclick="@SelectAllItems"
Size="@CheckBoxSize"
Color="@CheckBoxCheckedColor"
UnCheckedColor="@CheckBoxUnCheckedColor" />
Color="@EffectiveCheckBoxCheckedColor"
UnCheckedColor="@EffectiveCheckBoxUnCheckedColor" />

<MudText Typo="GetTypo()" Color="@TextColor">@SelectAllText</MudText>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,18 @@ protected internal void SetSearchString(T value)
/// <summary>
/// The color of the checked checkbox. It supports the theme colors.
/// </summary>
/// <remarks>The default is <see cref="Color.Primary"/></remarks>
/// <remarks>The default is <see cref="MudCheckBox.Color"/></remarks>
[Parameter]
[Category(CategoryTypes.List.Behavior)]
public Color CheckBoxCheckedColor { get; set; } = Color.Primary;
public Color? CheckBoxCheckedColor { get; set; } = null;

/// <summary>
/// The color of the unchecked checkbox. It supports the theme colors.
/// </summary>
/// <remarks>The default is <see cref="Color.Default"/></remarks>
/// <remarks>The default is <see cref="MudCheckBox.Color"/></remarks>
[Parameter]
[Category(CategoryTypes.Radio.Appearance)]
public Color CheckBoxUnCheckedColor { get; set; } = Color.Default;
public Color? CheckBoxUnCheckedColor { get; set; } = null;

/// <summary>
/// The size of the checkbox.
Expand Down Expand Up @@ -1484,5 +1484,8 @@ protected bool HasEligibleItems()
protected internal Typo GetTypo() => Dense == Dense.Slim || Dense == Dense.Superslim ? Typo.body2 : Typo.body1;

protected internal ValueTask ScrollToMiddleAsync(MudComboBoxItem<T> item) => item is not null ? ScrollManagerExtended.ScrollToMiddleAsync(_popoverId, item.ItemId) : ValueTask.CompletedTask;

protected internal Color EffectiveCheckBoxCheckedColor => CheckBoxCheckedColor ?? Color;
protected internal Color EffectiveCheckBoxUnCheckedColor => CheckBoxUnCheckedColor ?? Color;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<MudCheckBox Class="me-4" Dense
@bind-Checked="@Selected" @onclick="@HandleOnClick"
Size="@(CheckBoxSize ?? MudComboBox.CheckBoxSize)"
Color="@(CheckBoxCheckedColor ?? MudComboBox.CheckBoxCheckedColor)"
UnCheckedColor="@(CheckBoxUnCheckedColor ?? MudComboBox.CheckBoxUnCheckedColor)"
Color="@(CheckBoxCheckedColor ?? MudComboBox.EffectiveCheckBoxCheckedColor)"
UnCheckedColor="@(CheckBoxUnCheckedColor ?? MudComboBox.EffectiveCheckBoxUnCheckedColor)"
Disabled="@Disabled" />
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,8 @@ protected void SyncSelected()

protected async Task HandleOnClick()
{
//Selected = !Selected;
await MudComboBox.ToggleOption(this, !Selected);
//await MudComboBox?.SelectOption(Value);
await InvokeAsync(StateHasChanged);
//if (MudComboBox.MultiSelection == false)
//{
// await MudComboBox?.CloseMenu();
//}
//else
//{
// await MudComboBox.FocusAsync();
//}
await MudComboBox.FocusAsync();
await OnClick.InvokeAsync();
}
Expand Down

0 comments on commit 6012b71

Please sign in to comment.