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.

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 +107 -86
  7. reflex/compiler/compiler.py +110 -0
  8. reflex/components/component.py +3 -1
  9. reflex/components/core/match.py +8 -4
  10. reflex/components/datadisplay/dataeditor.py +5 -1
  11. reflex/components/markdown/markdown.py +1 -0
  12. reflex/components/radix/__init__.py +2 -0
  13. reflex/components/radix/primitives/__init__.py +14 -1
  14. reflex/components/radix/primitives/accordion.py +426 -69
  15. reflex/components/radix/primitives/accordion.pyi +41 -11
  16. reflex/components/radix/primitives/base.py +4 -0
  17. reflex/components/radix/primitives/base.pyi +81 -0
  18. reflex/components/radix/primitives/form.py +4 -2
  19. reflex/components/radix/primitives/form.pyi +2 -2
  20. reflex/components/radix/primitives/progress.py +4 -2
  21. reflex/components/radix/primitives/progress.pyi +2 -2
  22. reflex/components/radix/primitives/slider.py +7 -5
  23. reflex/components/radix/primitives/slider.pyi +5 -5
  24. reflex/components/radix/themes/components/__init__.py +8 -2
  25. reflex/components/radix/themes/components/alertdialog.py +4 -4
  26. reflex/components/radix/themes/components/alertdialog.pyi +8 -1
  27. reflex/components/radix/themes/components/aspectratio.py +2 -4
  28. reflex/components/radix/themes/components/aspectratio.pyi +1 -3
  29. reflex/components/radix/themes/components/avatar.py +7 -3
  30. reflex/components/radix/themes/components/avatar.pyi +5 -3
  31. reflex/components/radix/themes/components/badge.py +5 -7
  32. reflex/components/radix/themes/components/badge.pyi +4 -6
  33. reflex/components/radix/themes/components/callout.py +36 -5
  34. reflex/components/radix/themes/components/callout.pyi +273 -9
  35. reflex/components/radix/themes/components/card.py +3 -3
  36. reflex/components/radix/themes/components/card.pyi +2 -2
  37. reflex/components/radix/themes/components/checkbox.py +41 -4
  38. reflex/components/radix/themes/components/checkbox.pyi +231 -8
  39. reflex/components/radix/themes/components/dialog.py +1 -1
  40. reflex/components/radix/themes/components/dialog.pyi +1 -1
  41. reflex/components/radix/themes/components/dropdownmenu.py +6 -0
  42. reflex/components/radix/themes/components/dropdownmenu.pyi +193 -0
  43. reflex/components/radix/themes/components/iconbutton.py +1 -1
  44. reflex/components/radix/themes/components/iconbutton.pyi +1 -1
  45. reflex/components/radix/themes/components/icons.py +1 -0
  46. reflex/components/radix/themes/components/inset.py +1 -0
  47. reflex/components/radix/themes/components/inset.pyi +1 -0
  48. reflex/components/radix/themes/components/radiogroup.py +68 -1
  49. reflex/components/radix/themes/components/radiogroup.pyi +254 -2
  50. reflex/components/radix/themes/components/select.py +93 -4
  51. reflex/components/radix/themes/components/select.pyi +246 -4
  52. reflex/components/radix/themes/components/slider.py +9 -6
  53. reflex/components/radix/themes/components/slider.pyi +12 -6
  54. reflex/components/radix/themes/components/tooltip.py +1 -0
  55. reflex/components/radix/themes/components/tooltip.pyi +1 -0
  56. reflex/components/radix/themes/layout/box.py +1 -1
  57. reflex/state.py +9 -4
  58. reflex/style.py +15 -0
  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.9a2.dist-info}/METADATA +2 -2
  64. {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/RECORD +67 -67
  65. {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/WHEEL +1 -1
  66. {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.dist-info}/LICENSE +0 -0
  67. {reflex-0.3.8a2.dist-info → reflex-0.3.9a2.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[
@@ -15,7 +15,7 @@ from .badge import Badge
15
15
  from .button import Button
16
16
  from .callout import CalloutIcon, CalloutRoot, CalloutText
17
17
  from .card import Card
18
- from .checkbox import Checkbox
18
+ from .checkbox import Checkbox, HighLevelCheckbox
19
19
  from .contextmenu import (
20
20
  ContextMenuContent,
21
21
  ContextMenuItem,
@@ -39,6 +39,7 @@ from .dropdownmenu import (
39
39
  DropdownMenuItem,
40
40
  DropdownMenuRoot,
41
41
  DropdownMenuSeparator,
42
+ DropdownMenuSub,
42
43
  DropdownMenuSubContent,
43
44
  DropdownMenuSubTrigger,
44
45
  DropdownMenuTrigger,
@@ -48,9 +49,10 @@ from .iconbutton import IconButton
48
49
  from .icons import Icon
49
50
  from .inset import Inset
50
51
  from .popover import PopoverClose, PopoverContent, PopoverRoot, PopoverTrigger
51
- from .radiogroup import RadioGroupItem, RadioGroupRoot
52
+ from .radiogroup import HighLevelRadioGroup, RadioGroupItem, RadioGroupRoot
52
53
  from .scrollarea import ScrollArea
53
54
  from .select import (
55
+ HighLevelSelect,
54
56
  SelectContent,
55
57
  SelectGroup,
56
58
  SelectItem,
@@ -107,6 +109,7 @@ card = Card.create
107
109
 
108
110
  # Checkbox
109
111
  checkbox = Checkbox.create
112
+ checkbox_hl = HighLevelCheckbox.create
110
113
 
111
114
  # Context Menu
112
115
  contextmenu_root = ContextMenuRoot.create
@@ -131,6 +134,7 @@ dialog_close = DialogClose.create
131
134
  dropdownmenu_root = DropdownMenuRoot.create
132
135
  dropdownmenu_trigger = DropdownMenuTrigger.create
133
136
  dropdownmenu_content = DropdownMenuContent.create
137
+ dropdownmenu_sub = DropdownMenuSub.create
134
138
  dropdownmenu_sub_content = DropdownMenuSubContent.create
135
139
  dropdownmenu_sub_trigger = DropdownMenuSubTrigger.create
136
140
  dropdownmenu_item = DropdownMenuItem.create
@@ -159,6 +163,7 @@ popover_close = PopoverClose.create
159
163
  # Radio Group
160
164
  radio_group_root = RadioGroupRoot.create
161
165
  radio_group_item = RadioGroupItem.create
166
+ radio_group = HighLevelRadioGroup.create
162
167
 
163
168
  # Scroll Area
164
169
  scroll_area = ScrollArea.create
@@ -171,6 +176,7 @@ select_item = SelectItem.create
171
176
  select_separator = SelectSeparator.create
172
177
  select_group = SelectGroup.create
173
178
  select_label = SelectLabel.create
179
+ select = HighLevelSelect.create
174
180
 
175
181
  # Separator
176
182
  separator = Separator.create
@@ -4,10 +4,7 @@ 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
 
@@ -43,6 +40,9 @@ class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
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
 
@@ -10,7 +10,7 @@ from reflex.style import Style
10
10
  from typing import Any, Dict, Literal
11
11
  from reflex import el
12
12
  from reflex.vars import Var
13
- from ..base import CommonMarginProps, RadixThemesComponent
13
+ from ..base import CommonMarginProps, LiteralSize, RadixThemesComponent
14
14
 
15
15
  LiteralSwitchSize = Literal["1", "2", "3", "4"]
16
16
 
@@ -476,6 +476,12 @@ class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
476
476
  ],
477
477
  ]
478
478
  ] = None,
479
+ size: Optional[
480
+ Union[
481
+ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
482
+ Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
483
+ ]
484
+ ] = None,
479
485
  force_mount: Optional[Union[Var[bool], bool]] = None,
480
486
  access_key: Optional[
481
487
  Union[Var[Union[str, int, bool]], Union[str, int, bool]]
@@ -633,6 +639,7 @@ class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
633
639
  *children: Child components.
634
640
  color: map to CSS default color property.
635
641
  color_scheme: map to radix color property.
642
+ size: The size of the content.
636
643
  force_mount: Whether to force mount the content on open.
637
644
  access_key: Provides a hint for generating a keyboard shortcut for the current element.
638
645
  auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
@@ -1,5 +1,5 @@
1
1
  """Interactive components provided by @radix-ui/themes."""
2
- from typing import Literal, Union
2
+ from typing import Union
3
3
 
4
4
  from reflex.vars import Var
5
5
 
@@ -8,11 +8,9 @@ from ..base import (
8
8
  RadixThemesComponent,
9
9
  )
10
10
 
11
- LiteralSwitchSize = Literal["1", "2", "3", "4"]
12
-
13
11
 
14
12
  class AspectRatio(CommonMarginProps, RadixThemesComponent):
15
- """A toggle switch alternative to the checkbox."""
13
+ """Displays content with a desired ratio."""
16
14
 
17
15
  tag = "AspectRatio"
18
16
 
@@ -7,12 +7,10 @@ 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 Literal, Union
10
+ from typing import Union
11
11
  from reflex.vars import Var
12
12
  from ..base import CommonMarginProps, RadixThemesComponent
13
13
 
14
- LiteralSwitchSize = Literal["1", "2", "3", "4"]
15
-
16
14
  class AspectRatio(CommonMarginProps, RadixThemesComponent):
17
15
  @overload
18
16
  @classmethod
@@ -11,8 +11,6 @@ from ..base import (
11
11
  RadixThemesComponent,
12
12
  )
13
13
 
14
- LiteralSwitchSize = Literal["1", "2", "3", "4"]
15
-
16
14
 
17
15
  class Avatar(CommonMarginProps, RadixThemesComponent):
18
16
  """A toggle switch alternative to the checkbox."""
@@ -22,7 +20,7 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
22
20
  # The variant of the avatar
23
21
  variant: Var[Literal["solid", "soft"]]
24
22
 
25
- # The size of the avatar
23
+ # The size of the avatar: "1" - "9"
26
24
  size: Var[LiteralSize]
27
25
 
28
26
  # Color theme of the avatar
@@ -33,3 +31,9 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
33
31
 
34
32
  # Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
35
33
  radius: Var[LiteralRadius]
34
+
35
+ # The src of the avatar image
36
+ src: Var[str]
37
+
38
+ # The rendered fallback text
39
+ fallback: Var[str]
@@ -17,8 +17,6 @@ from ..base import (
17
17
  RadixThemesComponent,
18
18
  )
19
19
 
20
- LiteralSwitchSize = Literal["1", "2", "3", "4"]
21
-
22
20
  class Avatar(CommonMarginProps, RadixThemesComponent):
23
21
  @overload
24
22
  @classmethod
@@ -104,6 +102,8 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
104
102
  Literal["none", "small", "medium", "large", "full"],
105
103
  ]
106
104
  ] = None,
105
+ src: Optional[Union[Var[str], str]] = None,
106
+ fallback: Optional[Union[Var[str], str]] = None,
107
107
  m: Optional[
108
108
  Union[
109
109
  Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@@ -209,9 +209,11 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
209
209
  color: map to CSS default color property.
210
210
  color_scheme: map to radix color property.
211
211
  variant: The variant of the avatar
212
- size: The size of the avatar
212
+ size: The size of the avatar: "1" - "9"
213
213
  high_contrast: Whether to render the avatar with higher contrast color against background
214
214
  radius: Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
215
+ src: The src of the avatar image
216
+ fallback: The rendered fallback text
215
217
  m: Margin: "0" - "9"
216
218
  mx: Margin horizontal: "0" - "9"
217
219
  my: Margin vertical: "0" - "9"
@@ -11,25 +11,23 @@ from ..base import (
11
11
  RadixThemesComponent,
12
12
  )
13
13
 
14
- LiteralSwitchSize = Literal["1", "2", "3", "4"]
15
-
16
14
 
17
15
  class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
18
16
  """A toggle switch alternative to the checkbox."""
19
17
 
20
18
  tag = "Badge"
21
19
 
22
- # The variant of the avatar
20
+ # The variant of the badge
23
21
  variant: Var[Literal["solid", "soft", "surface", "outline"]]
24
22
 
25
- # The size of the avatar
23
+ # The size of the badge
26
24
  size: Var[Literal["1", "2"]]
27
25
 
28
- # Color theme of the avatar
26
+ # Color theme of the badge
29
27
  color: Var[LiteralAccentColor]
30
28
 
31
- # Whether to render the avatar with higher contrast color against background
29
+ # Whether to render the badge with higher contrast color against background
32
30
  high_contrast: Var[bool]
33
31
 
34
- # Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
32
+ # Override theme radius for badge: "none" | "small" | "medium" | "large" | "full"
35
33
  radius: Var[LiteralRadius]
@@ -17,8 +17,6 @@ from ..base import (
17
17
  RadixThemesComponent,
18
18
  )
19
19
 
20
- LiteralSwitchSize = Literal["1", "2", "3", "4"]
21
-
22
20
  class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
23
21
  @overload
24
22
  @classmethod
@@ -249,10 +247,10 @@ class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
249
247
  *children: Child components.
250
248
  color: map to CSS default color property.
251
249
  color_scheme: map to radix color property.
252
- variant: The variant of the avatar
253
- size: The size of the avatar
254
- high_contrast: Whether to render the avatar with higher contrast color against background
255
- radius: Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
250
+ variant: The variant of the badge
251
+ size: The size of the badge
252
+ high_contrast: Whether to render the badge with higher contrast color against background
253
+ radius: Override theme radius for badge: "none" | "small" | "medium" | "large" | "full"
256
254
  access_key: Provides a hint for generating a keyboard shortcut for the current element.
257
255
  auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
258
256
  content_editable: Indicates whether the element's content is editable.
@@ -1,13 +1,15 @@
1
1
  """Interactive components provided by @radix-ui/themes."""
2
- from typing import Literal
2
+ from typing import Literal, Union
3
3
 
4
+ import reflex as rx
4
5
  from reflex import el
6
+ from reflex.components.component import Component
7
+ from reflex.components.radix.themes.components.icons import Icon
5
8
  from reflex.vars import Var
6
9
 
7
10
  from ..base import (
8
11
  CommonMarginProps,
9
12
  LiteralAccentColor,
10
- LiteralRadius,
11
13
  LiteralVariant,
12
14
  RadixThemesComponent,
13
15
  )
@@ -33,9 +35,6 @@ class CalloutRoot(el.Div, CommonMarginProps, RadixThemesComponent):
33
35
  # Whether to render the button with higher contrast color against background
34
36
  high_contrast: Var[bool]
35
37
 
36
- # Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
37
- radius: Var[LiteralRadius]
38
-
39
38
 
40
39
  class CalloutIcon(el.Div, CommonMarginProps, RadixThemesComponent):
41
40
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
@@ -47,3 +46,35 @@ class CalloutText(el.P, CommonMarginProps, RadixThemesComponent):
47
46
  """Trigger an action or event, such as submitting a form or displaying a dialog."""
48
47
 
49
48
  tag = "Callout.Text"
49
+
50
+
51
+ class Callout(CalloutRoot):
52
+ """High level wrapper for the Callout component."""
53
+
54
+ # The text of the callout.
55
+ text: Var[str]
56
+
57
+ # The icon of the callout.
58
+ icon: Var[str]
59
+
60
+ @classmethod
61
+ def create(cls, text: Union[str, Var[str]], **props) -> Component:
62
+ """Create a callout component.
63
+
64
+ Args:
65
+ text: The text of the callout.
66
+ **props: The properties of the component.
67
+
68
+ Returns:
69
+ The callout component.
70
+ """
71
+ return CalloutRoot.create(
72
+ CalloutIcon.create(Icon.create(tag=props["icon"]))
73
+ if "icon" in props
74
+ else rx.fragment(),
75
+ CalloutText.create(text),
76
+ **props,
77
+ )
78
+
79
+
80
+ callout = Callout.create