streamlit-react-components 1.0.1__py3-none-any.whl → 1.0.3__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/_frontend/index.css +1 -1
- streamlit_react_components/_frontend/index.js +49 -49
- streamlit_react_components/common/stat_card.py +49 -7
- streamlit_react_components/form/checkbox_group.py +11 -0
- {streamlit_react_components-1.0.1.dist-info → streamlit_react_components-1.0.3.dist-info}/METADATA +1 -1
- {streamlit_react_components-1.0.1.dist-info → streamlit_react_components-1.0.3.dist-info}/RECORD +8 -8
- {streamlit_react_components-1.0.1.dist-info → streamlit_react_components-1.0.3.dist-info}/WHEEL +1 -1
- {streamlit_react_components-1.0.1.dist-info → streamlit_react_components-1.0.3.dist-info}/top_level.txt +0 -0
|
@@ -17,10 +17,16 @@ def stat_card(
|
|
|
17
17
|
value: Union[str, int, float],
|
|
18
18
|
color: str = "blue",
|
|
19
19
|
icon: str = "",
|
|
20
|
+
planned: Optional[Union[str, int, float]] = None,
|
|
21
|
+
delta: Optional[Union[str, int, float]] = None,
|
|
22
|
+
delta_style: str = "auto",
|
|
23
|
+
delta_thresholds: Optional[Dict[str, float]] = None,
|
|
24
|
+
unit: str = "",
|
|
25
|
+
action: Optional[Dict[str, str]] = None,
|
|
20
26
|
style: Optional[Dict[str, Any]] = None,
|
|
21
27
|
class_name: str = "",
|
|
22
28
|
key: Optional[str] = None,
|
|
23
|
-
) ->
|
|
29
|
+
) -> Optional[str]:
|
|
24
30
|
"""
|
|
25
31
|
Display a styled statistics card with a label and value.
|
|
26
32
|
|
|
@@ -30,12 +36,24 @@ def stat_card(
|
|
|
30
36
|
color: Accent color - preset name ("blue", "green", "red", "yellow",
|
|
31
37
|
"purple", "slate") or hex value (e.g., "#94a3b8")
|
|
32
38
|
icon: Optional emoji or icon to display with the label
|
|
39
|
+
planned: Optional planned/target value to display
|
|
40
|
+
delta: Optional delta/difference value to display
|
|
41
|
+
delta_style: How to style the delta - "auto" (green/red based on sign),
|
|
42
|
+
"neutral" (no color), "percentage" (show as %),
|
|
43
|
+
"inverse" (red for positive, green for negative)
|
|
44
|
+
delta_thresholds: Optional thresholds for delta color based on magnitude
|
|
45
|
+
e.g., {"warning": 10, "danger": 20}
|
|
46
|
+
unit: Unit of measurement (e.g., "kg", "%", "$")
|
|
47
|
+
action: Optional action button config {"id": "...", "label": "..."}
|
|
33
48
|
style: Inline CSS styles as a dictionary
|
|
34
49
|
class_name: Tailwind CSS classes
|
|
35
50
|
key: Unique key for the component
|
|
36
51
|
|
|
52
|
+
Returns:
|
|
53
|
+
The action button id if clicked, None otherwise
|
|
54
|
+
|
|
37
55
|
Example:
|
|
38
|
-
#
|
|
56
|
+
# Basic usage (backwards compatible)
|
|
39
57
|
stat_card(
|
|
40
58
|
label="Within Threshold",
|
|
41
59
|
value="4",
|
|
@@ -43,19 +61,43 @@ def stat_card(
|
|
|
43
61
|
style={"minWidth": "150px"}
|
|
44
62
|
)
|
|
45
63
|
|
|
46
|
-
#
|
|
64
|
+
# With all new features
|
|
65
|
+
clicked = stat_card(
|
|
66
|
+
label="Production Output",
|
|
67
|
+
value=1234,
|
|
68
|
+
planned=1200,
|
|
69
|
+
delta=34,
|
|
70
|
+
delta_style="auto",
|
|
71
|
+
unit="kg",
|
|
72
|
+
color="green",
|
|
73
|
+
icon="📊",
|
|
74
|
+
action={"id": "details", "label": "View Details"}
|
|
75
|
+
)
|
|
76
|
+
if clicked == "details":
|
|
77
|
+
st.write("Details clicked!")
|
|
78
|
+
|
|
79
|
+
# With thresholds
|
|
47
80
|
stat_card(
|
|
48
|
-
label="
|
|
49
|
-
value=
|
|
50
|
-
|
|
81
|
+
label="Defect Rate",
|
|
82
|
+
value=15,
|
|
83
|
+
delta=5,
|
|
84
|
+
delta_style="inverse",
|
|
85
|
+
delta_thresholds={"warning": 3, "danger": 10},
|
|
86
|
+
unit="%"
|
|
51
87
|
)
|
|
52
88
|
"""
|
|
53
|
-
_component(
|
|
89
|
+
return _component(
|
|
54
90
|
component="stat_card",
|
|
55
91
|
label=label,
|
|
56
92
|
value=str(value),
|
|
57
93
|
color=color,
|
|
58
94
|
icon=icon,
|
|
95
|
+
planned=str(planned) if planned is not None else None,
|
|
96
|
+
delta=float(delta) if delta is not None else None,
|
|
97
|
+
deltaStyle=delta_style,
|
|
98
|
+
deltaThresholds=delta_thresholds,
|
|
99
|
+
unit=unit,
|
|
100
|
+
action=action,
|
|
59
101
|
style=style,
|
|
60
102
|
className=class_name,
|
|
61
103
|
key=key,
|
|
@@ -15,6 +15,7 @@ _component = components.declare_component(
|
|
|
15
15
|
def checkbox_group(
|
|
16
16
|
items: List[Dict[str, Any]],
|
|
17
17
|
label: str = "",
|
|
18
|
+
layout: str = "vertical",
|
|
18
19
|
style: Optional[Dict[str, Any]] = None,
|
|
19
20
|
class_name: str = "",
|
|
20
21
|
key: Optional[str] = None,
|
|
@@ -28,6 +29,7 @@ def checkbox_group(
|
|
|
28
29
|
- label: Display label
|
|
29
30
|
- checked: Initial checked state (optional, default False)
|
|
30
31
|
label: Optional group label
|
|
32
|
+
layout: Layout direction - "vertical" (default) or "horizontal"
|
|
31
33
|
style: Inline CSS styles as a dictionary
|
|
32
34
|
class_name: Tailwind CSS classes
|
|
33
35
|
key: Unique key for the component
|
|
@@ -36,6 +38,7 @@ def checkbox_group(
|
|
|
36
38
|
List of checked item IDs
|
|
37
39
|
|
|
38
40
|
Example:
|
|
41
|
+
# Vertical layout (default)
|
|
39
42
|
selected = checkbox_group(
|
|
40
43
|
label="Parameters",
|
|
41
44
|
items=[
|
|
@@ -45,6 +48,13 @@ def checkbox_group(
|
|
|
45
48
|
]
|
|
46
49
|
)
|
|
47
50
|
# Returns: ["vphp", "lot_co"] if those are checked
|
|
51
|
+
|
|
52
|
+
# Horizontal layout
|
|
53
|
+
selected = checkbox_group(
|
|
54
|
+
label="Options",
|
|
55
|
+
items=[...],
|
|
56
|
+
layout="horizontal"
|
|
57
|
+
)
|
|
48
58
|
"""
|
|
49
59
|
# Get default checked items
|
|
50
60
|
default_checked = [item["id"] for item in items if item.get("checked", False)]
|
|
@@ -53,6 +63,7 @@ def checkbox_group(
|
|
|
53
63
|
component="checkbox_group",
|
|
54
64
|
label=label,
|
|
55
65
|
items=items,
|
|
66
|
+
layout=layout,
|
|
56
67
|
style=style,
|
|
57
68
|
className=class_name,
|
|
58
69
|
key=key,
|
{streamlit_react_components-1.0.1.dist-info → streamlit_react_components-1.0.3.dist-info}/RECORD
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
streamlit_react_components/__init__.py,sha256=-m5OJx0vsfzD6k2m_2X8eMQXi9pgkreAuDZJoVWbdJ0,673
|
|
2
|
-
streamlit_react_components/_frontend/index.css,sha256=
|
|
2
|
+
streamlit_react_components/_frontend/index.css,sha256=gN1hj1J5RV7pkO5Ynbl0Z_wTNCUtz9okN_KCJcEfWQU,26413
|
|
3
3
|
streamlit_react_components/_frontend/index.html,sha256=CjBEtVYlgT_q06BE16EHFrUrJZ6z0MCprrTg7qgAWzw,381
|
|
4
|
-
streamlit_react_components/_frontend/index.js,sha256=
|
|
4
|
+
streamlit_react_components/_frontend/index.js,sha256=UuKRqAIw5EukWf-xcs9iB9SoRAYOWDUFM75mzBe9OQI,5217194
|
|
5
5
|
streamlit_react_components/common/__init__.py,sha256=xUKaw_X2B2xd6AqW8oLzHupGp-TX3Fij0FjhMNwd-vs,550
|
|
6
6
|
streamlit_react_components/common/button_group.py,sha256=g38gpR62dQ8KLd3JyANvGonT6tf-tyooIjC6t3O4iH0,2225
|
|
7
7
|
streamlit_react_components/common/chart_legend.py,sha256=So703OO-sI6SWrSVGKH0OTiI-smr4luqgBtXQ9GwIlI,1377
|
|
@@ -10,13 +10,13 @@ streamlit_react_components/common/metric_row.py,sha256=abDfSrLvZO8MK2gglvE98L5U0
|
|
|
10
10
|
streamlit_react_components/common/panel.py,sha256=O4URjnK8u9_byFzDO9RAFdpXjzNdxpXY1CX8gEEK1pY,1094
|
|
11
11
|
streamlit_react_components/common/plotly_chart.py,sha256=px1pITa8GSYl_TTg4KzX81nQy_F-9XwUV_91fR7d0po,9368
|
|
12
12
|
streamlit_react_components/common/section_header.py,sha256=2sVLWHjHx2WdhbVVLBgs5shwUUbw6lbAKbsAwiwIWpg,2983
|
|
13
|
-
streamlit_react_components/common/stat_card.py,sha256=
|
|
13
|
+
streamlit_react_components/common/stat_card.py,sha256=cNl5Kh8vzg3JbDDfp7TdwZ9HOxyoUw1Vn_Bt3QhMDUM,3415
|
|
14
14
|
streamlit_react_components/common/step_indicator.py,sha256=araovSL_c5h66PawZBf5IlQbVoxXwE9kD0H10ZopVoU,1370
|
|
15
15
|
streamlit_react_components/form/__init__.py,sha256=XP9oBEHSwLTNqu88sYm0F_n828yzPStDJl3N62HxVvc,222
|
|
16
|
-
streamlit_react_components/form/checkbox_group.py,sha256=
|
|
16
|
+
streamlit_react_components/form/checkbox_group.py,sha256=LbwfyIRKjTnWOB-a4OL2-vJXAJ9QpXhbrbdUz5bBdW4,2100
|
|
17
17
|
streamlit_react_components/form/form_select.py,sha256=KILKVUO-Elb0nqbTEImxyoGQQrnZ_jft30iJSbY5ksk,1946
|
|
18
18
|
streamlit_react_components/form/form_slider.py,sha256=4w9h-d-9yAHg3ZqUHCZGzsfUG3lP5OTwVrDo5sZAnfQ,2032
|
|
19
|
-
streamlit_react_components-1.0.
|
|
20
|
-
streamlit_react_components-1.0.
|
|
21
|
-
streamlit_react_components-1.0.
|
|
22
|
-
streamlit_react_components-1.0.
|
|
19
|
+
streamlit_react_components-1.0.3.dist-info/METADATA,sha256=nAWOVVMnB59BJBDZ3yaQG5Vx5TSlCEVtlEYXPBusvd0,21677
|
|
20
|
+
streamlit_react_components-1.0.3.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
21
|
+
streamlit_react_components-1.0.3.dist-info/top_level.txt,sha256=3JFrl15-Uewx3BFMSzqrBufF9GmTS1LDKfShmg0R9VE,27
|
|
22
|
+
streamlit_react_components-1.0.3.dist-info/RECORD,,
|
|
File without changes
|