reflex 0.4.9a1__py3-none-any.whl → 0.5.0__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 +19 -16
- reflex/.templates/apps/demo/code/demo.py +1 -1
- reflex/.templates/apps/demo/code/pages/datatable.py +4 -4
- reflex/.templates/apps/demo/code/pages/forms.py +2 -2
- reflex/.templates/jinja/web/tailwind.config.js.jinja2 +12 -0
- reflex/.templates/web/utils/helpers/debounce.js +17 -0
- reflex/.templates/web/utils/helpers/throttle.js +22 -0
- reflex/.templates/web/utils/state.js +21 -3
- reflex/__init__.py +6 -1
- reflex/__init__.pyi +4 -1
- reflex/app.py +160 -140
- reflex/app_module_for_backend.py +1 -1
- reflex/base.py +13 -15
- reflex/compiler/compiler.py +10 -1
- reflex/compiler/utils.py +3 -30
- reflex/components/__init__.py +1 -0
- reflex/components/chakra/datadisplay/list.py +1 -3
- reflex/components/chakra/datadisplay/list.pyi +3 -3
- reflex/components/chakra/disclosure/accordion.py +1 -1
- reflex/components/chakra/forms/pininput.pyi +1 -1
- reflex/components/chakra/media/icon.py +2 -2
- reflex/components/component.py +275 -32
- reflex/components/core/__init__.py +2 -2
- reflex/components/core/cond.py +1 -10
- reflex/components/core/debounce.py +5 -2
- reflex/components/core/debounce.pyi +4 -2
- reflex/components/core/foreach.py +60 -49
- reflex/components/core/html.py +6 -0
- reflex/components/core/match.py +2 -17
- reflex/components/core/upload.py +42 -1
- reflex/components/core/upload.pyi +199 -1
- reflex/components/datadisplay/code.py +7 -3
- reflex/components/datadisplay/code.pyi +3 -1
- reflex/components/el/elements/forms.py +1 -1
- reflex/components/el/elements/forms.pyi +1 -1
- reflex/components/lucide/icon.py +5 -13
- reflex/components/lucide/icon.pyi +0 -1
- reflex/components/markdown/markdown.py +5 -23
- reflex/components/markdown/markdown.pyi +1 -4
- reflex/components/radix/primitives/accordion.py +265 -410
- reflex/components/radix/primitives/accordion.pyi +390 -36
- reflex/components/radix/primitives/form.py +33 -29
- reflex/components/radix/primitives/form.pyi +7 -2
- reflex/components/radix/primitives/progress.py +17 -9
- reflex/components/radix/primitives/progress.pyi +2 -0
- reflex/components/radix/primitives/slider.py +30 -18
- reflex/components/radix/primitives/slider.pyi +4 -0
- reflex/components/radix/themes/base.py +8 -1
- reflex/components/radix/themes/base.pyi +79 -1
- reflex/components/radix/themes/color_mode.py +88 -20
- reflex/components/radix/themes/color_mode.pyi +157 -139
- reflex/components/radix/themes/components/__init__.py +17 -0
- reflex/components/radix/themes/components/badge.py +2 -1
- reflex/components/radix/themes/components/badge.pyi +3 -1
- reflex/components/radix/themes/components/button.py +3 -1
- reflex/components/radix/themes/components/button.pyi +4 -1
- reflex/components/radix/themes/components/checkbox_cards.py +48 -0
- reflex/components/radix/themes/components/checkbox_cards.pyi +264 -0
- reflex/components/radix/themes/components/checkbox_group.py +42 -0
- reflex/components/radix/themes/components/checkbox_group.pyi +253 -0
- reflex/components/radix/themes/components/data_list.py +63 -0
- reflex/components/radix/themes/components/data_list.pyi +426 -0
- reflex/components/radix/themes/components/icon_button.py +20 -17
- reflex/components/radix/themes/components/icon_button.pyi +5 -1
- reflex/components/radix/themes/components/progress.py +55 -0
- reflex/components/radix/themes/components/progress.pyi +180 -0
- reflex/components/radix/themes/components/radio.py +31 -0
- reflex/components/radix/themes/components/radio.pyi +169 -0
- reflex/components/radix/themes/components/radio_cards.py +48 -0
- reflex/components/radix/themes/components/radio_cards.pyi +264 -0
- reflex/components/radix/themes/components/radio_group.py +2 -4
- reflex/components/radix/themes/components/segmented_control.py +48 -0
- reflex/components/radix/themes/components/segmented_control.pyi +262 -0
- reflex/components/radix/themes/components/skeleton.py +32 -0
- reflex/components/radix/themes/components/skeleton.pyi +106 -0
- reflex/components/radix/themes/components/spinner.py +26 -0
- reflex/components/radix/themes/components/spinner.pyi +101 -0
- reflex/components/radix/themes/components/tabs.py +26 -1
- reflex/components/radix/themes/components/tabs.pyi +69 -9
- reflex/components/radix/themes/components/text_field.py +101 -71
- reflex/components/radix/themes/components/text_field.pyi +81 -499
- reflex/components/radix/themes/layout/base.py +2 -2
- reflex/components/radix/themes/layout/base.pyi +4 -4
- reflex/components/radix/themes/layout/center.py +8 -3
- reflex/components/radix/themes/layout/center.pyi +2 -1
- reflex/components/radix/themes/layout/container.py +30 -2
- reflex/components/radix/themes/layout/container.pyi +9 -30
- reflex/components/radix/themes/layout/list.py +10 -5
- reflex/components/radix/themes/layout/list.pyi +5 -21
- reflex/components/radix/themes/layout/spacer.py +8 -3
- reflex/components/radix/themes/layout/spacer.pyi +2 -1
- reflex/components/radix/themes/layout/stack.py +7 -1
- reflex/components/radix/themes/layout/stack.pyi +3 -3
- reflex/components/radix/themes/typography/link.py +10 -2
- reflex/components/radix/themes/typography/link.pyi +5 -4
- reflex/components/sonner/__init__.py +3 -0
- reflex/components/sonner/toast.py +267 -0
- reflex/components/sonner/toast.pyi +205 -0
- reflex/components/tags/iter_tag.py +9 -6
- reflex/config.py +30 -54
- reflex/constants/__init__.py +0 -2
- reflex/constants/base.py +0 -5
- reflex/constants/colors.py +2 -0
- reflex/constants/installer.py +6 -1
- reflex/constants/route.py +4 -0
- reflex/custom_components/custom_components.py +24 -2
- reflex/event.py +75 -30
- reflex/experimental/__init__.py +5 -0
- reflex/experimental/layout.py +24 -6
- reflex/model.py +2 -1
- reflex/page.py +7 -4
- reflex/reflex.py +8 -3
- reflex/route.py +39 -0
- reflex/state.py +128 -131
- reflex/style.py +25 -3
- reflex/testing.py +10 -6
- reflex/utils/console.py +3 -1
- reflex/utils/exec.py +20 -7
- reflex/utils/format.py +1 -1
- reflex/utils/imports.py +3 -1
- reflex/utils/prerequisites.py +141 -20
- reflex/utils/processes.py +21 -1
- reflex/utils/pyi_generator.py +100 -5
- reflex/utils/serializers.py +1 -1
- reflex/utils/telemetry.py +26 -4
- reflex/utils/types.py +62 -18
- reflex/vars.py +11 -5
- {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/METADATA +16 -4
- {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/RECORD +132 -110
- {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/WHEEL +1 -1
- reflex/app.pyi +0 -149
- {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/LICENSE +0 -0
- {reflex-0.4.9a1.dist-info → reflex-0.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -43,7 +43,7 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
|
|
|
43
43
|
pl: Var[LiteralSpacing]
|
|
44
44
|
|
|
45
45
|
# Whether the element will take up the smallest possible space: "0" | "1"
|
|
46
|
-
|
|
46
|
+
flex_shrink: Var[LiteralBoolNumber]
|
|
47
47
|
|
|
48
48
|
# Whether the element will take up the largest possible space: "0" | "1"
|
|
49
|
-
|
|
49
|
+
flex_grow: Var[LiteralBoolNumber]
|
|
@@ -61,8 +61,8 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
|
|
|
61
61
|
Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
62
62
|
]
|
|
63
63
|
] = None,
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
flex_shrink: Optional[Union[Var[Literal["0", "1"]], Literal["0", "1"]]] = None,
|
|
65
|
+
flex_grow: Optional[Union[Var[Literal["0", "1"]], Literal["0", "1"]]] = None,
|
|
66
66
|
m: Optional[
|
|
67
67
|
Union[
|
|
68
68
|
Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
@@ -172,8 +172,8 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
|
|
|
172
172
|
pr: Padding right: "0" - "9"
|
|
173
173
|
pb: Padding bottom: "0" - "9"
|
|
174
174
|
pl: Padding left: "0" - "9"
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
flex_shrink: Whether the element will take up the smallest possible space: "0" | "1"
|
|
176
|
+
flex_grow: Whether the element will take up the largest possible space: "0" | "1"
|
|
177
177
|
m: Margin: "0" - "9"
|
|
178
178
|
mx: Margin horizontal: "0" - "9"
|
|
179
179
|
my: Margin vertical: "0" - "9"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from reflex.
|
|
5
|
+
from reflex.style import Style
|
|
6
6
|
|
|
7
7
|
from .flex import Flex
|
|
8
8
|
|
|
@@ -10,8 +10,13 @@ from .flex import Flex
|
|
|
10
10
|
class Center(Flex):
|
|
11
11
|
"""A center component."""
|
|
12
12
|
|
|
13
|
-
def
|
|
14
|
-
|
|
13
|
+
def add_style(self) -> Style | None:
|
|
14
|
+
"""Add style that center the content.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
The style of the component.
|
|
18
|
+
"""
|
|
19
|
+
return Style(
|
|
15
20
|
{
|
|
16
21
|
"display": "flex",
|
|
17
22
|
"align_items": "center",
|
|
@@ -7,10 +7,11 @@ 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 reflex.
|
|
10
|
+
from reflex.style import Style
|
|
11
11
|
from .flex import Flex
|
|
12
12
|
|
|
13
13
|
class Center(Flex):
|
|
14
|
+
def add_style(self) -> Style | None: ...
|
|
14
15
|
@overload
|
|
15
16
|
@classmethod
|
|
16
17
|
def create( # type: ignore
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
from typing import Literal
|
|
5
5
|
|
|
6
6
|
from reflex import el
|
|
7
|
+
from reflex.style import STACK_CHILDREN_FULL_WIDTH
|
|
7
8
|
from reflex.vars import Var
|
|
8
9
|
|
|
9
10
|
from ..base import RadixThemesComponent
|
|
@@ -19,5 +20,32 @@ class Container(el.Div, RadixThemesComponent):
|
|
|
19
20
|
|
|
20
21
|
tag = "Container"
|
|
21
22
|
|
|
22
|
-
# The size of the container: "1" - "4" (default "
|
|
23
|
-
size: Var[LiteralContainerSize]
|
|
23
|
+
# The size of the container: "1" - "4" (default "3")
|
|
24
|
+
size: Var[LiteralContainerSize] = Var.create_safe("3")
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def create(
|
|
28
|
+
cls,
|
|
29
|
+
*children,
|
|
30
|
+
padding: str = "16px",
|
|
31
|
+
stack_children_full_width: bool = False,
|
|
32
|
+
**props,
|
|
33
|
+
):
|
|
34
|
+
"""Create the container component.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
children: The children components.
|
|
38
|
+
padding: The padding of the container.
|
|
39
|
+
stack_children_full_width: If True, any vstack/hstack children will have 100% width.
|
|
40
|
+
props: The properties of the container.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
The container component.
|
|
44
|
+
"""
|
|
45
|
+
if stack_children_full_width:
|
|
46
|
+
props["style"] = {**STACK_CHILDREN_FULL_WIDTH, **props.pop("style", {})}
|
|
47
|
+
return super().create(
|
|
48
|
+
*children,
|
|
49
|
+
padding=padding,
|
|
50
|
+
**props,
|
|
51
|
+
)
|
|
@@ -9,6 +9,7 @@ from reflex.event import EventChain, EventHandler, EventSpec
|
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from typing import Literal
|
|
11
11
|
from reflex import el
|
|
12
|
+
from reflex.style import STACK_CHILDREN_FULL_WIDTH
|
|
12
13
|
from reflex.vars import Var
|
|
13
14
|
from ..base import RadixThemesComponent
|
|
14
15
|
|
|
@@ -20,6 +21,8 @@ class Container(el.Div, RadixThemesComponent):
|
|
|
20
21
|
def create( # type: ignore
|
|
21
22
|
cls,
|
|
22
23
|
*children,
|
|
24
|
+
padding: Optional[str] = "16px",
|
|
25
|
+
stack_children_full_width: Optional[bool] = False,
|
|
23
26
|
size: Optional[
|
|
24
27
|
Union[Var[Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"]]
|
|
25
28
|
] = None,
|
|
@@ -116,39 +119,15 @@ class Container(el.Div, RadixThemesComponent):
|
|
|
116
119
|
] = None,
|
|
117
120
|
**props
|
|
118
121
|
) -> "Container":
|
|
119
|
-
"""Create
|
|
120
|
-
|
|
121
|
-
Will prepend "RadixThemes" to the component tag to avoid conflicts with
|
|
122
|
-
other UI libraries for common names, like Text and Button.
|
|
122
|
+
"""Create the container component.
|
|
123
123
|
|
|
124
124
|
Args:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
content_editable: Indicates whether the element's content is editable.
|
|
130
|
-
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
131
|
-
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
132
|
-
draggable: Defines whether the element can be dragged.
|
|
133
|
-
enter_key_hint: Hints what media types the media element is able to play.
|
|
134
|
-
hidden: Defines whether the element is hidden.
|
|
135
|
-
input_mode: Defines the type of the element.
|
|
136
|
-
item_prop: Defines the name of the element for metadata purposes.
|
|
137
|
-
lang: Defines the language used in the element.
|
|
138
|
-
role: Defines the role of the element.
|
|
139
|
-
slot: Assigns a slot in a shadow DOM shadow tree to an element.
|
|
140
|
-
spell_check: Defines whether the element may be checked for spelling errors.
|
|
141
|
-
tab_index: Defines the position of the current element in the tabbing order.
|
|
142
|
-
title: Defines a tooltip for the element.
|
|
143
|
-
style: The style of the component.
|
|
144
|
-
key: A unique key for the component.
|
|
145
|
-
id: The id for the component.
|
|
146
|
-
class_name: The class name for the component.
|
|
147
|
-
autofocus: Whether the component should take the focus once the page is loaded
|
|
148
|
-
custom_attrs: custom attribute
|
|
149
|
-
**props: Component properties.
|
|
125
|
+
children: The children components.
|
|
126
|
+
padding: The padding of the container.
|
|
127
|
+
stack_children_full_width: If True, any vstack/hstack children will have 100% width.
|
|
128
|
+
props: The properties of the container.
|
|
150
129
|
|
|
151
130
|
Returns:
|
|
152
|
-
|
|
131
|
+
The container component.
|
|
153
132
|
"""
|
|
154
133
|
...
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""List components."""
|
|
2
|
+
from __future__ import annotations
|
|
2
3
|
|
|
3
4
|
from typing import Iterable, Literal, Optional, Union
|
|
4
5
|
|
|
@@ -49,7 +50,7 @@ class BaseList(Component):
|
|
|
49
50
|
def create(
|
|
50
51
|
cls,
|
|
51
52
|
*children,
|
|
52
|
-
items: Optional[
|
|
53
|
+
items: Optional[Var[Iterable]] = None,
|
|
53
54
|
**props,
|
|
54
55
|
):
|
|
55
56
|
"""Create a list component.
|
|
@@ -68,7 +69,7 @@ class BaseList(Component):
|
|
|
68
69
|
if isinstance(items, Var):
|
|
69
70
|
children = [Foreach.create(items, ListItem.create)]
|
|
70
71
|
else:
|
|
71
|
-
children = [ListItem.create(item) for item in items]
|
|
72
|
+
children = [ListItem.create(item) for item in items] # type: ignore
|
|
72
73
|
props["list_style_position"] = "outside"
|
|
73
74
|
props["direction"] = "column"
|
|
74
75
|
style = props.setdefault("style", {})
|
|
@@ -77,12 +78,16 @@ class BaseList(Component):
|
|
|
77
78
|
style["gap"] = props["gap"]
|
|
78
79
|
return super().create(*children, **props)
|
|
79
80
|
|
|
80
|
-
def
|
|
81
|
-
|
|
81
|
+
def add_style(self) -> Style | None:
|
|
82
|
+
"""Add style to the component.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
The style of the component.
|
|
86
|
+
"""
|
|
87
|
+
return Style(
|
|
82
88
|
{
|
|
83
89
|
"direction": "column",
|
|
84
90
|
"list_style_position": "inside",
|
|
85
|
-
**self.style,
|
|
86
91
|
}
|
|
87
92
|
)
|
|
88
93
|
|
|
@@ -40,7 +40,7 @@ class BaseList(Component):
|
|
|
40
40
|
def create( # type: ignore
|
|
41
41
|
cls,
|
|
42
42
|
*children,
|
|
43
|
-
items: Optional[Union[
|
|
43
|
+
items: Optional[Union[Var[Iterable], Iterable]] = None,
|
|
44
44
|
list_style_type: Optional[
|
|
45
45
|
Union[
|
|
46
46
|
Var[
|
|
@@ -157,6 +157,7 @@ class BaseList(Component):
|
|
|
157
157
|
|
|
158
158
|
"""
|
|
159
159
|
...
|
|
160
|
+
def add_style(self) -> Style | None: ...
|
|
160
161
|
|
|
161
162
|
class UnorderedList(BaseList, Ul):
|
|
162
163
|
@overload
|
|
@@ -165,7 +166,7 @@ class UnorderedList(BaseList, Ul):
|
|
|
165
166
|
cls,
|
|
166
167
|
*children,
|
|
167
168
|
items: Optional[Union[Var[Iterable], Iterable]] = None,
|
|
168
|
-
list_style_type: Optional[
|
|
169
|
+
list_style_type: Optional[LiteralListStyleTypeUnordered] = "disc",
|
|
169
170
|
access_key: Optional[
|
|
170
171
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
171
172
|
] = None,
|
|
@@ -302,24 +303,7 @@ class OrderedList(BaseList, Ol):
|
|
|
302
303
|
cls,
|
|
303
304
|
*children,
|
|
304
305
|
items: Optional[Union[Var[Iterable], Iterable]] = None,
|
|
305
|
-
list_style_type: Optional[
|
|
306
|
-
Literal[
|
|
307
|
-
"none",
|
|
308
|
-
"decimal",
|
|
309
|
-
"decimal-leading-zero",
|
|
310
|
-
"lower-roman",
|
|
311
|
-
"upper-roman",
|
|
312
|
-
"lower-greek",
|
|
313
|
-
"lower-latin",
|
|
314
|
-
"upper-latin",
|
|
315
|
-
"armenian",
|
|
316
|
-
"georgian",
|
|
317
|
-
"lower-alpha",
|
|
318
|
-
"upper-alpha",
|
|
319
|
-
"hiragana",
|
|
320
|
-
"katakana",
|
|
321
|
-
]
|
|
322
|
-
] = "decimal",
|
|
306
|
+
list_style_type: Optional[LiteralListStyleTypeOrdered] = "decimal",
|
|
323
307
|
reversed: Optional[
|
|
324
308
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
325
309
|
] = None,
|
|
@@ -600,7 +584,7 @@ class List(ComponentNamespace):
|
|
|
600
584
|
@staticmethod
|
|
601
585
|
def __call__(
|
|
602
586
|
*children,
|
|
603
|
-
items: Optional[Union[
|
|
587
|
+
items: Optional[Union[Var[Iterable], Iterable]] = None,
|
|
604
588
|
list_style_type: Optional[
|
|
605
589
|
Union[
|
|
606
590
|
Var[
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from reflex.
|
|
5
|
+
from reflex.style import Style
|
|
6
6
|
|
|
7
7
|
from .flex import Flex
|
|
8
8
|
|
|
@@ -10,8 +10,13 @@ from .flex import Flex
|
|
|
10
10
|
class Spacer(Flex):
|
|
11
11
|
"""A spacer component."""
|
|
12
12
|
|
|
13
|
-
def
|
|
14
|
-
|
|
13
|
+
def add_style(self) -> Style | None:
|
|
14
|
+
"""Add style to the component.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
The style of the component.
|
|
18
|
+
"""
|
|
19
|
+
return Style(
|
|
15
20
|
{
|
|
16
21
|
"flex": 1,
|
|
17
22
|
"justify_self": "stretch",
|
|
@@ -7,10 +7,11 @@ 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 reflex.
|
|
10
|
+
from reflex.style import Style
|
|
11
11
|
from .flex import Flex
|
|
12
12
|
|
|
13
13
|
class Spacer(Flex):
|
|
14
|
+
def add_style(self) -> Style | None: ...
|
|
14
15
|
@overload
|
|
15
16
|
@classmethod
|
|
16
17
|
def create( # type: ignore
|
|
@@ -16,7 +16,7 @@ class Stack(Flex):
|
|
|
16
16
|
def create(
|
|
17
17
|
cls,
|
|
18
18
|
*children,
|
|
19
|
-
spacing: LiteralSpacing = "
|
|
19
|
+
spacing: LiteralSpacing = "3",
|
|
20
20
|
align: LiteralAlign = "start",
|
|
21
21
|
**props,
|
|
22
22
|
) -> Component:
|
|
@@ -31,6 +31,12 @@ class Stack(Flex):
|
|
|
31
31
|
Returns:
|
|
32
32
|
The stack component.
|
|
33
33
|
"""
|
|
34
|
+
# Apply the default classname
|
|
35
|
+
given_class_name = props.pop("class_name", [])
|
|
36
|
+
if isinstance(given_class_name, str):
|
|
37
|
+
given_class_name = [given_class_name]
|
|
38
|
+
props["class_name"] = ["rx-Stack", *given_class_name]
|
|
39
|
+
|
|
34
40
|
return super().create(
|
|
35
41
|
*children,
|
|
36
42
|
spacing=spacing,
|
|
@@ -18,7 +18,7 @@ class Stack(Flex):
|
|
|
18
18
|
def create( # type: ignore
|
|
19
19
|
cls,
|
|
20
20
|
*children,
|
|
21
|
-
spacing: Optional[LiteralSpacing] = "
|
|
21
|
+
spacing: Optional[LiteralSpacing] = "3",
|
|
22
22
|
align: Optional[LiteralAlign] = "start",
|
|
23
23
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
24
24
|
direction: Optional[
|
|
@@ -177,7 +177,7 @@ class VStack(Stack):
|
|
|
177
177
|
def create( # type: ignore
|
|
178
178
|
cls,
|
|
179
179
|
*children,
|
|
180
|
-
spacing: Optional[LiteralSpacing] = "
|
|
180
|
+
spacing: Optional[LiteralSpacing] = "3",
|
|
181
181
|
align: Optional[LiteralAlign] = "start",
|
|
182
182
|
direction: Optional[
|
|
183
183
|
Union[
|
|
@@ -336,7 +336,7 @@ class HStack(Stack):
|
|
|
336
336
|
def create( # type: ignore
|
|
337
337
|
cls,
|
|
338
338
|
*children,
|
|
339
|
-
spacing: Optional[LiteralSpacing] = "
|
|
339
|
+
spacing: Optional[LiteralSpacing] = "3",
|
|
340
340
|
align: Optional[LiteralAlign] = "start",
|
|
341
341
|
direction: Optional[
|
|
342
342
|
Union[
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
https://www.radix-ui.com/themes/docs/theme/typography
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
from __future__ import annotations
|
|
6
7
|
|
|
7
8
|
from typing import Literal
|
|
8
9
|
|
|
9
10
|
from reflex.components.component import Component, MemoizationLeaf
|
|
11
|
+
from reflex.components.core.colors import color
|
|
10
12
|
from reflex.components.core.cond import cond
|
|
11
13
|
from reflex.components.el.elements.inline import A
|
|
12
14
|
from reflex.components.next.link import NextLink
|
|
@@ -23,7 +25,7 @@ from .base import (
|
|
|
23
25
|
LiteralTextWeight,
|
|
24
26
|
)
|
|
25
27
|
|
|
26
|
-
LiteralLinkUnderline = Literal["auto", "hover", "always"]
|
|
28
|
+
LiteralLinkUnderline = Literal["auto", "hover", "always", "none"]
|
|
27
29
|
|
|
28
30
|
next_link = NextLink.create()
|
|
29
31
|
|
|
@@ -45,7 +47,7 @@ class Link(RadixThemesComponent, A, MemoizationLeaf):
|
|
|
45
47
|
# Removes the leading trim space: "normal" | "start" | "end" | "both"
|
|
46
48
|
trim: Var[LiteralTextTrim]
|
|
47
49
|
|
|
48
|
-
# Sets the visibility of the underline affordance: "auto" | "hover" | "always"
|
|
50
|
+
# Sets the visibility of the underline affordance: "auto" | "hover" | "always" | "none"
|
|
49
51
|
underline: Var[LiteralLinkUnderline]
|
|
50
52
|
|
|
51
53
|
# Overrides the accent color inherited from the Theme.
|
|
@@ -74,12 +76,17 @@ class Link(RadixThemesComponent, A, MemoizationLeaf):
|
|
|
74
76
|
Returns:
|
|
75
77
|
Component: The link component
|
|
76
78
|
"""
|
|
79
|
+
props.setdefault(":hover", {"color": color("accent", 8)})
|
|
80
|
+
|
|
77
81
|
is_external = props.pop("is_external", None)
|
|
82
|
+
|
|
78
83
|
if is_external is not None:
|
|
79
84
|
props["target"] = cond(is_external, "_blank", "")
|
|
85
|
+
|
|
80
86
|
if props.get("href") is not None:
|
|
81
87
|
if not len(children):
|
|
82
88
|
raise ValueError("Link without a child will not display")
|
|
89
|
+
|
|
83
90
|
if "as_child" not in props:
|
|
84
91
|
# Extract props for the NextLink, the rest go to the Link/A element.
|
|
85
92
|
known_next_link_props = NextLink.get_props()
|
|
@@ -87,6 +94,7 @@ class Link(RadixThemesComponent, A, MemoizationLeaf):
|
|
|
87
94
|
for prop in props.copy():
|
|
88
95
|
if prop in known_next_link_props:
|
|
89
96
|
next_link_props[prop] = props.pop(prop)
|
|
97
|
+
|
|
90
98
|
# If user does not use `as_child`, by default we render using next_link to avoid page refresh during internal navigation
|
|
91
99
|
return super().create(
|
|
92
100
|
NextLink.create(*children, **next_link_props),
|
|
@@ -9,6 +9,7 @@ from reflex.event import EventChain, EventHandler, EventSpec
|
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from typing import Literal
|
|
11
11
|
from reflex.components.component import Component, MemoizationLeaf
|
|
12
|
+
from reflex.components.core.colors import color
|
|
12
13
|
from reflex.components.core.cond import cond
|
|
13
14
|
from reflex.components.el.elements.inline import A
|
|
14
15
|
from reflex.components.next.link import NextLink
|
|
@@ -17,7 +18,7 @@ from reflex.vars import Var
|
|
|
17
18
|
from ..base import LiteralAccentColor, RadixThemesComponent
|
|
18
19
|
from .base import LiteralTextSize, LiteralTextTrim, LiteralTextWeight
|
|
19
20
|
|
|
20
|
-
LiteralLinkUnderline = Literal["auto", "hover", "always"]
|
|
21
|
+
LiteralLinkUnderline = Literal["auto", "hover", "always", "none"]
|
|
21
22
|
next_link = NextLink.create()
|
|
22
23
|
|
|
23
24
|
class Link(RadixThemesComponent, A, MemoizationLeaf):
|
|
@@ -47,8 +48,8 @@ class Link(RadixThemesComponent, A, MemoizationLeaf):
|
|
|
47
48
|
] = None,
|
|
48
49
|
underline: Optional[
|
|
49
50
|
Union[
|
|
50
|
-
Var[Literal["auto", "hover", "always"]],
|
|
51
|
-
Literal["auto", "hover", "always"],
|
|
51
|
+
Var[Literal["auto", "hover", "always", "none"]],
|
|
52
|
+
Literal["auto", "hover", "always", "none"],
|
|
52
53
|
]
|
|
53
54
|
] = None,
|
|
54
55
|
color_scheme: Optional[
|
|
@@ -237,7 +238,7 @@ class Link(RadixThemesComponent, A, MemoizationLeaf):
|
|
|
237
238
|
size: Text size: "1" - "9"
|
|
238
239
|
weight: Thickness of text: "light" | "regular" | "medium" | "bold"
|
|
239
240
|
trim: Removes the leading trim space: "normal" | "start" | "end" | "both"
|
|
240
|
-
underline: Sets the visibility of the underline affordance: "auto" | "hover" | "always"
|
|
241
|
+
underline: Sets the visibility of the underline affordance: "auto" | "hover" | "always" | "none"
|
|
241
242
|
color_scheme: Overrides the accent color inherited from the Theme.
|
|
242
243
|
high_contrast: Whether to render the text with higher contrast color
|
|
243
244
|
is_external: If True, the link will open in a new tab
|