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.
- 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 +4 -5
- 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 +430 -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 +94 -5
- reflex/components/radix/themes/components/select.pyi +251 -5
- 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/format.py +13 -9
- 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.9.dist-info}/METADATA +2 -2
- {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/RECORD +67 -67
- {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/WHEEL +1 -1
- {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/LICENSE +0 -0
- {reflex-0.3.8a2.dist-info → reflex-0.3.9.dist-info}/entry_points.txt +0 -0
|
@@ -7,13 +7,15 @@ 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
|
|
10
|
+
from typing import Literal, Union
|
|
11
|
+
import reflex as rx
|
|
11
12
|
from reflex import el
|
|
13
|
+
from reflex.components.component import Component
|
|
14
|
+
from reflex.components.radix.themes.components.icons import Icon
|
|
12
15
|
from reflex.vars import Var
|
|
13
16
|
from ..base import (
|
|
14
17
|
CommonMarginProps,
|
|
15
18
|
LiteralAccentColor,
|
|
16
|
-
LiteralRadius,
|
|
17
19
|
LiteralVariant,
|
|
18
20
|
RadixThemesComponent,
|
|
19
21
|
)
|
|
@@ -98,12 +100,6 @@ class CalloutRoot(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
98
100
|
]
|
|
99
101
|
] = None,
|
|
100
102
|
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
101
|
-
radius: Optional[
|
|
102
|
-
Union[
|
|
103
|
-
Var[Literal["none", "small", "medium", "large", "full"]],
|
|
104
|
-
Literal["none", "small", "medium", "large", "full"],
|
|
105
|
-
]
|
|
106
|
-
] = None,
|
|
107
103
|
access_key: Optional[
|
|
108
104
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
109
105
|
] = None,
|
|
@@ -255,7 +251,6 @@ class CalloutRoot(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
255
251
|
size: Button size "1" - "4"
|
|
256
252
|
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
|
257
253
|
high_contrast: Whether to render the button with higher contrast color against background
|
|
258
|
-
radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
|
|
259
254
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
260
255
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
|
261
256
|
content_editable: Indicates whether the element's content is editable.
|
|
@@ -798,3 +793,272 @@ class CalloutText(el.P, CommonMarginProps, RadixThemesComponent):
|
|
|
798
793
|
A new component instance.
|
|
799
794
|
"""
|
|
800
795
|
...
|
|
796
|
+
|
|
797
|
+
class Callout(CalloutRoot):
|
|
798
|
+
@overload
|
|
799
|
+
@classmethod
|
|
800
|
+
def create( # type: ignore
|
|
801
|
+
cls,
|
|
802
|
+
*children,
|
|
803
|
+
text: Optional[Union[Var[str], str]] = None,
|
|
804
|
+
icon: Optional[Union[Var[str], str]] = None,
|
|
805
|
+
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
806
|
+
size: Optional[
|
|
807
|
+
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
|
808
|
+
] = None,
|
|
809
|
+
variant: Optional[
|
|
810
|
+
Union[
|
|
811
|
+
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
|
812
|
+
Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
|
|
813
|
+
]
|
|
814
|
+
] = None,
|
|
815
|
+
color: Optional[
|
|
816
|
+
Union[
|
|
817
|
+
Var[
|
|
818
|
+
Literal[
|
|
819
|
+
"tomato",
|
|
820
|
+
"red",
|
|
821
|
+
"ruby",
|
|
822
|
+
"crimson",
|
|
823
|
+
"pink",
|
|
824
|
+
"plum",
|
|
825
|
+
"purple",
|
|
826
|
+
"violet",
|
|
827
|
+
"iris",
|
|
828
|
+
"indigo",
|
|
829
|
+
"blue",
|
|
830
|
+
"cyan",
|
|
831
|
+
"teal",
|
|
832
|
+
"jade",
|
|
833
|
+
"green",
|
|
834
|
+
"grass",
|
|
835
|
+
"brown",
|
|
836
|
+
"orange",
|
|
837
|
+
"sky",
|
|
838
|
+
"mint",
|
|
839
|
+
"lime",
|
|
840
|
+
"yellow",
|
|
841
|
+
"amber",
|
|
842
|
+
"gold",
|
|
843
|
+
"bronze",
|
|
844
|
+
"gray",
|
|
845
|
+
]
|
|
846
|
+
],
|
|
847
|
+
Literal[
|
|
848
|
+
"tomato",
|
|
849
|
+
"red",
|
|
850
|
+
"ruby",
|
|
851
|
+
"crimson",
|
|
852
|
+
"pink",
|
|
853
|
+
"plum",
|
|
854
|
+
"purple",
|
|
855
|
+
"violet",
|
|
856
|
+
"iris",
|
|
857
|
+
"indigo",
|
|
858
|
+
"blue",
|
|
859
|
+
"cyan",
|
|
860
|
+
"teal",
|
|
861
|
+
"jade",
|
|
862
|
+
"green",
|
|
863
|
+
"grass",
|
|
864
|
+
"brown",
|
|
865
|
+
"orange",
|
|
866
|
+
"sky",
|
|
867
|
+
"mint",
|
|
868
|
+
"lime",
|
|
869
|
+
"yellow",
|
|
870
|
+
"amber",
|
|
871
|
+
"gold",
|
|
872
|
+
"bronze",
|
|
873
|
+
"gray",
|
|
874
|
+
],
|
|
875
|
+
]
|
|
876
|
+
] = None,
|
|
877
|
+
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
878
|
+
access_key: Optional[
|
|
879
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
880
|
+
] = None,
|
|
881
|
+
auto_capitalize: Optional[
|
|
882
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
883
|
+
] = None,
|
|
884
|
+
content_editable: Optional[
|
|
885
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
886
|
+
] = None,
|
|
887
|
+
context_menu: Optional[
|
|
888
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
889
|
+
] = None,
|
|
890
|
+
dir: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
|
|
891
|
+
draggable: Optional[
|
|
892
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
893
|
+
] = None,
|
|
894
|
+
enter_key_hint: Optional[
|
|
895
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
896
|
+
] = None,
|
|
897
|
+
hidden: Optional[
|
|
898
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
899
|
+
] = None,
|
|
900
|
+
input_mode: Optional[
|
|
901
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
902
|
+
] = None,
|
|
903
|
+
item_prop: Optional[
|
|
904
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
905
|
+
] = None,
|
|
906
|
+
lang: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
|
|
907
|
+
role: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
|
|
908
|
+
slot: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
|
|
909
|
+
spell_check: Optional[
|
|
910
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
911
|
+
] = None,
|
|
912
|
+
tab_index: Optional[
|
|
913
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
914
|
+
] = None,
|
|
915
|
+
title: Optional[
|
|
916
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
917
|
+
] = None,
|
|
918
|
+
translate: Optional[
|
|
919
|
+
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
920
|
+
] = None,
|
|
921
|
+
m: Optional[
|
|
922
|
+
Union[
|
|
923
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
924
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
925
|
+
]
|
|
926
|
+
] = None,
|
|
927
|
+
mx: Optional[
|
|
928
|
+
Union[
|
|
929
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
930
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
931
|
+
]
|
|
932
|
+
] = None,
|
|
933
|
+
my: Optional[
|
|
934
|
+
Union[
|
|
935
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
936
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
937
|
+
]
|
|
938
|
+
] = None,
|
|
939
|
+
mt: Optional[
|
|
940
|
+
Union[
|
|
941
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
942
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
943
|
+
]
|
|
944
|
+
] = None,
|
|
945
|
+
mr: Optional[
|
|
946
|
+
Union[
|
|
947
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
948
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
949
|
+
]
|
|
950
|
+
] = None,
|
|
951
|
+
mb: Optional[
|
|
952
|
+
Union[
|
|
953
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
954
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
955
|
+
]
|
|
956
|
+
] = None,
|
|
957
|
+
ml: Optional[
|
|
958
|
+
Union[
|
|
959
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
960
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
961
|
+
]
|
|
962
|
+
] = None,
|
|
963
|
+
style: Optional[Style] = None,
|
|
964
|
+
key: Optional[Any] = None,
|
|
965
|
+
id: Optional[Any] = None,
|
|
966
|
+
class_name: Optional[Any] = None,
|
|
967
|
+
autofocus: Optional[bool] = None,
|
|
968
|
+
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
969
|
+
on_blur: Optional[
|
|
970
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
971
|
+
] = None,
|
|
972
|
+
on_click: Optional[
|
|
973
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
974
|
+
] = None,
|
|
975
|
+
on_context_menu: Optional[
|
|
976
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
977
|
+
] = None,
|
|
978
|
+
on_double_click: Optional[
|
|
979
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
980
|
+
] = None,
|
|
981
|
+
on_focus: Optional[
|
|
982
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
983
|
+
] = None,
|
|
984
|
+
on_mount: Optional[
|
|
985
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
986
|
+
] = None,
|
|
987
|
+
on_mouse_down: Optional[
|
|
988
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
989
|
+
] = None,
|
|
990
|
+
on_mouse_enter: Optional[
|
|
991
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
992
|
+
] = None,
|
|
993
|
+
on_mouse_leave: Optional[
|
|
994
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
995
|
+
] = None,
|
|
996
|
+
on_mouse_move: Optional[
|
|
997
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
998
|
+
] = None,
|
|
999
|
+
on_mouse_out: Optional[
|
|
1000
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1001
|
+
] = None,
|
|
1002
|
+
on_mouse_over: Optional[
|
|
1003
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1004
|
+
] = None,
|
|
1005
|
+
on_mouse_up: Optional[
|
|
1006
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1007
|
+
] = None,
|
|
1008
|
+
on_scroll: Optional[
|
|
1009
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1010
|
+
] = None,
|
|
1011
|
+
on_unmount: Optional[
|
|
1012
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
1013
|
+
] = None,
|
|
1014
|
+
**props
|
|
1015
|
+
) -> "Callout":
|
|
1016
|
+
"""Create a callout component.
|
|
1017
|
+
|
|
1018
|
+
Args:
|
|
1019
|
+
text: The text of the callout.
|
|
1020
|
+
text: The text of the callout.
|
|
1021
|
+
icon: The icon of the callout.
|
|
1022
|
+
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
1023
|
+
size: Button size "1" - "4"
|
|
1024
|
+
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
|
1025
|
+
color: Override theme color for button
|
|
1026
|
+
high_contrast: Whether to render the button with higher contrast color against background
|
|
1027
|
+
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
1028
|
+
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
|
1029
|
+
content_editable: Indicates whether the element's content is editable.
|
|
1030
|
+
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
1031
|
+
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
1032
|
+
draggable: Defines whether the element can be dragged.
|
|
1033
|
+
enter_key_hint: Hints what media types the media element is able to play.
|
|
1034
|
+
hidden: Defines whether the element is hidden.
|
|
1035
|
+
input_mode: Defines the type of the element.
|
|
1036
|
+
item_prop: Defines the name of the element for metadata purposes.
|
|
1037
|
+
lang: Defines the language used in the element.
|
|
1038
|
+
role: Defines the role of the element.
|
|
1039
|
+
slot: Assigns a slot in a shadow DOM shadow tree to an element.
|
|
1040
|
+
spell_check: Defines whether the element may be checked for spelling errors.
|
|
1041
|
+
tab_index: Defines the position of the current element in the tabbing order.
|
|
1042
|
+
title: Defines a tooltip for the element.
|
|
1043
|
+
translate: Specifies whether the content of an element should be translated or not.
|
|
1044
|
+
m: Margin: "0" - "9"
|
|
1045
|
+
mx: Margin horizontal: "0" - "9"
|
|
1046
|
+
my: Margin vertical: "0" - "9"
|
|
1047
|
+
mt: Margin top: "0" - "9"
|
|
1048
|
+
mr: Margin right: "0" - "9"
|
|
1049
|
+
mb: Margin bottom: "0" - "9"
|
|
1050
|
+
ml: Margin left: "0" - "9"
|
|
1051
|
+
style: The style of the component.
|
|
1052
|
+
key: A unique key for the component.
|
|
1053
|
+
id: The id for the component.
|
|
1054
|
+
class_name: The class name for the component.
|
|
1055
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
1056
|
+
custom_attrs: custom attribute
|
|
1057
|
+
**props: The properties of the component.
|
|
1058
|
+
|
|
1059
|
+
Returns:
|
|
1060
|
+
The callout component.
|
|
1061
|
+
"""
|
|
1062
|
+
...
|
|
1063
|
+
|
|
1064
|
+
callout = Callout.create
|
|
@@ -11,15 +11,15 @@ from ..base import (
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class Card(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
14
|
-
"""
|
|
14
|
+
"""Container that groups related content and actions."""
|
|
15
15
|
|
|
16
16
|
tag = "Card"
|
|
17
17
|
|
|
18
18
|
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
19
19
|
as_child: Var[bool]
|
|
20
20
|
|
|
21
|
-
#
|
|
21
|
+
# Card size: "1" - "5"
|
|
22
22
|
size: Var[Literal["1", "2", "3", "4", "5"]]
|
|
23
23
|
|
|
24
|
-
# Variant of
|
|
24
|
+
# Variant of Card: "solid" | "soft" | "outline" | "ghost"
|
|
25
25
|
variant: Var[Literal["surface", "classic", "ghost"]]
|
|
@@ -241,8 +241,8 @@ class Card(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
241
241
|
color: map to CSS default color property.
|
|
242
242
|
color_scheme: map to radix color property.
|
|
243
243
|
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
244
|
-
size:
|
|
245
|
-
variant: Variant of
|
|
244
|
+
size: Card size: "1" - "5"
|
|
245
|
+
variant: Variant of Card: "solid" | "soft" | "outline" | "ghost"
|
|
246
246
|
access_key: Provides a hint for generating a keyboard shortcut for the current element.
|
|
247
247
|
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
|
|
248
248
|
content_editable: Indicates whether the element's content is editable.
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"""Interactive components provided by @radix-ui/themes."""
|
|
2
2
|
from typing import Any, Dict, Literal
|
|
3
3
|
|
|
4
|
+
from reflex.components.component import Component
|
|
5
|
+
from reflex.components.radix.themes.layout.flex import Flex
|
|
6
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
4
7
|
from reflex.vars import Var
|
|
5
8
|
|
|
6
9
|
from ..base import (
|
|
7
10
|
CommonMarginProps,
|
|
8
11
|
LiteralAccentColor,
|
|
9
|
-
|
|
12
|
+
LiteralSize,
|
|
10
13
|
LiteralVariant,
|
|
11
14
|
RadixThemesComponent,
|
|
12
15
|
)
|
|
@@ -34,9 +37,6 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
34
37
|
# Whether to render the button with higher contrast color against background
|
|
35
38
|
high_contrast: Var[bool]
|
|
36
39
|
|
|
37
|
-
# Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
|
|
38
|
-
radius: Var[LiteralRadius]
|
|
39
|
-
|
|
40
40
|
# Whether the checkbox is checked by default
|
|
41
41
|
default_checked: Var[bool]
|
|
42
42
|
|
|
@@ -65,3 +65,40 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
65
65
|
**super().get_event_triggers(),
|
|
66
66
|
"on_checked_change": lambda e0: [e0],
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class HighLevelCheckbox(Checkbox):
|
|
71
|
+
"""A checkbox component with a label."""
|
|
72
|
+
|
|
73
|
+
# The text label for the checkbox.
|
|
74
|
+
text: Var[str]
|
|
75
|
+
|
|
76
|
+
# The gap between the checkbox and the label.
|
|
77
|
+
gap: Var[LiteralSize]
|
|
78
|
+
|
|
79
|
+
# The size of the checkbox.
|
|
80
|
+
size: Var[LiteralCheckboxSize]
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def create(cls, text: Var[str] = Var.create_safe(""), **props) -> Component:
|
|
84
|
+
"""Create a checkbox with a label.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
text: The text of the label.
|
|
88
|
+
**props: Additional properties to apply to the checkbox item.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
The checkbox component with a label.
|
|
92
|
+
"""
|
|
93
|
+
gap = props.pop("gap", "2")
|
|
94
|
+
size = props.pop("size", "2")
|
|
95
|
+
|
|
96
|
+
return Text.create(
|
|
97
|
+
Flex.create(
|
|
98
|
+
Checkbox.create(size=size, **props),
|
|
99
|
+
text,
|
|
100
|
+
gap=gap,
|
|
101
|
+
),
|
|
102
|
+
as_="label",
|
|
103
|
+
size=size,
|
|
104
|
+
)
|
|
@@ -8,11 +8,14 @@ from reflex.vars import Var, BaseVar, ComputedVar
|
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from typing import Any, Dict, Literal
|
|
11
|
+
from reflex.components.component import Component
|
|
12
|
+
from reflex.components.radix.themes.layout.flex import Flex
|
|
13
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
11
14
|
from reflex.vars import Var
|
|
12
15
|
from ..base import (
|
|
13
16
|
CommonMarginProps,
|
|
14
17
|
LiteralAccentColor,
|
|
15
|
-
|
|
18
|
+
LiteralSize,
|
|
16
19
|
LiteralVariant,
|
|
17
20
|
RadixThemesComponent,
|
|
18
21
|
)
|
|
@@ -100,12 +103,6 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
100
103
|
]
|
|
101
104
|
] = None,
|
|
102
105
|
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
103
|
-
radius: Optional[
|
|
104
|
-
Union[
|
|
105
|
-
Var[Literal["none", "small", "medium", "large", "full"]],
|
|
106
|
-
Literal["none", "small", "medium", "large", "full"],
|
|
107
|
-
]
|
|
108
|
-
] = None,
|
|
109
106
|
default_checked: Optional[Union[Var[bool], bool]] = None,
|
|
110
107
|
checked: Optional[Union[Var[bool], bool]] = None,
|
|
111
108
|
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
@@ -223,7 +220,6 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
223
220
|
size: Button size "1" - "3"
|
|
224
221
|
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
|
225
222
|
high_contrast: Whether to render the button with higher contrast color against background
|
|
226
|
-
radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
|
|
227
223
|
default_checked: Whether the checkbox is checked by default
|
|
228
224
|
checked: Whether the checkbox is checked
|
|
229
225
|
disabled: Whether the checkbox is disabled
|
|
@@ -249,3 +245,230 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
249
245
|
A new component instance.
|
|
250
246
|
"""
|
|
251
247
|
...
|
|
248
|
+
|
|
249
|
+
class HighLevelCheckbox(Checkbox):
|
|
250
|
+
@overload
|
|
251
|
+
@classmethod
|
|
252
|
+
def create( # type: ignore
|
|
253
|
+
cls,
|
|
254
|
+
*children,
|
|
255
|
+
text: Optional[Union[Var[str], str]] = None,
|
|
256
|
+
gap: Optional[
|
|
257
|
+
Union[
|
|
258
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
259
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
260
|
+
]
|
|
261
|
+
] = None,
|
|
262
|
+
size: Optional[
|
|
263
|
+
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
|
264
|
+
] = None,
|
|
265
|
+
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
266
|
+
variant: Optional[
|
|
267
|
+
Union[
|
|
268
|
+
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
|
269
|
+
Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
|
|
270
|
+
]
|
|
271
|
+
] = None,
|
|
272
|
+
color: Optional[
|
|
273
|
+
Union[
|
|
274
|
+
Var[
|
|
275
|
+
Literal[
|
|
276
|
+
"tomato",
|
|
277
|
+
"red",
|
|
278
|
+
"ruby",
|
|
279
|
+
"crimson",
|
|
280
|
+
"pink",
|
|
281
|
+
"plum",
|
|
282
|
+
"purple",
|
|
283
|
+
"violet",
|
|
284
|
+
"iris",
|
|
285
|
+
"indigo",
|
|
286
|
+
"blue",
|
|
287
|
+
"cyan",
|
|
288
|
+
"teal",
|
|
289
|
+
"jade",
|
|
290
|
+
"green",
|
|
291
|
+
"grass",
|
|
292
|
+
"brown",
|
|
293
|
+
"orange",
|
|
294
|
+
"sky",
|
|
295
|
+
"mint",
|
|
296
|
+
"lime",
|
|
297
|
+
"yellow",
|
|
298
|
+
"amber",
|
|
299
|
+
"gold",
|
|
300
|
+
"bronze",
|
|
301
|
+
"gray",
|
|
302
|
+
]
|
|
303
|
+
],
|
|
304
|
+
Literal[
|
|
305
|
+
"tomato",
|
|
306
|
+
"red",
|
|
307
|
+
"ruby",
|
|
308
|
+
"crimson",
|
|
309
|
+
"pink",
|
|
310
|
+
"plum",
|
|
311
|
+
"purple",
|
|
312
|
+
"violet",
|
|
313
|
+
"iris",
|
|
314
|
+
"indigo",
|
|
315
|
+
"blue",
|
|
316
|
+
"cyan",
|
|
317
|
+
"teal",
|
|
318
|
+
"jade",
|
|
319
|
+
"green",
|
|
320
|
+
"grass",
|
|
321
|
+
"brown",
|
|
322
|
+
"orange",
|
|
323
|
+
"sky",
|
|
324
|
+
"mint",
|
|
325
|
+
"lime",
|
|
326
|
+
"yellow",
|
|
327
|
+
"amber",
|
|
328
|
+
"gold",
|
|
329
|
+
"bronze",
|
|
330
|
+
"gray",
|
|
331
|
+
],
|
|
332
|
+
]
|
|
333
|
+
] = None,
|
|
334
|
+
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
335
|
+
default_checked: Optional[Union[Var[bool], bool]] = None,
|
|
336
|
+
checked: Optional[Union[Var[bool], bool]] = None,
|
|
337
|
+
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
338
|
+
required: Optional[Union[Var[bool], bool]] = None,
|
|
339
|
+
name: Optional[Union[Var[str], str]] = None,
|
|
340
|
+
value: Optional[Union[Var[str], str]] = None,
|
|
341
|
+
m: Optional[
|
|
342
|
+
Union[
|
|
343
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
344
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
345
|
+
]
|
|
346
|
+
] = None,
|
|
347
|
+
mx: Optional[
|
|
348
|
+
Union[
|
|
349
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
350
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
351
|
+
]
|
|
352
|
+
] = None,
|
|
353
|
+
my: Optional[
|
|
354
|
+
Union[
|
|
355
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
356
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
357
|
+
]
|
|
358
|
+
] = None,
|
|
359
|
+
mt: Optional[
|
|
360
|
+
Union[
|
|
361
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
362
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
363
|
+
]
|
|
364
|
+
] = None,
|
|
365
|
+
mr: Optional[
|
|
366
|
+
Union[
|
|
367
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
368
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
369
|
+
]
|
|
370
|
+
] = None,
|
|
371
|
+
mb: Optional[
|
|
372
|
+
Union[
|
|
373
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
374
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
375
|
+
]
|
|
376
|
+
] = None,
|
|
377
|
+
ml: Optional[
|
|
378
|
+
Union[
|
|
379
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
380
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
381
|
+
]
|
|
382
|
+
] = None,
|
|
383
|
+
style: Optional[Style] = None,
|
|
384
|
+
key: Optional[Any] = None,
|
|
385
|
+
id: Optional[Any] = None,
|
|
386
|
+
class_name: Optional[Any] = None,
|
|
387
|
+
autofocus: Optional[bool] = None,
|
|
388
|
+
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
389
|
+
on_blur: Optional[
|
|
390
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
391
|
+
] = None,
|
|
392
|
+
on_checked_change: Optional[
|
|
393
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
394
|
+
] = None,
|
|
395
|
+
on_click: Optional[
|
|
396
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
397
|
+
] = None,
|
|
398
|
+
on_context_menu: Optional[
|
|
399
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
400
|
+
] = None,
|
|
401
|
+
on_double_click: Optional[
|
|
402
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
403
|
+
] = None,
|
|
404
|
+
on_focus: Optional[
|
|
405
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
406
|
+
] = None,
|
|
407
|
+
on_mount: Optional[
|
|
408
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
409
|
+
] = None,
|
|
410
|
+
on_mouse_down: Optional[
|
|
411
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
412
|
+
] = None,
|
|
413
|
+
on_mouse_enter: Optional[
|
|
414
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
415
|
+
] = None,
|
|
416
|
+
on_mouse_leave: Optional[
|
|
417
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
418
|
+
] = None,
|
|
419
|
+
on_mouse_move: Optional[
|
|
420
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
421
|
+
] = None,
|
|
422
|
+
on_mouse_out: Optional[
|
|
423
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
424
|
+
] = None,
|
|
425
|
+
on_mouse_over: Optional[
|
|
426
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
427
|
+
] = None,
|
|
428
|
+
on_mouse_up: Optional[
|
|
429
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
430
|
+
] = None,
|
|
431
|
+
on_scroll: Optional[
|
|
432
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
433
|
+
] = None,
|
|
434
|
+
on_unmount: Optional[
|
|
435
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
436
|
+
] = None,
|
|
437
|
+
**props
|
|
438
|
+
) -> "HighLevelCheckbox":
|
|
439
|
+
"""Create a checkbox with a label.
|
|
440
|
+
|
|
441
|
+
Args:
|
|
442
|
+
text: The text of the label.
|
|
443
|
+
text: The text label for the checkbox.
|
|
444
|
+
gap: The gap between the checkbox and the label.
|
|
445
|
+
size: Button size "1" - "3"
|
|
446
|
+
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
447
|
+
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
|
448
|
+
color: Override theme color for button
|
|
449
|
+
high_contrast: Whether to render the button with higher contrast color against background
|
|
450
|
+
default_checked: Whether the checkbox is checked by default
|
|
451
|
+
checked: Whether the checkbox is checked
|
|
452
|
+
disabled: Whether the checkbox is disabled
|
|
453
|
+
required: Whether the checkbox is required
|
|
454
|
+
name: The name of the checkbox control when submitting the form.
|
|
455
|
+
value: The value of the checkbox control when submitting the form.
|
|
456
|
+
m: Margin: "0" - "9"
|
|
457
|
+
mx: Margin horizontal: "0" - "9"
|
|
458
|
+
my: Margin vertical: "0" - "9"
|
|
459
|
+
mt: Margin top: "0" - "9"
|
|
460
|
+
mr: Margin right: "0" - "9"
|
|
461
|
+
mb: Margin bottom: "0" - "9"
|
|
462
|
+
ml: Margin left: "0" - "9"
|
|
463
|
+
style: The style of the component.
|
|
464
|
+
key: A unique key for the component.
|
|
465
|
+
id: The id for the component.
|
|
466
|
+
class_name: The class name for the component.
|
|
467
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
468
|
+
custom_attrs: custom attribute
|
|
469
|
+
**props: Additional properties to apply to the checkbox item.
|
|
470
|
+
|
|
471
|
+
Returns:
|
|
472
|
+
The checkbox component with a label.
|
|
473
|
+
"""
|
|
474
|
+
...
|