-
-
Notifications
You must be signed in to change notification settings - Fork 264
Apply BitLabel improvements (#13081) #13084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
msynk
merged 1 commit into
bitfoundation:develop
from
msynk:13081-blazorui-label-improvements
Sep 1, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
373 changes: 373 additions & 0 deletions
373
src/BlazorUI/Bit.BlazorUI/Components/Utilities/Label/BitLabel.cs
Large diffs are not rendered by default.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/BlazorUI/Bit.BlazorUI/Components/Utilities/Label/BitLabel.razor
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
src/BlazorUI/Bit.BlazorUI/Components/Utilities/Label/BitLabel.razor.cs
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/BlazorUI/Bit.BlazorUI/Components/Utilities/Label/BitLabelClassStyles.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| namespace Bit.BlazorUI; | ||
|
|
||
| /// <summary> | ||
| /// The custom CSS classes/styles for the different parts of the <see cref="BitLabel"/> component. | ||
| /// </summary> | ||
| public class BitLabelClassStyles | ||
| { | ||
| /// <summary> | ||
| /// Custom CSS classes/styles for the root element of the label. | ||
| /// </summary> | ||
| public string? Root { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes/styles for the required indicator of the label. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// The indicator is the element the asterisk - or whatever <see cref="BitLabel.RequiredText"/> or | ||
| /// <see cref="BitLabel.RequiredTemplate"/> puts in its place - is rendered into, and it only exists while | ||
| /// <see cref="BitLabel.Required"/> is set. | ||
| /// </remarks> | ||
| public string? RequiredIndicator { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes/styles for the optional indicator of the label. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// The indicator is the element the "(optional)" text - or whatever <see cref="BitLabel.OptionalText"/> or | ||
| /// <see cref="BitLabel.OptionalTemplate"/> puts in its place - is rendered into, and it only exists while | ||
| /// <see cref="BitLabel.Optional"/> is set and <see cref="BitLabel.Required"/> is not. | ||
| /// </remarks> | ||
| public string? OptionalIndicator { get; set; } | ||
| } |
181 changes: 181 additions & 0 deletions
181
src/BlazorUI/Bit.BlazorUI/Components/Utilities/Label/BitLabelParams.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| namespace Bit.BlazorUI; | ||
|
|
||
| /// <summary> | ||
| /// The parameters for the <see cref="BitLabel"/> component. | ||
| /// </summary> | ||
| public class BitLabelParams : BitComponentBaseParams, IBitComponentParams | ||
| { | ||
| /// <summary> | ||
| /// Represents the parameter name used to identify the BitLabel cascading parameters within BitParams. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This constant is typically used when referencing or accessing the BitLabel value in | ||
| /// parameterized APIs or configuration settings. Using this constant helps ensure consistency and reduces the risk | ||
| /// of typographical errors. | ||
| /// </remarks> | ||
| public const string ParamName = $"{nameof(BitParams)}.{nameof(BitLabel)}"; | ||
|
|
||
|
|
||
|
|
||
| public string Name => ParamName; | ||
|
|
||
|
|
||
|
|
||
| /// <summary> | ||
| /// Custom CSS classes for the different parts of the label. | ||
| /// </summary> | ||
| public BitLabelClassStyles? Classes { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The general color of the label. | ||
| /// </summary> | ||
| public BitColor? Color { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The custom html element used for the root node. The default is "label". | ||
| /// </summary> | ||
| public string? Element { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Prevents the text of the label from being selected. | ||
| /// </summary> | ||
| public bool? NoSelect { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Keeps the label on a single line and truncates the overflow with an ellipsis. | ||
| /// </summary> | ||
| public bool? NoWrap { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Whether the associated field is optional, which renders an indicator after the content of the label. | ||
| /// </summary> | ||
| public bool? Optional { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The text of the optional indicator of the label. The default is "(optional)". | ||
| /// </summary> | ||
| public string? OptionalText { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Whether the associated field is required, which renders an indicator after the content of the label. | ||
| /// </summary> | ||
| public bool? Required { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The text of the required indicator of the label. The default is "*". | ||
| /// </summary> | ||
| public string? RequiredText { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The size of the label. | ||
| /// </summary> | ||
| public BitSize? Size { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Custom CSS styles for the different parts of the label. | ||
| /// </summary> | ||
| public BitLabelClassStyles? Styles { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Removes the label from the page while keeping it available to assistive technologies. | ||
| /// </summary> | ||
| public bool? VisuallyHidden { get; set; } | ||
|
|
||
|
|
||
|
|
||
| /// <summary> | ||
| /// Updates the properties of the specified <see cref="BitLabel"/> instance with any values that have been set on | ||
| /// this object, if those properties have not already been set on the <see cref="BitLabel"/>. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Only properties that have a value set and have not already been set on the <paramref name="bitLabel"/> will be updated. | ||
| /// This method does not overwrite existing values on <paramref name="bitLabel"/>. | ||
| /// </remarks> | ||
| /// <param name="bitLabel"> | ||
| /// The <see cref="BitLabel"/> instance whose properties will be updated. Cannot be null. | ||
| /// </param> | ||
| public void UpdateParameters(BitLabel bitLabel) | ||
| { | ||
| if (bitLabel is null) return; | ||
|
|
||
| UpdateBaseParameters(bitLabel); | ||
|
|
||
| if (Classes is not null && bitLabel.HasNotBeenSet(nameof(Classes))) | ||
| { | ||
| bitLabel.Classes = Classes; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Color.HasValue && bitLabel.HasNotBeenSet(nameof(Color))) | ||
| { | ||
| bitLabel.Color = Color.Value; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Element.HasValue() && bitLabel.HasNotBeenSet(nameof(Element))) | ||
| { | ||
| bitLabel.Element = Element; | ||
| } | ||
|
|
||
| if (NoSelect.HasValue && bitLabel.HasNotBeenSet(nameof(NoSelect))) | ||
| { | ||
| bitLabel.NoSelect = NoSelect.Value; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (NoWrap.HasValue && bitLabel.HasNotBeenSet(nameof(NoWrap))) | ||
| { | ||
| bitLabel.NoWrap = NoWrap.Value; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Optional.HasValue && bitLabel.HasNotBeenSet(nameof(Optional))) | ||
| { | ||
| bitLabel.Optional = Optional.Value; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (OptionalText.HasValue() && bitLabel.HasNotBeenSet(nameof(OptionalText))) | ||
| { | ||
| bitLabel.OptionalText = OptionalText; | ||
| } | ||
|
|
||
| if (Required.HasValue && bitLabel.HasNotBeenSet(nameof(Required))) | ||
| { | ||
| bitLabel.Required = Required.Value; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (RequiredText.HasValue() && bitLabel.HasNotBeenSet(nameof(RequiredText))) | ||
| { | ||
| bitLabel.RequiredText = RequiredText; | ||
| } | ||
|
|
||
| if (Size.HasValue && bitLabel.HasNotBeenSet(nameof(Size))) | ||
| { | ||
| bitLabel.Size = Size.Value; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
|
|
||
| if (Styles is not null && bitLabel.HasNotBeenSet(nameof(Styles))) | ||
| { | ||
| bitLabel.Styles = Styles; | ||
|
|
||
| bitLabel.StyleBuilder.Reset(); | ||
| } | ||
|
|
||
| if (VisuallyHidden.HasValue && bitLabel.HasNotBeenSet(nameof(VisuallyHidden))) | ||
| { | ||
| bitLabel.VisuallyHidden = VisuallyHidden.Value; | ||
|
|
||
| bitLabel.ClassBuilder.Reset(); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.