reflex 0.3.8a1__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 (73) 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/apps/sidebar/code/sidebar.py +6 -1
  4. reflex/.templates/jinja/web/pages/utils.js.jinja2 +1 -1
  5. reflex/__init__.py +2 -0
  6. reflex/__init__.pyi +3 -0
  7. reflex/app.py +22 -7
  8. reflex/components/chakra/__init__.py +1 -0
  9. reflex/components/chakra/forms/__init__.py +1 -0
  10. reflex/components/chakra/forms/time_picker.py +11 -0
  11. reflex/components/chakra/forms/time_picker.pyi +129 -0
  12. reflex/components/component.py +3 -1
  13. reflex/components/core/match.py +8 -4
  14. reflex/components/datadisplay/dataeditor.py +5 -1
  15. reflex/components/markdown/markdown.py +1 -0
  16. reflex/components/radix/__init__.py +2 -0
  17. reflex/components/radix/primitives/__init__.py +14 -1
  18. reflex/components/radix/primitives/accordion.py +430 -69
  19. reflex/components/radix/primitives/accordion.pyi +41 -11
  20. reflex/components/radix/primitives/base.py +4 -0
  21. reflex/components/radix/primitives/base.pyi +81 -0
  22. reflex/components/radix/primitives/form.py +4 -2
  23. reflex/components/radix/primitives/form.pyi +2 -2
  24. reflex/components/radix/primitives/progress.py +4 -2
  25. reflex/components/radix/primitives/progress.pyi +2 -2
  26. reflex/components/radix/primitives/slider.py +7 -5
  27. reflex/components/radix/primitives/slider.pyi +5 -5
  28. reflex/components/radix/themes/components/__init__.py +14 -4
  29. reflex/components/radix/themes/components/alertdialog.py +31 -10
  30. reflex/components/radix/themes/components/alertdialog.pyi +396 -3
  31. reflex/components/radix/themes/components/aspectratio.py +2 -4
  32. reflex/components/radix/themes/components/aspectratio.pyi +1 -3
  33. reflex/components/radix/themes/components/avatar.py +7 -3
  34. reflex/components/radix/themes/components/avatar.pyi +5 -3
  35. reflex/components/radix/themes/components/badge.py +5 -7
  36. reflex/components/radix/themes/components/badge.pyi +4 -6
  37. reflex/components/radix/themes/components/callout.py +36 -5
  38. reflex/components/radix/themes/components/callout.pyi +273 -9
  39. reflex/components/radix/themes/components/card.py +3 -3
  40. reflex/components/radix/themes/components/card.pyi +2 -2
  41. reflex/components/radix/themes/components/checkbox.py +41 -4
  42. reflex/components/radix/themes/components/checkbox.pyi +231 -8
  43. reflex/components/radix/themes/components/dialog.py +1 -1
  44. reflex/components/radix/themes/components/dialog.pyi +1 -1
  45. reflex/components/radix/themes/components/dropdownmenu.py +6 -0
  46. reflex/components/radix/themes/components/dropdownmenu.pyi +193 -0
  47. reflex/components/radix/themes/components/iconbutton.py +1 -1
  48. reflex/components/radix/themes/components/iconbutton.pyi +1 -1
  49. reflex/components/radix/themes/components/icons.py +1 -0
  50. reflex/components/radix/themes/components/inset.py +1 -0
  51. reflex/components/radix/themes/components/inset.pyi +1 -0
  52. reflex/components/radix/themes/components/radiogroup.py +68 -1
  53. reflex/components/radix/themes/components/radiogroup.pyi +254 -2
  54. reflex/components/radix/themes/components/select.py +94 -5
  55. reflex/components/radix/themes/components/select.pyi +251 -5
  56. reflex/components/radix/themes/components/slider.py +9 -6
  57. reflex/components/radix/themes/components/slider.pyi +12 -6
  58. reflex/components/radix/themes/components/tooltip.py +1 -0
  59. reflex/components/radix/themes/components/tooltip.pyi +1 -0
  60. reflex/components/radix/themes/layout/box.py +1 -1
  61. reflex/state.py +21 -4
  62. reflex/style.py +15 -0
  63. reflex/testing.py +2 -0
  64. reflex/utils/format.py +13 -9
  65. reflex/utils/path_ops.py +2 -2
  66. reflex/utils/prerequisites.py +61 -4
  67. reflex/utils/types.py +4 -1
  68. reflex/vars.py +36 -3
  69. {reflex-0.3.8a1.dist-info → reflex-0.3.9.dist-info}/METADATA +2 -2
  70. {reflex-0.3.8a1.dist-info → reflex-0.3.9.dist-info}/RECORD +73 -71
  71. {reflex-0.3.8a1.dist-info → reflex-0.3.9.dist-info}/WHEEL +1 -1
  72. {reflex-0.3.8a1.dist-info → reflex-0.3.9.dist-info}/LICENSE +0 -0
  73. {reflex-0.3.8a1.dist-info → reflex-0.3.9.dist-info}/entry_points.txt +0 -0
@@ -93,3 +93,84 @@ class RadixPrimitiveComponent(Component):
93
93
  TypeError: If an invalid child is passed.
94
94
  """
95
95
  ...
96
+
97
+ class RadixPrimitiveComponentWithClassName(RadixPrimitiveComponent):
98
+ @overload
99
+ @classmethod
100
+ def create( # type: ignore
101
+ cls,
102
+ *children,
103
+ as_child: Optional[Union[Var[bool], bool]] = None,
104
+ style: Optional[Style] = None,
105
+ key: Optional[Any] = None,
106
+ id: Optional[Any] = None,
107
+ class_name: Optional[Any] = None,
108
+ autofocus: Optional[bool] = None,
109
+ custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
110
+ on_blur: Optional[
111
+ Union[EventHandler, EventSpec, list, function, BaseVar]
112
+ ] = None,
113
+ on_click: Optional[
114
+ Union[EventHandler, EventSpec, list, function, BaseVar]
115
+ ] = None,
116
+ on_context_menu: Optional[
117
+ Union[EventHandler, EventSpec, list, function, BaseVar]
118
+ ] = None,
119
+ on_double_click: Optional[
120
+ Union[EventHandler, EventSpec, list, function, BaseVar]
121
+ ] = None,
122
+ on_focus: Optional[
123
+ Union[EventHandler, EventSpec, list, function, BaseVar]
124
+ ] = None,
125
+ on_mount: Optional[
126
+ Union[EventHandler, EventSpec, list, function, BaseVar]
127
+ ] = None,
128
+ on_mouse_down: Optional[
129
+ Union[EventHandler, EventSpec, list, function, BaseVar]
130
+ ] = None,
131
+ on_mouse_enter: Optional[
132
+ Union[EventHandler, EventSpec, list, function, BaseVar]
133
+ ] = None,
134
+ on_mouse_leave: Optional[
135
+ Union[EventHandler, EventSpec, list, function, BaseVar]
136
+ ] = None,
137
+ on_mouse_move: Optional[
138
+ Union[EventHandler, EventSpec, list, function, BaseVar]
139
+ ] = None,
140
+ on_mouse_out: Optional[
141
+ Union[EventHandler, EventSpec, list, function, BaseVar]
142
+ ] = None,
143
+ on_mouse_over: Optional[
144
+ Union[EventHandler, EventSpec, list, function, BaseVar]
145
+ ] = None,
146
+ on_mouse_up: Optional[
147
+ Union[EventHandler, EventSpec, list, function, BaseVar]
148
+ ] = None,
149
+ on_scroll: Optional[
150
+ Union[EventHandler, EventSpec, list, function, BaseVar]
151
+ ] = None,
152
+ on_unmount: Optional[
153
+ Union[EventHandler, EventSpec, list, function, BaseVar]
154
+ ] = None,
155
+ **props
156
+ ) -> "RadixPrimitiveComponentWithClassName":
157
+ """Create the component.
158
+
159
+ Args:
160
+ *children: The children of the component.
161
+ as_child: Change the default rendered element for the one passed as a child.
162
+ style: The style of the component.
163
+ key: A unique key for the component.
164
+ id: The id for the component.
165
+ class_name: The class name for the component.
166
+ autofocus: Whether the component should take the focus once the page is loaded
167
+ custom_attrs: custom attribute
168
+ **props: The props of the component.
169
+
170
+ Returns:
171
+ The component.
172
+
173
+ Raises:
174
+ TypeError: If an invalid child is passed.
175
+ """
176
+ ...
@@ -1,5 +1,7 @@
1
1
  """Radix form component."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  from hashlib import md5
4
6
  from typing import Any, Dict, Iterator, Literal
5
7
 
@@ -14,7 +16,7 @@ from reflex.utils import imports
14
16
  from reflex.utils.format import format_event_chain, to_camel_case
15
17
  from reflex.vars import BaseVar, Var
16
18
 
17
- from .base import RadixPrimitiveComponent
19
+ from .base import RadixPrimitiveComponentWithClassName
18
20
 
19
21
  FORM_DATA = Var.create("form_data")
20
22
  HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string(
@@ -34,7 +36,7 @@ HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string(
34
36
  )
35
37
 
36
38
 
37
- class FormComponent(RadixPrimitiveComponent):
39
+ class FormComponent(RadixPrimitiveComponentWithClassName):
38
40
  """Base class for all @radix-ui/react-form components."""
39
41
 
40
42
  library = "@radix-ui/react-form@^0.0.3"
@@ -18,14 +18,14 @@ from reflex.event import EventChain
18
18
  from reflex.utils import imports
19
19
  from reflex.utils.format import format_event_chain, to_camel_case
20
20
  from reflex.vars import BaseVar, Var
21
- from .base import RadixPrimitiveComponent
21
+ from .base import RadixPrimitiveComponentWithClassName
22
22
 
23
23
  FORM_DATA = Var.create("form_data")
24
24
  HANDLE_SUBMIT_JS_JINJA2 = Environment().from_string(
25
25
  "\n const handleSubmit_{{ handle_submit_unique_name }} = useCallback((ev) => {\n const $form = ev.target\n ev.preventDefault()\n const {{ form_data }} = {...Object.fromEntries(new FormData($form).entries()), ...{{ field_ref_mapping }}}\n\n {{ on_submit_event_chain }}\n\n if ({{ reset_on_submit }}) {\n $form.reset()\n }\n })\n "
26
26
  )
27
27
 
28
- class FormComponent(RadixPrimitiveComponent):
28
+ class FormComponent(RadixPrimitiveComponentWithClassName):
29
29
  @overload
30
30
  @classmethod
31
31
  def create( # type: ignore
@@ -1,14 +1,16 @@
1
1
  """Progress."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  from typing import Optional
4
6
 
5
7
  from reflex.components.component import Component
6
- from reflex.components.radix.primitives.base import RadixPrimitiveComponent
8
+ from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
7
9
  from reflex.style import Style
8
10
  from reflex.vars import Var
9
11
 
10
12
 
11
- class ProgressComponent(RadixPrimitiveComponent):
13
+ class ProgressComponent(RadixPrimitiveComponentWithClassName):
12
14
  """A Progress component."""
13
15
 
14
16
  library = "@radix-ui/react-progress@^1.0.3"
@@ -9,11 +9,11 @@ from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  from typing import Optional
11
11
  from reflex.components.component import Component
12
- from reflex.components.radix.primitives.base import RadixPrimitiveComponent
12
+ from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
13
13
  from reflex.style import Style
14
14
  from reflex.vars import Var
15
15
 
16
- class ProgressComponent(RadixPrimitiveComponent):
16
+ class ProgressComponent(RadixPrimitiveComponentWithClassName):
17
17
  @overload
18
18
  @classmethod
19
19
  def create( # type: ignore
@@ -1,9 +1,11 @@
1
1
  """Radix slider components."""
2
2
 
3
- from typing import Any, Dict, Literal
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, List, Literal
4
6
 
5
7
  from reflex.components.component import Component
6
- from reflex.components.radix.primitives.base import RadixPrimitiveComponent
8
+ from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
7
9
  from reflex.style import Style
8
10
  from reflex.vars import Var
9
11
 
@@ -11,7 +13,7 @@ LiteralSliderOrientation = Literal["horizontal", "vertical"]
11
13
  LiteralSliderDir = Literal["ltr", "rtl"]
12
14
 
13
15
 
14
- class SliderComponent(RadixPrimitiveComponent):
16
+ class SliderComponent(RadixPrimitiveComponentWithClassName):
15
17
  """Base class for all @radix-ui/react-slider components."""
16
18
 
17
19
  library = "@radix-ui/react-slider@^1.1.2"
@@ -23,9 +25,9 @@ class SliderRoot(SliderComponent):
23
25
  tag = "Root"
24
26
  alias = "RadixSliderRoot"
25
27
 
26
- default_value: Var[list[int]]
28
+ default_value: Var[List[int]]
27
29
 
28
- value: Var[list[int]]
30
+ value: Var[List[int]]
29
31
 
30
32
  name: Var[str]
31
33
 
@@ -7,16 +7,16 @@ 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
11
11
  from reflex.components.component import Component
12
- from reflex.components.radix.primitives.base import RadixPrimitiveComponent
12
+ from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
13
13
  from reflex.style import Style
14
14
  from reflex.vars import Var
15
15
 
16
16
  LiteralSliderOrientation = Literal["horizontal", "vertical"]
17
17
  LiteralSliderDir = Literal["ltr", "rtl"]
18
18
 
19
- class SliderComponent(RadixPrimitiveComponent):
19
+ class SliderComponent(RadixPrimitiveComponentWithClassName):
20
20
  @overload
21
21
  @classmethod
22
22
  def create( # type: ignore
@@ -104,8 +104,8 @@ class SliderRoot(SliderComponent):
104
104
  def create( # type: ignore
105
105
  cls,
106
106
  *children,
107
- default_value: Optional[Union[Var[list[int]], list[int]]] = None,
108
- value: Optional[Union[Var[list[int]], list[int]]] = None,
107
+ default_value: Optional[Union[Var[List[int]], List[int]]] = None,
108
+ value: Optional[Union[Var[List[int]], List[int]]] = None,
109
109
  name: Optional[Union[Var[str], str]] = None,
110
110
  disabled: Optional[Union[Var[bool], bool]] = None,
111
111
  orientation: Optional[
@@ -1,9 +1,11 @@
1
1
  """Radix themes components."""
2
2
 
3
3
  from .alertdialog import (
4
- AlertDialog,
4
+ AlertDialogAction,
5
+ AlertDialogCancel,
5
6
  AlertDialogContent,
6
7
  AlertDialogDescription,
8
+ AlertDialogRoot,
7
9
  AlertDialogTitle,
8
10
  AlertDialogTrigger,
9
11
  )
@@ -13,7 +15,7 @@ from .badge import Badge
13
15
  from .button import Button
14
16
  from .callout import CalloutIcon, CalloutRoot, CalloutText
15
17
  from .card import Card
16
- from .checkbox import Checkbox
18
+ from .checkbox import Checkbox, HighLevelCheckbox
17
19
  from .contextmenu import (
18
20
  ContextMenuContent,
19
21
  ContextMenuItem,
@@ -37,6 +39,7 @@ from .dropdownmenu import (
37
39
  DropdownMenuItem,
38
40
  DropdownMenuRoot,
39
41
  DropdownMenuSeparator,
42
+ DropdownMenuSub,
40
43
  DropdownMenuSubContent,
41
44
  DropdownMenuSubTrigger,
42
45
  DropdownMenuTrigger,
@@ -46,9 +49,10 @@ from .iconbutton import IconButton
46
49
  from .icons import Icon
47
50
  from .inset import Inset
48
51
  from .popover import PopoverClose, PopoverContent, PopoverRoot, PopoverTrigger
49
- from .radiogroup import RadioGroupItem, RadioGroupRoot
52
+ from .radiogroup import HighLevelRadioGroup, RadioGroupItem, RadioGroupRoot
50
53
  from .scrollarea import ScrollArea
51
54
  from .select import (
55
+ HighLevelSelect,
52
56
  SelectContent,
53
57
  SelectGroup,
54
58
  SelectItem,
@@ -75,11 +79,13 @@ from .textfield import TextFieldInput, TextFieldRoot, TextFieldSlot
75
79
  from .tooltip import Tooltip
76
80
 
77
81
  # Alert Dialog
78
- alertdialog = AlertDialog.create
82
+ alertdialog_root = AlertDialogRoot.create
79
83
  alertdialog_trigger = AlertDialogTrigger.create
80
84
  alertdialog_content = AlertDialogContent.create
81
85
  alertdialog_title = AlertDialogTitle.create
82
86
  alertdialog_description = AlertDialogDescription.create
87
+ alertdialog_action = AlertDialogAction.create
88
+ alertdialog_cancel = AlertDialogCancel.create
83
89
 
84
90
  # Aspect Ratio
85
91
  aspect_ratio = AspectRatio.create
@@ -103,6 +109,7 @@ card = Card.create
103
109
 
104
110
  # Checkbox
105
111
  checkbox = Checkbox.create
112
+ checkbox_hl = HighLevelCheckbox.create
106
113
 
107
114
  # Context Menu
108
115
  contextmenu_root = ContextMenuRoot.create
@@ -127,6 +134,7 @@ dialog_close = DialogClose.create
127
134
  dropdownmenu_root = DropdownMenuRoot.create
128
135
  dropdownmenu_trigger = DropdownMenuTrigger.create
129
136
  dropdownmenu_content = DropdownMenuContent.create
137
+ dropdownmenu_sub = DropdownMenuSub.create
130
138
  dropdownmenu_sub_content = DropdownMenuSubContent.create
131
139
  dropdownmenu_sub_trigger = DropdownMenuSubTrigger.create
132
140
  dropdownmenu_item = DropdownMenuItem.create
@@ -155,6 +163,7 @@ popover_close = PopoverClose.create
155
163
  # Radio Group
156
164
  radio_group_root = RadioGroupRoot.create
157
165
  radio_group_item = RadioGroupItem.create
166
+ radio_group = HighLevelRadioGroup.create
158
167
 
159
168
  # Scroll Area
160
169
  scroll_area = ScrollArea.create
@@ -167,6 +176,7 @@ select_item = SelectItem.create
167
176
  select_separator = SelectSeparator.create
168
177
  select_group = SelectGroup.create
169
178
  select_label = SelectLabel.create
179
+ select = HighLevelSelect.create
170
180
 
171
181
  # Separator
172
182
  separator = Separator.create
@@ -4,16 +4,13 @@ from typing import Any, Dict, Literal
4
4
  from reflex import el
5
5
  from reflex.vars import Var
6
6
 
7
- from ..base import (
8
- CommonMarginProps,
9
- RadixThemesComponent,
10
- )
7
+ from ..base import CommonMarginProps, LiteralSize, RadixThemesComponent
11
8
 
12
9
  LiteralSwitchSize = Literal["1", "2", "3", "4"]
13
10
 
14
11
 
15
- class AlertDialog(CommonMarginProps, RadixThemesComponent):
16
- """A toggle switch alternative to the checkbox."""
12
+ class AlertDialogRoot(CommonMarginProps, RadixThemesComponent):
13
+ """Contains all the parts of the dialog."""
17
14
 
18
15
  tag = "AlertDialog.Root"
19
16
 
@@ -33,16 +30,19 @@ class AlertDialog(CommonMarginProps, RadixThemesComponent):
33
30
 
34
31
 
35
32
  class AlertDialogTrigger(CommonMarginProps, RadixThemesComponent):
36
- """A toggle switch alternative to the checkbox."""
33
+ """Wraps the control that will open the dialog."""
37
34
 
38
35
  tag = "AlertDialog.Trigger"
39
36
 
40
37
 
41
38
  class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
42
- """A toggle switch alternative to the checkbox."""
39
+ """Contains the content of the dialog. This component is based on the div element."""
43
40
 
44
41
  tag = "AlertDialog.Content"
45
42
 
43
+ # The size of the content.
44
+ size: Var[LiteralSize]
45
+
46
46
  # Whether to force mount the content on open.
47
47
  force_mount: Var[bool]
48
48
 
@@ -61,12 +61,33 @@ class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
61
61
 
62
62
 
63
63
  class AlertDialogTitle(CommonMarginProps, RadixThemesComponent):
64
- """A toggle switch alternative to the checkbox."""
64
+ """An accessible title that is announced when the dialog is opened.
65
+ This part is based on the Heading component with a pre-defined font size and
66
+ leading trim on top.
67
+ """
65
68
 
66
69
  tag = "AlertDialog.Title"
67
70
 
68
71
 
69
72
  class AlertDialogDescription(CommonMarginProps, RadixThemesComponent):
70
- """A toggle switch alternative to the checkbox."""
73
+ """An optional accessible description that is announced when the dialog is opened.
74
+ This part is based on the Text component with a pre-defined font size.
75
+ """
71
76
 
72
77
  tag = "AlertDialog.Description"
78
+
79
+
80
+ class AlertDialogAction(CommonMarginProps, RadixThemesComponent):
81
+ """Wraps the control that will close the dialog. This should be distinguished
82
+ visually from the Cancel control.
83
+ """
84
+
85
+ tag = "AlertDialog.Action"
86
+
87
+
88
+ class AlertDialogCancel(CommonMarginProps, RadixThemesComponent):
89
+ """Wraps the control that will close the dialog. This should be distinguished
90
+ visually from the Action control.
91
+ """
92
+
93
+ tag = "AlertDialog.Cancel"