Browse Source

Quick fixes for regressions in 0.4.0 (#2639)

* rx.el.img accepts Any type for src prop

This retains compatibility with the previous chakra image src prop.

* Re-add `moment` back to top-level namespace
Masen Furer 1 year ago
parent
commit
10984ef869

+ 1 - 0
reflex/__init__.py

@@ -107,6 +107,7 @@ _ALL_COMPONENTS = [
     "list_item",
     "list_item",
     "unordered_list",
     "unordered_list",
     "ordered_list",
     "ordered_list",
+    "moment",
 ]
 ]
 
 
 _MAPPING = {
 _MAPPING = {

+ 1 - 0
reflex/__init__.pyi

@@ -93,6 +93,7 @@ from reflex.components import markdown as markdown
 from reflex.components import list_item as list_item
 from reflex.components import list_item as list_item
 from reflex.components import unordered_list as unordered_list
 from reflex.components import unordered_list as unordered_list
 from reflex.components import ordered_list as ordered_list
 from reflex.components import ordered_list as ordered_list
+from reflex.components import moment as moment
 from reflex.components.component import Component as Component
 from reflex.components.component import Component as Component
 from reflex.components.component import NoSSRComponent as NoSSRComponent
 from reflex.components.component import NoSSRComponent as NoSSRComponent
 from reflex.components.component import memo as memo
 from reflex.components.component import memo as memo

+ 2 - 2
reflex/components/el/elements/media.py

@@ -1,5 +1,5 @@
 """Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
 """Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
-from typing import Union
+from typing import Any, Union
 
 
 from reflex.vars import Var as Var
 from reflex.vars import Var as Var
 
 
@@ -108,7 +108,7 @@ class Img(BaseHTML):
     sizes: Var[Union[str, int, bool]]
     sizes: Var[Union[str, int, bool]]
 
 
     # URL of the image to display
     # URL of the image to display
-    src: Var[Union[str, int, bool]]
+    src: Var[Any]
 
 
     # A set of source sizes and URLs for responsive images
     # A set of source sizes and URLs for responsive images
     src_set: Var[Union[str, int, bool]]
     src_set: Var[Union[str, int, bool]]

+ 2 - 2
reflex/components/el/elements/media.pyi

@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.vars import Var, BaseVar, ComputedVar
 from reflex.event import EventChain, EventHandler, EventSpec
 from reflex.event import EventChain, EventHandler, EventSpec
 from reflex.style import Style
 from reflex.style import Style
-from typing import Union
+from typing import Any, Union
 from reflex.vars import Var as Var
 from reflex.vars import Var as Var
 from .base import BaseHTML
 from .base import BaseHTML
 
 
@@ -376,7 +376,7 @@ class Img(BaseHTML):
         sizes: Optional[
         sizes: Optional[
             Union[Var[Union[str, int, bool]], Union[str, int, bool]]
             Union[Var[Union[str, int, bool]], Union[str, int, bool]]
         ] = None,
         ] = None,
-        src: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
+        src: Optional[Union[Var[Any], Any]] = None,
         src_set: Optional[
         src_set: Optional[
             Union[Var[Union[str, int, bool]], Union[str, int, bool]]
             Union[Var[Union[str, int, bool]], Union[str, int, bool]]
         ] = None,
         ] = None,