reflex 0.3.8a2__py3-none-any.whl → 0.3.9__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.

Files changed (67) hide show
  1. reflex/.templates/apps/blank/code/blank.py +1 -1
  2. reflex/.templates/apps/demo/code/demo.py +1 -1
  3. reflex/.templates/jinja/web/pages/utils.js.jinja2 +1 -1
  4. reflex/__init__.py +1 -0
  5. reflex/__init__.pyi +1 -0
  6. reflex/app.py +4 -5
  7. reflex/components/component.py +3 -1
  8. reflex/components/core/match.py +8 -4
  9. reflex/components/datadisplay/dataeditor.py +5 -1
  10. reflex/components/markdown/markdown.py +1 -0
  11. reflex/components/radix/__init__.py +2 -0
  12. reflex/components/radix/primitives/__init__.py +14 -1
  13. reflex/components/radix/primitives/accordion.py +430 -69
  14. reflex/components/radix/primitives/accordion.pyi +41 -11
  15. reflex/components/radix/primitives/base.py +4 -0
  16. reflex/components/radix/primitives/base.pyi +81 -0
  17. reflex/components/radix/primitives/form.py +4 -2
  18. reflex/components/radix/primitives/form.pyi +2 -2
  19. reflex/components/radix/primitives/progress.py +4 -2
  20. reflex/components/radix/primitives/progress.pyi +2 -2
  21. reflex/components/radix/primitives/slider.py +7 -5
  22. reflex/components/radix/primitives/slider.pyi +5 -5
  23. reflex/components/radix/themes/components/__init__.py +8 -2
  24. reflex/components/radix/themes/components/alertdialog.py +4 -4
  25. reflex/components/radix/themes/components/alertdialog.pyi +8 -1
  26. reflex/components/radix/themes/components/aspectratio.py +2 -4
  27. reflex/components/radix/themes/components/aspectratio.pyi +1 -3
  28. reflex/components/radix/themes/components/avatar.py +7 -3
  29. reflex/components/radix/themes/components/avatar.pyi +5 -3
  30. reflex/components/radix/themes/components/badge.py +5 -7
  31. reflex/components/radix/themes/components/badge.pyi +4 -6
  32. reflex/components/radix/themes/components/callout.py +36 -5
  33. reflex/components/radix/themes/components/callout.pyi +273 -9
  34. reflex/components/radix/themes/components/card.py +3 -3
  35. reflex/components/radix/themes/components/card.pyi +2 -2
  36. reflex/components/radix/themes/components/checkbox.py +41 -4
  37. reflex/components/radix/themes/components/checkbox.pyi +231 -8
  38. reflex/components/radix/themes/components/dialog.py +1 -1
  39. reflex/components/radix/themes/components/dialog.pyi +1 -1
  40. reflex/components/radix/themes/components/dropdownmenu.py +6 -0
  41. reflex/components/radix/themes/components/dropdownmenu.pyi +193 -0
  42. reflex/components/radix/themes/components/iconbutton.py +1 -1
  43. reflex/components/radix/themes/components/iconbutton.pyi +1 -1
  44. reflex/components/radix/themes/components/icons.py +1 -0
  45. reflex/components/radix/themes/components/inset.py +1 -0
  46. reflex/components/radix/themes/components/inset.pyi +1 -0
  47. reflex/components/radix/themes/components/radiogroup.py +68 -1
  48. reflex/components/radix/themes/components/radiogroup.pyi +254 -2
  49. reflex/components/radix/themes/components/select.py +94 -5
  50. reflex/components/radix/themes/components/select.pyi +251 -5
  51. reflex/components/radix/themes/components/slider.py +9 -6
  52. reflex/components/radix/themes/components/slider.pyi +12 -6
  53. reflex/components/radix/themes/components/tooltip.py +1 -0
  54. reflex/components/radix/themes/components/tooltip.pyi +1 -0
  55. reflex/components/radix/themes/layout/box.py +1 -1
  56. reflex/state.py +9 -4
  57. reflex/style.py +15 -0
  58. reflex/utils/format.py +13 -9
  59. reflex/utils/path_ops.py +2 -2
  60. reflex/utils/prerequisites.py +57 -5
  61. reflex/utils/types.py +4 -1
  62. reflex/vars.py +36 -3
  63. {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/METADATA +2 -2
  64. {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/RECORD +67 -67
  65. {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/WHEEL +1 -1
  66. {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/LICENSE +0 -0
  67. {reflex-0.3.8a2.dist-info → reflex-0.3.9.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 (
@@ -19,23 +21,29 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent):
19
21
  tag = "Select.Root"
20
22
 
21
23
  # The size of the select: "1" | "2" | "3"
22
- size: Var[Literal[1, 2, 3]]
24
+ size: Var[Literal["1", "2", "3"]]
23
25
 
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. Use when you need to control the state 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 onOpenChange.
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 of the select item when submitting the form.
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,
@@ -88,12 +90,16 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent):
88
90
  ],
89
91
  ]
90
92
  ] = None,
91
- size: Optional[Union[Var[Literal[1, 2, 3]], Literal[1, 2, 3]]] = None,
93
+ size: Optional[
94
+ Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
95
+ ] = None,
92
96
  default_value: Optional[Union[Var[str], str]] = None,
93
97
  value: Optional[Union[Var[str], str]] = None,
94
98
  default_open: Optional[Union[Var[bool], bool]] = None,
95
99
  open: Optional[Union[Var[bool], bool]] = None,
96
100
  name: Optional[Union[Var[str], str]] = None,
101
+ disabled: Optional[Union[Var[bool], bool]] = None,
102
+ required: Optional[Union[Var[bool], bool]] = None,
97
103
  m: Optional[
98
104
  Union[
99
105
  Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@@ -206,10 +212,12 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent):
206
212
  color_scheme: map to radix color property.
207
213
  size: The size of the select: "1" | "2" | "3"
208
214
  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. Use when you need to control the state of the select.
215
+ value: The controlled value of the select. Should be used in conjunction with on_value_change.
210
216
  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 onOpenChange.
217
+ open: The controlled open state of the select. Must be used in conjunction with on_open_change.
212
218
  name: The name of the select control when submitting the form.
219
+ disabled: When True, prevents the user from interacting with select.
220
+ required: When True, indicates that the user must select a value before the owning form can be submitted.
213
221
  m: Margin: "0" - "9"
214
222
  mx: Margin horizontal: "0" - "9"
215
223
  my: Margin vertical: "0" - "9"
@@ -936,6 +944,7 @@ class SelectItem(CommonMarginProps, RadixThemesComponent):
936
944
  ]
937
945
  ] = None,
938
946
  value: Optional[Union[Var[str], str]] = None,
947
+ disabled: Optional[Union[Var[bool], bool]] = None,
939
948
  m: Optional[
940
949
  Union[
941
950
  Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@@ -1040,7 +1049,8 @@ class SelectItem(CommonMarginProps, RadixThemesComponent):
1040
1049
  *children: Child components.
1041
1050
  color: map to CSS default color property.
1042
1051
  color_scheme: map to radix color property.
1043
- value: The value of the select item when submitting the form.
1052
+ value: The value given as data when submitting a form with a name.
1053
+ disabled: Whether the select item is disabled
1044
1054
  m: Margin: "0" - "9"
1045
1055
  mx: Margin horizontal: "0" - "9"
1046
1056
  my: Margin vertical: "0" - "9"
@@ -1446,3 +1456,239 @@ class SelectSeparator(CommonMarginProps, RadixThemesComponent):
1446
1456
  A new component instance.
1447
1457
  """
1448
1458
  ...
1459
+
1460
+ class HighLevelSelect(SelectRoot):
1461
+ @overload
1462
+ @classmethod
1463
+ def create( # type: ignore
1464
+ cls,
1465
+ *children,
1466
+ items: Optional[Union[Var[List[str]], List[str]]] = None,
1467
+ placeholder: Optional[Union[Var[str], str]] = None,
1468
+ label: Optional[Union[Var[str], str]] = None,
1469
+ color: Optional[
1470
+ Union[
1471
+ Var[
1472
+ Literal[
1473
+ "tomato",
1474
+ "red",
1475
+ "ruby",
1476
+ "crimson",
1477
+ "pink",
1478
+ "plum",
1479
+ "purple",
1480
+ "violet",
1481
+ "iris",
1482
+ "indigo",
1483
+ "blue",
1484
+ "cyan",
1485
+ "teal",
1486
+ "jade",
1487
+ "green",
1488
+ "grass",
1489
+ "brown",
1490
+ "orange",
1491
+ "sky",
1492
+ "mint",
1493
+ "lime",
1494
+ "yellow",
1495
+ "amber",
1496
+ "gold",
1497
+ "bronze",
1498
+ "gray",
1499
+ ]
1500
+ ],
1501
+ Literal[
1502
+ "tomato",
1503
+ "red",
1504
+ "ruby",
1505
+ "crimson",
1506
+ "pink",
1507
+ "plum",
1508
+ "purple",
1509
+ "violet",
1510
+ "iris",
1511
+ "indigo",
1512
+ "blue",
1513
+ "cyan",
1514
+ "teal",
1515
+ "jade",
1516
+ "green",
1517
+ "grass",
1518
+ "brown",
1519
+ "orange",
1520
+ "sky",
1521
+ "mint",
1522
+ "lime",
1523
+ "yellow",
1524
+ "amber",
1525
+ "gold",
1526
+ "bronze",
1527
+ "gray",
1528
+ ],
1529
+ ]
1530
+ ] = None,
1531
+ high_contrast: Optional[Union[Var[bool], bool]] = None,
1532
+ variant: Optional[
1533
+ Union[
1534
+ Var[Literal["classic", "surface", "soft", "ghost"]],
1535
+ Literal["classic", "surface", "soft", "ghost"],
1536
+ ]
1537
+ ] = None,
1538
+ radius: Optional[
1539
+ Union[
1540
+ Var[Literal["none", "small", "medium", "large", "full"]],
1541
+ Literal["none", "small", "medium", "large", "full"],
1542
+ ]
1543
+ ] = None,
1544
+ width: Optional[Union[Var[str], str]] = None,
1545
+ size: Optional[
1546
+ Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
1547
+ ] = None,
1548
+ default_value: Optional[Union[Var[str], str]] = None,
1549
+ value: Optional[Union[Var[str], str]] = None,
1550
+ default_open: Optional[Union[Var[bool], bool]] = None,
1551
+ open: Optional[Union[Var[bool], bool]] = None,
1552
+ name: Optional[Union[Var[str], str]] = None,
1553
+ disabled: Optional[Union[Var[bool], bool]] = None,
1554
+ required: Optional[Union[Var[bool], bool]] = None,
1555
+ m: Optional[
1556
+ Union[
1557
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
1558
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
1559
+ ]
1560
+ ] = None,
1561
+ mx: Optional[
1562
+ Union[
1563
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
1564
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
1565
+ ]
1566
+ ] = None,
1567
+ my: Optional[
1568
+ Union[
1569
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
1570
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
1571
+ ]
1572
+ ] = None,
1573
+ mt: Optional[
1574
+ Union[
1575
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
1576
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
1577
+ ]
1578
+ ] = None,
1579
+ mr: Optional[
1580
+ Union[
1581
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
1582
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
1583
+ ]
1584
+ ] = None,
1585
+ mb: Optional[
1586
+ Union[
1587
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
1588
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
1589
+ ]
1590
+ ] = None,
1591
+ ml: Optional[
1592
+ Union[
1593
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
1594
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
1595
+ ]
1596
+ ] = None,
1597
+ style: Optional[Style] = None,
1598
+ key: Optional[Any] = None,
1599
+ id: Optional[Any] = None,
1600
+ class_name: Optional[Any] = None,
1601
+ autofocus: Optional[bool] = None,
1602
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
1603
+ on_blur: Optional[
1604
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1605
+ ] = None,
1606
+ on_click: Optional[
1607
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1608
+ ] = None,
1609
+ on_context_menu: Optional[
1610
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1611
+ ] = None,
1612
+ on_double_click: Optional[
1613
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1614
+ ] = None,
1615
+ on_focus: Optional[
1616
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1617
+ ] = None,
1618
+ on_mount: Optional[
1619
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1620
+ ] = None,
1621
+ on_mouse_down: Optional[
1622
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1623
+ ] = None,
1624
+ on_mouse_enter: Optional[
1625
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1626
+ ] = None,
1627
+ on_mouse_leave: Optional[
1628
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1629
+ ] = None,
1630
+ on_mouse_move: Optional[
1631
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1632
+ ] = None,
1633
+ on_mouse_out: Optional[
1634
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1635
+ ] = None,
1636
+ on_mouse_over: Optional[
1637
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1638
+ ] = None,
1639
+ on_mouse_up: Optional[
1640
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1641
+ ] = None,
1642
+ on_open_change: Optional[
1643
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1644
+ ] = None,
1645
+ on_scroll: Optional[
1646
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1647
+ ] = None,
1648
+ on_unmount: Optional[
1649
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1650
+ ] = None,
1651
+ on_value_change: Optional[
1652
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1653
+ ] = None,
1654
+ **props
1655
+ ) -> "HighLevelSelect":
1656
+ """Create a select component.
1657
+
1658
+ Args:
1659
+ items: The items of the select.
1660
+ items: The items of the select.
1661
+ placeholder: The placeholder of the select.
1662
+ label: The label of the select.
1663
+ color: The color of the select.
1664
+ high_contrast: Whether to render the select with higher contrast color against background.
1665
+ variant: The variant of the select.
1666
+ radius: The radius of the select.
1667
+ width: The width of the select.
1668
+ size: The size of the select: "1" | "2" | "3"
1669
+ default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select.
1670
+ value: The controlled value of the select. Should be used in conjunction with on_value_change.
1671
+ default_open: The open state of the select when it is initially rendered. Use when you do not need to control its open state.
1672
+ open: The controlled open state of the select. Must be used in conjunction with on_open_change.
1673
+ name: The name of the select control when submitting the form.
1674
+ disabled: When True, prevents the user from interacting with select.
1675
+ required: When True, indicates that the user must select a value before the owning form can be submitted.
1676
+ m: Margin: "0" - "9"
1677
+ mx: Margin horizontal: "0" - "9"
1678
+ my: Margin vertical: "0" - "9"
1679
+ mt: Margin top: "0" - "9"
1680
+ mr: Margin right: "0" - "9"
1681
+ mb: Margin bottom: "0" - "9"
1682
+ ml: Margin left: "0" - "9"
1683
+ style: The style of the component.
1684
+ key: A unique key for the component.
1685
+ id: The id for the component.
1686
+ class_name: The class name for the component.
1687
+ autofocus: Whether the component should take the focus once the page is loaded
1688
+ custom_attrs: custom attribute
1689
+ **props: Additional properties to apply to the select component.
1690
+
1691
+ Returns:
1692
+ The select component.
1693
+ """
1694
+ ...
@@ -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[Union[Var[List[float]], List[float]]] = None,
107
- value: Optional[Union[Var[float], float]] = None,
108
- min: Optional[Union[Var[float], float]] = None,
109
- max: Optional[Union[Var[float], float]] = None,
110
- step: Optional[Union[Var[float], float]] = None,
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.
@@ -12,4 +12,5 @@ class Tooltip(CommonMarginProps, RadixThemesComponent):
12
12
 
13
13
  tag = "Tooltip"
14
14
 
15
+ # The content of the tooltip.
15
16
  content: Var[str]
@@ -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"
@@ -7,6 +7,6 @@ from .base import LayoutComponent
7
7
 
8
8
 
9
9
  class Box(el.Div, LayoutComponent):
10
- """A fundamental layout building block, based on <div>."""
10
+ """A fundamental layout building block, based on `div` element."""
11
11
 
12
12
  tag = "Box"
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 v in cls.__dict__.values()
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 types.is_backend_variable(name) and name not in RESERVED_BACKEND_VAR_NAMES:
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/format.py CHANGED
@@ -255,16 +255,20 @@ def format_cond(
255
255
 
256
256
  # Format prop conds.
257
257
  if is_prop:
258
- prop1 = Var.create_safe(
259
- true_value,
260
- _var_is_string=type(true_value) is str,
261
- )
262
- prop1._var_is_local = True
263
- prop2 = Var.create_safe(
264
- false_value,
265
- _var_is_string=type(false_value) is str,
258
+ if not isinstance(true_value, Var):
259
+ true_value = Var.create_safe(
260
+ true_value,
261
+ _var_is_string=type(true_value) is str,
262
+ )
263
+ prop1 = true_value._replace(
264
+ _var_is_local=True,
266
265
  )
267
- prop2._var_is_local = True
266
+ if not isinstance(false_value, Var):
267
+ false_value = Var.create_safe(
268
+ false_value,
269
+ _var_is_string=type(false_value) is str,
270
+ )
271
+ prop2 = false_value._replace(_var_is_local=True)
268
272
  prop1, prop2 = str(prop1), str(prop2) # avoid f-string semantics for Var
269
273
  return f"{cond} ? {prop1} : {prop2}".replace("{", "").replace("}", "")
270
274
 
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: