Skip to content

Add missing new Icon parameters to BitDateRangePicker (#12197)#12198

Merged
msynk merged 4 commits intobitfoundation:developfrom
msynk:12197-blazorui-daterangepicker-missing-new-icons
Mar 20, 2026
Merged

Add missing new Icon parameters to BitDateRangePicker (#12197)#12198
msynk merged 4 commits intobitfoundation:developfrom
msynk:12197-blazorui-daterangepicker-missing-new-icons

Conversation

@msynk
Copy link
Copy Markdown
Member

@msynk msynk commented Mar 19, 2026

closes #12197

Summary by CodeRabbit

  • New Features

    • DateRangePicker: fully customizable icons for navigation, today/clear/close, time-picker toggle, and time increment/decrement controls; supports multiple icon libraries.
  • Documentation

    • Demo updated with three new examples showing icon customizations (navigation and time-picker scenarios).
  • Tests

    • New unit tests covering icon rendering for all customizable controls.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 19, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fe28161a-0553-4b26-bcba-a0e52665900e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds per-control icon customization to BitDateRangePicker: 22 icon/iconName parameter pairs, template changes to compute icon CSS classes via BitIconInfo, demo examples showing external icons, and extensive unit tests asserting rendered icon classes.

Changes

Cohort / File(s) Summary
Component: Icon parameters
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs
Introduces 22 new icon/iconName parameter pairs (44 properties) for clear/close, go-to-today, month/year/year-range navigation, show/hide time picker, and start/end time increase/decrease controls.
Component: Icon rendering
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor
Replaced hardcoded <i> class strings with computed classes via BitIconInfo.From(...).GetCssClasses() and applied @Classes/@Styles continuations across clear, navigation, today, time toggle, and time step buttons.
Demo pages (markup)
src/BlazorUI/Demo/Client/.../BitDateRangePickerDemo.razor, .../BitDateRangePickerDemo.razor.samples.cs
Adds three new "External Icons" demo sections (FontAwesome and Bootstrap variants) showing navigation, go-to-today, and time-picker icon customizations; adjusts sample literals.
Demo code-behind / metadata
src/BlazorUI/Demo/Client/.../BitDateRangePickerDemo.razor.cs
Updates demo componentParameters metadata to include new BitIconInfo? and string? icon-name parameters and reorders some parameter entries for presentation.
Tests
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs
Adds numerous unit tests validating rendered CSS classes for new icon parameters (both *IconName and *Icon scenarios), including interaction for year-range navigation; several tests marked [Ignore].

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibble classes, soft and neat,

From chevrons small to today's sweet beat,
Twenty-two pairs I proudly bring,
Icons hop in—now let them sing! 🎶

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: adding missing new Icon parameters to BitDateRangePicker component.
Linked Issues check ✅ Passed The PR successfully adds missing Icon parameters and implementation to BitDateRangePicker, directly addressing the objective stated in issue #12197.
Out of Scope Changes check ✅ Passed All changes are focused on adding Icon parameters and demo/test coverage for BitDateRangePicker; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

Copy link
Copy Markdown
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 addresses #12197 by adding the missing BitIconInfo? Icon / string? IconName-style parameters to BitDateRangePicker so consumers can use external icon libraries for navigation, clear/close, and time-picker icons, aligning the component with other Bit.BlazorUI inputs.

Changes:

  • Added new icon + icon-name parameters to BitDateRangePicker and wired them into the rendered markup via BitIconInfo.From(...).GetCssClasses().
  • Expanded the demo page and sample snippets to show using the new icon parameters (FontAwesome + Bootstrap icons).
  • Added bUnit tests validating icon-name and BitIconInfo behaviors for the new parameters.

Reviewed changes

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

Show a summary per file
File Description
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs Adds tests for the new icon parameters (including some currently ignored tests).
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor.samples.cs Updates code samples to demonstrate new icon parameters.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor.cs Extends the demo’s parameter documentation list with the new icon parameters.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor Adds runnable demo examples for custom navigation/time-picker icons.
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs Introduces the new [Parameter] properties for the missing icon customization points.
src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor Applies the new parameters to the rendered <i> elements via computed icon CSS class variables.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs`:
- Around line 659-665: The XML summary for the ShowTimePickerAsOverlay parameter
incorrectly says "Show month picker…" — update the triple-slash summary above
the ShowTimePickerAsOverlay property in BitDateRangePicker.razor.cs to
accurately describe its purpose (e.g., "Show time picker on top of date range
picker when visible.") and make the same wording correction in the demo
parameter table where ShowTimePickerAsOverlay is documented so the public docs
match the property behavior; reference the ShowTimePickerAsOverlay property and
ensure any CallOnSet(OnSetParameters) attribute usages remain unchanged.

In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor`:
- Around line 299-304: The demo uses ShowTimePickerIcon and HideTimePickerIcon
but they only render in overlay mode; update the BitDateRangePicker instance in
BitDateRangePickerDemo to enable overlay by adding ShowTimePickerAsOverlay
(true) alongside ShowTimePicker, and make the matching change in
BitDateRangePickerDemo.razor.samples.cs so the sample data includes
ShowTimePickerAsOverlay as well; this ensures the ShowTimePickerIcon and
HideTimePickerIcon parameters are actually exercised in both the razor component
and its sample file.

In
`@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs`:
- Around line 692-776: Remove the [Ignore] attributes on the four tests and
adjust each RenderComponent<BitDateRangePicker> call to render the picker in
overlay mode and then open the overlay so the show/hide time-picker buttons are
actually rendered; specifically, in the
BitDateRangePickerShowTimePickerIconNameTest,
BitDateRangePickerShowTimePickerIconTest,
BitDateRangePickerHideTimePickerIconNameTest and
BitDateRangePickerHideTimePickerIconTest add the component parameter that
enables overlay rendering (e.g., the component's overlay-mode parameter such as
IsOverlay/UseOverlay/OpenOnFocus—whichever the BitDateRangePicker exposes) and
simulate opening the overlay (e.g., click the toggle element or call the
component method that opens the overlay) before querying for the "i" elements so
the ShowTimePickerIcon/HideTimePickerIcon assertions run against rendered
buttons.
- Around line 314-336: The test BitDateRangePickerNextMonthNavIconNameTest
currently only asserts the base icon class and misses the rotation helper used
as a fallback in BitDateRangePicker.razor; update the test so when iconName is
null (the default icon case) it also asserts that the rendered icon's ClassList
contains the rotation helper "bit-ico-r180" (in addition to "bit-icon--Up"), and
apply the same change to the other Next* and *Increase* default-icon tests
(e.g., NextYearNavIconNameTest / IncreaseMonthNavIconName tests) so they verify
both the base icon class (NextMonthNavIconName / NextYearNavIconName / Increase*
props) and the rotation helper class when relying on the component's default.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1819806a-9adb-4fb4-bc4d-5a232a2e8a08

📥 Commits

Reviewing files that changed from the base of the PR and between 484d6f6 and 7f9c473.

📒 Files selected for processing (6)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor.samples.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs

Copy link
Copy Markdown
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 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor.cs:684

  • The demo parameter table lists Styles as BitDateRangePickerClassStyles but its default value is null and the component parameter is nullable (BitDateRangePickerClassStyles?). This is inconsistent/misleading for consumers; update the displayed type to include ? (or adjust default/parameter type for consistency).
            Name = "Styles",
            Type = "BitDateRangePickerClassStyles",
            DefaultValue = "null",
            Description = "Custom CSS styles for different parts of the BitDateRangePicker.",
            Href = "#daterangepicker-class-styles",
            LinkType = LinkType.Link

@msynk msynk requested a review from Copilot March 20, 2026 08:46
@msynk
Copy link
Copy Markdown
Member Author

msynk commented Mar 20, 2026

@coderabbitai re-review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2026

@msynk Sure! I'll re-review the changes in this PR now.

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
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 6 out of 6 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs (2)

314-336: ⚠️ Potential issue | 🟡 Minor

Assert the rotation helper in the default “next” and “increase” cases.

The fallback classes for these paths are compound defaults in BitDateRangePicker.razor (for example Up bit-ico-r180 and ChevronDownSmall bit-ico-r180). The null rows here only assert the base icon class, so these tests still pass if the rotation helper disappears and the arrow points the wrong way.

Also applies to: 535-557, 639-664, 782-805, 872-895, 962-985, 1056-1075

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs`
around lines 314 - 336, The test BitDateRangePickerNextMonthNavIconNameTest only
asserts the base icon class for the null fallback and therefore misses verifying
the rotation helper (e.g. "bit-ico-r180") that is part of the compound default
in BitDateRangePicker.razor; update this test (and the other similar tests at
the listed locations) to assert both the base icon class and the expected
rotation helper when iconName is null by checking icon.ClassList contains both
expectedClass and the rotation class (e.g., "bit-ico-r180"), while leaving the
branch that supplies NextMonthNavIconName unchanged.

692-780: ⚠️ Potential issue | 🟡 Minor

These show/hide icon tests are still excluded from CI.

[Ignore] drops the only coverage for ShowTimePickerIcon and HideTimePickerIcon. This should be fixable now by rendering the picker in a deterministic overlay state and tagging the relevant buttons/icons through Classes instead of scanning every <i> element.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs`
around lines 692 - 780, Remove the [Ignore] attributes from the four tests
(BitDateRangePickerShowTimePickerIconNameTest,
BitDateRangePickerShowTimePickerIconTest,
BitDateRangePickerHideTimePickerIconNameTest,
BitDateRangePickerHideTimePickerIconTest), render the BitDateRangePicker in a
deterministic "overlay open" state instead of relying on loose JSInterop (e.g.,
supply the parameter or perform the action that opens the picker during
RenderComponent so the time-picker buttons are present), and change the element
lookup to target a specific CSS hook you add via the component parameters (use
Classes or a dedicated data-attribute on the ShowTimePicker/HideTimePicker
button/icon) rather than scanning all <i> elements; then assert presence of the
expected classes on the targeted element.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor`:
- Around line 299-313: The ClearButtonIcon isn't visible because ShowClearButton
only appears when the picker has a selected range; update the BitDateRangePicker
instance to seed Value with a non-empty date range so the clear button renders
on initial display and do the same in BitDateRangePickerDemo.razor.samples.cs
(ensure you set the Value property to a populated range that covers Start and
End so ClearButtonIcon is exercised while keeping ShowClearButton unchanged).

---

Duplicate comments:
In
`@src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs`:
- Around line 314-336: The test BitDateRangePickerNextMonthNavIconNameTest only
asserts the base icon class for the null fallback and therefore misses verifying
the rotation helper (e.g. "bit-ico-r180") that is part of the compound default
in BitDateRangePicker.razor; update this test (and the other similar tests at
the listed locations) to assert both the base icon class and the expected
rotation helper when iconName is null by checking icon.ClassList contains both
expectedClass and the rotation class (e.g., "bit-ico-r180"), while leaving the
branch that supplies NextMonthNavIconName unchanged.
- Around line 692-780: Remove the [Ignore] attributes from the four tests
(BitDateRangePickerShowTimePickerIconNameTest,
BitDateRangePickerShowTimePickerIconTest,
BitDateRangePickerHideTimePickerIconNameTest,
BitDateRangePickerHideTimePickerIconTest), render the BitDateRangePicker in a
deterministic "overlay open" state instead of relying on loose JSInterop (e.g.,
supply the parameter or perform the action that opens the picker during
RenderComponent so the time-picker buttons are present), and change the element
lookup to target a specific CSS hook you add via the component parameters (use
Classes or a dedicated data-attribute on the ShowTimePicker/HideTimePicker
button/icon) rather than scanning all <i> elements; then assert presence of the
expected classes on the targeted element.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9cf92349-ba81-4127-ae46-ae8f4b82ed01

📥 Commits

Reviewing files that changed from the base of the PR and between 484d6f6 and b460c9a.

📒 Files selected for processing (6)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/DateRangePicker/BitDateRangePicker.razor.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Inputs/DateRangePicker/BitDateRangePickerDemo.razor.samples.cs
  • src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Inputs/DateRangePicker/BitDateRangePickerTests.cs

Copy link
Copy Markdown
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 7 out of 7 changed files in this pull request and generated 2 comments.

Copy link
Copy Markdown
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 7 out of 7 changed files in this pull request and generated no new comments.

@msynk msynk merged commit 9a73e7e into bitfoundation:develop Mar 20, 2026
7 checks passed
@msynk msynk deleted the 12197-blazorui-daterangepicker-missing-new-icons branch March 20, 2026 11:49
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.

Missing new Icon implementation for the BitDateRangePicker component

2 participants