Skip to content
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

Draft
wants to merge 2 commits into
base: dev-v5
Choose a base branch
from

Conversation

AClerbois
Copy link
Contributor

Pull Request

πŸ“– Description

🎫 Issues

πŸ‘©β€πŸ’» Reviewer Notes

πŸ“‘ Test Plan

βœ… Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new component
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

⏭ Next Steps

@AClerbois AClerbois changed the title Users/aclerbois/dev v5/fluentcheckbox [dev-v5] Add checkbox component Jan 22, 2025
@AClerbois AClerbois force-pushed the users/aclerbois/dev-v5/fluentcheckbox branch 3 times, most recently from d4d01fc to a7bc5aa Compare January 22, 2025 17:14
if (HasLabel())
{
// When the id is not provided, generate a unique id. This allow to use the label for.
Id ??= $"checkbox-{Identifier.NewId()}";
Copy link
Collaborator

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.

Copy link
Contributor Author

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" />
Copy link
Collaborator

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.

Copy link
Contributor Author

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 {
Copy link
Collaborator

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.";
Copy link
Collaborator

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)

@AClerbois AClerbois force-pushed the users/aclerbois/dev-v5/fluentcheckbox branch from a3d905c to 7ffc94d Compare January 26, 2025 17:13
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants