Skip to content

Commit 34c0ac7

Browse files
committed
Implement dialog in chartlets.py
1 parent 28b21e6 commit 34c0ac7

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

chartlets.py/chartlets/components/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from .button import Button
33
from .button import IconButton
44
from .checkbox import Checkbox
5+
from .dialog import Dialog
56
from .charts.vega import VegaChart
67
from .progress import CircularProgress
78
from .progress import CircularProgressWithLabel
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
from dataclasses import dataclass, field
2+
from typing import Literal, Any
3+
4+
from chartlets import Container
5+
6+
7+
@dataclass(frozen=True)
8+
class Dialog(Container):
9+
"""A modal dialog that presents content and actions in a focused interface."""
10+
11+
open: bool = field(default=False)
12+
"""Controls whether the dialog is open."""
13+
14+
title: str | None = None
15+
"""The title of the dialog."""
16+
17+
titleProps: dict[str, Any] | None = None
18+
"""Additional properties for the dialog title. Can include
19+
typography-related attributes.
20+
https://mui.com/material-ui/api/dialog-title/"""
21+
22+
content: str | None = None
23+
"""The content of the dialog."""
24+
25+
contentProps: dict[str, Any] | None = None
26+
"""Additional properties for the dialog content. Can include
27+
typography-related attributes.
28+
https://mui.com/material-ui/api/dialog-content-text/"""
29+
30+
disableEscapeKeyDown: bool | None = None
31+
"""If true, pressing the Escape key does not close the dialog."""
32+
33+
fullScreen: bool | None = None
34+
"""If true, the dialog will be displayed in full-screen mode."""
35+
36+
fullWidth: bool | None = None
37+
"""If true, the dialog will take up the full width of the screen."""
38+
39+
maxWidth: Literal["xs", "sm", "md", "lg", "xl", False] | str | None = None
40+
"""The maximum width of the dialog."""
41+
42+
scroll: Literal["body", "paper"] | None = None
43+
"""Determines the scroll behavior of the dialog's content."""
44+
45+
ariaLabel: str | None = None
46+
"""Defines a string value that labels the dialog for accessibility."""
47+
48+
ariaDescribedBy: str | None = None
49+
"""Defines the ID of an element that describes the dialog for
50+
accessibility."""

0 commit comments

Comments
 (0)