streamlit-react-components 1.8.1.3__py3-none-any.whl → 1.8.1.4__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/common/button_group.py +24 -3
- streamlit_react_components/common/data_table.py +24 -3
- streamlit_react_components/common/step_indicator.py +24 -3
- {streamlit_react_components-1.8.1.3.dist-info → streamlit_react_components-1.8.1.4.dist-info}/METADATA +1 -1
- {streamlit_react_components-1.8.1.3.dist-info → streamlit_react_components-1.8.1.4.dist-info}/RECORD +7 -7
- {streamlit_react_components-1.8.1.3.dist-info → streamlit_react_components-1.8.1.4.dist-info}/WHEEL +0 -0
- {streamlit_react_components-1.8.1.3.dist-info → streamlit_react_components-1.8.1.4.dist-info}/top_level.txt +0 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
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
|
{streamlit_react_components-1.8.1.3.dist-info → streamlit_react_components-1.8.1.4.dist-info}/RECORD
RENAMED
|
@@ -6,23 +6,23 @@ streamlit_react_components/_frontend/index.css,sha256=nGAyY9oe87Ayha6-wUCCA2wQFW
|
|
|
6
6
|
streamlit_react_components/_frontend/index.html,sha256=CjBEtVYlgT_q06BE16EHFrUrJZ6z0MCprrTg7qgAWzw,381
|
|
7
7
|
streamlit_react_components/_frontend/index.js,sha256=hwCCVph157qY7W8npcohZr4IiA7HXaDVKbPHpV01jK8,5233586
|
|
8
8
|
streamlit_react_components/common/__init__.py,sha256=l5BfFZdqjrdLG3sJnJrgahEiTgoBX92_aE0wp2tn_w0,606
|
|
9
|
-
streamlit_react_components/common/button_group.py,sha256=
|
|
9
|
+
streamlit_react_components/common/button_group.py,sha256=CVUrFyLsybF2XiCKvzdxGRH7g4lzfsxEg9zqU80gkEg,3554
|
|
10
10
|
streamlit_react_components/common/chart_legend.py,sha256=ylul6Os5A89S8fIJs7XpBdIk6uWijg_zwR1eB7u9wSw,1824
|
|
11
|
-
streamlit_react_components/common/data_table.py,sha256=
|
|
11
|
+
streamlit_react_components/common/data_table.py,sha256=XdNvszJhAWC7K4E5GSAn8jXN8Xpkv04HnZU5V0I8Qc0,3463
|
|
12
12
|
streamlit_react_components/common/metric_row.py,sha256=84KmKq_ECJ6kTozDSVTVVxN0G5TyGEgtDzl4V_bilAc,1704
|
|
13
13
|
streamlit_react_components/common/panel.py,sha256=iMcB5RF0SnU4yZHsvQQRuiNPnwQ6m8Epi56k2ziSjR8,1541
|
|
14
14
|
streamlit_react_components/common/plotly_chart.py,sha256=YHY5kNBdyoEwNeJ4JPDh9DWDkN3zq8YgIncIMyu285A,9815
|
|
15
15
|
streamlit_react_components/common/section_header.py,sha256=zgEW9Jlj48kiRB3_mYLk3a_oK7w55gnia_laMar_hOk,3430
|
|
16
16
|
streamlit_react_components/common/smart_chart.py,sha256=kYzdPTpgdJLfX6CUXuT8fUMRubN1DRZ9Zej-XFFgje4,20068
|
|
17
17
|
streamlit_react_components/common/stat_card.py,sha256=-C-73nglpPFbtliK7JfZLQExc9N1wYsyTjDsTXHVjKQ,4758
|
|
18
|
-
streamlit_react_components/common/step_indicator.py,sha256=
|
|
18
|
+
streamlit_react_components/common/step_indicator.py,sha256=lsVDnIOOmbgNuIQgzG6u1R5nAszhJhkO8i5B5P05h8k,2697
|
|
19
19
|
streamlit_react_components/form/__init__.py,sha256=urk_QJxnOrlMoHBTbCUGfjwxCbNs5lTFIoexUYB4AsA,349
|
|
20
20
|
streamlit_react_components/form/checkbox_group.py,sha256=P3UJ0JrPpkx_yMDy0bzEt7VyIEmG1iB847a9-TKfPbA,4219
|
|
21
21
|
streamlit_react_components/form/form_date_slider.py,sha256=FpKvY7uV5uTsLcjOQwPX_IQL97I4Jg7t-e-RVf1329Y,5801
|
|
22
22
|
streamlit_react_components/form/form_select.py,sha256=bJFyN9at6nTyDcev_7l7pYDW_KhXHG2D7lSfNxPIPTQ,3964
|
|
23
23
|
streamlit_react_components/form/form_slider.py,sha256=ZL1fCLCfanolmxOzuEQo28D1WYFy17uH0EuwbFwD7f8,4020
|
|
24
24
|
streamlit_react_components/form/radio_group.py,sha256=ktmB37APMLiaUJGmP38hlA6I_diPyexkcNGXCvDXjw8,4098
|
|
25
|
-
streamlit_react_components-1.8.1.
|
|
26
|
-
streamlit_react_components-1.8.1.
|
|
27
|
-
streamlit_react_components-1.8.1.
|
|
28
|
-
streamlit_react_components-1.8.1.
|
|
25
|
+
streamlit_react_components-1.8.1.4.dist-info/METADATA,sha256=r5MsVnj6_WJBuObu73Fh2iKNFYiiirhv7iYLj8sJjAc,21679
|
|
26
|
+
streamlit_react_components-1.8.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
27
|
+
streamlit_react_components-1.8.1.4.dist-info/top_level.txt,sha256=3JFrl15-Uewx3BFMSzqrBufF9GmTS1LDKfShmg0R9VE,27
|
|
28
|
+
streamlit_react_components-1.8.1.4.dist-info/RECORD,,
|
{streamlit_react_components-1.8.1.3.dist-info → streamlit_react_components-1.8.1.4.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|