reflex 0.3.8a2__py3-none-any.whl → 0.3.9a2__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.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/apps/blank/code/blank.py +1 -1
- reflex/.templates/apps/demo/code/demo.py +1 -1
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +1 -1
- reflex/__init__.py +1 -0
- reflex/__init__.pyi +1 -0
- reflex/app.py +107 -86
- reflex/compiler/compiler.py +110 -0
- reflex/components/component.py +3 -1
- reflex/components/core/match.py +8 -4
- reflex/components/datadisplay/dataeditor.py +5 -1
- reflex/components/markdown/markdown.py +1 -0
- reflex/components/radix/__init__.py +2 -0
- reflex/components/radix/primitives/__init__.py +14 -1
- reflex/components/radix/primitives/accordion.py +426 -69
- reflex/components/radix/primitives/accordion.pyi +41 -11
- reflex/components/radix/primitives/base.py +4 -0
- reflex/components/radix/primitives/base.pyi +81 -0
- reflex/components/radix/primitives/form.py +4 -2
- reflex/components/radix/primitives/form.pyi +2 -2
- reflex/components/radix/primitives/progress.py +4 -2
- reflex/components/radix/primitives/progress.pyi +2 -2
- reflex/components/radix/primitives/slider.py +7 -5
- reflex/components/radix/primitives/slider.pyi +5 -5
- reflex/components/radix/themes/components/__init__.py +8 -2
- reflex/components/radix/themes/components/alertdialog.py +4 -4
- reflex/components/radix/themes/components/alertdialog.pyi +8 -1
- reflex/components/radix/themes/components/aspectratio.py +2 -4
- reflex/components/radix/themes/components/aspectratio.pyi +1 -3
- reflex/components/radix/themes/components/avatar.py +7 -3
- reflex/components/radix/themes/components/avatar.pyi +5 -3
- reflex/components/radix/themes/components/badge.py +5 -7
- reflex/components/radix/themes/components/badge.pyi +4 -6
- reflex/components/radix/themes/components/callout.py +36 -5
- reflex/components/radix/themes/components/callout.pyi +273 -9
- reflex/components/radix/themes/components/card.py +3 -3
- reflex/components/radix/themes/components/card.pyi +2 -2
- reflex/components/radix/themes/components/checkbox.py +41 -4
- reflex/components/radix/themes/components/checkbox.pyi +231 -8
- reflex/components/radix/themes/components/dialog.py +1 -1
- reflex/components/radix/themes/components/dialog.pyi +1 -1
- reflex/components/radix/themes/components/dropdownmenu.py +6 -0
- reflex/components/radix/themes/components/dropdownmenu.pyi +193 -0
- reflex/components/radix/themes/components/iconbutton.py +1 -1
- reflex/components/radix/themes/components/iconbutton.pyi +1 -1
- reflex/components/radix/themes/components/icons.py +1 -0
- reflex/components/radix/themes/components/inset.py +1 -0
- reflex/components/radix/themes/components/inset.pyi +1 -0
- reflex/components/radix/themes/components/radiogroup.py +68 -1
- reflex/components/radix/themes/components/radiogroup.pyi +254 -2
- reflex/components/radix/themes/components/select.py +93 -4
- reflex/components/radix/themes/components/select.pyi +246 -4
- reflex/components/radix/themes/components/slider.py +9 -6
- reflex/components/radix/themes/components/slider.pyi +12 -6
- reflex/components/radix/themes/components/tooltip.py +1 -0
- reflex/components/radix/themes/components/tooltip.pyi +1 -0
- reflex/components/radix/themes/layout/box.py +1 -1
- reflex/state.py +9 -4
- reflex/style.py +15 -0
- reflex/utils/path_ops.py +2 -2
- reflex/utils/prerequisites.py +57 -5
- reflex/utils/types.py +4 -1
- reflex/vars.py +36 -3
- {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/METADATA +2 -2
- {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/RECORD +67 -67
- {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/WHEEL +1 -1
- {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/LICENSE +0 -0
- {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"""Interactive components provided by @radix-ui/themes."""
|
|
2
|
-
from typing import Any, Dict, Literal
|
|
2
|
+
from typing import Any, Dict, List, Literal, Union
|
|
3
3
|
|
|
4
|
+
import reflex as rx
|
|
5
|
+
from reflex.components.component import Component
|
|
4
6
|
from reflex.vars import Var
|
|
5
7
|
|
|
6
8
|
from ..base import (
|
|
@@ -24,18 +26,24 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
24
26
|
# The value of the select when initially rendered. Use when you do not need to control the state of the select.
|
|
25
27
|
default_value: Var[str]
|
|
26
28
|
|
|
27
|
-
# The controlled value of the select.
|
|
29
|
+
# The controlled value of the select. Should be used in conjunction with on_value_change.
|
|
28
30
|
value: Var[str]
|
|
29
31
|
|
|
30
32
|
# The open state of the select when it is initially rendered. Use when you do not need to control its open state.
|
|
31
33
|
default_open: Var[bool]
|
|
32
34
|
|
|
33
|
-
# The controlled open state of the select. Must be used in conjunction with
|
|
35
|
+
# The controlled open state of the select. Must be used in conjunction with on_open_change.
|
|
34
36
|
open: Var[bool]
|
|
35
37
|
|
|
36
38
|
# The name of the select control when submitting the form.
|
|
37
39
|
name: Var[str]
|
|
38
40
|
|
|
41
|
+
# When True, prevents the user from interacting with select.
|
|
42
|
+
disabled: Var[bool]
|
|
43
|
+
|
|
44
|
+
# When True, indicates that the user must select a value before the owning form can be submitted.
|
|
45
|
+
required: Var[bool]
|
|
46
|
+
|
|
39
47
|
def get_event_triggers(self) -> Dict[str, Any]:
|
|
40
48
|
"""Get the events triggers signatures for the component.
|
|
41
49
|
|
|
@@ -121,9 +129,12 @@ class SelectItem(CommonMarginProps, RadixThemesComponent):
|
|
|
121
129
|
|
|
122
130
|
tag = "Select.Item"
|
|
123
131
|
|
|
124
|
-
# The value
|
|
132
|
+
# The value given as data when submitting a form with a name.
|
|
125
133
|
value: Var[str]
|
|
126
134
|
|
|
135
|
+
# Whether the select item is disabled
|
|
136
|
+
disabled: Var[bool]
|
|
137
|
+
|
|
127
138
|
|
|
128
139
|
class SelectLabel(CommonMarginProps, RadixThemesComponent):
|
|
129
140
|
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
|
|
@@ -135,3 +146,81 @@ class SelectSeparator(CommonMarginProps, RadixThemesComponent):
|
|
|
135
146
|
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
|
|
136
147
|
|
|
137
148
|
tag = "Select.Separator"
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class HighLevelSelect(SelectRoot):
|
|
152
|
+
"""High level wrapper for the Select component."""
|
|
153
|
+
|
|
154
|
+
# The items of the select.
|
|
155
|
+
items: Var[List[str]]
|
|
156
|
+
|
|
157
|
+
# The placeholder of the select.
|
|
158
|
+
placeholder: Var[str]
|
|
159
|
+
|
|
160
|
+
# The label of the select.
|
|
161
|
+
label: Var[str]
|
|
162
|
+
|
|
163
|
+
# The color of the select.
|
|
164
|
+
color: Var[LiteralAccentColor]
|
|
165
|
+
|
|
166
|
+
# Whether to render the select with higher contrast color against background.
|
|
167
|
+
high_contrast: Var[bool]
|
|
168
|
+
|
|
169
|
+
# The variant of the select.
|
|
170
|
+
variant: Var[Literal["classic", "surface", "soft", "ghost"]]
|
|
171
|
+
|
|
172
|
+
# The radius of the select.
|
|
173
|
+
radius: Var[LiteralRadius]
|
|
174
|
+
|
|
175
|
+
# The width of the select.
|
|
176
|
+
width: Var[str]
|
|
177
|
+
|
|
178
|
+
@classmethod
|
|
179
|
+
def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component:
|
|
180
|
+
"""Create a select component.
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
items: The items of the select.
|
|
184
|
+
**props: Additional properties to apply to the select component.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
The select component.
|
|
188
|
+
"""
|
|
189
|
+
content_props = {
|
|
190
|
+
prop: props.pop(prop) for prop in ["high_contrast"] if prop in props
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
trigger_props = {
|
|
194
|
+
prop: props.pop(prop)
|
|
195
|
+
for prop in ["placeholder", "variant", "radius", "width"]
|
|
196
|
+
if prop in props
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
color = props.pop("color", None)
|
|
200
|
+
|
|
201
|
+
if color is not None:
|
|
202
|
+
content_props["color_scheme"] = color
|
|
203
|
+
trigger_props["color_scheme"] = color
|
|
204
|
+
|
|
205
|
+
label = props.pop("label", None)
|
|
206
|
+
|
|
207
|
+
if isinstance(items, Var):
|
|
208
|
+
child = [
|
|
209
|
+
rx.foreach(items, lambda item: SelectItem.create(item, value=item))
|
|
210
|
+
]
|
|
211
|
+
else:
|
|
212
|
+
child = [SelectItem.create(item, value=item) for item in items]
|
|
213
|
+
|
|
214
|
+
return SelectRoot.create(
|
|
215
|
+
SelectTrigger.create(
|
|
216
|
+
**trigger_props,
|
|
217
|
+
),
|
|
218
|
+
SelectContent.create(
|
|
219
|
+
SelectGroup.create(
|
|
220
|
+
SelectLabel.create(label) if label is not None else "",
|
|
221
|
+
*child,
|
|
222
|
+
),
|
|
223
|
+
**content_props,
|
|
224
|
+
),
|
|
225
|
+
**props,
|
|
226
|
+
)
|
|
@@ -7,7 +7,9 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any, Dict, Literal
|
|
10
|
+
from typing import Any, Dict, List, Literal, Union
|
|
11
|
+
import reflex as rx
|
|
12
|
+
from reflex.components.component import Component
|
|
11
13
|
from reflex.vars import Var
|
|
12
14
|
from ..base import (
|
|
13
15
|
CommonMarginProps,
|
|
@@ -94,6 +96,8 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
94
96
|
default_open: Optional[Union[Var[bool], bool]] = None,
|
|
95
97
|
open: Optional[Union[Var[bool], bool]] = None,
|
|
96
98
|
name: Optional[Union[Var[str], str]] = None,
|
|
99
|
+
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
100
|
+
required: Optional[Union[Var[bool], bool]] = None,
|
|
97
101
|
m: Optional[
|
|
98
102
|
Union[
|
|
99
103
|
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
@@ -206,10 +210,12 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
206
210
|
color_scheme: map to radix color property.
|
|
207
211
|
size: The size of the select: "1" | "2" | "3"
|
|
208
212
|
default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select.
|
|
209
|
-
value: The controlled value of the select.
|
|
213
|
+
value: The controlled value of the select. Should be used in conjunction with on_value_change.
|
|
210
214
|
default_open: The open state of the select when it is initially rendered. Use when you do not need to control its open state.
|
|
211
|
-
open: The controlled open state of the select. Must be used in conjunction with
|
|
215
|
+
open: The controlled open state of the select. Must be used in conjunction with on_open_change.
|
|
212
216
|
name: The name of the select control when submitting the form.
|
|
217
|
+
disabled: When True, prevents the user from interacting with select.
|
|
218
|
+
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
|
213
219
|
m: Margin: "0" - "9"
|
|
214
220
|
mx: Margin horizontal: "0" - "9"
|
|
215
221
|
my: Margin vertical: "0" - "9"
|
|
@@ -936,6 +942,7 @@ class SelectItem(CommonMarginProps, RadixThemesComponent):
|
|
|
936
942
|
]
|
|
937
943
|
] = None,
|
|
938
944
|
value: Optional[Union[Var[str], str]] = None,
|
|
945
|
+
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
939
946
|
m: Optional[
|
|
940
947
|
Union[
|
|
941
948
|
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
@@ -1040,7 +1047,8 @@ class SelectItem(CommonMarginProps, RadixThemesComponent):
|
|
|
1040
1047
|
*children: Child components.
|
|
1041
1048
|
color: map to CSS default color property.
|
|
1042
1049
|
color_scheme: map to radix color property.
|
|
1043
|
-
value: The value
|
|
1050
|
+
value: The value given as data when submitting a form with a name.
|
|
1051
|
+
disabled: Whether the select item is disabled
|
|
1044
1052
|
m: Margin: "0" - "9"
|
|
1045
1053
|
mx: Margin horizontal: "0" - "9"
|
|
1046
1054
|
my: Margin vertical: "0" - "9"
|
|
@@ -1446,3 +1454,237 @@ class SelectSeparator(CommonMarginProps, RadixThemesComponent):
|
|
|
1446
1454
|
A new component instance.
|
|
1447
1455
|
"""
|
|
1448
1456
|
...
|
|
1457
|
+
|
|
1458
|
+
class HighLevelSelect(SelectRoot):
|
|
1459
|
+
@overload
|
|
1460
|
+
@classmethod
|
|
1461
|
+
def create( # type: ignore
|
|
1462
|
+
cls,
|
|
1463
|
+
*children,
|
|
1464
|
+
items: Optional[Union[Var[List[str]], List[str]]] = None,
|
|
1465
|
+
placeholder: Optional[Union[Var[str], str]] = None,
|
|
1466
|
+
label: Optional[Union[Var[str], str]] = None,
|
|
1467
|
+
color: Optional[
|
|
1468
|
+
Union[
|
|
1469
|
+
Var[
|
|
1470
|
+
Literal[
|
|
1471
|
+
"tomato",
|
|
1472
|
+
"red",
|
|
1473
|
+
"ruby",
|
|
1474
|
+
"crimson",
|
|
1475
|
+
"pink",
|
|
1476
|
+
"plum",
|
|
1477
|
+
"purple",
|
|
1478
|
+
"violet",
|
|
1479
|
+
"iris",
|
|
1480
|
+
"indigo",
|
|
1481
|
+
"blue",
|
|
1482
|
+
"cyan",
|
|
1483
|
+
"teal",
|
|
1484
|
+
"jade",
|
|
1485
|
+
"green",
|
|
1486
|
+
"grass",
|
|
1487
|
+
"brown",
|
|
1488
|
+
"orange",
|
|
1489
|
+
"sky",
|
|
1490
|
+
"mint",
|
|
1491
|
+
"lime",
|
|
1492
|
+
"yellow",
|
|
1493
|
+
"amber",
|
|
1494
|
+
"gold",
|
|
1495
|
+
"bronze",
|
|
1496
|
+
"gray",
|
|
1497
|
+
]
|
|
1498
|
+
],
|
|
1499
|
+
Literal[
|
|
1500
|
+
"tomato",
|
|
1501
|
+
"red",
|
|
1502
|
+
"ruby",
|
|
1503
|
+
"crimson",
|
|
1504
|
+
"pink",
|
|
1505
|
+
"plum",
|
|
1506
|
+
"purple",
|
|
1507
|
+
"violet",
|
|
1508
|
+
"iris",
|
|
1509
|
+
"indigo",
|
|
1510
|
+
"blue",
|
|
1511
|
+
"cyan",
|
|
1512
|
+
"teal",
|
|
1513
|
+
"jade",
|
|
1514
|
+
"green",
|
|
1515
|
+
"grass",
|
|
1516
|
+
"brown",
|
|
1517
|
+
"orange",
|
|
1518
|
+
"sky",
|
|
1519
|
+
"mint",
|
|
1520
|
+
"lime",
|
|
1521
|
+
"yellow",
|
|
1522
|
+
"amber",
|
|
1523
|
+
"gold",
|
|
1524
|
+
"bronze",
|
|
1525
|
+
"gray",
|
|
1526
|
+
],
|
|
1527
|
+
]
|
|
1528
|
+
] = None,
|
|
1529
|
+
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
1530
|
+
variant: Optional[
|
|
1531
|
+
Union[
|
|
1532
|
+
Var[Literal["classic", "surface", "soft", "ghost"]],
|
|
1533
|
+
Literal["classic", "surface", "soft", "ghost"],
|
|
1534
|
+
]
|
|
1535
|
+
] = None,
|
|
1536
|
+
radius: Optional[
|
|
1537
|
+
Union[
|
|
1538
|
+
Var[Literal["none", "small", "medium", "large", "full"]],
|
|
1539
|
+
Literal["none", "small", "medium", "large", "full"],
|
|
1540
|
+
]
|
|
1541
|
+
] = None,
|
|
1542
|
+
width: Optional[Union[Var[str], str]] = None,
|
|
1543
|
+
size: Optional[Union[Var[Literal[1, 2, 3]], Literal[1, 2, 3]]] = None,
|
|
1544
|
+
default_value: Optional[Union[Var[str], str]] = None,
|
|
1545
|
+
value: Optional[Union[Var[str], str]] = None,
|
|
1546
|
+
default_open: Optional[Union[Var[bool], bool]] = None,
|
|
1547
|
+
open: Optional[Union[Var[bool], bool]] = None,
|
|
1548
|
+
name: Optional[Union[Var[str], str]] = None,
|
|
1549
|
+
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
1550
|
+
required: Optional[Union[Var[bool], bool]] = None,
|
|
1551
|
+
m: Optional[
|
|
1552
|
+
Union[
|
|
1553
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
1554
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
1555
|
+
]
|
|
1556
|
+
] = None,
|
|
1557
|
+
mx: Optional[
|
|
1558
|
+
Union[
|
|
1559
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
1560
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
1561
|
+
]
|
|
1562
|
+
] = None,
|
|
1563
|
+
my: Optional[
|
|
1564
|
+
Union[
|
|
1565
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
1566
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
1567
|
+
]
|
|
1568
|
+
] = None,
|
|
1569
|
+
mt: Optional[
|
|
1570
|
+
Union[
|
|
1571
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
1572
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
1573
|
+
]
|
|
1574
|
+
] = None,
|
|
1575
|
+
mr: Optional[
|
|
1576
|
+
Union[
|
|
1577
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
1578
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
1579
|
+
]
|
|
1580
|
+
] = None,
|
|
1581
|
+
mb: Optional[
|
|
1582
|
+
Union[
|
|
1583
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
1584
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
1585
|
+
]
|
|
1586
|
+
] = None,
|
|
1587
|
+
ml: Optional[
|
|
1588
|
+
Union[
|
|
1589
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
1590
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
1591
|
+
]
|
|
1592
|
+
] = None,
|
|
1593
|
+
style: Optional[Style] = None,
|
|
1594
|
+
key: Optional[Any] = None,
|
|
1595
|
+
id: Optional[Any] = None,
|
|
1596
|
+
class_name: Optional[Any] = None,
|
|
1597
|
+
autofocus: Optional[bool] = None,
|
|
1598
|
+
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
1599
|
+
on_blur: Optional[
|
|
1600
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1601
|
+
] = None,
|
|
1602
|
+
on_click: Optional[
|
|
1603
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1604
|
+
] = None,
|
|
1605
|
+
on_context_menu: Optional[
|
|
1606
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1607
|
+
] = None,
|
|
1608
|
+
on_double_click: Optional[
|
|
1609
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1610
|
+
] = None,
|
|
1611
|
+
on_focus: Optional[
|
|
1612
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1613
|
+
] = None,
|
|
1614
|
+
on_mount: Optional[
|
|
1615
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1616
|
+
] = None,
|
|
1617
|
+
on_mouse_down: Optional[
|
|
1618
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1619
|
+
] = None,
|
|
1620
|
+
on_mouse_enter: Optional[
|
|
1621
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1622
|
+
] = None,
|
|
1623
|
+
on_mouse_leave: Optional[
|
|
1624
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1625
|
+
] = None,
|
|
1626
|
+
on_mouse_move: Optional[
|
|
1627
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1628
|
+
] = None,
|
|
1629
|
+
on_mouse_out: Optional[
|
|
1630
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1631
|
+
] = None,
|
|
1632
|
+
on_mouse_over: Optional[
|
|
1633
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1634
|
+
] = None,
|
|
1635
|
+
on_mouse_up: Optional[
|
|
1636
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1637
|
+
] = None,
|
|
1638
|
+
on_open_change: Optional[
|
|
1639
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1640
|
+
] = None,
|
|
1641
|
+
on_scroll: Optional[
|
|
1642
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1643
|
+
] = None,
|
|
1644
|
+
on_unmount: Optional[
|
|
1645
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1646
|
+
] = None,
|
|
1647
|
+
on_value_change: Optional[
|
|
1648
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1649
|
+
] = None,
|
|
1650
|
+
**props
|
|
1651
|
+
) -> "HighLevelSelect":
|
|
1652
|
+
"""Create a select component.
|
|
1653
|
+
|
|
1654
|
+
Args:
|
|
1655
|
+
items: The items of the select.
|
|
1656
|
+
items: The items of the select.
|
|
1657
|
+
placeholder: The placeholder of the select.
|
|
1658
|
+
label: The label of the select.
|
|
1659
|
+
color: The color of the select.
|
|
1660
|
+
high_contrast: Whether to render the select with higher contrast color against background.
|
|
1661
|
+
variant: The variant of the select.
|
|
1662
|
+
radius: The radius of the select.
|
|
1663
|
+
width: The width of the select.
|
|
1664
|
+
size: The size of the select: "1" | "2" | "3"
|
|
1665
|
+
default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select.
|
|
1666
|
+
value: The controlled value of the select. Should be used in conjunction with on_value_change.
|
|
1667
|
+
default_open: The open state of the select when it is initially rendered. Use when you do not need to control its open state.
|
|
1668
|
+
open: The controlled open state of the select. Must be used in conjunction with on_open_change.
|
|
1669
|
+
name: The name of the select control when submitting the form.
|
|
1670
|
+
disabled: When True, prevents the user from interacting with select.
|
|
1671
|
+
required: When True, indicates that the user must select a value before the owning form can be submitted.
|
|
1672
|
+
m: Margin: "0" - "9"
|
|
1673
|
+
mx: Margin horizontal: "0" - "9"
|
|
1674
|
+
my: Margin vertical: "0" - "9"
|
|
1675
|
+
mt: Margin top: "0" - "9"
|
|
1676
|
+
mr: Margin right: "0" - "9"
|
|
1677
|
+
mb: Margin bottom: "0" - "9"
|
|
1678
|
+
ml: Margin left: "0" - "9"
|
|
1679
|
+
style: The style of the component.
|
|
1680
|
+
key: A unique key for the component.
|
|
1681
|
+
id: The id for the component.
|
|
1682
|
+
class_name: The class name for the component.
|
|
1683
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
1684
|
+
custom_attrs: custom attribute
|
|
1685
|
+
**props: Additional properties to apply to the select component.
|
|
1686
|
+
|
|
1687
|
+
Returns:
|
|
1688
|
+
The select component.
|
|
1689
|
+
"""
|
|
1690
|
+
...
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""Interactive components provided by @radix-ui/themes."""
|
|
2
|
-
from typing import Any, Dict, List, Literal
|
|
2
|
+
from typing import Any, Dict, List, Literal, Union
|
|
3
3
|
|
|
4
4
|
from reflex.vars import Var
|
|
5
5
|
|
|
@@ -35,19 +35,22 @@ class Slider(CommonMarginProps, RadixThemesComponent):
|
|
|
35
35
|
radius: Var[LiteralRadius]
|
|
36
36
|
|
|
37
37
|
# The value of the slider when initially rendered. Use when you do not need to control the state of the slider.
|
|
38
|
-
default_value: Var[List[float]]
|
|
38
|
+
default_value: Var[List[Union[float, int]]]
|
|
39
39
|
|
|
40
40
|
# The controlled value of the slider. Must be used in conjunction with onValueChange.
|
|
41
|
-
value: Var[float]
|
|
41
|
+
value: Var[List[Union[float, int]]]
|
|
42
|
+
|
|
43
|
+
# The name of the slider. Submitted with its owning form as part of a name/value pair.
|
|
44
|
+
name: Var[str]
|
|
42
45
|
|
|
43
46
|
# The minimum value of the slider.
|
|
44
|
-
min: Var[float]
|
|
47
|
+
min: Var[Union[float, int]]
|
|
45
48
|
|
|
46
49
|
# The maximum value of the slider.
|
|
47
|
-
max: Var[float]
|
|
50
|
+
max: Var[Union[float, int]]
|
|
48
51
|
|
|
49
52
|
# The step value of the slider.
|
|
50
|
-
step: Var[float]
|
|
53
|
+
step: Var[Union[float, int]]
|
|
51
54
|
|
|
52
55
|
# Whether the slider is disabled
|
|
53
56
|
disabled: Var[bool]
|
|
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any, Dict, List, Literal
|
|
10
|
+
from typing import Any, Dict, List, Literal, Union
|
|
11
11
|
from reflex.vars import Var
|
|
12
12
|
from ..base import (
|
|
13
13
|
CommonMarginProps,
|
|
@@ -103,11 +103,16 @@ class Slider(CommonMarginProps, RadixThemesComponent):
|
|
|
103
103
|
Literal["none", "small", "medium", "large", "full"],
|
|
104
104
|
]
|
|
105
105
|
] = None,
|
|
106
|
-
default_value: Optional[
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
default_value: Optional[
|
|
107
|
+
Union[Var[List[Union[float, int]]], List[Union[float, int]]]
|
|
108
|
+
] = None,
|
|
109
|
+
value: Optional[
|
|
110
|
+
Union[Var[List[Union[float, int]]], List[Union[float, int]]]
|
|
111
|
+
] = None,
|
|
112
|
+
name: Optional[Union[Var[str], str]] = None,
|
|
113
|
+
min: Optional[Union[Var[Union[float, int]], Union[float, int]]] = None,
|
|
114
|
+
max: Optional[Union[Var[Union[float, int]], Union[float, int]]] = None,
|
|
115
|
+
step: Optional[Union[Var[Union[float, int]], Union[float, int]]] = None,
|
|
111
116
|
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
112
117
|
orientation: Optional[
|
|
113
118
|
Union[
|
|
@@ -232,6 +237,7 @@ class Slider(CommonMarginProps, RadixThemesComponent):
|
|
|
232
237
|
radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
|
|
233
238
|
default_value: The value of the slider when initially rendered. Use when you do not need to control the state of the slider.
|
|
234
239
|
value: The controlled value of the slider. Must be used in conjunction with onValueChange.
|
|
240
|
+
name: The name of the slider. Submitted with its owning form as part of a name/value pair.
|
|
235
241
|
min: The minimum value of the slider.
|
|
236
242
|
max: The maximum value of the slider.
|
|
237
243
|
step: The step value of the slider.
|
|
@@ -184,6 +184,7 @@ class Tooltip(CommonMarginProps, RadixThemesComponent):
|
|
|
184
184
|
*children: Child components.
|
|
185
185
|
color: map to CSS default color property.
|
|
186
186
|
color_scheme: map to radix color property.
|
|
187
|
+
content: The content of the tooltip.
|
|
187
188
|
m: Margin: "0" - "9"
|
|
188
189
|
mx: Margin horizontal: "0" - "9"
|
|
189
190
|
my: Margin vertical: "0" - "9"
|
reflex/state.py
CHANGED
|
@@ -315,7 +315,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
315
315
|
cls.new_backend_vars = {
|
|
316
316
|
name: value
|
|
317
317
|
for name, value in cls.__dict__.items()
|
|
318
|
-
if types.is_backend_variable(name)
|
|
318
|
+
if types.is_backend_variable(name, cls)
|
|
319
319
|
and name not in cls.inherited_backend_vars
|
|
320
320
|
and not isinstance(value, FunctionType)
|
|
321
321
|
}
|
|
@@ -332,7 +332,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
332
332
|
}
|
|
333
333
|
cls.computed_vars = {
|
|
334
334
|
v._var_name: v._var_set_state(cls)
|
|
335
|
-
for
|
|
335
|
+
for mixin in cls.__mro__
|
|
336
|
+
if mixin is cls or not issubclass(mixin, (BaseState, ABC))
|
|
337
|
+
for v in mixin.__dict__.values()
|
|
336
338
|
if isinstance(v, ComputedVar)
|
|
337
339
|
}
|
|
338
340
|
cls.vars = {
|
|
@@ -876,7 +878,10 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
876
878
|
setattr(self.parent_state, name, value)
|
|
877
879
|
return
|
|
878
880
|
|
|
879
|
-
if
|
|
881
|
+
if (
|
|
882
|
+
types.is_backend_variable(name, self.__class__)
|
|
883
|
+
and name not in RESERVED_BACKEND_VAR_NAMES
|
|
884
|
+
):
|
|
880
885
|
self._backend_vars.__setitem__(name, value)
|
|
881
886
|
self.dirty_vars.add(name)
|
|
882
887
|
self._mark_dirty()
|
|
@@ -1175,7 +1180,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
1175
1180
|
subdelta = {
|
|
1176
1181
|
prop: getattr(self, prop)
|
|
1177
1182
|
for prop in delta_vars
|
|
1178
|
-
if not types.is_backend_variable(prop)
|
|
1183
|
+
if not types.is_backend_variable(prop, self.__class__)
|
|
1179
1184
|
}
|
|
1180
1185
|
if len(subdelta) > 0:
|
|
1181
1186
|
delta[self.get_full_name()] = subdelta
|
reflex/style.py
CHANGED
|
@@ -220,3 +220,18 @@ def format_as_emotion(style_dict: dict[str, Any]) -> dict[str, Any] | None:
|
|
|
220
220
|
emotion_style[key] = value
|
|
221
221
|
if emotion_style:
|
|
222
222
|
return emotion_style
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def convert_dict_to_style_and_format_emotion(
|
|
226
|
+
raw_dict: dict[str, Any]
|
|
227
|
+
) -> dict[str, Any] | None:
|
|
228
|
+
"""Convert a dict to a style dict and then format as emotion.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
raw_dict: The dict to convert.
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
The emotion dict.
|
|
235
|
+
|
|
236
|
+
"""
|
|
237
|
+
return format_as_emotion(Style(raw_dict))
|
reflex/utils/path_ops.py
CHANGED
|
@@ -121,8 +121,8 @@ def get_node_bin_path() -> str | None:
|
|
|
121
121
|
"""
|
|
122
122
|
if not os.path.exists(constants.Node.BIN_PATH):
|
|
123
123
|
str_path = which("node")
|
|
124
|
-
return str(Path(str_path).parent) if str_path else str_path
|
|
125
|
-
return constants.Node.BIN_PATH
|
|
124
|
+
return str(Path(str_path).parent.resolve()) if str_path else str_path
|
|
125
|
+
return str(Path(constants.Node.BIN_PATH).resolve())
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
def get_node_path() -> str | None:
|