Skip to content

Commit

Permalink
adding cancel and action sub components for alert dialog and rename a…
Browse files Browse the repository at this point in the history
…lert dialog root (#2352)

* adding cancel and action sub components for alert dialog

* updates to pass integration tests

* add components

---------

Co-authored-by: Tom Gotsman <tomgotsman@Toms-MacBook-Pro.local>
Co-authored-by: Tom Gotsman <tomgotsman@toms-mbp.lan>
  • Loading branch information
3 people authored Jan 5, 2024
1 parent abfc099 commit 51baa94
Show file tree
Hide file tree
Showing 3 changed files with 421 additions and 10 deletions.
8 changes: 6 additions & 2 deletions reflex/components/radix/themes/components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Radix themes components."""

from .alertdialog import (
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogRoot,
AlertDialogTitle,
AlertDialogTrigger,
)
Expand Down Expand Up @@ -75,11 +77,13 @@
from .tooltip import Tooltip

# Alert Dialog
alertdialog = AlertDialog.create
alertdialog_root = AlertDialogRoot.create
alertdialog_trigger = AlertDialogTrigger.create
alertdialog_content = AlertDialogContent.create
alertdialog_title = AlertDialogTitle.create
alertdialog_description = AlertDialogDescription.create
alertdialog_action = AlertDialogAction.create
alertdialog_cancel = AlertDialogCancel.create

# Aspect Ratio
aspect_ratio = AspectRatio.create
Expand Down
33 changes: 27 additions & 6 deletions reflex/components/radix/themes/components/alertdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
LiteralSwitchSize = Literal["1", "2", "3", "4"]


class AlertDialog(CommonMarginProps, RadixThemesComponent):
"""A toggle switch alternative to the checkbox."""
class AlertDialogRoot(CommonMarginProps, RadixThemesComponent):
"""Contains all the parts of the dialog."""

tag = "AlertDialog.Root"

Expand All @@ -33,13 +33,13 @@ def get_event_triggers(self) -> Dict[str, Any]:


class AlertDialogTrigger(CommonMarginProps, RadixThemesComponent):
"""A toggle switch alternative to the checkbox."""
"""Wraps the control that will open the dialog."""

tag = "AlertDialog.Trigger"


class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
"""A toggle switch alternative to the checkbox."""
"""Contains the content of the dialog. This component is based on the div element."""

tag = "AlertDialog.Content"

Expand All @@ -61,12 +61,33 @@ def get_event_triggers(self) -> Dict[str, Any]:


class AlertDialogTitle(CommonMarginProps, RadixThemesComponent):
"""A toggle switch alternative to the checkbox."""
"""An accessible title that is announced when the dialog is opened.
This part is based on the Heading component with a pre-defined font size and
leading trim on top.
"""

tag = "AlertDialog.Title"


class AlertDialogDescription(CommonMarginProps, RadixThemesComponent):
"""A toggle switch alternative to the checkbox."""
"""An optional accessible description that is announced when the dialog is opened.
This part is based on the Text component with a pre-defined font size.
"""

tag = "AlertDialog.Description"


class AlertDialogAction(CommonMarginProps, RadixThemesComponent):
"""Wraps the control that will close the dialog. This should be distinguished
visually from the Cancel control.
"""

tag = "AlertDialog.Action"


class AlertDialogCancel(CommonMarginProps, RadixThemesComponent):
"""Wraps the control that will close the dialog. This should be distinguished
visually from the Action control.
"""

tag = "AlertDialog.Cancel"
Loading

0 comments on commit 51baa94

Please sign in to comment.