Conversation
There was a problem hiding this comment.
Greptile Overview
Summary
This PR adds a complete primitive Dialog component implementation to Reflex's Radix UI primitives collection. The change introduces a new `RadixPrimitiveTriggerComponent` base class in `base.py` that handles trigger components with special click event behavior, mirroring the existing pattern from the themes module. This base class automatically wraps children in a Flex component when they have `on_click` event handlers to prevent them from overriding the primitive's internal trigger functionality.The main addition is a comprehensive Dialog component in dialog.py that provides all essential dialog elements: Root, Portal, Overlay, Trigger, Content, Title, Description, and Close. These primitive components offer lower-level control compared to the existing themes-based dialog, exposing additional props like force_mount, container, modal, and as_child that aren't available in the themes version. The implementation follows established patterns from other primitive components in the codebase with proper inheritance structure and event handling.
The component is properly integrated into the lazy loading system through updates to __init__.py and includes updated TypeScript type definitions in pyi_hashes.json. This addition completes the suite of fundamental UI primitives in Reflex, providing developers with maximum flexibility for modal dialog implementations while maintaining consistency with the existing architectural patterns.
Important Files Changed
Changed Files
| Filename | Score | Overview |
|---|---|---|
| reflex/components/radix/primitives/base.py | 5/5 | Adds RadixPrimitiveTriggerComponent base class with click event handling logic |
| reflex/components/radix/primitives/dialog.py | 5/5 | Complete primitive Dialog component implementation with all dialog elements |
| reflex/components/radix/primitives/init.py | 4/5 | Registers new dialog component in lazy loading system through manual dictionary merge |
| pyi_hashes.json | 5/5 | Updates TypeScript definition hashes for new and modified primitive components |
Confidence score: 5/5
- This PR is safe to merge with minimal risk as it adds well-structured new functionality without modifying existing behavior
- Score reflects clean architectural implementation following established patterns and comprehensive component coverage
- No files require special attention as all changes follow existing codebase conventions
Sequence Diagram
sequenceDiagram
participant User
participant DialogTrigger as "Dialog.Trigger"
participant DialogRoot as "Dialog.Root"
participant DialogPortal as "Dialog.Portal"
participant DialogOverlay as "Dialog.Overlay"
participant DialogContent as "Dialog.Content"
participant DialogClose as "Dialog.Close"
User->>DialogTrigger: "Click trigger button"
DialogTrigger->>DialogRoot: "Trigger open state change"
DialogRoot->>DialogRoot: "Set open=true"
DialogRoot->>DialogPortal: "Create portal container"
DialogPortal->>DialogOverlay: "Mount overlay layer"
DialogOverlay->>DialogContent: "Display dialog content"
Note over DialogContent: Dialog content with title, description rendered
User->>DialogClose: "Click close button"
DialogClose->>DialogRoot: "Trigger close state change"
DialogRoot->>DialogRoot: "Set open=false"
DialogRoot->>DialogPortal: "Unmount dialog components"
DialogPortal->>DialogOverlay: "Remove overlay"
DialogPortal->>DialogContent: "Remove content"
4 files reviewed, 3 comments
CodSpeed Performance ReportMerging #5848 will not alter performanceComparing Summary
|
No description provided.