reflex 0.5.0__py3-none-any.whl → 0.5.0a1__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/demo/code/demo.py +1 -1
- reflex/.templates/jinja/web/tailwind.config.js.jinja2 +0 -12
- reflex/components/component.py +5 -1
- reflex/components/core/foreach.py +33 -59
- reflex/components/radix/primitives/accordion.py +94 -128
- reflex/components/radix/primitives/accordion.pyi +12 -25
- reflex/components/radix/primitives/form.py +1 -1
- reflex/components/radix/themes/color_mode.py +1 -25
- reflex/components/radix/themes/color_mode.pyi +1 -178
- reflex/custom_components/custom_components.py +1 -2
- reflex/style.py +2 -5
- {reflex-0.5.0.dist-info → reflex-0.5.0a1.dist-info}/METADATA +1 -1
- {reflex-0.5.0.dist-info → reflex-0.5.0a1.dist-info}/RECORD +16 -16
- {reflex-0.5.0.dist-info → reflex-0.5.0a1.dist-info}/LICENSE +0 -0
- {reflex-0.5.0.dist-info → reflex-0.5.0a1.dist-info}/WHEEL +0 -0
- {reflex-0.5.0.dist-info → reflex-0.5.0a1.dist-info}/entry_points.txt +0 -0
|
@@ -44,7 +44,7 @@ def template(main_content: Callable[[], rx.Component]) -> rx.Component:
|
|
|
44
44
|
),
|
|
45
45
|
rx.chakra.menu_item(
|
|
46
46
|
rx.chakra.link(
|
|
47
|
-
"Contact", href="mailto:founders
|
|
47
|
+
"Contact", href="mailto:founders@=reflex.dev", width="100%"
|
|
48
48
|
)
|
|
49
49
|
),
|
|
50
50
|
),
|
|
@@ -17,16 +17,4 @@ module.exports = {
|
|
|
17
17
|
{% if darkMode is defined %}
|
|
18
18
|
darkMode: {{darkMode|json_dumps}},
|
|
19
19
|
{% endif %}
|
|
20
|
-
{% if corePlugins is defined %}
|
|
21
|
-
corePlugins: {{corePlugins|json_dumps}},
|
|
22
|
-
{% endif %}
|
|
23
|
-
{% if important is defined %}
|
|
24
|
-
important: {{important|json_dumps}},
|
|
25
|
-
{% endif %}
|
|
26
|
-
{% if prefix is defined %}
|
|
27
|
-
prefix: {{prefix|json_dumps}},
|
|
28
|
-
{% endif %}
|
|
29
|
-
{% if separator is defined %}
|
|
30
|
-
separator: {{separator|json_dumps}},
|
|
31
|
-
{% endif %}
|
|
32
20
|
};
|
reflex/components/component.py
CHANGED
|
@@ -781,7 +781,7 @@ class Component(BaseComponent, ABC):
|
|
|
781
781
|
|
|
782
782
|
return cls(children=children, **props)
|
|
783
783
|
|
|
784
|
-
def add_style(self) ->
|
|
784
|
+
def add_style(self) -> Style | None:
|
|
785
785
|
"""Add style to the component.
|
|
786
786
|
|
|
787
787
|
Downstream components can override this method to return a style dict
|
|
@@ -801,16 +801,20 @@ class Component(BaseComponent, ABC):
|
|
|
801
801
|
The style to add.
|
|
802
802
|
"""
|
|
803
803
|
styles = []
|
|
804
|
+
vars = []
|
|
804
805
|
|
|
805
806
|
# Walk the MRO to call all `add_style` methods.
|
|
806
807
|
for base in self._iter_parent_classes_with_method("add_style"):
|
|
807
808
|
s = base.add_style(self) # type: ignore
|
|
808
809
|
if s is not None:
|
|
809
810
|
styles.append(s)
|
|
811
|
+
vars.append(s._var_data)
|
|
810
812
|
|
|
811
813
|
_style = Style()
|
|
812
814
|
for s in reversed(styles):
|
|
813
815
|
_style.update(s)
|
|
816
|
+
|
|
817
|
+
_style._var_data = VarData.merge(*vars)
|
|
814
818
|
return _style
|
|
815
819
|
|
|
816
820
|
def _get_component_style(self, styles: ComponentStyle) -> Style | None:
|
|
@@ -2,24 +2,16 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import inspect
|
|
5
|
+
from hashlib import md5
|
|
5
6
|
from typing import Any, Callable, Iterable
|
|
6
7
|
|
|
7
8
|
from reflex.components.base.fragment import Fragment
|
|
8
9
|
from reflex.components.component import Component
|
|
9
10
|
from reflex.components.tags import IterTag
|
|
10
11
|
from reflex.constants import MemoizationMode
|
|
11
|
-
from reflex.utils import console
|
|
12
12
|
from reflex.vars import Var
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class ForeachVarError(TypeError):
|
|
16
|
-
"""Raised when the iterable type is Any."""
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class ForeachRenderError(TypeError):
|
|
20
|
-
"""Raised when there is an error with the foreach render function."""
|
|
21
|
-
|
|
22
|
-
|
|
23
15
|
class Foreach(Component):
|
|
24
16
|
"""A component that takes in an iterable and a render function and renders a list of components."""
|
|
25
17
|
|
|
@@ -32,84 +24,56 @@ class Foreach(Component):
|
|
|
32
24
|
render_fn: Callable = Fragment.create
|
|
33
25
|
|
|
34
26
|
@classmethod
|
|
35
|
-
def create(
|
|
36
|
-
cls,
|
|
37
|
-
iterable: Var[Iterable] | Iterable,
|
|
38
|
-
render_fn: Callable,
|
|
39
|
-
**props,
|
|
40
|
-
) -> Foreach:
|
|
27
|
+
def create(cls, iterable: Var[Iterable], render_fn: Callable, **props) -> Foreach:
|
|
41
28
|
"""Create a foreach component.
|
|
42
29
|
|
|
43
30
|
Args:
|
|
44
31
|
iterable: The iterable to create components from.
|
|
45
32
|
render_fn: A function from the render args to the component.
|
|
46
|
-
**props: The attributes to pass to each child component
|
|
33
|
+
**props: The attributes to pass to each child component.
|
|
47
34
|
|
|
48
35
|
Returns:
|
|
49
36
|
The foreach component.
|
|
50
37
|
|
|
51
38
|
Raises:
|
|
52
|
-
|
|
39
|
+
TypeError: If the iterable is of type Any.
|
|
53
40
|
"""
|
|
54
|
-
|
|
55
|
-
console.deprecate(
|
|
56
|
-
feature_name="Passing props to rx.foreach",
|
|
57
|
-
reason="it does not have the intended effect and may be confusing",
|
|
58
|
-
deprecation_version="0.5.0",
|
|
59
|
-
removal_version="0.6.0",
|
|
60
|
-
)
|
|
61
|
-
iterable = Var.create_safe(iterable)
|
|
41
|
+
iterable = Var.create(iterable) # type: ignore
|
|
62
42
|
if iterable._var_type == Any:
|
|
63
|
-
raise
|
|
64
|
-
f"Could not foreach over var
|
|
65
|
-
"(If you are trying to foreach over a state var, add a type annotation to the var). "
|
|
66
|
-
"See https://reflex.dev/docs/library/layout/foreach/"
|
|
43
|
+
raise TypeError(
|
|
44
|
+
f"Could not foreach over var of type Any. (If you are trying to foreach over a state var, add a type annotation to the var.)"
|
|
67
45
|
)
|
|
68
46
|
component = cls(
|
|
69
47
|
iterable=iterable,
|
|
70
48
|
render_fn=render_fn,
|
|
49
|
+
**props,
|
|
71
50
|
)
|
|
72
|
-
# Keep a ref to a rendered component to determine correct imports
|
|
73
|
-
component.children = [
|
|
51
|
+
# Keep a ref to a rendered component to determine correct imports.
|
|
52
|
+
component.children = [
|
|
53
|
+
component._render(props=dict(index_var_name="i")).render_component()
|
|
54
|
+
]
|
|
74
55
|
return component
|
|
75
56
|
|
|
76
|
-
def _render(self) -> IterTag:
|
|
77
|
-
props = {}
|
|
57
|
+
def _render(self, props: dict[str, Any] | None = None) -> IterTag:
|
|
58
|
+
props = {} if props is None else props.copy()
|
|
78
59
|
|
|
60
|
+
# Determine the arg var name based on the params accepted by render_fn.
|
|
79
61
|
render_sig = inspect.signature(self.render_fn)
|
|
80
62
|
params = list(render_sig.parameters.values())
|
|
81
|
-
|
|
82
|
-
# Validate the render function signature.
|
|
83
|
-
if len(params) == 0 or len(params) > 2:
|
|
84
|
-
raise ForeachRenderError(
|
|
85
|
-
"Expected 1 or 2 parameters in foreach render function, got "
|
|
86
|
-
f"{[p.name for p in params]}. See https://reflex.dev/docs/library/layout/foreach/"
|
|
87
|
-
)
|
|
88
|
-
|
|
89
63
|
if len(params) >= 1:
|
|
90
|
-
|
|
91
|
-
props["arg_var_name"] = params[0].name
|
|
64
|
+
props.setdefault("arg_var_name", params[0].name)
|
|
92
65
|
|
|
93
|
-
if len(params)
|
|
66
|
+
if len(params) >= 2:
|
|
94
67
|
# Determine the index var name based on the params accepted by render_fn.
|
|
95
|
-
props
|
|
96
|
-
|
|
97
|
-
# Otherwise, use a deterministic index, based on the
|
|
98
|
-
code_hash = (
|
|
99
|
-
|
|
100
|
-
.to_bytes(
|
|
101
|
-
length=8,
|
|
102
|
-
byteorder="big",
|
|
103
|
-
signed=True,
|
|
104
|
-
)
|
|
105
|
-
.hex()
|
|
106
|
-
)
|
|
107
|
-
props["index_var_name"] = f"index_{code_hash}"
|
|
68
|
+
props.setdefault("index_var_name", params[1].name)
|
|
69
|
+
elif "index_var_name" not in props:
|
|
70
|
+
# Otherwise, use a deterministic index, based on the rendered code.
|
|
71
|
+
code_hash = md5(str(self.children[0].render()).encode("utf-8")).hexdigest()
|
|
72
|
+
props.setdefault("index_var_name", f"index_{code_hash}")
|
|
108
73
|
|
|
109
74
|
return IterTag(
|
|
110
75
|
iterable=self.iterable,
|
|
111
76
|
render_fn=self.render_fn,
|
|
112
|
-
children=self.children,
|
|
113
77
|
**props,
|
|
114
78
|
)
|
|
115
79
|
|
|
@@ -120,9 +84,19 @@ class Foreach(Component):
|
|
|
120
84
|
The dictionary for template of component.
|
|
121
85
|
"""
|
|
122
86
|
tag = self._render()
|
|
87
|
+
component = tag.render_component()
|
|
123
88
|
|
|
124
89
|
return dict(
|
|
125
|
-
tag
|
|
90
|
+
tag.add_props(
|
|
91
|
+
**self.event_triggers,
|
|
92
|
+
key=self.key,
|
|
93
|
+
sx=self.style,
|
|
94
|
+
id=self.id,
|
|
95
|
+
class_name=self.class_name,
|
|
96
|
+
).set(
|
|
97
|
+
children=[component.render()],
|
|
98
|
+
props=tag.format_props(),
|
|
99
|
+
),
|
|
126
100
|
iterable_state=tag.iterable._var_full_name,
|
|
127
101
|
arg_name=tag.arg_var_name,
|
|
128
102
|
arg_index=tag.get_index_var_arg(),
|
|
@@ -6,10 +6,9 @@ from typing import Any, Dict, List, Literal, Optional, Union
|
|
|
6
6
|
|
|
7
7
|
from reflex.components.component import Component, ComponentNamespace
|
|
8
8
|
from reflex.components.core.colors import color
|
|
9
|
-
from reflex.components.core.cond import cond
|
|
10
9
|
from reflex.components.lucide.icon import Icon
|
|
11
10
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
|
12
|
-
from reflex.components.radix.themes.base import LiteralAccentColor
|
|
11
|
+
from reflex.components.radix.themes.base import LiteralAccentColor
|
|
13
12
|
from reflex.style import Style
|
|
14
13
|
from reflex.utils import imports
|
|
15
14
|
from reflex.vars import Var, get_uuid_string_var
|
|
@@ -20,32 +19,6 @@ LiteralAccordionOrientation = Literal["vertical", "horizontal"]
|
|
|
20
19
|
LiteralAccordionVariant = Literal["classic", "soft", "surface", "outline", "ghost"]
|
|
21
20
|
|
|
22
21
|
DEFAULT_ANIMATION_DURATION = 250
|
|
23
|
-
DEFAULT_ANIMATION_EASING = "cubic-bezier(0.87, 0, 0.13, 1)"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def _inherited_variant_selector(
|
|
27
|
-
variant: Var[LiteralAccordionVariant] | LiteralAccordionVariant,
|
|
28
|
-
*selectors: str,
|
|
29
|
-
) -> str:
|
|
30
|
-
"""Create a multi CSS selector for targeting variant against the given selectors.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
variant: The variant to target.
|
|
34
|
-
selectors: The selectors to apply the variant to (default &)
|
|
35
|
-
|
|
36
|
-
Returns:
|
|
37
|
-
A CSS selector that is more specific on elements that directly set the variant.
|
|
38
|
-
"""
|
|
39
|
-
if not selectors:
|
|
40
|
-
selectors = ("&",)
|
|
41
|
-
# Prefer the `data-variant` that is set directly on the selector,
|
|
42
|
-
# but also inherit the `data-variant` from any parent element.
|
|
43
|
-
return ", ".join(
|
|
44
|
-
[
|
|
45
|
-
f"{selector}[data-variant='{variant}'], *:where([data-variant='{variant}']) {selector}"
|
|
46
|
-
for selector in selectors
|
|
47
|
-
]
|
|
48
|
-
)
|
|
49
22
|
|
|
50
23
|
|
|
51
24
|
class AccordionComponent(RadixPrimitiveComponent):
|
|
@@ -57,14 +30,14 @@ class AccordionComponent(RadixPrimitiveComponent):
|
|
|
57
30
|
color_scheme: Var[LiteralAccentColor]
|
|
58
31
|
|
|
59
32
|
# The variant of the component.
|
|
60
|
-
variant: Var[LiteralAccordionVariant]
|
|
33
|
+
variant: Var[LiteralAccordionVariant] = Var.create_safe("classic")
|
|
61
34
|
|
|
62
35
|
def add_style(self) -> Style | None:
|
|
63
36
|
"""Add style to the component."""
|
|
64
37
|
if self.color_scheme is not None:
|
|
65
38
|
self.custom_attrs["data-accent-color"] = self.color_scheme
|
|
66
|
-
|
|
67
|
-
|
|
39
|
+
|
|
40
|
+
self.custom_attrs["data-variant"] = self.variant
|
|
68
41
|
|
|
69
42
|
def _exclude_props(self) -> list[str]:
|
|
70
43
|
return ["color_scheme", "variant"]
|
|
@@ -98,27 +71,28 @@ class AccordionRoot(AccordionComponent):
|
|
|
98
71
|
# The orientation of the accordion.
|
|
99
72
|
orientation: Var[LiteralAccordionOrientation]
|
|
100
73
|
|
|
101
|
-
# The
|
|
102
|
-
|
|
74
|
+
# The variant of the accordion.
|
|
75
|
+
variant: Var[LiteralAccordionVariant] = Var.create_safe("classic")
|
|
103
76
|
|
|
104
|
-
|
|
105
|
-
duration: Var[int] = Var.create_safe(DEFAULT_ANIMATION_DURATION)
|
|
77
|
+
_valid_children: List[str] = ["AccordionItem"]
|
|
106
78
|
|
|
107
|
-
|
|
108
|
-
|
|
79
|
+
@classmethod
|
|
80
|
+
def create(cls, *children, **props) -> Component:
|
|
81
|
+
"""Create the Accordion root component.
|
|
109
82
|
|
|
110
|
-
|
|
111
|
-
|
|
83
|
+
Args:
|
|
84
|
+
*children: The children of the component.
|
|
85
|
+
**props: The properties of the component.
|
|
112
86
|
|
|
113
|
-
|
|
87
|
+
Returns:
|
|
88
|
+
The Accordion root Component.
|
|
89
|
+
"""
|
|
90
|
+
for child in children:
|
|
91
|
+
if isinstance(child, AccordionItem):
|
|
92
|
+
child.color_scheme = props.get("color_scheme") # type: ignore
|
|
93
|
+
child.variant = props.get("variant") # type: ignore
|
|
114
94
|
|
|
115
|
-
|
|
116
|
-
return super()._exclude_props() + [
|
|
117
|
-
"radius",
|
|
118
|
-
"duration",
|
|
119
|
-
"easing",
|
|
120
|
-
"show_dividers",
|
|
121
|
-
]
|
|
95
|
+
return super().create(*children, **props)
|
|
122
96
|
|
|
123
97
|
def get_event_triggers(self) -> Dict[str, Any]:
|
|
124
98
|
"""Get the events triggers signatures for the component.
|
|
@@ -137,42 +111,30 @@ class AccordionRoot(AccordionComponent):
|
|
|
137
111
|
Returns:
|
|
138
112
|
The style of the component.
|
|
139
113
|
"""
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
"background_color": "none",
|
|
165
|
-
"box_shadow": "None",
|
|
166
|
-
},
|
|
167
|
-
"--animation-duration": f"{self.duration}ms",
|
|
168
|
-
"--animation-easing": self.easing,
|
|
169
|
-
}
|
|
170
|
-
if self.show_dividers is not None:
|
|
171
|
-
style["--divider-px"] = cond(self.show_dividers, "1px", "0")
|
|
172
|
-
else:
|
|
173
|
-
style["&[data-variant='outline']"]["--divider-px"] = "1px"
|
|
174
|
-
style["&[data-variant='surface']"]["--divider-px"] = "1px"
|
|
175
|
-
return Style(style)
|
|
114
|
+
return Style(
|
|
115
|
+
{
|
|
116
|
+
"border_radius": "6px",
|
|
117
|
+
"box_shadow": f"0 2px 10px {color('black', 1, alpha=True)}",
|
|
118
|
+
"&[data-variant='classic']": {
|
|
119
|
+
"background_color": color("accent", 9),
|
|
120
|
+
"box_shadow": f"0 2px 10px {color('black', 4, alpha=True)}",
|
|
121
|
+
},
|
|
122
|
+
"&[data-variant='soft']": {
|
|
123
|
+
"background_color": color("accent", 3),
|
|
124
|
+
},
|
|
125
|
+
"&[data-variant='outline']": {
|
|
126
|
+
"border": f"1px solid {color('accent', 6)}",
|
|
127
|
+
},
|
|
128
|
+
"&[data-variant='surface']": {
|
|
129
|
+
"border": f"1px solid {color('accent', 6)}",
|
|
130
|
+
"background_color": color("accent", 3),
|
|
131
|
+
},
|
|
132
|
+
"&[data-variant='ghost']": {
|
|
133
|
+
"background_color": "none",
|
|
134
|
+
"box_shadow": "None",
|
|
135
|
+
},
|
|
136
|
+
}
|
|
137
|
+
)
|
|
176
138
|
|
|
177
139
|
|
|
178
140
|
class AccordionItem(AccordionComponent):
|
|
@@ -223,28 +185,23 @@ class AccordionItem(AccordionComponent):
|
|
|
223
185
|
):
|
|
224
186
|
cls_name = f"{cls_name} AccordionItem"
|
|
225
187
|
|
|
226
|
-
color_scheme = props.get("color_scheme")
|
|
227
|
-
variant = props.get("variant")
|
|
228
|
-
|
|
229
188
|
if (header is not None) and (content is not None):
|
|
230
189
|
children = [
|
|
231
190
|
AccordionHeader.create(
|
|
232
191
|
AccordionTrigger.create(
|
|
233
192
|
header,
|
|
234
193
|
AccordionIcon.create(
|
|
235
|
-
color_scheme=color_scheme,
|
|
236
|
-
variant=variant,
|
|
194
|
+
color_scheme=props.get("color_scheme"),
|
|
195
|
+
variant=props.get("variant"),
|
|
237
196
|
),
|
|
238
|
-
color_scheme=color_scheme,
|
|
239
|
-
variant=variant,
|
|
197
|
+
color_scheme=props.get("color_scheme"),
|
|
198
|
+
variant=props.get("variant"),
|
|
240
199
|
),
|
|
241
|
-
color_scheme=color_scheme,
|
|
242
|
-
variant=variant,
|
|
200
|
+
color_scheme=props.get("color_scheme"),
|
|
201
|
+
variant=props.get("variant"),
|
|
243
202
|
),
|
|
244
203
|
AccordionContent.create(
|
|
245
|
-
content,
|
|
246
|
-
color_scheme=color_scheme,
|
|
247
|
-
variant=variant,
|
|
204
|
+
content, color_scheme=props.get("color_scheme")
|
|
248
205
|
),
|
|
249
206
|
]
|
|
250
207
|
|
|
@@ -256,35 +213,29 @@ class AccordionItem(AccordionComponent):
|
|
|
256
213
|
Returns:
|
|
257
214
|
The style of the component.
|
|
258
215
|
"""
|
|
259
|
-
|
|
216
|
+
for child in self.children:
|
|
217
|
+
if isinstance(child, (AccordionHeader, AccordionContent)):
|
|
218
|
+
child.color_scheme = self.color_scheme
|
|
219
|
+
child.variant = self.variant
|
|
220
|
+
|
|
260
221
|
return Style(
|
|
261
222
|
{
|
|
262
223
|
"overflow": "hidden",
|
|
263
224
|
"width": "100%",
|
|
264
225
|
"margin_top": "1px",
|
|
265
|
-
"border_top": divider_style,
|
|
266
226
|
"&:first-child": {
|
|
267
227
|
"margin_top": 0,
|
|
268
|
-
"
|
|
269
|
-
"
|
|
270
|
-
"border_top_right_radius": "var(--radius-4)",
|
|
228
|
+
"border_top_left_radius": "4px",
|
|
229
|
+
"border_top_right_radius": "4px",
|
|
271
230
|
},
|
|
272
231
|
"&:last-child": {
|
|
273
|
-
"border_bottom_left_radius": "
|
|
274
|
-
"border_bottom_right_radius": "
|
|
232
|
+
"border_bottom_left_radius": "4px",
|
|
233
|
+
"border_bottom_right_radius": "4px",
|
|
275
234
|
},
|
|
276
235
|
"&:focus-within": {
|
|
277
236
|
"position": "relative",
|
|
278
237
|
"z_index": 1,
|
|
279
238
|
},
|
|
280
|
-
_inherited_variant_selector("ghost", "&:first-child"): {
|
|
281
|
-
"border_radius": 0,
|
|
282
|
-
"border_top": divider_style,
|
|
283
|
-
},
|
|
284
|
-
_inherited_variant_selector("ghost", "&:last-child"): {
|
|
285
|
-
"border_radius": 0,
|
|
286
|
-
"border_bottom": divider_style,
|
|
287
|
-
},
|
|
288
239
|
}
|
|
289
240
|
)
|
|
290
241
|
|
|
@@ -320,9 +271,17 @@ class AccordionHeader(AccordionComponent):
|
|
|
320
271
|
Returns:
|
|
321
272
|
The style of the component.
|
|
322
273
|
"""
|
|
274
|
+
for child in self.children:
|
|
275
|
+
if isinstance(child, AccordionTrigger):
|
|
276
|
+
child.color_scheme = self.color_scheme
|
|
277
|
+
child.variant = self.variant
|
|
278
|
+
|
|
323
279
|
return Style({"display": "flex"})
|
|
324
280
|
|
|
325
281
|
|
|
282
|
+
cubic_bezier = "cubic-bezier(0.87, 0, 0.13, 1)"
|
|
283
|
+
|
|
284
|
+
|
|
326
285
|
class AccordionTrigger(AccordionComponent):
|
|
327
286
|
"""An accordion component."""
|
|
328
287
|
|
|
@@ -354,18 +313,24 @@ class AccordionTrigger(AccordionComponent):
|
|
|
354
313
|
Returns:
|
|
355
314
|
The style of the component.
|
|
356
315
|
"""
|
|
316
|
+
for child in self.children:
|
|
317
|
+
if isinstance(child, AccordionIcon):
|
|
318
|
+
child.color_scheme = self.color_scheme
|
|
319
|
+
child.variant = self.variant
|
|
320
|
+
|
|
357
321
|
return Style(
|
|
358
322
|
{
|
|
359
323
|
"color": color("accent", 11),
|
|
360
|
-
"font_size": "1.1em",
|
|
361
324
|
"line_height": 1,
|
|
325
|
+
"font_size": "15px",
|
|
362
326
|
"justify_content": "space-between",
|
|
363
327
|
"align_items": "center",
|
|
364
328
|
"flex": 1,
|
|
365
329
|
"display": "flex",
|
|
366
|
-
"padding": "
|
|
330
|
+
"padding": "0 20px",
|
|
331
|
+
"height": "45px",
|
|
332
|
+
"font_family": "inherit",
|
|
367
333
|
"width": "100%",
|
|
368
|
-
"box_shadow": f"0 var(--divider-px) 0 {color('gray', 6, alpha=True)}",
|
|
369
334
|
"&[data-state='open'] > .AccordionChevron": {
|
|
370
335
|
"transform": "rotate(180deg)",
|
|
371
336
|
},
|
|
@@ -373,15 +338,17 @@ class AccordionTrigger(AccordionComponent):
|
|
|
373
338
|
"background_color": color("accent", 4),
|
|
374
339
|
},
|
|
375
340
|
"& > .AccordionChevron": {
|
|
376
|
-
"transition": f"transform
|
|
341
|
+
"transition": f"transform {DEFAULT_ANIMATION_DURATION}ms {cubic_bezier}",
|
|
377
342
|
},
|
|
378
|
-
|
|
379
|
-
"color": "
|
|
343
|
+
"&[data-variant='classic']": {
|
|
344
|
+
"color": color("accent", 12),
|
|
345
|
+
"box_shadow": color("accent", 11),
|
|
380
346
|
"&:hover": {
|
|
381
347
|
"background_color": color("accent", 10),
|
|
382
348
|
},
|
|
383
349
|
"& > .AccordionChevron": {
|
|
384
|
-
"color": "
|
|
350
|
+
"color": color("accent", 12),
|
|
351
|
+
"transition": f"transform {DEFAULT_ANIMATION_DURATION}ms {cubic_bezier}",
|
|
385
352
|
},
|
|
386
353
|
},
|
|
387
354
|
}
|
|
@@ -477,31 +444,30 @@ to {
|
|
|
477
444
|
The style of the component.
|
|
478
445
|
"""
|
|
479
446
|
slideDown = Var.create(
|
|
480
|
-
f"${{slideDown}}
|
|
447
|
+
f"${{slideDown}} {DEFAULT_ANIMATION_DURATION}ms {cubic_bezier}",
|
|
481
448
|
_var_is_string=True,
|
|
482
449
|
)
|
|
483
450
|
|
|
484
451
|
slideUp = Var.create(
|
|
485
|
-
f"${{slideUp}}
|
|
452
|
+
f"${{slideUp}} {DEFAULT_ANIMATION_DURATION}ms {cubic_bezier}",
|
|
486
453
|
_var_is_string=True,
|
|
487
454
|
)
|
|
488
455
|
|
|
489
456
|
return Style(
|
|
490
457
|
{
|
|
491
458
|
"overflow": "hidden",
|
|
459
|
+
"font_size": "10px",
|
|
492
460
|
"color": color("accent", 11),
|
|
493
|
-
"
|
|
494
|
-
|
|
495
|
-
"&:before, &:after": {
|
|
496
|
-
"content": "' '",
|
|
497
|
-
"display": "block",
|
|
498
|
-
"height": "var(--space-3)",
|
|
499
|
-
},
|
|
461
|
+
"background_color": color("accent", 3),
|
|
462
|
+
"padding": "0 15px",
|
|
500
463
|
"&[data-state='open']": {"animation": slideDown},
|
|
501
464
|
"&[data-state='closed']": {"animation": slideUp},
|
|
502
|
-
|
|
503
|
-
"color": "
|
|
465
|
+
"&[data-variant='classic']": {
|
|
466
|
+
"color": color("accent", 12),
|
|
467
|
+
"background_color": color("accent", 9),
|
|
504
468
|
},
|
|
469
|
+
"&[data-variant='outline']": {"background_color": "transparent"},
|
|
470
|
+
"&[data-variant='ghost']": {"background_color": "transparent"},
|
|
505
471
|
}
|
|
506
472
|
)
|
|
507
473
|
|
|
@@ -10,10 +10,9 @@ from reflex.style import Style
|
|
|
10
10
|
from typing import Any, Dict, List, Literal, Optional, Union
|
|
11
11
|
from reflex.components.component import Component, ComponentNamespace
|
|
12
12
|
from reflex.components.core.colors import color
|
|
13
|
-
from reflex.components.core.cond import cond
|
|
14
13
|
from reflex.components.lucide.icon import Icon
|
|
15
14
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
|
16
|
-
from reflex.components.radix.themes.base import LiteralAccentColor
|
|
15
|
+
from reflex.components.radix.themes.base import LiteralAccentColor
|
|
17
16
|
from reflex.style import Style
|
|
18
17
|
from reflex.utils import imports
|
|
19
18
|
from reflex.vars import Var, get_uuid_string_var
|
|
@@ -23,7 +22,6 @@ LiteralAccordionDir = Literal["ltr", "rtl"]
|
|
|
23
22
|
LiteralAccordionOrientation = Literal["vertical", "horizontal"]
|
|
24
23
|
LiteralAccordionVariant = Literal["classic", "soft", "surface", "outline", "ghost"]
|
|
25
24
|
DEFAULT_ANIMATION_DURATION = 250
|
|
26
|
-
DEFAULT_ANIMATION_EASING = "cubic-bezier(0.87, 0, 0.13, 1)"
|
|
27
25
|
|
|
28
26
|
class AccordionComponent(RadixPrimitiveComponent):
|
|
29
27
|
def add_style(self) -> Style | None: ...
|
|
@@ -175,8 +173,6 @@ class AccordionComponent(RadixPrimitiveComponent):
|
|
|
175
173
|
...
|
|
176
174
|
|
|
177
175
|
class AccordionRoot(AccordionComponent):
|
|
178
|
-
def get_event_triggers(self) -> Dict[str, Any]: ...
|
|
179
|
-
def add_style(self): ...
|
|
180
176
|
@overload
|
|
181
177
|
@classmethod
|
|
182
178
|
def create( # type: ignore
|
|
@@ -200,15 +196,12 @@ class AccordionRoot(AccordionComponent):
|
|
|
200
196
|
Literal["vertical", "horizontal"],
|
|
201
197
|
]
|
|
202
198
|
] = None,
|
|
203
|
-
|
|
199
|
+
variant: Optional[
|
|
204
200
|
Union[
|
|
205
|
-
Var[Literal["
|
|
206
|
-
Literal["
|
|
201
|
+
Var[Literal["classic", "soft", "surface", "outline", "ghost"]],
|
|
202
|
+
Literal["classic", "soft", "surface", "outline", "ghost"],
|
|
207
203
|
]
|
|
208
204
|
] = None,
|
|
209
|
-
duration: Optional[Union[Var[int], int]] = None,
|
|
210
|
-
easing: Optional[Union[Var[str], str]] = None,
|
|
211
|
-
show_dividers: Optional[Union[Var[bool], bool]] = None,
|
|
212
205
|
color_scheme: Optional[
|
|
213
206
|
Union[
|
|
214
207
|
Var[
|
|
@@ -271,12 +264,6 @@ class AccordionRoot(AccordionComponent):
|
|
|
271
264
|
],
|
|
272
265
|
]
|
|
273
266
|
] = None,
|
|
274
|
-
variant: Optional[
|
|
275
|
-
Union[
|
|
276
|
-
Var[Literal["classic", "soft", "surface", "outline", "ghost"]],
|
|
277
|
-
Literal["classic", "soft", "surface", "outline", "ghost"],
|
|
278
|
-
]
|
|
279
|
-
] = None,
|
|
280
267
|
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
281
268
|
style: Optional[Style] = None,
|
|
282
269
|
key: Optional[Any] = None,
|
|
@@ -334,7 +321,7 @@ class AccordionRoot(AccordionComponent):
|
|
|
334
321
|
] = None,
|
|
335
322
|
**props
|
|
336
323
|
) -> "AccordionRoot":
|
|
337
|
-
"""Create the component.
|
|
324
|
+
"""Create the Accordion root component.
|
|
338
325
|
|
|
339
326
|
Args:
|
|
340
327
|
*children: The children of the component.
|
|
@@ -345,12 +332,8 @@ class AccordionRoot(AccordionComponent):
|
|
|
345
332
|
disabled: Whether or not the accordion is disabled.
|
|
346
333
|
dir: The reading direction of the accordion when applicable.
|
|
347
334
|
orientation: The orientation of the accordion.
|
|
348
|
-
radius: The radius of the accordion corners.
|
|
349
|
-
duration: The time in milliseconds to animate open and close
|
|
350
|
-
easing: The easing function to use for the animation.
|
|
351
|
-
show_dividers: Whether to show divider lines between items.
|
|
352
|
-
color_scheme: The color scheme of the component.
|
|
353
335
|
variant: The variant of the component.
|
|
336
|
+
color_scheme: The color scheme of the component.
|
|
354
337
|
as_child: Change the default rendered element for the one passed as a child.
|
|
355
338
|
style: The style of the component.
|
|
356
339
|
key: A unique key for the component.
|
|
@@ -358,12 +341,14 @@ class AccordionRoot(AccordionComponent):
|
|
|
358
341
|
class_name: The class name for the component.
|
|
359
342
|
autofocus: Whether the component should take the focus once the page is loaded
|
|
360
343
|
custom_attrs: custom attribute
|
|
361
|
-
**props: The
|
|
344
|
+
**props: The properties of the component.
|
|
362
345
|
|
|
363
346
|
Returns:
|
|
364
|
-
The
|
|
347
|
+
The Accordion root Component.
|
|
365
348
|
"""
|
|
366
349
|
...
|
|
350
|
+
def get_event_triggers(self) -> Dict[str, Any]: ...
|
|
351
|
+
def add_style(self): ...
|
|
367
352
|
|
|
368
353
|
class AccordionItem(AccordionComponent):
|
|
369
354
|
@overload
|
|
@@ -671,6 +656,8 @@ class AccordionHeader(AccordionComponent):
|
|
|
671
656
|
...
|
|
672
657
|
def add_style(self) -> Style | None: ...
|
|
673
658
|
|
|
659
|
+
cubic_bezier = "cubic-bezier(0.87, 0, 0.13, 1)"
|
|
660
|
+
|
|
674
661
|
class AccordionTrigger(AccordionComponent):
|
|
675
662
|
@overload
|
|
676
663
|
@classmethod
|
|
@@ -23,8 +23,7 @@ from typing import Literal, get_args
|
|
|
23
23
|
from reflex.components.component import BaseComponent
|
|
24
24
|
from reflex.components.core.cond import Cond, color_mode_cond, cond
|
|
25
25
|
from reflex.components.lucide.icon import Icon
|
|
26
|
-
from reflex.
|
|
27
|
-
from reflex.style import LIGHT_COLOR_MODE, color_mode, toggle_color_mode
|
|
26
|
+
from reflex.style import color_mode, toggle_color_mode
|
|
28
27
|
from reflex.utils import console
|
|
29
28
|
from reflex.vars import BaseVar, Var
|
|
30
29
|
|
|
@@ -144,34 +143,11 @@ class ColorModeIconButton(IconButton):
|
|
|
144
143
|
)
|
|
145
144
|
|
|
146
145
|
|
|
147
|
-
class ColorModeSwitch(Switch):
|
|
148
|
-
"""Switch for toggling light / dark mode via toggle_color_mode."""
|
|
149
|
-
|
|
150
|
-
@classmethod
|
|
151
|
-
def create(cls, *children, **props):
|
|
152
|
-
"""Create a switch component bound to color_mode.
|
|
153
|
-
|
|
154
|
-
Args:
|
|
155
|
-
*children: The children of the component.
|
|
156
|
-
**props: The props to pass to the component.
|
|
157
|
-
|
|
158
|
-
Returns:
|
|
159
|
-
The switch component.
|
|
160
|
-
"""
|
|
161
|
-
return Switch.create(
|
|
162
|
-
*children,
|
|
163
|
-
checked=color_mode != LIGHT_COLOR_MODE,
|
|
164
|
-
on_change=toggle_color_mode,
|
|
165
|
-
**props,
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
|
|
169
146
|
class ColorModeNamespace(BaseVar):
|
|
170
147
|
"""Namespace for color mode components."""
|
|
171
148
|
|
|
172
149
|
icon = staticmethod(ColorModeIcon.create)
|
|
173
150
|
button = staticmethod(ColorModeIconButton.create)
|
|
174
|
-
switch = staticmethod(ColorModeSwitch.create)
|
|
175
151
|
|
|
176
152
|
|
|
177
153
|
color_mode_var_and_namespace = ColorModeNamespace(**dataclasses.asdict(color_mode))
|
|
@@ -12,8 +12,7 @@ from typing import Literal, get_args
|
|
|
12
12
|
from reflex.components.component import BaseComponent
|
|
13
13
|
from reflex.components.core.cond import Cond, color_mode_cond, cond
|
|
14
14
|
from reflex.components.lucide.icon import Icon
|
|
15
|
-
from reflex.
|
|
16
|
-
from reflex.style import LIGHT_COLOR_MODE, color_mode, toggle_color_mode
|
|
15
|
+
from reflex.style import color_mode, toggle_color_mode
|
|
17
16
|
from reflex.utils import console
|
|
18
17
|
from reflex.vars import BaseVar, Var
|
|
19
18
|
from .components.icon_button import IconButton
|
|
@@ -363,184 +362,8 @@ class ColorModeIconButton(IconButton):
|
|
|
363
362
|
"""
|
|
364
363
|
...
|
|
365
364
|
|
|
366
|
-
class ColorModeSwitch(Switch):
|
|
367
|
-
@overload
|
|
368
|
-
@classmethod
|
|
369
|
-
def create( # type: ignore
|
|
370
|
-
cls,
|
|
371
|
-
*children,
|
|
372
|
-
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
373
|
-
default_checked: Optional[Union[Var[bool], bool]] = None,
|
|
374
|
-
checked: Optional[Union[Var[bool], bool]] = None,
|
|
375
|
-
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
376
|
-
required: Optional[Union[Var[bool], bool]] = None,
|
|
377
|
-
name: Optional[Union[Var[str], str]] = None,
|
|
378
|
-
value: Optional[Union[Var[str], str]] = None,
|
|
379
|
-
size: Optional[
|
|
380
|
-
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
|
381
|
-
] = None,
|
|
382
|
-
variant: Optional[
|
|
383
|
-
Union[
|
|
384
|
-
Var[Literal["classic", "surface", "soft"]],
|
|
385
|
-
Literal["classic", "surface", "soft"],
|
|
386
|
-
]
|
|
387
|
-
] = None,
|
|
388
|
-
color_scheme: Optional[
|
|
389
|
-
Union[
|
|
390
|
-
Var[
|
|
391
|
-
Literal[
|
|
392
|
-
"tomato",
|
|
393
|
-
"red",
|
|
394
|
-
"ruby",
|
|
395
|
-
"crimson",
|
|
396
|
-
"pink",
|
|
397
|
-
"plum",
|
|
398
|
-
"purple",
|
|
399
|
-
"violet",
|
|
400
|
-
"iris",
|
|
401
|
-
"indigo",
|
|
402
|
-
"blue",
|
|
403
|
-
"cyan",
|
|
404
|
-
"teal",
|
|
405
|
-
"jade",
|
|
406
|
-
"green",
|
|
407
|
-
"grass",
|
|
408
|
-
"brown",
|
|
409
|
-
"orange",
|
|
410
|
-
"sky",
|
|
411
|
-
"mint",
|
|
412
|
-
"lime",
|
|
413
|
-
"yellow",
|
|
414
|
-
"amber",
|
|
415
|
-
"gold",
|
|
416
|
-
"bronze",
|
|
417
|
-
"gray",
|
|
418
|
-
]
|
|
419
|
-
],
|
|
420
|
-
Literal[
|
|
421
|
-
"tomato",
|
|
422
|
-
"red",
|
|
423
|
-
"ruby",
|
|
424
|
-
"crimson",
|
|
425
|
-
"pink",
|
|
426
|
-
"plum",
|
|
427
|
-
"purple",
|
|
428
|
-
"violet",
|
|
429
|
-
"iris",
|
|
430
|
-
"indigo",
|
|
431
|
-
"blue",
|
|
432
|
-
"cyan",
|
|
433
|
-
"teal",
|
|
434
|
-
"jade",
|
|
435
|
-
"green",
|
|
436
|
-
"grass",
|
|
437
|
-
"brown",
|
|
438
|
-
"orange",
|
|
439
|
-
"sky",
|
|
440
|
-
"mint",
|
|
441
|
-
"lime",
|
|
442
|
-
"yellow",
|
|
443
|
-
"amber",
|
|
444
|
-
"gold",
|
|
445
|
-
"bronze",
|
|
446
|
-
"gray",
|
|
447
|
-
],
|
|
448
|
-
]
|
|
449
|
-
] = None,
|
|
450
|
-
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
451
|
-
radius: Optional[
|
|
452
|
-
Union[
|
|
453
|
-
Var[Literal["none", "small", "full"]], Literal["none", "small", "full"]
|
|
454
|
-
]
|
|
455
|
-
] = None,
|
|
456
|
-
style: Optional[Style] = None,
|
|
457
|
-
key: Optional[Any] = None,
|
|
458
|
-
id: Optional[Any] = None,
|
|
459
|
-
class_name: Optional[Any] = None,
|
|
460
|
-
autofocus: Optional[bool] = None,
|
|
461
|
-
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
462
|
-
on_blur: Optional[
|
|
463
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
464
|
-
] = None,
|
|
465
|
-
on_change: Optional[
|
|
466
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
467
|
-
] = None,
|
|
468
|
-
on_click: Optional[
|
|
469
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
470
|
-
] = None,
|
|
471
|
-
on_context_menu: Optional[
|
|
472
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
473
|
-
] = None,
|
|
474
|
-
on_double_click: Optional[
|
|
475
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
476
|
-
] = None,
|
|
477
|
-
on_focus: Optional[
|
|
478
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
479
|
-
] = None,
|
|
480
|
-
on_mount: Optional[
|
|
481
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
482
|
-
] = None,
|
|
483
|
-
on_mouse_down: Optional[
|
|
484
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
485
|
-
] = None,
|
|
486
|
-
on_mouse_enter: Optional[
|
|
487
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
488
|
-
] = None,
|
|
489
|
-
on_mouse_leave: Optional[
|
|
490
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
491
|
-
] = None,
|
|
492
|
-
on_mouse_move: Optional[
|
|
493
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
494
|
-
] = None,
|
|
495
|
-
on_mouse_out: Optional[
|
|
496
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
497
|
-
] = None,
|
|
498
|
-
on_mouse_over: Optional[
|
|
499
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
500
|
-
] = None,
|
|
501
|
-
on_mouse_up: Optional[
|
|
502
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
503
|
-
] = None,
|
|
504
|
-
on_scroll: Optional[
|
|
505
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
506
|
-
] = None,
|
|
507
|
-
on_unmount: Optional[
|
|
508
|
-
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
509
|
-
] = None,
|
|
510
|
-
**props
|
|
511
|
-
) -> "ColorModeSwitch":
|
|
512
|
-
"""Create a switch component bound to color_mode.
|
|
513
|
-
|
|
514
|
-
Args:
|
|
515
|
-
*children: The children of the component.
|
|
516
|
-
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
517
|
-
default_checked: Whether the switch is checked by default
|
|
518
|
-
checked: Whether the switch is checked
|
|
519
|
-
disabled: If true, prevent the user from interacting with the switch
|
|
520
|
-
required: If true, the user must interact with the switch to submit the form
|
|
521
|
-
name: The name of the switch (when submitting a form)
|
|
522
|
-
value: The value associated with the "on" position
|
|
523
|
-
size: Switch size "1" - "4"
|
|
524
|
-
variant: Variant of switch: "classic" | "surface" | "soft"
|
|
525
|
-
color_scheme: Override theme color for switch
|
|
526
|
-
high_contrast: Whether to render the switch with higher contrast color against background
|
|
527
|
-
radius: Override theme radius for switch: "none" | "small" | "full"
|
|
528
|
-
style: The style of the component.
|
|
529
|
-
key: A unique key for the component.
|
|
530
|
-
id: The id for the component.
|
|
531
|
-
class_name: The class name for the component.
|
|
532
|
-
autofocus: Whether the component should take the focus once the page is loaded
|
|
533
|
-
custom_attrs: custom attribute
|
|
534
|
-
**props: The props to pass to the component.
|
|
535
|
-
|
|
536
|
-
Returns:
|
|
537
|
-
The switch component.
|
|
538
|
-
"""
|
|
539
|
-
...
|
|
540
|
-
|
|
541
365
|
class ColorModeNamespace(BaseVar):
|
|
542
366
|
icon = staticmethod(ColorModeIcon.create)
|
|
543
367
|
button = staticmethod(ColorModeIconButton.create)
|
|
544
|
-
switch = staticmethod(ColorModeSwitch.create)
|
|
545
368
|
|
|
546
369
|
color_mode_var_and_namespace = ColorModeNamespace(**dataclasses.asdict(color_mode))
|
|
@@ -20,6 +20,7 @@ from reflex import constants
|
|
|
20
20
|
from reflex.config import get_config
|
|
21
21
|
from reflex.constants import CustomComponents
|
|
22
22
|
from reflex.utils import console
|
|
23
|
+
from reflex.utils.pyi_generator import PyiGenerator
|
|
23
24
|
|
|
24
25
|
config = get_config()
|
|
25
26
|
custom_components_cli = typer.Typer()
|
|
@@ -437,8 +438,6 @@ def _run_commands_in_subprocess(cmds: list[str]) -> bool:
|
|
|
437
438
|
|
|
438
439
|
def _make_pyi_files():
|
|
439
440
|
"""Create pyi files for the custom component."""
|
|
440
|
-
from reflex.utils.pyi_generator import PyiGenerator
|
|
441
|
-
|
|
442
441
|
package_name = _get_package_config()["project"]["name"]
|
|
443
442
|
|
|
444
443
|
for dir, _, _ in os.walk(f"./{package_name}"):
|
reflex/style.py
CHANGED
|
@@ -180,15 +180,12 @@ class Style(dict):
|
|
|
180
180
|
style_dict: The style dictionary.
|
|
181
181
|
kwargs: Other key value pairs to apply to the dict update.
|
|
182
182
|
"""
|
|
183
|
+
if kwargs:
|
|
184
|
+
style_dict = {**(style_dict or {}), **kwargs}
|
|
183
185
|
if not isinstance(style_dict, Style):
|
|
184
186
|
converted_dict = type(self)(style_dict)
|
|
185
187
|
else:
|
|
186
188
|
converted_dict = style_dict
|
|
187
|
-
if kwargs:
|
|
188
|
-
if converted_dict is None:
|
|
189
|
-
converted_dict = type(self)(kwargs)
|
|
190
|
-
else:
|
|
191
|
-
converted_dict.update(kwargs)
|
|
192
189
|
# Combine our VarData with that of any Vars in the style_dict that was passed.
|
|
193
190
|
self._var_data = VarData.merge(self._var_data, converted_dict._var_data)
|
|
194
191
|
super().update(converted_dict)
|
|
@@ -8,7 +8,7 @@ reflex/.templates/apps/demo/assets/icon.svg,sha256=3EnRAihBIXdNZIf5cuFystIyoV6en
|
|
|
8
8
|
reflex/.templates/apps/demo/assets/logo.svg,sha256=f_YiqcSiX3jtK3j43YmEZK6z9f-KPCXcZN6vU71wgeQ,5403
|
|
9
9
|
reflex/.templates/apps/demo/assets/paneleft.svg,sha256=yXj0tH-VpnQaEwriXmb9ar2HgeXcGU5W6d4buKDUkA4,807
|
|
10
10
|
reflex/.templates/apps/demo/code/__init__.py,sha256=kYpJ6_dYllTemD8RF6s_LH8zL10PuK4Zuogutt1oeAI,32
|
|
11
|
-
reflex/.templates/apps/demo/code/demo.py,sha256=
|
|
11
|
+
reflex/.templates/apps/demo/code/demo.py,sha256=G0JOEkz5NwHSk58jMPpBUbO0NzgtdMI230rt9Dd0Ses,2928
|
|
12
12
|
reflex/.templates/apps/demo/code/pages/__init__.py,sha256=iHhkpNuJcB_j9A54SSpIcbWAt89PpoLbNIWCs0Sk2ac,194
|
|
13
13
|
reflex/.templates/apps/demo/code/pages/chatapp.py,sha256=1LQt8idpMfryzvblpg2iaOwhcLIXhUO9yVrt0KmFWCg,706
|
|
14
14
|
reflex/.templates/apps/demo/code/pages/datatable.py,sha256=7h7uOdMs93YGHjcUPUqhqjz0c2ZFhD-1KulVuQa6_q4,10906
|
|
@@ -46,7 +46,7 @@ reflex/.templates/jinja/web/pages/stateful_component.js.jinja2,sha256=jl8HEaDdJb
|
|
|
46
46
|
reflex/.templates/jinja/web/pages/stateful_components.js.jinja2,sha256=BfHi7ckH9u5xOliKWxjgmnia6AJbNnII97SC-dt_KSU,101
|
|
47
47
|
reflex/.templates/jinja/web/pages/utils.js.jinja2,sha256=xi1ryZ2dqWM4pmB4p028hxRtsdP6T3ZR5a8OG_U1IAs,3883
|
|
48
48
|
reflex/.templates/jinja/web/styles/styles.css.jinja2,sha256=4-CvqGR8-nRzkuCOSp_PdqmhPEmOs_kOhskOlhLMEUg,141
|
|
49
|
-
reflex/.templates/jinja/web/tailwind.config.js.jinja2,sha256=
|
|
49
|
+
reflex/.templates/jinja/web/tailwind.config.js.jinja2,sha256=cblxOcM8DLKg9S8OgS-uxA4OfGer60GAWwBOxNXwqzo,436
|
|
50
50
|
reflex/.templates/jinja/web/utils/context.js.jinja2,sha256=Vl2pKWItPjYSSVvPGRZHM5Oi177ijl-RxUjxkyeMXwc,3790
|
|
51
51
|
reflex/.templates/jinja/web/utils/theme.js.jinja2,sha256=cdRQR4cx0OFHUY060k1AdsPpK7BNUV--NzsC9HdH4l8,37
|
|
52
52
|
reflex/.templates/web/.gitignore,sha256=3tT0CtVkCL09D_Y3Hd4myUgGcBuESeavCa0WHU5ifJ4,417
|
|
@@ -233,7 +233,7 @@ reflex/components/chakra/typography/span.py,sha256=2DbW5DB27ijtTeugSDUVp3nQ64mrG
|
|
|
233
233
|
reflex/components/chakra/typography/span.pyi,sha256=itDe7RpjJN_K_9pZ7n_U9qlrTshGejv9lh5plvh3DCU,3372
|
|
234
234
|
reflex/components/chakra/typography/text.py,sha256=9YXBdK5UYqgDam3ITeRSnd8bu9ht3zydt0pkmJAECsk,472
|
|
235
235
|
reflex/components/chakra/typography/text.pyi,sha256=FzqNtf0NUkGmRLrazSyfKHqznJjz_KCryU-2sRghZ0M,3596
|
|
236
|
-
reflex/components/component.py,sha256=
|
|
236
|
+
reflex/components/component.py,sha256=Lv1NmA-GPwT5IovV9Jj-OF250tag7hw7gnW7TvAxzmg,75843
|
|
237
237
|
reflex/components/core/__init__.py,sha256=EUhgNfO2NfQZ6HoeWJcF-INb4WpQecrYGKAUTLsg1R8,857
|
|
238
238
|
reflex/components/core/banner.py,sha256=DxYh4ORFIQlPPxvT-gudF0A8yj22oy6D_0IldTVHuZU,5943
|
|
239
239
|
reflex/components/core/banner.pyi,sha256=PPS1GJLp5uyD1h6mI0Fs-IKf9w4l7qG50rmkSA_HVno,17164
|
|
@@ -243,7 +243,7 @@ reflex/components/core/colors.py,sha256=-hzVGLEq3TiqroqzMi_YzGBCPXMvkNsen3pS_NzI
|
|
|
243
243
|
reflex/components/core/cond.py,sha256=bXip53gCUoZGLDgKgi6YFjJMIwPAos8Smb8SoOfzgCk,6005
|
|
244
244
|
reflex/components/core/debounce.py,sha256=VfK_QDzd7kriLYp5I3NsHujtXYJiciaNG2omYZIkEvM,4888
|
|
245
245
|
reflex/components/core/debounce.pyi,sha256=VGBX3hsRQo3xFP0xkYJuy25rDQ5rxRIk58mCV34fHSI,4216
|
|
246
|
-
reflex/components/core/foreach.py,sha256=
|
|
246
|
+
reflex/components/core/foreach.py,sha256=dUcL9OgmqR7zNEDcLVXL5mtwNquAE5KMOSsRcf1qnyk,3647
|
|
247
247
|
reflex/components/core/html.py,sha256=3TjZweaxqGnma5l9UIEzmE5bsl0VSS6ixn8xD_xu2W0,1284
|
|
248
248
|
reflex/components/core/html.pyi,sha256=6lqiYm9XUcRuR1kW6Ken8GAyf63-f5R5Swrli9B0eWg,6616
|
|
249
249
|
reflex/components/core/layout/__init__.py,sha256=znldZaj_NGt8qCZDG70GMwjMTskcvCf_2N_EjCAHwdc,30
|
|
@@ -314,13 +314,13 @@ reflex/components/plotly/plotly.py,sha256=GVExqrdSIfXngDFZATjjkomrwx97UM8F2W56rd
|
|
|
314
314
|
reflex/components/plotly/plotly.pyi,sha256=FrY0iQX7elz2ZWKW-DXdg8cz_v7bB7QqkZkpUZ1-oj8,6865
|
|
315
315
|
reflex/components/radix/__init__.py,sha256=5BGBr3z1_GcgCbNXUqAlK5AR13J7fxzFn4Wj-nTDNa4,112
|
|
316
316
|
reflex/components/radix/primitives/__init__.py,sha256=wkbCDG6q2MuZobhD6FeH9PgLXKZhb6cImguCV4n-aGs,214
|
|
317
|
-
reflex/components/radix/primitives/accordion.py,sha256=
|
|
318
|
-
reflex/components/radix/primitives/accordion.pyi,sha256=
|
|
317
|
+
reflex/components/radix/primitives/accordion.py,sha256=tXCXzoXr2E5IJhD2RizZN5d_t77ZrUDOx4f6IU5-Bus,14879
|
|
318
|
+
reflex/components/radix/primitives/accordion.pyi,sha256=14lO6IIRHXO66XChfvaoyfjo_gx00b786jf7nFD24no,37299
|
|
319
319
|
reflex/components/radix/primitives/base.py,sha256=s3OX4V2pNl6AQ3H9rz-pkE-2TNuNrqj0Mn2mOItF0eM,869
|
|
320
320
|
reflex/components/radix/primitives/base.pyi,sha256=_SqXWZfCB80_VHW-jO33WhoRunUpiUcUIxziG9Fb2fw,6478
|
|
321
321
|
reflex/components/radix/primitives/drawer.py,sha256=Y4XDgSECoKnOopHiech3uXFhZPZOB3D6iQoicTDEuDc,8660
|
|
322
322
|
reflex/components/radix/primitives/drawer.pyi,sha256=n6lRm9UvTc3iWdXFZsmDVPvzZGlWmrvnaUEHEGChub8,34484
|
|
323
|
-
reflex/components/radix/primitives/form.py,sha256=
|
|
323
|
+
reflex/components/radix/primitives/form.py,sha256=wiYW_28QVj3OCLfkh56CJWwXlS4UAOhD-6hqurE0VPM,4965
|
|
324
324
|
reflex/components/radix/primitives/form.pyi,sha256=dqzqclVIP612jWCnxJP99JN0y_CfQf4FKbMlZGM-1rY,48138
|
|
325
325
|
reflex/components/radix/primitives/progress.py,sha256=H9Xz_HEc5lXJbRcr0G3S9r9zb6XiVrR1f2ZWwUwC-8s,4160
|
|
326
326
|
reflex/components/radix/primitives/progress.pyi,sha256=2_G6T8AeBo2InfM7i4kRAWIzBz2bXqNR2-YnVunlKE4,22874
|
|
@@ -329,8 +329,8 @@ reflex/components/radix/primitives/slider.pyi,sha256=mgVdvP64yRKgLe_Zxi1z2Q5o7Bg
|
|
|
329
329
|
reflex/components/radix/themes/__init__.py,sha256=G7nHi3YqfM17fVE_XycJYapjB6en3wCcuwFz6xci45Q,292
|
|
330
330
|
reflex/components/radix/themes/base.py,sha256=RepABp4uqffOZhzmFd210BgMcyXmsQrWTQXKqyjR5o8,8294
|
|
331
331
|
reflex/components/radix/themes/base.pyi,sha256=zAo0VQcLpSU4sxGT0DX6TaUF0IAjIei8IM04IgZFsHE,26971
|
|
332
|
-
reflex/components/radix/themes/color_mode.py,sha256=
|
|
333
|
-
reflex/components/radix/themes/color_mode.pyi,sha256=
|
|
332
|
+
reflex/components/radix/themes/color_mode.py,sha256=7MDLB1KfvBonw3ArZnyPdd9ZRkr1AmHpbKIZlUiP8Hk,4819
|
|
333
|
+
reflex/components/radix/themes/color_mode.pyi,sha256=G87SahSpYVjc29_q3oCj7O8aqVxp0wJfYpqVemvmi5k,15461
|
|
334
334
|
reflex/components/radix/themes/components/__init__.py,sha256=YNqd2CzuNp794X_12iVLC2b8HRDiyIDuwZWiS_bu620,2440
|
|
335
335
|
reflex/components/radix/themes/components/alert_dialog.py,sha256=QNxRfqZZQb5oYG1or68cYOYH5NaSuy3RK03QrLyfhuA,3267
|
|
336
336
|
reflex/components/radix/themes/components/alert_dialog.pyi,sha256=gVA8HRj4a_BmioWMIK8u6Xo4jO8QtwOcn7rKJtnmTlk,24434
|
|
@@ -479,7 +479,7 @@ reflex/constants/installer.py,sha256=NoxgxmrAeYMIclYe81yIXdltL38YqdKq0ty-tIEvZrQ
|
|
|
479
479
|
reflex/constants/route.py,sha256=fu1jp9MoIriUJ8Cu4gLeinTxkyVBbRPs8Bkt35vqYOM,2144
|
|
480
480
|
reflex/constants/style.py,sha256=gSzu0sQEQjW81PekxJnwRs7SXQQVco-LxtVjCi0IQZc,636
|
|
481
481
|
reflex/custom_components/__init__.py,sha256=R4zsvOi4dfPmHc18KEphohXnQFBPnUCb50cMR5hSLDE,36
|
|
482
|
-
reflex/custom_components/custom_components.py,sha256=
|
|
482
|
+
reflex/custom_components/custom_components.py,sha256=8hg5TI6b-PLuv41peZqzuX7UiYextgoekX0sYenIk_c,32293
|
|
483
483
|
reflex/event.py,sha256=IJLjI9EdN64OJqOVllNppApZO8oAqMx0F0VyLegf4HQ,27893
|
|
484
484
|
reflex/experimental/__init__.py,sha256=sE-g9y56aC2pQxyMGvbm2-_hPKa4e1YBjrQ3cRhiRis,608
|
|
485
485
|
reflex/experimental/hooks.py,sha256=ruqdKV3smQT53vVwYvs8Zx4RyTy6nY00rD0Loe1gWdU,2196
|
|
@@ -493,7 +493,7 @@ reflex/page.py,sha256=NPT0xMownZGTiYiRtrUJnvAe_4oEvlzEJEkG-vrGhqI,2077
|
|
|
493
493
|
reflex/reflex.py,sha256=VJZAwe9lIqbS3VB3QkP5-OMmNXmM4gi-5TWMCJgZPcc,17826
|
|
494
494
|
reflex/route.py,sha256=WZS7stKgO94nekFFYHaOqNgN3zZGpJb3YpGF4ViTHmw,4198
|
|
495
495
|
reflex/state.py,sha256=IAMB5rOVSNR04PhV1JCSUjM9lpspnDzNYyPm1_Asx88,105748
|
|
496
|
-
reflex/style.py,sha256=
|
|
496
|
+
reflex/style.py,sha256=l2JY6ZiHF_eRXToxEUCq5KwilI4_EFFQoFd0c1b4W0E,9308
|
|
497
497
|
reflex/testing.py,sha256=zFlvQODofiaQd082v_bDK__qsBPzwysxeIDf-B86luI,30743
|
|
498
498
|
reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
|
|
499
499
|
reflex/utils/build.py,sha256=9LE93QlbfTHYyQWTgGZYSXX7QGDYzuE01ttWUVw_rGQ,8573
|
|
@@ -514,8 +514,8 @@ reflex/utils/types.py,sha256=NVdeZIQZTrrUCJMmlRSzQ8ZvCdAnQPQWCLBQioR4aQg,14842
|
|
|
514
514
|
reflex/utils/watch.py,sha256=HzGrHQIZ_62Di0BO46kd2AZktNA3A6nFIBuf8c6ip30,2609
|
|
515
515
|
reflex/vars.py,sha256=1IboqkSJYh_z-XlWAPzfcCaX-5imVdv6QSrpUAXBWNg,67317
|
|
516
516
|
reflex/vars.pyi,sha256=7sVCLoLg9Y7QAmXWz6FCtVmScpSV84u0yQ3ZBImb_Bk,5583
|
|
517
|
-
reflex-0.5.
|
|
518
|
-
reflex-0.5.
|
|
519
|
-
reflex-0.5.
|
|
520
|
-
reflex-0.5.
|
|
521
|
-
reflex-0.5.
|
|
517
|
+
reflex-0.5.0a1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
518
|
+
reflex-0.5.0a1.dist-info/METADATA,sha256=6CWVWM2qaZpmStSqOZrZt3_3S90WZ4v8LtAe4Ngrgt8,12089
|
|
519
|
+
reflex-0.5.0a1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
520
|
+
reflex-0.5.0a1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
|
|
521
|
+
reflex-0.5.0a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|