Skip to content

Add ProModal component (#9503)#12420

Open
msynk wants to merge 1 commit into
bitfoundation:developfrom
msynk:9503-blazorui-extras-promodal-ii
Open

Add ProModal component (#9503)#12420
msynk wants to merge 1 commit into
bitfoundation:developfrom
msynk:9503-blazorui-extras-promodal-ii

Conversation

@msynk
Copy link
Copy Markdown
Member

@msynk msynk commented Jun 1, 2026

closes #9503

Summary by CodeRabbit

  • New Features
    • Added a new ProModal component with advanced configuration options including positioning, sizing modes (full-width, full-height, full-size), draggable support, header/footer customization, scroll behavior control, overlay blocking, and dismissal callbacks.
    • ProModal demo page now available in the component library documentation showcasing multiple usage scenarios and configuration examples.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

Walkthrough

This PR introduces a new BitProModal component to the Bit.BlazorUI Extras library. The component wraps BitModal and adds 25+ configurable parameters for positioning, sizing, visibility state, header/footer/body content slots, close button behavior, and event callbacks. It includes complete demo coverage with 11 examples and integrates into the app navigation.

Changes

BitProModal Component

Layer / File(s) Summary
Component styling contract
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModalClassStyles.cs
BitProModalClassStyles class extends BitModalClassStyles with six nullable properties to customize CSS for header, close button, body, and footer regions.
Component parameters and lifecycle
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.razor.cs
BitProModal class defines 25+ [Parameter] properties controlling positioning (AbsolutePosition, Position, DragElementSelector), sizing (FullSize, FullWidth, FullHeight), visibility/behavior (IsOpen, Draggable, Blocking, Modeless, ModeFull, AutoToggleScroll), content slots (Header, HeaderText, Body, ChildContent, Footer, FooterText), close button (CloseIcon, CloseIconName, ShowCloseButton), and callbacks (OnOpen, OnDismiss, OnOverlayClick). Implements Open() and Close() methods that trigger OnOpen exactly once per opening via OnAfterRenderAsync.
Component markup
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.razor
Razor markup wraps BitModal and conditionally renders header (with optional close button using icon CSS classes), body (from Body or ChildContent), and footer (from Footer or FooterText), all connected to code-behind parameters and lifecycle.
Component styling and asset registration
src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.scss, src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss
BitProModal.scss defines BEM-style rules for the modal structure (flex container, overlay background), sticky header/footer regions (with z-index layering, padding, font weight), close button interactive states (hover/active colors), and scrollable body. Stylesheet is imported in extra-components.scss.
Demo page with 11 usage examples
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProModal/BitProModalDemo.razor, BitProModalDemo.razor.cs, BitProModalDemo.razor.scss
Demo page at /components/promodal showcases basic open, header/footer templates, advanced options (blocking/modeless/FullSize/FullWidth/FullHeight), absolute positioning with scroller selector, position presets (top/center/bottom), draggable behavior with custom drag element, event callbacks (OnOpen and OnDismiss focusing text fields), custom styles/classes, external close icon (FontAwesome), and RTL rendering. Code-behind provides parameter metadata lists and 11 code examples; demo SCSS adds layout and scoped style variants.
Navigation integration
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor, src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cs
ProModal entry is added to both the Home page Extras component list and the MainLayout nav items, each linking to /components/promodal.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A modal so pro, with parameters galore!
Open and close with style evermore,
Headers and footers in perfect array,
Draggable, positionable, ready to sway!
✨ Let the ProModal lead the display!

🚥 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 title clearly and specifically identifies the main change: adding the ProModal component to the BlazorUI Extras project.
Linked Issues check ✅ Passed The PR successfully adds the complete BitProModal component to the Extras project, including component markup, logic, styling, class styles, demo page, and navigation, fulfilling issue #9503.
Out of Scope Changes check ✅ Passed All changes are directly related to adding the ProModal component and its supporting infrastructure as required by issue #9503; no out-of-scope 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

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.

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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.razor.cs`:
- Around line 23-26: The XML doc for the Blocking parameter is incorrect: it
currently says “Whether the Modal can be light dismissed…”, but Blocking
actually prevents light-dismiss when true (overlay click handler returns early
when ModalParameters.Blocking is true). Update the summary for the Blocking
property in BitProModal (and the duplicated summaries in BitProModalDemo and any
BitModal references) to state that when true the modal cannot be light-dismissed
by clicking the overlay; when false overlay clicks allow dismissal. Ensure the
wording clearly indicates the boolean semantics (true = prevents light-dismiss,
false = allows it).

In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.scss`:
- Line 1: In BitProModal.scss update the `@import` to omit the .scss extension
(change the import of 'functions.scss' to 'functions') to satisfy the stylelint
rule scss/load-partial-extension; locate the `@import` line in BitProModal.scss
that references '../../../Bit.BlazorUI/Styles/functions.scss' and remove the
'.scss' suffix (or alternatively add/configure a stylelint suppression/baseline
for this rule if you intend to keep extensions across Extras files).
🪄 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: 839c5e64-71a6-48d0-8212-86f5b4be13b0

📥 Commits

Reviewing files that changed from the base of the PR and between 046d116 and 082ef02.

📒 Files selected for processing (10)
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.razor
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.razor.cs
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.scss
  • src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModalClassStyles.cs
  • src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-components.scss
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProModal/BitProModalDemo.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProModal/BitProModalDemo.razor.cs
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Extras/ProModal/BitProModalDemo.razor.scss
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Home/ComponentsSection.razor
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/MainLayout.razor.NavItems.cs

Comment on lines +23 to +26
/// <summary>
/// Whether the Modal can be light dismissed by clicking outside the Modal (on the overlay).
/// </summary>
[Parameter] public bool Blocking { get; set; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Locate BitModal's Blocking parameter and its summary
fd -t f 'BitModal.razor.cs' | xargs rg -nP -B3 'public bool Blocking'

Repository: bitfoundation/bitplatform

Length of output: 266


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Inspect BitModal's Blocking usage
fd -t f 'BitModal.razor.cs' | head -n 5 | while read -r f; do
  echo "=== $f: Blocking usages ==="
  rg -n --hidden -S 'Blocking' "$f" || true
done

# 2) Show overlay/dismiss related code paths in BitModal
fd -t f 'BitModal.razor.cs' | head -n 5 | while read -r f; do
  echo "=== $f: likely dismiss/overlay click ==="
  rg -n --hidden -S '(overlay|light|dismiss|click|Modeless|modeless)' "$f" || true
done

# 3) Inspect ProModal docs around Line 129 ("Blocking is ignored") and where Modeless/Blocking are applied
fd -t f 'BitProModal.razor.cs' | head -n 5 | while read -r f; do
  echo "=== $f: Modeless/Blocking docs ==="
  rg -n --hidden -S 'Modeless|Blocking is ignored|Blocking' "$f" || true
done

Repository: bitfoundation/bitplatform

Length of output: 2159


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Modal/BitModal.razor.cs"
nl -ba "$file" | sed -n '200,270p'

Repository: bitfoundation/bitplatform

Length of output: 112


🏁 Script executed:

#!/bin/bash
set -euo pipefail

bitmodal="src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Modal/BitModal.razor.cs"
promodal="src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.razor.cs"

echo "=== BitModal docs (top) ==="
cat -n "$bitmodal" | sed -n '20,130p'

echo "=== BitModal Blocking gate (dismiss/overlay) ==="
cat -n "$bitmodal" | sed -n '200,270p'

echo "=== BitProModal docs (Blocking/Modeless) ==="
cat -n "$promodal" | sed -n '1,170p'

Repository: bitfoundation/bitplatform

Length of output: 14109


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for the duplicated summary wording in the demo
fd -t f 'BitProModalDemo.razor.cs' | xargs -r rg -n 'Blocking|light dismissed|overlay' || true

# Find other occurrences of the same Blocking summary text
fd -t f | xargs -r rg -n 'Whether the Modal can be light dismissed by clicking outside' || true

Repository: bitfoundation/bitplatform

Length of output: 2318


Fix Blocking docs to match behavior (it prevents light-dismiss)

BitModal’s overlay click handler returns immediately when ModalParameters.Blocking is true, so overlay clicking won’t trigger dismissal; the current summary (“Whether the Modal can be light dismissed…”) is misleading. The same wording is duplicated in BitProModal and BitProModalDemo.

📝 Suggested wording
-    /// <summary>
-    /// Whether the Modal can be light dismissed by clicking outside the Modal (on the overlay).
-    /// </summary>
+    /// <summary>
+    /// When enabled, prevents the Modal from being light dismissed by clicking outside the Modal (on the overlay).
+    /// </summary>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// <summary>
/// Whether the Modal can be light dismissed by clicking outside the Modal (on the overlay).
/// </summary>
[Parameter] public bool Blocking { get; set; }
/// <summary>
/// When enabled, prevents the Modal from being light dismissed by clicking outside the Modal (on the overlay).
/// </summary>
[Parameter] public bool Blocking { get; set; }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.razor.cs`
around lines 23 - 26, The XML doc for the Blocking parameter is incorrect: it
currently says “Whether the Modal can be light dismissed…”, but Blocking
actually prevents light-dismiss when true (overlay click handler returns early
when ModalParameters.Blocking is true). Update the summary for the Blocking
property in BitProModal (and the duplicated summaries in BitProModalDemo and any
BitModal references) to state that when true the modal cannot be light-dismissed
by clicking the overlay; when false overlay clicks allow dismissal. Ensure the
wording clearly indicates the boolean semantics (true = prevents light-dismiss,
false = allows it).

@@ -0,0 +1,77 @@
@import '../../../Bit.BlazorUI/Styles/functions.scss';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Stylelint flags the .scss extension in @import.

scss/load-partial-extension reports this import. Note the rest of the Extras stylesheets (e.g. extra-components.scss) also use the extension, so this matches existing convention — either drop the extension here to satisfy the linter or confirm the rule is suppressed/baselined for these files before relying on the existing convention.

🎨 Option: drop extension to satisfy stylelint
-@import '../../../Bit.BlazorUI/Styles/functions.scss';
+@import '../../../Bit.BlazorUI/Styles/functions';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@import '../../../Bit.BlazorUI/Styles/functions.scss';
`@import` '../../../Bit.BlazorUI/Styles/functions';
🧰 Tools
🪛 Stylelint (17.12.0)

[error] 1-1: Unexpected extension ".scss" in @import (scss/load-partial-extension)

(scss/load-partial-extension)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/BlazorUI/Bit.BlazorUI.Extras/Components/ProModal/BitProModal.scss` at
line 1, In BitProModal.scss update the `@import` to omit the .scss extension
(change the import of 'functions.scss' to 'functions') to satisfy the stylelint
rule scss/load-partial-extension; locate the `@import` line in BitProModal.scss
that references '../../../Bit.BlazorUI/Styles/functions.scss' and remove the
'.scss' suffix (or alternatively add/configure a stylelint suppression/baseline
for this rule if you intend to keep extensions across Extras files).

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.

The BitProModal component is missing from the Extras project of the BlazorUI

1 participant