streamlit-react-components 1.0.5__py3-none-any.whl → 1.0.7__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.
Files changed (25) hide show
  1. streamlit_react_components/__init__.py +5 -1
  2. streamlit_react_components/_frontend/index.css +1 -1
  3. streamlit_react_components/_frontend/index.js +143 -142
  4. streamlit_react_components/common/__init__.py +2 -0
  5. streamlit_react_components/common/button_group.py +10 -0
  6. streamlit_react_components/common/chart_legend.py +10 -0
  7. streamlit_react_components/common/data_table.py +10 -0
  8. streamlit_react_components/common/metric_row.py +10 -0
  9. streamlit_react_components/common/panel.py +10 -0
  10. streamlit_react_components/common/plotly_chart.py +10 -0
  11. streamlit_react_components/common/section_header.py +10 -0
  12. streamlit_react_components/common/smart_chart.py +584 -0
  13. streamlit_react_components/common/stat_card.py +10 -0
  14. streamlit_react_components/common/step_indicator.py +10 -0
  15. streamlit_react_components/form/__init__.py +2 -0
  16. streamlit_react_components/form/checkbox_group.py +10 -0
  17. streamlit_react_components/form/form_select.py +10 -0
  18. streamlit_react_components/form/form_slider.py +10 -0
  19. streamlit_react_components/form/radio_group.py +78 -0
  20. streamlit_react_components/themes.py +1203 -0
  21. {streamlit_react_components-1.0.5.dist-info → streamlit_react_components-1.0.7.dist-info}/METADATA +1 -1
  22. streamlit_react_components-1.0.7.dist-info/RECORD +25 -0
  23. {streamlit_react_components-1.0.5.dist-info → streamlit_react_components-1.0.7.dist-info}/WHEEL +1 -1
  24. streamlit_react_components-1.0.5.dist-info/RECORD +0 -22
  25. {streamlit_react_components-1.0.5.dist-info → streamlit_react_components-1.0.7.dist-info}/top_level.txt +0 -0
@@ -9,6 +9,7 @@ from .step_indicator import step_indicator
9
9
  from .button_group import button_group
10
10
  from .chart_legend import chart_legend
11
11
  from .plotly_chart import plotly_chart
12
+ from .smart_chart import smart_chart
12
13
 
13
14
  __all__ = [
14
15
  "panel",
@@ -20,4 +21,5 @@ __all__ = [
20
21
  "button_group",
21
22
  "chart_legend",
22
23
  "plotly_chart",
24
+ "smart_chart",
23
25
  ]
@@ -16,6 +16,7 @@ def button_group(
16
16
  buttons: List[Dict[str, Any]],
17
17
  style: Optional[Dict[str, Any]] = None,
18
18
  class_name: str = "",
19
+ theme: Optional[Dict[str, Any]] = None,
19
20
  key: Optional[str] = None,
20
21
  ) -> Optional[str]:
21
22
  """
@@ -33,6 +34,8 @@ def button_group(
33
34
  - className: Tailwind CSS classes for this button (optional)
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:
@@ -59,11 +62,18 @@ def button_group(
59
62
  if clicked == "approve":
60
63
  approve_item()
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
  return _component(
63
72
  component="button_group",
64
73
  buttons=buttons,
65
74
  style=style,
66
75
  className=class_name,
76
+ theme=resolved_theme,
67
77
  key=key,
68
78
  default=None,
69
79
  )
@@ -16,6 +16,7 @@ def chart_legend(
16
16
  items: List[Dict[str, str]],
17
17
  style: Optional[Dict[str, Any]] = None,
18
18
  class_name: str = "",
19
+ theme: Optional[Dict[str, Any]] = None,
19
20
  key: Optional[str] = None,
20
21
  ) -> None:
21
22
  """
@@ -27,6 +28,8 @@ def chart_legend(
27
28
  - label: Legend label text
28
29
  style: Inline CSS styles as a dictionary
29
30
  class_name: Tailwind CSS classes
31
+ theme: Optional theme dictionary. If None, uses active global theme.
32
+ Set to False to disable theming for this component.
30
33
  key: Unique key for the component
31
34
 
32
35
  Example:
@@ -39,11 +42,18 @@ def chart_legend(
39
42
  ]
40
43
  )
41
44
  """
45
+ # Resolve theme (None = use global, False = disable)
46
+ from ..themes import get_active_theme
47
+ resolved_theme = None
48
+ if theme is not False:
49
+ resolved_theme = theme if theme is not None else get_active_theme()
50
+
42
51
  _component(
43
52
  component="chart_legend",
44
53
  items=items,
45
54
  style=style,
46
55
  className=class_name,
56
+ theme=resolved_theme,
47
57
  key=key,
48
58
  default=None,
49
59
  )
@@ -18,6 +18,7 @@ def data_table(
18
18
  show_header: bool = True,
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
  ) -> Optional[Dict[str, Any]]:
23
24
  """
@@ -34,6 +35,8 @@ def data_table(
34
35
  show_header: Whether to show the header row (default True)
35
36
  style: Inline CSS styles as a dictionary
36
37
  class_name: Tailwind CSS classes
38
+ theme: Optional theme dictionary. If None, uses active global theme.
39
+ Set to False to disable theming for this component.
37
40
  key: Unique key for the component
38
41
 
39
42
  Returns:
@@ -53,6 +56,12 @@ def data_table(
53
56
  if clicked:
54
57
  st.write(f"Clicked row: {clicked['rowData']}")
55
58
  """
59
+ # Resolve theme (None = use global, False = disable)
60
+ from ..themes import get_active_theme
61
+ resolved_theme = None
62
+ if theme is not False:
63
+ resolved_theme = theme if theme is not None else get_active_theme()
64
+
56
65
  return _component(
57
66
  component="data_table",
58
67
  columns=columns,
@@ -60,6 +69,7 @@ def data_table(
60
69
  showHeader=show_header,
61
70
  style=style,
62
71
  className=class_name,
72
+ theme=resolved_theme,
63
73
  key=key,
64
74
  default=None,
65
75
  )
@@ -18,6 +18,7 @@ def metric_row(
18
18
  value_color: str = "",
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
  ) -> None:
23
24
  """
@@ -29,12 +30,20 @@ def metric_row(
29
30
  value_color: Tailwind text color class for the value (e.g., "text-green-400")
30
31
  style: Inline CSS styles as a dictionary
31
32
  class_name: Tailwind CSS classes
33
+ theme: Optional theme dictionary. If None, uses active global theme.
34
+ Set to False to disable theming for this component.
32
35
  key: Unique key for the component
33
36
 
34
37
  Example:
35
38
  metric_row(label="Mean", value="78.4%")
36
39
  metric_row(label="Trend", value="↑ +0.4%/mo", value_color="text-green-400")
37
40
  """
41
+ # Resolve theme (None = use global, False = disable)
42
+ from ..themes import get_active_theme
43
+ resolved_theme = None
44
+ if theme is not False:
45
+ resolved_theme = theme if theme is not None else get_active_theme()
46
+
38
47
  _component(
39
48
  component="metric_row",
40
49
  label=label,
@@ -42,6 +51,7 @@ def metric_row(
42
51
  valueColor=value_color,
43
52
  style=style,
44
53
  className=class_name,
54
+ theme=resolved_theme,
45
55
  key=key,
46
56
  default=None,
47
57
  )
@@ -16,6 +16,7 @@ def panel(
16
16
  children: str = "",
17
17
  style: Optional[Dict[str, Any]] = None,
18
18
  class_name: str = "",
19
+ theme: Optional[Dict[str, Any]] = None,
19
20
  key: Optional[str] = None,
20
21
  ) -> None:
21
22
  """
@@ -25,6 +26,8 @@ def panel(
25
26
  children: HTML content to render inside the panel
26
27
  style: Inline CSS styles as a dictionary (e.g., {"background": "#1e293b"})
27
28
  class_name: Tailwind CSS classes (e.g., "bg-slate-900 p-4")
29
+ theme: Optional theme dictionary. If None, uses active global theme.
30
+ Set to False to disable theming for this component.
28
31
  key: Unique key for the component
29
32
 
30
33
  Example:
@@ -33,11 +36,18 @@ def panel(
33
36
  class_name="mt-4"
34
37
  )
35
38
  """
39
+ # Resolve theme (None = use global, False = disable)
40
+ from ..themes import get_active_theme
41
+ resolved_theme = None
42
+ if theme is not False:
43
+ resolved_theme = theme if theme is not None else get_active_theme()
44
+
36
45
  _component(
37
46
  component="panel",
38
47
  children=children,
39
48
  style=style,
40
49
  className=class_name,
50
+ theme=resolved_theme,
41
51
  key=key,
42
52
  default=None,
43
53
  )
@@ -134,6 +134,7 @@ def plotly_chart(
134
134
  modal_title: str = "",
135
135
  style: Optional[Dict[str, Any]] = None,
136
136
  class_name: str = "",
137
+ theme: Optional[Dict[str, Any]] = None,
137
138
  key: Optional[str] = None,
138
139
  ) -> Optional[Dict[str, Any]]:
139
140
  """
@@ -162,6 +163,8 @@ def plotly_chart(
162
163
  modal_title: Title displayed in dialog header when expanded
163
164
  style: Inline CSS styles as a dictionary
164
165
  class_name: Tailwind CSS classes
166
+ theme: Optional theme dictionary. If None, uses active global theme.
167
+ Set to False to disable theming for this component.
165
168
  key: Unique key for the component
166
169
 
167
170
  Returns:
@@ -249,6 +252,12 @@ def plotly_chart(
249
252
  else:
250
253
  raise ValueError("Either 'figure' or 'data' parameter is required")
251
254
 
255
+ # Resolve theme (None = use global, False = disable)
256
+ from ..themes import get_active_theme
257
+ resolved_theme = None
258
+ if theme is not False:
259
+ resolved_theme = theme if theme is not None else get_active_theme()
260
+
252
261
  # Render the component
253
262
  result = _component(
254
263
  component="plotly_chart",
@@ -262,6 +271,7 @@ def plotly_chart(
262
271
  modalTitle=modal_title,
263
272
  style=style,
264
273
  className=class_name,
274
+ theme=resolved_theme,
265
275
  key=key,
266
276
  default=None,
267
277
  )
@@ -18,6 +18,7 @@ def section_header(
18
18
  actions: Optional[List[Dict[str, Any]]] = None,
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
  ) -> Optional[str]:
23
24
  """
@@ -39,6 +40,8 @@ def section_header(
39
40
  st.switch_page() (optional)
40
41
  style: Inline CSS styles as a dictionary
41
42
  class_name: Tailwind CSS classes
43
+ theme: Optional theme dictionary. If None, uses active global theme.
44
+ Set to False to disable theming for this component.
42
45
  key: Unique key for the component
43
46
 
44
47
  Returns:
@@ -77,6 +80,12 @@ def section_header(
77
80
  if clicked == "home":
78
81
  st.switch_page("pages/home.py")
79
82
  """
83
+ # Resolve theme (None = use global, False = disable)
84
+ from ..themes import get_active_theme
85
+ resolved_theme = None
86
+ if theme is not False:
87
+ resolved_theme = theme if theme is not None else get_active_theme()
88
+
80
89
  return _component(
81
90
  component="section_header",
82
91
  title=title,
@@ -84,6 +93,7 @@ def section_header(
84
93
  actions=actions or [],
85
94
  style=style,
86
95
  className=class_name,
96
+ theme=resolved_theme,
87
97
  key=key,
88
98
  default=None,
89
99
  )