streamlit-react-components 1.8.1.3__tar.gz → 1.8.1.4__tar.gz

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 (34) hide show
  1. {streamlit_react_components-1.8.1.3/src/streamlit_react_components.egg-info → streamlit_react_components-1.8.1.4}/PKG-INFO +1 -1
  2. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/pyproject.toml +1 -1
  3. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/button_group.py +24 -3
  4. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/data_table.py +24 -3
  5. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/step_indicator.py +24 -3
  6. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4/src/streamlit_react_components.egg-info}/PKG-INFO +1 -1
  7. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/MANIFEST.in +0 -0
  8. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/README.md +0 -0
  9. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/setup.cfg +0 -0
  10. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/__init__.py +0 -0
  11. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/_frontend/index.css +0 -0
  12. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/_frontend/index.html +0 -0
  13. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/_frontend/index.js +0 -0
  14. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/__init__.py +0 -0
  15. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/chart_legend.py +0 -0
  16. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/metric_row.py +0 -0
  17. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/panel.py +0 -0
  18. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/plotly_chart.py +0 -0
  19. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/section_header.py +0 -0
  20. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/smart_chart.py +0 -0
  21. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/common/stat_card.py +0 -0
  22. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/form/__init__.py +0 -0
  23. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/form/checkbox_group.py +0 -0
  24. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/form/form_date_slider.py +0 -0
  25. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/form/form_select.py +0 -0
  26. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/form/form_slider.py +0 -0
  27. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/form/radio_group.py +0 -0
  28. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/styled_container.py +0 -0
  29. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/tailwind.py +0 -0
  30. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components/themes.py +0 -0
  31. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components.egg-info/SOURCES.txt +0 -0
  32. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components.egg-info/dependency_links.txt +0 -0
  33. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components.egg-info/requires.txt +0 -0
  34. {streamlit_react_components-1.8.1.3 → streamlit_react_components-1.8.1.4}/src/streamlit_react_components.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-react-components
3
- Version: 1.8.1.3
3
+ Version: 1.8.1.4
4
4
  Summary: Reusable React-based Streamlit components with Tailwind CSS styling
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/your-org/streamlit-react-components
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "streamlit-react-components"
7
- version = "1.8.1.3"
7
+ version = "1.8.1.4"
8
8
  description = "Reusable React-based Streamlit components with Tailwind CSS styling"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,8 +1,9 @@
1
1
  """ButtonGroup component - A group of action buttons."""
2
2
 
3
+ import streamlit as st
3
4
  import streamlit.components.v1 as components
4
5
  from pathlib import Path
5
- from typing import Dict, Any, List, Optional
6
+ from typing import Dict, Any, List, Optional, Callable
6
7
 
7
8
  _FRONTEND_DIR = Path(__file__).parent.parent / "_frontend"
8
9
 
@@ -14,6 +15,9 @@ _component = components.declare_component(
14
15
 
15
16
  def button_group(
16
17
  buttons: List[Dict[str, Any]],
18
+ on_change: Optional[Callable] = None,
19
+ args: Optional[tuple] = None,
20
+ kwargs: Optional[Dict[str, Any]] = None,
17
21
  style: Optional[Dict[str, Any]] = None,
18
22
  class_name: str = "",
19
23
  theme: Optional[Dict[str, Any]] = None,
@@ -32,11 +36,14 @@ def button_group(
32
36
  - disabled: Whether button is disabled (optional)
33
37
  - style: Inline CSS styles dict for this button (optional)
34
38
  - className: Tailwind CSS classes for this button (optional)
39
+ on_change: Optional callback function called when a button is clicked
40
+ args: Optional tuple of args to pass to on_change callback
41
+ kwargs: Optional dict of kwargs to pass to on_change callback
35
42
  style: Inline CSS styles as a dictionary
36
43
  class_name: Tailwind CSS classes
37
44
  theme: Optional theme dictionary. If None, uses active global theme.
38
45
  Set to False to disable theming for this component.
39
- key: Unique key for the component
46
+ key: Unique key for the component (required if on_change is used)
40
47
 
41
48
  Returns:
42
49
  The ID of the clicked button, or None if no click
@@ -68,7 +75,7 @@ def button_group(
68
75
  if theme is not False:
69
76
  resolved_theme = theme if theme is not None else get_active_theme()
70
77
 
71
- return _component(
78
+ result = _component(
72
79
  component="button_group",
73
80
  buttons=buttons,
74
81
  style=style,
@@ -77,3 +84,17 @@ def button_group(
77
84
  key=key,
78
85
  default=None,
79
86
  )
87
+
88
+ # Execute on_change callback if a button was clicked
89
+ if on_change and key:
90
+ prev_key = f"_button_group_prev_{key}"
91
+ prev_value = st.session_state.get(prev_key)
92
+
93
+ # Only fire callback if value actually changed (not on first render)
94
+ if prev_value is not None and result != prev_value:
95
+ on_change(*(args or ()), **(kwargs or {}))
96
+
97
+ # Always update previous value
98
+ st.session_state[prev_key] = result
99
+
100
+ return result
@@ -1,8 +1,9 @@
1
1
  """DataTable component - A styled data table with click support."""
2
2
 
3
+ import streamlit as st
3
4
  import streamlit.components.v1 as components
4
5
  from pathlib import Path
5
- from typing import Dict, Any, List, Optional
6
+ from typing import Dict, Any, List, Optional, Callable
6
7
 
7
8
  _FRONTEND_DIR = Path(__file__).parent.parent / "_frontend"
8
9
 
@@ -16,6 +17,9 @@ def data_table(
16
17
  columns: List[Dict[str, Any]],
17
18
  rows: List[Dict[str, Any]],
18
19
  show_header: bool = True,
20
+ on_change: Optional[Callable] = None,
21
+ args: Optional[tuple] = None,
22
+ kwargs: Optional[Dict[str, Any]] = None,
19
23
  style: Optional[Dict[str, Any]] = None,
20
24
  class_name: str = "",
21
25
  theme: Optional[Dict[str, Any]] = None,
@@ -33,11 +37,14 @@ def data_table(
33
37
  - colorByValue: True to color based on status values (optional)
34
38
  rows: List of row data dictionaries
35
39
  show_header: Whether to show the header row (default True)
40
+ on_change: Optional callback function called when a row is clicked
41
+ args: Optional tuple of args to pass to on_change callback
42
+ kwargs: Optional dict of kwargs to pass to on_change callback
36
43
  style: Inline CSS styles as a dictionary
37
44
  class_name: Tailwind CSS classes
38
45
  theme: Optional theme dictionary. If None, uses active global theme.
39
46
  Set to False to disable theming for this component.
40
- key: Unique key for the component
47
+ key: Unique key for the component (required if on_change is used)
41
48
 
42
49
  Returns:
43
50
  Dictionary with rowIndex and rowData when a row is clicked, None otherwise
@@ -62,7 +69,7 @@ def data_table(
62
69
  if theme is not False:
63
70
  resolved_theme = theme if theme is not None else get_active_theme()
64
71
 
65
- return _component(
72
+ result = _component(
66
73
  component="data_table",
67
74
  columns=columns,
68
75
  rows=rows,
@@ -73,3 +80,17 @@ def data_table(
73
80
  key=key,
74
81
  default=None,
75
82
  )
83
+
84
+ # Execute on_change callback if a row was clicked
85
+ if on_change and key:
86
+ prev_key = f"_data_table_prev_{key}"
87
+ prev_value = st.session_state.get(prev_key)
88
+
89
+ # Only fire callback if value actually changed (not on first render)
90
+ if prev_value is not None and result != prev_value:
91
+ on_change(*(args or ()), **(kwargs or {}))
92
+
93
+ # Always update previous value
94
+ st.session_state[prev_key] = result
95
+
96
+ return result
@@ -1,8 +1,9 @@
1
1
  """StepIndicator component - A multi-step wizard progress indicator."""
2
2
 
3
+ import streamlit as st
3
4
  import streamlit.components.v1 as components
4
5
  from pathlib import Path
5
- from typing import Dict, Any, List, Optional
6
+ from typing import Dict, Any, List, Optional, Callable
6
7
 
7
8
  _FRONTEND_DIR = Path(__file__).parent.parent / "_frontend"
8
9
 
@@ -15,6 +16,9 @@ _component = components.declare_component(
15
16
  def step_indicator(
16
17
  steps: List[str],
17
18
  current_step: int,
19
+ on_change: Optional[Callable] = None,
20
+ args: Optional[tuple] = None,
21
+ kwargs: Optional[Dict[str, Any]] = None,
18
22
  style: Optional[Dict[str, Any]] = None,
19
23
  class_name: str = "",
20
24
  theme: Optional[Dict[str, Any]] = None,
@@ -26,11 +30,14 @@ def step_indicator(
26
30
  Args:
27
31
  steps: List of step labels (e.g., ["Supply Plan", "Levers", "Review"])
28
32
  current_step: Current active step (1-indexed)
33
+ on_change: Optional callback function called when a step is clicked
34
+ args: Optional tuple of args to pass to on_change callback
35
+ kwargs: Optional dict of kwargs to pass to on_change callback
29
36
  style: Inline CSS styles as a dictionary
30
37
  class_name: Tailwind CSS classes
31
38
  theme: Optional theme dictionary. If None, uses active global theme.
32
39
  Set to False to disable theming for this component.
33
- key: Unique key for the component
40
+ key: Unique key for the component (required if on_change is used)
34
41
 
35
42
  Returns:
36
43
  The step number that was clicked, or None if no click
@@ -49,7 +56,7 @@ def step_indicator(
49
56
  if theme is not False:
50
57
  resolved_theme = theme if theme is not None else get_active_theme()
51
58
 
52
- return _component(
59
+ result = _component(
53
60
  component="step_indicator",
54
61
  steps=steps,
55
62
  currentStep=current_step,
@@ -59,3 +66,17 @@ def step_indicator(
59
66
  key=key,
60
67
  default=None,
61
68
  )
69
+
70
+ # Execute on_change callback if a step was clicked
71
+ if on_change and key:
72
+ prev_key = f"_step_indicator_prev_{key}"
73
+ prev_value = st.session_state.get(prev_key)
74
+
75
+ # Only fire callback if value actually changed (not on first render)
76
+ if prev_value is not None and result != prev_value:
77
+ on_change(*(args or ()), **(kwargs or {}))
78
+
79
+ # Always update previous value
80
+ st.session_state[prev_key] = result
81
+
82
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-react-components
3
- Version: 1.8.1.3
3
+ Version: 1.8.1.4
4
4
  Summary: Reusable React-based Streamlit components with Tailwind CSS styling
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/your-org/streamlit-react-components