streamlit-react-components 1.0.5__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit_react_components/__init__.py +5 -1
- streamlit_react_components/_frontend/index.css +1 -1
- streamlit_react_components/_frontend/index.js +142 -141
- streamlit_react_components/common/__init__.py +2 -0
- streamlit_react_components/common/button_group.py +10 -0
- streamlit_react_components/common/chart_legend.py +10 -0
- streamlit_react_components/common/data_table.py +10 -0
- streamlit_react_components/common/metric_row.py +10 -0
- streamlit_react_components/common/panel.py +10 -0
- streamlit_react_components/common/plotly_chart.py +10 -0
- streamlit_react_components/common/section_header.py +10 -0
- streamlit_react_components/common/smart_chart.py +327 -0
- streamlit_react_components/common/stat_card.py +10 -0
- streamlit_react_components/common/step_indicator.py +10 -0
- streamlit_react_components/form/__init__.py +2 -0
- streamlit_react_components/form/checkbox_group.py +10 -0
- streamlit_react_components/form/form_select.py +10 -0
- streamlit_react_components/form/form_slider.py +10 -0
- streamlit_react_components/form/radio_group.py +78 -0
- streamlit_react_components/themes.py +1203 -0
- {streamlit_react_components-1.0.5.dist-info → streamlit_react_components-1.0.6.dist-info}/METADATA +1 -1
- streamlit_react_components-1.0.6.dist-info/RECORD +25 -0
- {streamlit_react_components-1.0.5.dist-info → streamlit_react_components-1.0.6.dist-info}/WHEEL +1 -1
- streamlit_react_components-1.0.5.dist-info/RECORD +0 -22
- {streamlit_react_components-1.0.5.dist-info → streamlit_react_components-1.0.6.dist-info}/top_level.txt +0 -0
|
@@ -18,6 +18,7 @@ def checkbox_group(
|
|
|
18
18
|
layout: str = "vertical",
|
|
19
19
|
style: Optional[Dict[str, Any]] = None,
|
|
20
20
|
class_name: str = "",
|
|
21
|
+
theme: Optional[Dict[str, Any]] = None,
|
|
21
22
|
key: Optional[str] = None,
|
|
22
23
|
) -> List[str]:
|
|
23
24
|
"""
|
|
@@ -32,6 +33,8 @@ def checkbox_group(
|
|
|
32
33
|
layout: Layout direction - "vertical" (default) or "horizontal"
|
|
33
34
|
style: Inline CSS styles as a dictionary
|
|
34
35
|
class_name: Tailwind CSS classes
|
|
36
|
+
theme: Optional theme dictionary. If None, uses active global theme.
|
|
37
|
+
Set to False to disable theming for this component.
|
|
35
38
|
key: Unique key for the component
|
|
36
39
|
|
|
37
40
|
Returns:
|
|
@@ -59,6 +62,12 @@ def checkbox_group(
|
|
|
59
62
|
# Get default checked items
|
|
60
63
|
default_checked = [item["id"] for item in items if item.get("checked", False)]
|
|
61
64
|
|
|
65
|
+
# Resolve theme (None = use global, False = disable)
|
|
66
|
+
from ..themes import get_active_theme
|
|
67
|
+
resolved_theme = None
|
|
68
|
+
if theme is not False:
|
|
69
|
+
resolved_theme = theme if theme is not None else get_active_theme()
|
|
70
|
+
|
|
62
71
|
result = _component(
|
|
63
72
|
component="checkbox_group",
|
|
64
73
|
label=label,
|
|
@@ -66,6 +75,7 @@ def checkbox_group(
|
|
|
66
75
|
layout=layout,
|
|
67
76
|
style=style,
|
|
68
77
|
className=class_name,
|
|
78
|
+
theme=resolved_theme,
|
|
69
79
|
key=key,
|
|
70
80
|
default=default_checked,
|
|
71
81
|
)
|
|
@@ -19,6 +19,7 @@ def form_select(
|
|
|
19
19
|
groups: Optional[List[Dict[str, Any]]] = None,
|
|
20
20
|
style: Optional[Dict[str, Any]] = None,
|
|
21
21
|
class_name: str = "",
|
|
22
|
+
theme: Optional[Dict[str, Any]] = None,
|
|
22
23
|
key: Optional[str] = None,
|
|
23
24
|
) -> str:
|
|
24
25
|
"""
|
|
@@ -33,6 +34,8 @@ def form_select(
|
|
|
33
34
|
- options: List of options in this group
|
|
34
35
|
style: Inline CSS styles as a dictionary
|
|
35
36
|
class_name: Tailwind CSS classes
|
|
37
|
+
theme: Optional theme dictionary. If None, uses active global theme.
|
|
38
|
+
Set to False to disable theming for this component.
|
|
36
39
|
key: Unique key for the component
|
|
37
40
|
|
|
38
41
|
Returns:
|
|
@@ -55,6 +58,12 @@ def form_select(
|
|
|
55
58
|
]
|
|
56
59
|
)
|
|
57
60
|
"""
|
|
61
|
+
# Resolve theme (None = use global, False = disable)
|
|
62
|
+
from ..themes import get_active_theme
|
|
63
|
+
resolved_theme = None
|
|
64
|
+
if theme is not False:
|
|
65
|
+
resolved_theme = theme if theme is not None else get_active_theme()
|
|
66
|
+
|
|
58
67
|
result = _component(
|
|
59
68
|
component="form_select",
|
|
60
69
|
label=label,
|
|
@@ -63,6 +72,7 @@ def form_select(
|
|
|
63
72
|
groups=groups,
|
|
64
73
|
style=style,
|
|
65
74
|
className=class_name,
|
|
75
|
+
theme=resolved_theme,
|
|
66
76
|
key=key,
|
|
67
77
|
default=value,
|
|
68
78
|
)
|
|
@@ -22,6 +22,7 @@ def form_slider(
|
|
|
22
22
|
color: str = "blue",
|
|
23
23
|
style: Optional[Dict[str, Any]] = None,
|
|
24
24
|
class_name: str = "",
|
|
25
|
+
theme: Optional[Dict[str, Any]] = None,
|
|
25
26
|
key: Optional[str] = None,
|
|
26
27
|
) -> float:
|
|
27
28
|
"""
|
|
@@ -38,6 +39,8 @@ def form_slider(
|
|
|
38
39
|
"purple", "slate") or hex value (e.g., "#94a3b8")
|
|
39
40
|
style: Inline CSS styles as a dictionary
|
|
40
41
|
class_name: Tailwind CSS classes
|
|
42
|
+
theme: Optional theme dictionary. If None, uses active global theme.
|
|
43
|
+
Set to False to disable theming for this component.
|
|
41
44
|
key: Unique key for the component
|
|
42
45
|
|
|
43
46
|
Returns:
|
|
@@ -63,6 +66,12 @@ def form_slider(
|
|
|
63
66
|
color="#ff5733"
|
|
64
67
|
)
|
|
65
68
|
"""
|
|
69
|
+
# Resolve theme (None = use global, False = disable)
|
|
70
|
+
from ..themes import get_active_theme
|
|
71
|
+
resolved_theme = None
|
|
72
|
+
if theme is not False:
|
|
73
|
+
resolved_theme = theme if theme is not None else get_active_theme()
|
|
74
|
+
|
|
66
75
|
result = _component(
|
|
67
76
|
component="form_slider",
|
|
68
77
|
label=label,
|
|
@@ -74,6 +83,7 @@ def form_slider(
|
|
|
74
83
|
color=color,
|
|
75
84
|
style=style,
|
|
76
85
|
className=class_name,
|
|
86
|
+
theme=resolved_theme,
|
|
77
87
|
key=key,
|
|
78
88
|
default=value,
|
|
79
89
|
)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""RadioGroup component - A group of radio buttons for single selection."""
|
|
2
|
+
|
|
3
|
+
import streamlit.components.v1 as components
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Dict, Any, List, Optional
|
|
6
|
+
|
|
7
|
+
_FRONTEND_DIR = Path(__file__).parent.parent / "_frontend"
|
|
8
|
+
|
|
9
|
+
_component = components.declare_component(
|
|
10
|
+
"streamlit_react_components",
|
|
11
|
+
path=str(_FRONTEND_DIR),
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def radio_group(
|
|
16
|
+
items: List[Dict[str, Any]],
|
|
17
|
+
label: str = "",
|
|
18
|
+
layout: str = "vertical",
|
|
19
|
+
style: Optional[Dict[str, Any]] = None,
|
|
20
|
+
class_name: str = "",
|
|
21
|
+
theme: Optional[Dict[str, Any]] = None,
|
|
22
|
+
key: Optional[str] = None,
|
|
23
|
+
) -> Optional[str]:
|
|
24
|
+
"""
|
|
25
|
+
Display a group of radio buttons for single selection.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
items: List of radio items, each with:
|
|
29
|
+
- id: Unique identifier
|
|
30
|
+
- label: Display label
|
|
31
|
+
- checked: Initial checked state (optional, default False)
|
|
32
|
+
label: Optional group label
|
|
33
|
+
layout: Layout direction - "vertical" (default) or "horizontal"
|
|
34
|
+
style: Inline CSS styles as a dictionary
|
|
35
|
+
class_name: Tailwind CSS classes
|
|
36
|
+
theme: Optional theme dictionary. If None, uses active global theme.
|
|
37
|
+
Set to False to disable theming for this component.
|
|
38
|
+
key: Unique key for the component
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
ID of the selected item (string), or None if nothing selected
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
selected = radio_group(
|
|
45
|
+
label="Payment Method",
|
|
46
|
+
items=[
|
|
47
|
+
{"id": "credit", "label": "Credit Card", "checked": True},
|
|
48
|
+
{"id": "debit", "label": "Debit Card"},
|
|
49
|
+
{"id": "paypal", "label": "PayPal"}
|
|
50
|
+
]
|
|
51
|
+
)
|
|
52
|
+
# Returns: "credit" (only one can be selected)
|
|
53
|
+
"""
|
|
54
|
+
# Get default selected item (first checked item)
|
|
55
|
+
default_selected = None
|
|
56
|
+
for item in items:
|
|
57
|
+
if item.get("checked", False):
|
|
58
|
+
default_selected = item["id"]
|
|
59
|
+
break
|
|
60
|
+
|
|
61
|
+
# Resolve theme (None = use global, False = disable)
|
|
62
|
+
from ..themes import get_active_theme
|
|
63
|
+
resolved_theme = None
|
|
64
|
+
if theme is not False:
|
|
65
|
+
resolved_theme = theme if theme is not None else get_active_theme()
|
|
66
|
+
|
|
67
|
+
result = _component(
|
|
68
|
+
component="radio_group",
|
|
69
|
+
label=label,
|
|
70
|
+
items=items,
|
|
71
|
+
layout=layout,
|
|
72
|
+
style=style,
|
|
73
|
+
className=class_name,
|
|
74
|
+
theme=resolved_theme,
|
|
75
|
+
key=key,
|
|
76
|
+
default=default_selected,
|
|
77
|
+
)
|
|
78
|
+
return result if result is not None else default_selected
|