-
Notifications
You must be signed in to change notification settings - Fork 394
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
[dev-v5] Add checkbox component #3223
base: dev-v5
Are you sure you want to change the base?
[dev-v5] Add checkbox component #3223
Conversation
d4d01fc
to
a7bc5aa
Compare
if (HasLabel()) | ||
{ | ||
// When the id is not provided, generate a unique id. This allow to use the label for. | ||
Id ??= $"checkbox-{Identifier.NewId()}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary to add a prefix. You can use Identifier.NewId()
.
If the developer wants to know where his component is, he can set a custom ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the next commit
<FluentCheckbox Shape="@CheckboxShape.Square" Label="Square disabled checked" Disabled="true" Checked="true" /> | ||
<FluentCheckbox Shape="@CheckboxShape.Circular" Label="Circular disabled checked" Disabled="true" Checked="true" /> | ||
|
||
<FluentCheckbox Shape="@CheckboxShape.Square" Label="Square disabled unchecked" Disabled="true" Checked="false" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't display all possibilities: check/uncheck... The user can click on it to display the different views. So only a Square
and a Circular
checkbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the next commit
* Wait for this PR to delete the code. | ||
* https://github.com/microsoft/fluentui/pull/33144 | ||
*/ | ||
export function ObserveAttributeChanges(element: HTMLElement): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this file and use the global function.
if (firstRender)
{
await JSRuntime.InvokeVoidAsync("Microsoft.FluentUI.Blazor.Utilities.Attributes.observeAttributeChange", Element, "indeterminate", "boolean", "", true); // Force to refresh the Checked when Indeterminate is updated.
await JSRuntime.InvokeVoidAsync("Microsoft.FluentUI.Blazor.Utilities.Attributes.observeAttributeChange", Element, "checked", "boolean");
}
} | ||
|
||
result = null; | ||
validationErrorMessage = "The provided value is not a valid boolean."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is it possible?
- Either the value has to be defined by us and if an error is detected we can throw an exception.
- Either this case is possible and we need to use the localisation engine (we cannot hardcode strings)
a3d905c
to
7ffc94d
Compare
Updated CheckboxThreeStates.razor to include additional FluentCheckbox components and modify existing ones. Renamed variables and added new ones in the @code section. Modified OnInitializedAsync and SetCheckStateChangedAsync methods in FluentCheckbox.razor.cs to handle value changes more effectively.
Pull Request
π Description
π« Issues
π©βπ» Reviewer Notes
π Test Plan
β Checklist
General
Component-specific
β Next Steps