Skip to content

Add datepicker component#58

Merged
albx merged 5 commits intomainfrom
feature/23-datepicker
Nov 6, 2025
Merged

Add datepicker component#58
albx merged 5 commits intomainfrom
feature/23-datepicker

Conversation

@albx
Copy link
Owner

@albx albx commented Nov 4, 2025

This pull request introduces a new BitDatepicker form component to the codebase, supporting both DateTime and DateOnly types. The implementation includes the component itself, its code-behind logic, comprehensive unit tests, a Storybook story for documentation and demonstration, and a minor update to the solution file for Visual Studio compatibility. The most important changes are summarized below:

New Component Implementation

  • Added the BitDatepicker generic component (BitDatepicker.razor and BitDatepicker.razor.cs), supporting date selection for both DateTime and DateOnly types, and enforcing type safety with clear error handling for unsupported types. [1] [2]
  • Updated BitFormComponentBase<T> to use the correct type check for supported types, ensuring consistent validation across form components.

Testing

  • Introduced comprehensive unit tests for the new date picker, covering correct value setting for both DateTime and DateOnly, as well as type validation and error handling.
  • Added a rendering test to verify the default HTML markup output of the BitDatepicker component.

Documentation & Stories

  • Added a Storybook story for BitDatepicker, providing interactive documentation and usage examples for the component in the UI library.

@albx albx linked an issue Nov 4, 2025 that may be closed by this pull request
@albx albx marked this pull request as ready for review November 6, 2025 13:08
@albx albx requested a review from Copilot November 6, 2025 13:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new BitDatepicker component to the BitBlazor form components library. The component provides date selection functionality with support for both DateTime and DateOnly types, integrating with Blazor's form validation system and Bootstrap Italia styling.

Key Changes:

  • Introduces BitDatepicker<T> component with support for DateTime and DateOnly types
  • Refactors BitFormComponentBase to use a new ComponentType property for type validation
  • Adds comprehensive test coverage with both rendering and behavior tests
  • Includes extensive documentation with usage examples and best practices

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/BitBlazor/Form/Datepicker/BitDatepicker.razor Razor markup for the datepicker component using InputDate internally
src/BitBlazor/Form/Datepicker/BitDatepicker.razor.cs Code-behind defining supported types and field prefix
src/BitBlazor/Form/BitFormComponentBase.cs Refactored to use ComponentType property instead of inline type extraction
tests/BitBlazor.Test/Form/Datepicker/BitDatepickerTest.Rendering.razor Rendering tests verifying HTML output
tests/BitBlazor.Test/Form/Datepicker/BitDatepickerTest.Behaviors.cs Behavior tests for value binding and type validation
stories/BitBlazor.Stories/Components/Stories/Form/BitDatepicker.stories.razor Storybook integration for component showcase
docs/form/datepicker.md Comprehensive documentation with examples
docs/form/form-components.md Updated component listing
docs/README.md Added datepicker to main documentation index
BitBlazor.sln Visual Studio version metadata update
Comments suppressed due to low confidence (1)

src/BitBlazor/Form/BitFormComponentBase.cs:81

  • Corrected spelling of 'costructor' to 'constructor'.
    /// This property will validate the <typeparamref name="T"/> type in the costructor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Nov 6, 2025

@albx I've opened a new pull request, #60, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 6, 2025

@albx I've opened a new pull request, #61, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/BitBlazor/Form/BitFormComponentBase.cs:81

  • Corrected spelling of 'costructor' to 'constructor'.
    /// This property will validate the <typeparamref name="T"/> type in the costructor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@albx albx merged commit 828e3a6 into main Nov 6, 2025
5 checks passed
@albx albx deleted the feature/23-datepicker branch November 6, 2025 13:27
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.

[FEATURE] Add Datepicker Component

2 participants