diff --git a/reflex/components/base/link.py b/reflex/components/base/link.py index 04d109e51..b2a696163 100644 --- a/reflex/components/base/link.py +++ b/reflex/components/base/link.py @@ -1,5 +1,5 @@ """Display the title of the current page.""" - +from typing import Optional from reflex.components.component import Component from reflex.vars import Var @@ -11,10 +11,10 @@ class RawLink(Component): tag = "link" # The href. - href: Var[str] + href: Optional[Var[str]] = None # The type of link. - rel: Var[str] + rel: Optional[Var[str]] = None class ScriptTag(Component): @@ -23,22 +23,22 @@ class ScriptTag(Component): tag = "script" # The type of script represented. - type_: Var[str] + type_: Optional[Var[str]] = None # The URI of an external script. - source: Var[str] + source: Optional[Var[str]] = None # Metadata to verify the content of the script. - integrity: Var[str] + integrity: Optional[Var[str]] = None # Whether to allow cross-origin requests. - crossorigin: Var[str] + crossorigin: Optional[Var[str]] = None # Indicates which referrer to send when fetching the script. - referrer_policy: Var[str] + referrer_policy: Optional[Var[str]] = None # Whether to asynchronously load the script. - is_async: Var[bool] + is_async: Optional[Var[bool]] = None # Whether to defer loading the script. - defer: Var[bool] + defer: Optional[Var[bool]] = None diff --git a/reflex/components/base/script.py b/reflex/components/base/script.py index e379a1824..752d7c92f 100644 --- a/reflex/components/base/script.py +++ b/reflex/components/base/script.py @@ -1,10 +1,10 @@ """Next.js script wrappers and inline script functionality. - -https://nextjs.org/docs/app/api-reference/components/script +from typing import Optional +https://nextjs.org/docs/app/api-reference/components/script. """ from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.component import Component from reflex.vars import Var @@ -25,7 +25,7 @@ class Script(Component): is_default = True # Required unless inline script is used - src: Var[str] + src: Optional[Var[str]] = None # When the script will execute: afterInteractive | beforeInteractive | lazyOnload strategy: Var[str] = "afterInteractive" # type: ignore diff --git a/reflex/components/chakra/datadisplay/badge.py b/reflex/components/chakra/datadisplay/badge.py index 52d36fe7c..01f1d5c45 100644 --- a/reflex/components/chakra/datadisplay/badge.py +++ b/reflex/components/chakra/datadisplay/badge.py @@ -1,4 +1,5 @@ """Badge component.""" +from typing import Optional from reflex.components.chakra import ChakraComponent, LiteralVariant from reflex.vars import Var @@ -10,7 +11,7 @@ class Badge(ChakraComponent): tag = "Badge" # Variant of the badge ("solid" | "subtle" | "outline") - variant: Var[LiteralVariant] + variant: Optional[Var[LiteralVariant]] = None # The color of the badge - color_scheme: Var[str] + color_scheme: Optional[Var[str]] = None diff --git a/reflex/components/chakra/datadisplay/divider.py b/reflex/components/chakra/datadisplay/divider.py index de33e4ec0..b7d075632 100644 --- a/reflex/components/chakra/datadisplay/divider.py +++ b/reflex/components/chakra/datadisplay/divider.py @@ -1,5 +1,5 @@ """A line to divide parts of the layout.""" -from typing import Literal +from typing import Literal, Optional from reflex.components.chakra import ChakraComponent, LiteralDividerVariant from reflex.vars import Var @@ -13,7 +13,7 @@ class Divider(ChakraComponent): tag = "Divider" # Pass the orientation prop and set it to either horizontal or vertical. If the vertical orientation is used, make sure that the parent element is assigned a height. - orientation: Var[LiteralLayout] + orientation: Optional[Var[LiteralLayout]] = None # Variant of the divider ("solid" | "dashed") - variant: Var[LiteralDividerVariant] + variant: Optional[Var[LiteralDividerVariant]] = None diff --git a/reflex/components/chakra/datadisplay/list.py b/reflex/components/chakra/datadisplay/list.py index 5ae03989c..cc32b8106 100644 --- a/reflex/components/chakra/datadisplay/list.py +++ b/reflex/components/chakra/datadisplay/list.py @@ -1,12 +1,12 @@ """List components.""" - from __future__ import annotations +from typing import Generic, Optional, TypeVar + from reflex.components.chakra import ChakraComponent from reflex.components.component import Component from reflex.components.core.foreach import Foreach from reflex.vars import Var -from typing import TypeVar, Generic T = TypeVar("T") @@ -17,13 +17,13 @@ class List(ChakraComponent, Generic[T]): tag = "List" # The space between each list item - spacing: Var[str] + spacing: Optional[Var[str]] = None # Shorthand prop for listStylePosition - style_position: Var[str] + style_position: Optional[Var[str]] = None # Shorthand prop for listStyleType - style_type: Var[str] + style_type: Optional[Var[str]] = None @classmethod def create( diff --git a/reflex/components/chakra/datadisplay/stat.py b/reflex/components/chakra/datadisplay/stat.py index b9fe7f332..58078cef3 100644 --- a/reflex/components/chakra/datadisplay/stat.py +++ b/reflex/components/chakra/datadisplay/stat.py @@ -1,4 +1,5 @@ """Statistics components.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.components.component import Component @@ -71,7 +72,7 @@ class StatArrow(ChakraComponent): tag = "StatArrow" # The type of arrow, either increase or decrease. - type_: Var[str] + type_: Optional[Var[str]] = None class StatGroup(ChakraComponent): diff --git a/reflex/components/chakra/datadisplay/table.py b/reflex/components/chakra/datadisplay/table.py index cdc5c1fea..b2237817b 100644 --- a/reflex/components/chakra/datadisplay/table.py +++ b/reflex/components/chakra/datadisplay/table.py @@ -1,5 +1,5 @@ """Table components.""" -from typing import List, Tuple +from typing import List, Optional, Tuple from reflex.components.chakra import ChakraComponent from reflex.components.component import Component @@ -14,16 +14,16 @@ class Table(ChakraComponent): tag = "Table" # The color scheme of the table - color_scheme: Var[str] + color_scheme: Optional[Var[str]] = None # The variant of the table style to use - variant: Var[str] + variant: Optional[Var[str]] = None # The size of the table - size: Var[str] + size: Optional[Var[str]] = None # The placement of the table caption. - placement: Var[str] + placement: Optional[Var[str]] = None @classmethod def create( @@ -274,7 +274,7 @@ class Th(ChakraComponent): _invalid_children: List[str] = ["Tbody", "Thead", "Tr", "Td", "Th"] # Aligns the cell content to the right. - is_numeric: Var[bool] + is_numeric: Optional[Var[bool]] = None class Td(ChakraComponent): @@ -286,7 +286,7 @@ class Td(ChakraComponent): _invalid_children: List[str] = ["Tbody", "Thead"] # Aligns the cell content to the right. - is_numeric: Var[bool] + is_numeric: Optional[Var[bool]] = None class TableCaption(ChakraComponent): @@ -295,7 +295,7 @@ class TableCaption(ChakraComponent): tag = "TableCaption" # The placement of the table caption. This sets the `caption-side` CSS attribute. - placement: Var[str] + placement: Optional[Var[str]] = None class TableContainer(ChakraComponent): diff --git a/reflex/components/chakra/datadisplay/tag.py b/reflex/components/chakra/datadisplay/tag.py index 4a02d22d9..7fd9e8954 100644 --- a/reflex/components/chakra/datadisplay/tag.py +++ b/reflex/components/chakra/datadisplay/tag.py @@ -44,17 +44,17 @@ class Tag(ChakraComponent): # options: "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | # "cyan" | "purple" | "pink" # default: "gray" - color_scheme: Var[LiteralTagColorScheme] + color_scheme: Optional[Var[LiteralTagColorScheme]] = None # The size of the tag # options: "sm" | "md" | "lg" # default: "md" - size: Var[LiteralTagSize] + size: Optional[Var[LiteralTagSize]] = None # The variant of the tag # options: "solid" | "subtle" | "outline" # default: "solid" - variant: Var[LiteralVariant] + variant: Optional[Var[LiteralVariant]] = None @classmethod def create( diff --git a/reflex/components/chakra/disclosure/accordion.py b/reflex/components/chakra/disclosure/accordion.py index 7fd61ca61..15148c137 100644 --- a/reflex/components/chakra/disclosure/accordion.py +++ b/reflex/components/chakra/disclosure/accordion.py @@ -1,5 +1,4 @@ """Container to stack elements with spacing.""" - from typing import List, Optional, Union from reflex.components.chakra import ChakraComponent @@ -13,19 +12,19 @@ class Accordion(ChakraComponent): tag = "Accordion" # If true, multiple accordion items can be expanded at once. - allow_multiple: Var[bool] + allow_multiple: Optional[Var[bool]] = None # If true, any expanded accordion item can be collapsed again. - allow_toggle: Var[bool] + allow_toggle: Optional[Var[bool]] = None # The initial index(es) of the expanded accordion item(s). - default_index: Var[Optional[List[int]]] + default_index: Optional[Var[Optional[List[int]]]] = None # The index(es) of the expanded accordion item - index: Var[Union[int, List[int]]] + index: Optional[Var[Union[int, List[int]]]] = None # If true, height animation and transitions will be disabled. - reduce_motion: Var[bool] + reduce_motion: Optional[Var[bool]] = None @classmethod def create( @@ -83,13 +82,13 @@ class AccordionItem(ChakraComponent): tag = "AccordionItem" # A unique id for the accordion item. - id_: Var[str] + id_: Optional[Var[str]] = None # If true, the accordion item will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the accordion item will be focusable. - is_focusable: Var[bool] + is_focusable: Optional[Var[bool]] = None class AccordionButton(ChakraComponent): diff --git a/reflex/components/chakra/disclosure/tabs.py b/reflex/components/chakra/disclosure/tabs.py index 4600384b4..cf6871702 100644 --- a/reflex/components/chakra/disclosure/tabs.py +++ b/reflex/components/chakra/disclosure/tabs.py @@ -1,5 +1,4 @@ """Tab components.""" - from typing import List, Optional, Tuple from reflex.components.chakra import ( @@ -18,34 +17,34 @@ class Tabs(ChakraComponent): tag = "Tabs" # The alignment of the tabs ("center" | "end" | "start"). - align: Var[LiteralTagAlign] + align: Optional[Var[LiteralTagAlign]] = None # The initial index of the selected tab (in uncontrolled mode). - default_index: Var[int] + default_index: Optional[Var[int]] = None # The id of the tab. - id_: Var[str] + id_: Optional[Var[str]] = None # If true, tabs will stretch to width of the tablist. - is_fitted: Var[bool] + is_fitted: Optional[Var[bool]] = None # Performance booster. If true, rendering of the tab panel's will be deferred until it is selected. - is_lazy: Var[bool] + is_lazy: Optional[Var[bool]] = None # If true, the tabs will be manually activated and display its panel by pressing Space or Enter. If false, the tabs will be automatically activated and their panel is displayed when they receive focus. - is_manual: Var[bool] + is_manual: Optional[Var[bool]] = None # The orientation of the tab list. - orientation: Var[str] + orientation: Optional[Var[str]] = None # "line" | "enclosed" | "enclosed-colored" | "soft-rounded" | "solid-rounded" | "unstyled" - variant: Var[LiteralTabsVariant] + variant: Optional[Var[LiteralTabsVariant]] = None # The color scheme of the tabs. - color_scheme: Var[LiteralColorScheme] + color_scheme: Optional[Var[LiteralColorScheme]] = None # Index of the selected tab (in controlled mode). - index: Var[int] + index: Optional[Var[int]] = None @classmethod def create( @@ -79,16 +78,16 @@ class Tab(ChakraComponent): tag = "Tab" # If true, the Tab won't be toggleable. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the Tab will be selected. - is_selected: Var[bool] + is_selected: Optional[Var[bool]] = None # The id of the tab. - id_: Var[str] + id_: Optional[Var[str]] = None # The id of the panel. - panel_id: Var[str] + panel_id: Optional[Var[str]] = None _valid_parents: List[str] = ["TabList"] diff --git a/reflex/components/chakra/disclosure/transition.py b/reflex/components/chakra/disclosure/transition.py index f24afa827..c2fc18bd3 100644 --- a/reflex/components/chakra/disclosure/transition.py +++ b/reflex/components/chakra/disclosure/transition.py @@ -1,5 +1,5 @@ """A transition Component.""" -from typing import Union +from typing import Optional, Union from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -9,10 +9,10 @@ class Transition(ChakraComponent): """Base componemt of all transitions.""" # Show the component; triggers when enter or exit states - in_: Var[bool] + in_: Optional[Var[bool]] = None # If true, the element will unmount when `in={false}` and animation is done - unmount_on_exit: Var[bool] + unmount_on_exit: Optional[Var[bool]] = None class Fade(Transition): @@ -27,10 +27,10 @@ class ScaleFade(Transition): tag = "ScaleFade" # The initial scale of the element - initial_scale: Var[float] + initial_scale: Optional[Var[float]] = None # If true, the element will transition back to exit state - reverse: Var[bool] + reverse: Optional[Var[bool]] = None class Slide(Transition): @@ -39,7 +39,7 @@ class Slide(Transition): tag = "Slide" # The direction to slide from - direction: Var[str] + direction: Optional[Var[str]] = None class SlideFade(Transition): @@ -48,13 +48,13 @@ class SlideFade(Transition): tag = "SlideFade" # The offset on the horizontal or x axis - offsetX: Var[Union[str, int]] + offsetX: Optional[Var[Union[str, int]]] = None # The offset on the vertical or y axis - offsetY: Var[Union[str, int]] + offsetY: Optional[Var[Union[str, int]]] = None # If true, the element will be transitioned back to the offset when it leaves. Otherwise, it'll only fade out - reverse: Var[bool] + reverse: Optional[Var[bool]] = None class Collapse(Transition): @@ -63,10 +63,10 @@ class Collapse(Transition): tag = "Collapse" # If true, the opacity of the content will be animated - animateOpacity: Var[bool] + animateOpacity: Optional[Var[bool]] = None # The height you want the content in its expanded state. - endingHeight: Var[str] + endingHeight: Optional[Var[str]] = None # The height you want the content in its collapsed state. - startingHeight: Var[Union[str, int]] + startingHeight: Optional[Var[Union[str, int]]] = None diff --git a/reflex/components/chakra/feedback/alert.py b/reflex/components/chakra/feedback/alert.py index 57f99817f..2940a6d0c 100644 --- a/reflex/components/chakra/feedback/alert.py +++ b/reflex/components/chakra/feedback/alert.py @@ -1,4 +1,5 @@ """Alert components.""" +from typing import Optional from reflex.components.chakra import ( ChakraComponent, @@ -15,10 +16,10 @@ class Alert(ChakraComponent): tag = "Alert" # The status of the alert ("success" | "info" | "warning" | "error") - status: Var[LiteralStatus] + status: Optional[Var[LiteralStatus]] = None # "subtle" | "left-accent" | "top-accent" | "solid" - variant: Var[LiteralAlertVariant] + variant: Optional[Var[LiteralAlertVariant]] = None @classmethod def create( diff --git a/reflex/components/chakra/feedback/circularprogress.py b/reflex/components/chakra/feedback/circularprogress.py index 45a0877eb..c22ea6210 100644 --- a/reflex/components/chakra/feedback/circularprogress.py +++ b/reflex/components/chakra/feedback/circularprogress.py @@ -1,5 +1,5 @@ """Container to stack elements with spacing.""" -from typing import Union +from typing import Optional, Union from reflex.components.chakra import ChakraComponent from reflex.components.component import Component @@ -12,34 +12,34 @@ class CircularProgress(ChakraComponent): tag = "CircularProgress" # If true, the cap of the progress indicator will be rounded. - cap_is_round: Var[bool] + cap_is_round: Optional[Var[bool]] = None # If true, the progress will be indeterminate and the value prop will be ignored - is_indeterminate: Var[bool] + is_indeterminate: Optional[Var[bool]] = None # Maximum value defining 100% progress made (must be higher than 'min') - max_: Var[int] + max_: Optional[Var[int]] = None # Minimum value defining 'no progress' (must be lower than 'max') - min_: Var[int] + min_: Optional[Var[int]] = None # This defines the stroke width of the svg circle. - thickness: Var[Union[str, int]] + thickness: Optional[Var[Union[str, int]]] = None # The color name of the progress track. Use a color key in the theme object - track_color: Var[str] + track_color: Optional[Var[str]] = None # Current progress (must be between min/max). - value: Var[int] + value: Optional[Var[int]] = None # The desired valueText to use in place of the value. - value_text: Var[str] + value_text: Optional[Var[str]] = None # The color name of the progress bar - color: Var[str] + color: Optional[Var[str]] = None # The size of the circular progress - size: Var[str] + size: Optional[Var[str]] = None @classmethod def create(cls, *children, label=None, **props) -> Component: diff --git a/reflex/components/chakra/feedback/progress.py b/reflex/components/chakra/feedback/progress.py index 6dbaf1e94..3f6983383 100644 --- a/reflex/components/chakra/feedback/progress.py +++ b/reflex/components/chakra/feedback/progress.py @@ -1,6 +1,5 @@ """Container to stack elements with spacing.""" - -from typing import Union +from typing import Optional, Union from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -12,22 +11,22 @@ class Progress(ChakraComponent): tag = "Progress" # If true, the progress bar will show stripe - has_stripe: Var[bool] + has_stripe: Optional[Var[bool]] = None # If true, and has_stripe is true, the stripes will be animated - is_animated: Var[bool] + is_animated: Optional[Var[bool]] = None # If true, the progress will be indeterminate and the value prop will be ignored - is_indeterminate: Var[bool] + is_indeterminate: Optional[Var[bool]] = None # The maximum value of the progress - max_: Var[int] + max_: Optional[Var[int]] = None # The minimum value of the progress - min_: Var[int] + min_: Optional[Var[int]] = None # The value of the progress indicator. If undefined the progress bar will be in indeterminate state - value: Var[Union[int, float]] + value: Optional[Var[Union[int, float]]] = None # The color scheme of the progress bar. - color_scheme: Var[str] + color_scheme: Optional[Var[str]] = None diff --git a/reflex/components/chakra/feedback/skeleton.py b/reflex/components/chakra/feedback/skeleton.py index ef71cd514..4766dc6f6 100644 --- a/reflex/components/chakra/feedback/skeleton.py +++ b/reflex/components/chakra/feedback/skeleton.py @@ -1,4 +1,5 @@ """Container to stack elements with spacing.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -10,19 +11,19 @@ class Skeleton(ChakraComponent): tag = "Skeleton" # The color at the animation end - end_color: Var[str] + end_color: Optional[Var[str]] = None # The fadeIn duration in seconds - fade_duration: Var[float] + fade_duration: Optional[Var[float]] = None # If true, it'll render its children with a nice fade transition - is_loaded: Var[bool] + is_loaded: Optional[Var[bool]] = None # The animation speed in seconds - speed: Var[float] + speed: Optional[Var[float]] = None # The color at the animation start - start_color: Var[str] + start_color: Optional[Var[str]] = None class SkeletonCircle(ChakraComponent): @@ -31,19 +32,19 @@ class SkeletonCircle(ChakraComponent): tag = "SkeletonCircle" # The color at the animation end - end_color: Var[str] + end_color: Optional[Var[str]] = None # The fadeIn duration in seconds - fade_duration: Var[float] + fade_duration: Optional[Var[float]] = None # If true, it'll render its children with a nice fade transition - is_loaded: Var[bool] + is_loaded: Optional[Var[bool]] = None # The animation speed in seconds - speed: Var[float] + speed: Optional[Var[float]] = None # The color at the animation start - start_color: Var[str] + start_color: Optional[Var[str]] = None class SkeletonText(ChakraComponent): @@ -52,19 +53,19 @@ class SkeletonText(ChakraComponent): tag = "SkeletonText" # The color at the animation end - end_color: Var[str] + end_color: Optional[Var[str]] = None # The fadeIn duration in seconds - fade_duration: Var[float] + fade_duration: Optional[Var[float]] = None # If true, it'll render its children with a nice fade transition - is_loaded: Var[bool] + is_loaded: Optional[Var[bool]] = None # The animation speed in seconds - speed: Var[float] + speed: Optional[Var[float]] = None # The color at the animation start - start_color: Var[str] + start_color: Optional[Var[str]] = None # Number is lines of text. - no_of_lines: Var[int] + no_of_lines: Optional[Var[int]] = None diff --git a/reflex/components/chakra/feedback/spinner.py b/reflex/components/chakra/feedback/spinner.py index eed335ce1..74e076d10 100644 --- a/reflex/components/chakra/feedback/spinner.py +++ b/reflex/components/chakra/feedback/spinner.py @@ -1,4 +1,5 @@ """Container to stack elements with spacing.""" +from typing import Optional from reflex.components.chakra import ChakraComponent, LiteralSpinnerSize from reflex.vars import Var @@ -10,16 +11,16 @@ class Spinner(ChakraComponent): tag = "Spinner" # The color of the empty area in the spinner - empty_color: Var[str] + empty_color: Optional[Var[str]] = None # For accessibility, it is important to add a fallback loading text. This text will be visible to screen readers. - label: Var[str] + label: Optional[Var[str]] = None # The speed of the spinner must be as a string and in seconds '1s'. Default is '0.45s'. - speed: Var[str] + speed: Optional[Var[str]] = None # The thickness of the spinner. - thickness: Var[int] + thickness: Optional[Var[int]] = None # "xs" | "sm" | "md" | "lg" | "xl" - size: Var[LiteralSpinnerSize] + size: Optional[Var[LiteralSpinnerSize]] = None diff --git a/reflex/components/chakra/forms/button.py b/reflex/components/chakra/forms/button.py index bbadbf73d..643306871 100644 --- a/reflex/components/chakra/forms/button.py +++ b/reflex/components/chakra/forms/button.py @@ -1,5 +1,5 @@ """A button component.""" -from typing import List +from typing import List, Optional from reflex.components.chakra import ( ChakraComponent, @@ -17,48 +17,48 @@ class Button(ChakraComponent): tag = "Button" # The space between the button icon and label. - icon_spacing: Var[int] + icon_spacing: Optional[Var[int]] = None # If true, the button will be styled in its active state. - is_active: Var[bool] + is_active: Optional[Var[bool]] = None # If true, the button will be styled in its disabled state. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the button will take up the full width of its container. - is_full_width: Var[bool] + is_full_width: Optional[Var[bool]] = None # If true, the button will show a spinner. - is_loading: Var[bool] + is_loading: Optional[Var[bool]] = None # The label to show in the button when isLoading is true If no text is passed, it only shows the spinner. - loading_text: Var[str] + loading_text: Optional[Var[str]] = None # "lg" | "md" | "sm" | "xs" - size: Var[LiteralButtonSize] + size: Optional[Var[LiteralButtonSize]] = None # "ghost" | "outline" | "solid" | "link" | "unstyled" - variant: Var[LiteralButtonVariant] + variant: Optional[Var[LiteralButtonVariant]] = None # Built in color scheme for ease of use. # Options: # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" - color_scheme: Var[LiteralColorScheme] + color_scheme: Optional[Var[LiteralColorScheme]] = None # Position of the loading spinner. # Options: # "start" | "end" - spinner_placement: Var[LiteralSpinnerPlacement] + spinner_placement: Optional[Var[LiteralSpinnerPlacement]] = None # The type of button. - type_: Var[str] + type_: Optional[Var[str]] = None # Components that are not allowed as children. _invalid_children: List[str] = ["Button", "MenuButton"] # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None class ButtonGroup(ChakraComponent): @@ -67,16 +67,16 @@ class ButtonGroup(ChakraComponent): tag = "ButtonGroup" # If true, the borderRadius of button that are direct children will be altered to look flushed together. - is_attached: Var[bool] + is_attached: Optional[Var[bool]] = None # If true, all wrapped button will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # The spacing between the buttons. - spacing: Var[int] + spacing: Optional[Var[int]] = None # "lg" | "md" | "sm" | "xs" - size: Var[LiteralButtonSize] + size: Optional[Var[LiteralButtonSize]] = None # "ghost" | "outline" | "solid" | "link" | "unstyled" - variant: Var[LiteralButtonVariant] + variant: Optional[Var[LiteralButtonVariant]] = None diff --git a/reflex/components/chakra/forms/checkbox.py b/reflex/components/chakra/forms/checkbox.py index b0e29ea16..298eaf167 100644 --- a/reflex/components/chakra/forms/checkbox.py +++ b/reflex/components/chakra/forms/checkbox.py @@ -1,7 +1,7 @@ """A checkbox component.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ( ChakraComponent, @@ -21,40 +21,40 @@ class Checkbox(ChakraComponent): # Options: # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" - color_scheme: Var[LiteralColorScheme] + color_scheme: Optional[Var[LiteralColorScheme]] = None # "sm" | "md" | "lg" - size: Var[LiteralTagSize] + size: Optional[Var[LiteralTagSize]] = None # If true, the checkbox will be checked. - is_checked: Var[bool] + is_checked: Optional[Var[bool]] = None # If true, the checkbox will be disabled - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true and is_disabled is passed, the checkbox will remain tabbable but not interactive - is_focusable: Var[bool] + is_focusable: Optional[Var[bool]] = None # If true, the checkbox will be indeterminate. This only affects the icon shown inside checkbox and does not modify the is_checked var. - is_indeterminate: Var[bool] + is_indeterminate: Optional[Var[bool]] = None # If true, the checkbox is marked as invalid. Changes style of unchecked state. - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the checkbox will be readonly - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the checkbox input is marked as required, and required attribute will be added - is_required: Var[bool] + is_required: Optional[Var[bool]] = None # The name of the input field in a checkbox (Useful for form submission). - name: Var[str] + name: Optional[Var[str]] = None # The value of the input field when checked (use is_checked prop for a bool) value: Var[str] = Var.create("true") # type: ignore # The spacing between the checkbox and its label text (0.5rem) - spacing: Var[str] + spacing: Optional[Var[str]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -74,13 +74,13 @@ class CheckboxGroup(ChakraComponent): tag = "CheckboxGroup" # The value of the checkbox group - value: Var[str] + value: Optional[Var[str]] = None # The initial value of the checkbox group - default_value: Var[str] + default_value: Optional[Var[str]] = None # If true, all wrapped checkbox inputs will be disabled - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, input elements will receive checked attribute instead of isChecked. This assumes, you're using native radio inputs - is_native: Var[bool] + is_native: Optional[Var[bool]] = None diff --git a/reflex/components/chakra/forms/editable.py b/reflex/components/chakra/forms/editable.py index d09a90a3f..4524492f1 100644 --- a/reflex/components/chakra/forms/editable.py +++ b/reflex/components/chakra/forms/editable.py @@ -1,7 +1,7 @@ """An editable component.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ChakraComponent from reflex.constants import EventTriggers @@ -14,28 +14,28 @@ class Editable(ChakraComponent): tag = "Editable" # If true, the Editable will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the read only view, has a tabIndex set to 0 so it can receive focus via the keyboard or click. - is_preview_focusable: Var[bool] + is_preview_focusable: Optional[Var[bool]] = None # The placeholder text when the value is empty. - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # If true, the input's text will be highlighted on focus. - select_all_on_focus: Var[bool] + select_all_on_focus: Optional[Var[bool]] = None # If true, the Editable will start with edit mode by default. - start_with_edit_view: Var[bool] + start_with_edit_view: Optional[Var[bool]] = None # If true, it'll update the value onBlur and turn off the edit mode. - submit_on_blur: Var[bool] + submit_on_blur: Optional[Var[bool]] = None # The value of the Editable in both edit & preview mode - value: Var[str] + value: Optional[Var[str]] = None # The initial value of the Editable in both edit and preview mode. - default_value: Var[str] + default_value: Optional[Var[str]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/chakra/forms/form.py b/reflex/components/chakra/forms/form.py index 5d38f66b4..6149d645f 100644 --- a/reflex/components/chakra/forms/form.py +++ b/reflex/components/chakra/forms/form.py @@ -2,7 +2,7 @@ from __future__ import annotations from hashlib import md5 -from typing import Any, Dict, Iterator +from typing import Any, Dict, Iterator, Optional from jinja2 import Environment @@ -45,7 +45,7 @@ class Form(ChakraComponent): reset_on_submit: Var[bool] = False # type: ignore # The name used to make this form's submit handler function unique - handle_submit_unique_name: Var[str] + handle_submit_unique_name: Optional[Var[str]] = None @classmethod def create(cls, *children, **props) -> Component: @@ -154,19 +154,19 @@ class FormControl(ChakraComponent): tag = "FormControl" # If true, the form control will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the form control will be invalid. - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the form control will be readonly - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the form control will be required. - is_required: Var[bool] + is_required: Optional[Var[bool]] = None # The label text used to inform users as to what information is requested for a text field. - label: Var[str] + label: Optional[Var[str]] = None @classmethod def create( @@ -225,7 +225,7 @@ class FormLabel(ChakraComponent): tag = "FormLabel" # Link - html_for: Var[str] + html_for: Optional[Var[str]] = None class FormErrorMessage(ChakraComponent): diff --git a/reflex/components/chakra/forms/iconbutton.py b/reflex/components/chakra/forms/iconbutton.py index 10e3d3a6f..bd53ecae0 100644 --- a/reflex/components/chakra/forms/iconbutton.py +++ b/reflex/components/chakra/forms/iconbutton.py @@ -1,5 +1,4 @@ """An icon button component.""" - from typing import Optional from reflex.components.chakra.typography.text import Text @@ -14,25 +13,25 @@ class IconButton(Text): library = "@chakra-ui/button@2.1.0" # The type of button. - type: Var[str] + type: Optional[Var[str]] = None # A label that describes the button - aria_label: Var[str] + aria_label: Optional[Var[str]] = None # The icon to be used in the button. icon: Optional[Component] # If true, the button will be styled in its active state. - is_active: Var[bool] + is_active: Optional[Var[bool]] = None # If true, the button will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the button will show a spinner. - is_loading: Var[bool] + is_loading: Optional[Var[bool]] = None # If true, the button will be perfectly round. Else, it'll be slightly round - is_round: Var[bool] + is_round: Optional[Var[bool]] = None # Replace the spinner component when isLoading is set to true - spinner: Var[str] + spinner: Optional[Var[str]] = None diff --git a/reflex/components/chakra/forms/input.py b/reflex/components/chakra/forms/input.py index 4512a4f48..e694c1006 100644 --- a/reflex/components/chakra/forms/input.py +++ b/reflex/components/chakra/forms/input.py @@ -1,6 +1,5 @@ """An input component.""" - -from typing import Any, Dict +from typing import Any, Dict, Optional from reflex.components.chakra import ( ChakraComponent, @@ -21,43 +20,43 @@ class Input(ChakraComponent): tag = "Input" # State var to bind the input. - value: Var[str] + value: Optional[Var[str]] = None # The default value of the input. - default_value: Var[str] + default_value: Optional[Var[str]] = None # The placeholder text. - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # The type of input. - type_: Var[LiteralInputType] + type_: Optional[Var[LiteralInputType]] = None # The border color when the input is invalid. - error_border_color: Var[str] + error_border_color: Optional[Var[str]] = None # The border color when the input is focused. - focus_border_color: Var[str] + focus_border_color: Optional[Var[str]] = None # If true, the form control will be disabled. This has 2 side effects - The FormLabel will have `data-disabled` attribute - The form element (e.g, Input) will be disabled - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the form control will be invalid. This has 2 side effects - The FormLabel and FormErrorIcon will have `data-invalid` set to true - The form element (e.g, Input) will have `aria-invalid` set to true - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the form control will be readonly. - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the form control will be required. This has 2 side effects - The FormLabel will show a required indicator - The form element (e.g, Input) will have `aria-required` set to true - is_required: Var[bool] + is_required: Optional[Var[bool]] = None # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[LiteralInputVariant] + variant: Optional[Var[LiteralInputVariant]] = None # "lg" | "md" | "sm" | "xs" - size: Var[LiteralButtonSize] + size: Optional[Var[LiteralButtonSize]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def _get_imports(self) -> imports.ImportDict: return imports.merge_imports( diff --git a/reflex/components/chakra/forms/multiselect.py b/reflex/components/chakra/forms/multiselect.py index d9af42c3b..db4739c97 100644 --- a/reflex/components/chakra/forms/multiselect.py +++ b/reflex/components/chakra/forms/multiselect.py @@ -51,19 +51,19 @@ class Select(Component): alias = "MultiSelect" # Focus the control when it is mounted - auto_focus: Var[bool] + auto_focus: Optional[Var[bool]] = None # Remove the currently focused option when the user presses backspace # when Select isClearable or isMulti - backspace_removes_value: Var[bool] + backspace_removes_value: Optional[Var[bool]] = None # Remove focus from the input when the user selects an option # (handy for dismissing the keyboard on touch devices) - blur_input_on_select: Var[bool] + blur_input_on_select: Optional[Var[bool]] = None # When the user reaches the top/bottom of the menu, # prevent scroll on the scroll-parent - capture_menu_scroll: Var[bool] + capture_menu_scroll: Optional[Var[bool]] = None # [chakra] # To use the chakraStyles prop, first, @@ -101,13 +101,13 @@ class Select(Component): # - placeholder - Box # - singleValue - Box # - valueContainer - Box - chakra_styles: Var[str] + chakra_styles: Optional[Var[str]] = None # Close the select menu when the user selects an option - close_menu_on_select: Var[bool] + close_menu_on_select: Optional[Var[bool]] = None # If true, close the select menu when the user scrolls the document/body. - close_menu_on_scroll: Var[bool] + close_menu_on_scroll: Optional[Var[bool]] = None # [chakra] # The visual color appearance of the component @@ -116,117 +116,117 @@ class Select(Component): # "purple" | "pink" | "linkedin" | "facebook" | "messenger" | # "whatsapp" | "twitter" | "telegram" # default: "gray" - color_scheme: Var[str] + color_scheme: Optional[Var[str]] = None # This complex object includes all the compositional components # that are used in react-select. If you wish to overwrite a component, # pass in an object with the appropriate namespace. # If you only wish to restyle a component, # we recommend using the styles prop instead. - components: Var[Dict[str, Component]] + components: Optional[Var[Dict[str, Component]]] = None # Whether the value of the select, e.g. SingleValue, # should be displayed in the control. - control_should_render_value: Var[bool] + control_should_render_value: Optional[Var[bool]] = None # Delimiter used to join multiple values into a single HTML Input value - delimiter: Var[str] + delimiter: Optional[Var[str]] = None # [chakra] # Colors the component border with the given chakra color string on error state # default: "red.500" - error_border_color: Var[str] + error_border_color: Optional[Var[str]] = None # Clear all values when the user presses escape AND the menu is closed - escape_clears_value: Var[bool] + escape_clears_value: Optional[Var[bool]] = None # [chakra] # Colors the component border with the given chakra color string on focus # default: "blue.500" - focus_border_color: Var[str] + focus_border_color: Optional[Var[str]] = None # Sets the form attribute on the input - form: Var[str] + form: Optional[Var[str]] = None # Hide the selected option from the menu - hide_selected_options: Var[bool] + hide_selected_options: Optional[Var[bool]] = None # The id to set on the SelectContainer component. - # id: Var[str] + # id: Optional[Var[str]] = None # The value of the search input - input_value: Var[str] + input_value: Optional[Var[str]] = None # The id of the search input - input_id: Var[str] + input_id: Optional[Var[str]] = None # Is the select value clearable - is_clearable: Var[bool] + is_clearable: Optional[Var[bool]] = None # Is the select disabled - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # [chakra] # Style component in the chakra invalid style # default: False - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # Support multiple selected options - is_multi: Var[bool] + is_multi: Optional[Var[bool]] = None # [chakra] # Style component as disabled (chakra style) # default: False - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # Is the select direction right-to-left - is_rtl: Var[bool] + is_rtl: Optional[Var[bool]] = None # Whether to enable search functionality - is_searchable: Var[bool] + is_searchable: Optional[Var[bool]] = None # Minimum height of the menu before flipping - min_menu_height: Var[int] + min_menu_height: Optional[Var[int]] = None # Maximum height of the menu before scrolling - max_menu_height: Var[int] + max_menu_height: Optional[Var[int]] = None # Default placement of the menu in relation to the control. # 'auto' will flip when there isn't enough space below the control. # options: "bottom" | "auto" | "top" - menu_placement: Var[str] + menu_placement: Optional[Var[str]] = None # The CSS position value of the menu, # when "fixed" extra layout management is required # options: "absolute" | "fixed" - menu_position: Var[str] + menu_position: Optional[Var[str]] = None # Whether to block scroll events when the menu is open - menu_should_block_scroll: Var[bool] + menu_should_block_scroll: Optional[Var[bool]] = None # Whether the menu should be scrolled into view when it opens - menu_should_scroll_into_view: Var[bool] + menu_should_scroll_into_view: Optional[Var[bool]] = None # Name of the HTML Input (optional - without this, no input will be rendered) - name: Var[str] + name: Optional[Var[str]] = None # Allows control of whether the menu is opened when the Select is focused - open_menu_on_focus: Var[bool] + open_menu_on_focus: Optional[Var[bool]] = None # Allows control of whether the menu is opened when the Select is clicked - open_menu_on_click: Var[bool] + open_menu_on_click: Optional[Var[bool]] = None # Array of options that populate the select menu - options: Var[List[Dict]] + options: Optional[Var[List[Dict]]] = None # Number of options to jump in menu when page{up|down} keys are used - page_size: Var[int] + page_size: Optional[Var[int]] = None # Placeholder for the select value - placeholder: Var[Optional[str]] + placeholder: Optional[Var[Optional[str]]] = None # Marks the value-holding input as required for form validation - required: Var[bool] + required: Optional[Var[bool]] = None # [chakra] # If you choose to stick with the default selectedOptionStyle="color", @@ -239,7 +239,7 @@ class Select(Component): # If you would like to use a specific color for the background that's not a part of your theme, # use the chakraStyles prop to customize it. # default: "blue" - selected_option_color_scheme: Var[str] + selected_option_color_scheme: Optional[Var[str]] = None # [chakra] # The default option "color" will style a selected option @@ -253,28 +253,28 @@ class Select(Component): # if hide_selected_options=False is also passed. # options: "color" | "check" # default: "color" - selected_option_style: Var[str] + selected_option_style: Optional[Var[str]] = None # [chakra] # The size of the component. # options: "sm" | "md" | "lg" # default: "md" - size: Var[str] + size: Optional[Var[str]] = None # Sets the tabIndex attribute on the input - tab_index: Var[int] + tab_index: Optional[Var[int]] = None # Select the currently focused option when the user presses tab - tab_selects_value: Var[bool] + tab_selects_value: Optional[Var[bool]] = None # [chakra] # Variant of multi-select tags # options: "subtle" | "solid" | "outline" # default: "subtle" - tag_variant: Var[str] + tag_variant: Optional[Var[str]] = None # Remove all non-essential styles - unstyled: Var[bool] + unstyled: Optional[Var[bool]] = None # [chakra] # If this prop is passed, @@ -287,7 +287,7 @@ class Select(Component): # However, as this button only appears when isMulti is passed, # using this style could make more sense for a single select. # default: False - use_basic_style: Var[bool] + use_basic_style: Optional[Var[bool]] = None # [chakra] # The variant of the Select. If no variant is passed, @@ -295,7 +295,7 @@ class Select(Component): # If your component theme for Input is not modified, it will be outline. # options: "outline" | "filled" | "flushed" | "unstyled" # default: "outline" - variant: Var[str] + variant: Optional[Var[str]] = None # How the options should be displayed in the menu. menu_position: Var[str] = "fixed" # type: ignore diff --git a/reflex/components/chakra/forms/numberinput.py b/reflex/components/chakra/forms/numberinput.py index c6ed8df6d..8e064d77e 100644 --- a/reflex/components/chakra/forms/numberinput.py +++ b/reflex/components/chakra/forms/numberinput.py @@ -1,7 +1,6 @@ """A number input component.""" - from numbers import Number -from typing import Any, Dict +from typing import Any, Dict, Optional from reflex.components.chakra import ( ChakraComponent, @@ -19,61 +18,61 @@ class NumberInput(ChakraComponent): tag = "NumberInput" # State var to bind the input. - value: Var[Number] + value: Optional[Var[Number]] = None # If true, the input's value will change based on mouse wheel. - allow_mouse_wheel: Var[bool] + allow_mouse_wheel: Optional[Var[bool]] = None # This controls the value update when you blur out of the input. - If true and the value is greater than max, the value will be reset to max - Else, the value remains the same. - clamped_value_on_blur: Var[bool] + clamped_value_on_blur: Optional[Var[bool]] = None # The initial value of the counter. Should be less than max and greater than min - default_value: Var[Number] + default_value: Optional[Var[Number]] = None # The border color when the input is invalid. - error_border_color: Var[str] + error_border_color: Optional[Var[str]] = None # The border color when the input is focused. - focus_border_color: Var[str] + focus_border_color: Optional[Var[str]] = None # If true, the input will be focused as you increment or decrement the value with the stepper - focus_input_on_change: Var[bool] + focus_input_on_change: Optional[Var[bool]] = None # Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices ("text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal") - # input_mode: Var[LiteralInputNumberMode] + # input_mode: Optional[Var[LiteralInputNumberMode]] = None # Whether the input should be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the input will have `aria-invalid` set to true - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the input will be in readonly mode - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # Whether the input is required - is_required: Var[bool] + is_required: Optional[Var[bool]] = None # Whether the pressed key should be allowed in the input. The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/ - is_valid_character: Var[str] + is_valid_character: Optional[Var[str]] = None # This controls the value update behavior in general. - If true and you use the stepper or up/down arrow keys, the value will not exceed the max or go lower than min - If false, the value will be allowed to go out of range. - keep_within_range: Var[bool] + keep_within_range: Optional[Var[bool]] = None # The maximum value of the counter - max_: Var[Number] + max_: Optional[Var[Number]] = None # The minimum value of the counter - min_: Var[Number] + min_: Optional[Var[Number]] = None # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[LiteralInputVariant] + variant: Optional[Var[LiteralInputVariant]] = None # "lg" | "md" | "sm" | "xs" - size: Var[LiteralButtonSize] + size: Optional[Var[LiteralButtonSize]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/chakra/forms/pininput.py b/reflex/components/chakra/forms/pininput.py index d57c9acaf..1e54bdc04 100644 --- a/reflex/components/chakra/forms/pininput.py +++ b/reflex/components/chakra/forms/pininput.py @@ -18,49 +18,49 @@ class PinInput(ChakraComponent): tag = "PinInput" # State var to bind the the input. - value: Var[str] + value: Optional[Var[str]] = None # If true, the pin input receives focus on mount - auto_focus: Var[bool] + auto_focus: Optional[Var[bool]] = None # The default value of the pin input - default_value: Var[str] + default_value: Optional[Var[str]] = None # The border color when the input is invalid. - error_border_color: Var[str] + error_border_color: Optional[Var[str]] = None # The border color when the input is focused. - focus_border_color: Var[str] + focus_border_color: Optional[Var[str]] = None # The top-level id string that will be applied to the input fields. The index of the input will be appended to this top-level id. - id_: Var[str] + id_: Optional[Var[str]] = None # The length of the number input. - length: Var[int] + length: Optional[Var[int]] = None # If true, the pin input component is put in the disabled state - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the pin input component is put in the invalid state - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, focus will move automatically to the next input once filled - manage_focus: Var[bool] + manage_focus: Optional[Var[bool]] = None # If true, the input's value will be masked just like `type=password` - mask: Var[bool] + mask: Optional[Var[bool]] = None # The placeholder for the pin input - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # The type of values the pin-input should allow ("number" | "alphanumeric"). - type_: Var[str] + type_: Optional[Var[str]] = None # "outline" | "flushed" | "filled" | "unstyled" - variant: Var[LiteralInputVariant] + variant: Optional[Var[LiteralInputVariant]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def _get_imports(self) -> ImportDict: """Include PinInputField explicitly because it may not be a child component at compile time. @@ -171,7 +171,7 @@ class PinInputField(ChakraComponent): index: Optional[Var[int]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None @classmethod def for_length(cls, length: Var | int, **props) -> Var: diff --git a/reflex/components/chakra/forms/radio.py b/reflex/components/chakra/forms/radio.py index 67ad9200b..23213f6f5 100644 --- a/reflex/components/chakra/forms/radio.py +++ b/reflex/components/chakra/forms/radio.py @@ -1,7 +1,5 @@ """A radio component.""" - - -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union from reflex.components.chakra import ChakraComponent from reflex.components.chakra.typography.text import Text @@ -18,13 +16,13 @@ class RadioGroup(ChakraComponent): tag = "RadioGroup" # State var to bind the the input. - value: Var[Any] + value: Optional[Var[Any]] = None # The default value. - default_value: Var[Any] + default_value: Optional[Var[Any]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def get_event_triggers(self) -> Dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -65,31 +63,31 @@ class Radio(Text): tag = "Radio" # Value of radio. - value: Var[Any] + value: Optional[Var[Any]] = None # The default value. - default_value: Var[Any] + default_value: Optional[Var[Any]] = None # The color scheme. - color_scheme: Var[str] + color_scheme: Optional[Var[str]] = None # If true, the radio will be initially checked. - default_checked: Var[bool] + default_checked: Optional[Var[bool]] = None # If true, the radio will be checked. You'll need to pass onChange to update its value (since it is now controlled) - is_checked: Var[bool] + is_checked: Optional[Var[bool]] = None # If true, the radio will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the radio button will be invalid. This also sets `aria-invalid` to true. - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the radio will be read-only - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the radio button will be required. This also sets `aria-required` to true. - is_required: Var[bool] + is_required: Optional[Var[bool]] = None @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/chakra/forms/rangeslider.py b/reflex/components/chakra/forms/rangeslider.py index 6179f3646..c076dc885 100644 --- a/reflex/components/chakra/forms/rangeslider.py +++ b/reflex/components/chakra/forms/rangeslider.py @@ -16,37 +16,37 @@ class RangeSlider(ChakraComponent): tag = "RangeSlider" # State var to bind the the input. - value: Var[List[int]] + value: Optional[Var[List[int]]] = None # The default values. - default_value: Var[List[int]] + default_value: Optional[Var[List[int]]] = None # The writing mode ("ltr" | "rtl") - direction: Var[LiteralChakraDirection] + direction: Optional[Var[LiteralChakraDirection]] = None # If false, the slider handle will not capture focus when value changes. - focus_thumb_on_change: Var[bool] + focus_thumb_on_change: Optional[Var[bool]] = None # If true, the slider will be disabled - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the slider will be in `read-only` state. - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the value will be incremented or decremented in reverse. - is_reversed: Var[bool] + is_reversed: Optional[Var[bool]] = None # The minimum value of the slider. - min_: Var[int] + min_: Optional[Var[int]] = None # The maximum value of the slider. - max_: Var[int] + max_: Optional[Var[int]] = None # The minimum distance between slider thumbs. Useful for preventing the thumbs from being too close together. - min_steps_between_thumbs: Var[int] + min_steps_between_thumbs: Optional[Var[int]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -136,7 +136,7 @@ class RangeSliderThumb(ChakraComponent): tag = "RangeSliderThumb" # The position of the thumb. - index: Var[int] + index: Optional[Var[int]] = None def _get_ref_hook(self) -> Optional[str]: # hook is None because RangeSlider is handling it. diff --git a/reflex/components/chakra/forms/select.py b/reflex/components/chakra/forms/select.py index c898f40d9..906fbe12e 100644 --- a/reflex/components/chakra/forms/select.py +++ b/reflex/components/chakra/forms/select.py @@ -1,6 +1,5 @@ """A select component.""" - -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralInputVariant from reflex.components.chakra.typography.text import Text @@ -17,37 +16,37 @@ class Select(ChakraComponent): tag = "Select" # State var to bind the select. - value: Var[str] + value: Optional[Var[str]] = None # The default value of the select. - default_value: Var[str] + default_value: Optional[Var[str]] = None # The placeholder text. - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # The border color when the select is invalid. - error_border_color: Var[str] + error_border_color: Optional[Var[str]] = None # The border color when the select is focused. - focus_border_color: Var[str] + focus_border_color: Optional[Var[str]] = None # If true, the select will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the form control will be invalid. This has 2 side effects: - The FormLabel and FormErrorIcon will have `data-invalid` set to true - The form element (e.g, Input) will have `aria-invalid` set to true - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the form control will be required. This has 2 side effects: - The FormLabel will show a required indicator - The form element (e.g, Input) will have `aria-required` set to true - is_required: Var[bool] + is_required: Optional[Var[bool]] = None # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[LiteralInputVariant] + variant: Optional[Var[LiteralInputVariant]] = None # The size of the select. - size: Var[str] + size: Optional[Var[str]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def get_event_triggers(self) -> Dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -90,7 +89,7 @@ class Option(Text): tag = "option" - value: Var[Any] + value: Optional[Var[Any]] = None @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/chakra/forms/slider.py b/reflex/components/chakra/forms/slider.py index 69eb6ac9f..ce847ebd2 100644 --- a/reflex/components/chakra/forms/slider.py +++ b/reflex/components/chakra/forms/slider.py @@ -1,7 +1,7 @@ """A slider component.""" from __future__ import annotations -from typing import Any, Literal, Union +from typing import Any, Literal, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralChakraDirection from reflex.components.component import Component @@ -17,58 +17,58 @@ class Slider(ChakraComponent): tag = "Slider" # State var to bind the input. - value: Var[int] + value: Optional[Var[int]] = None # The color scheme. - color_scheme: Var[str] + color_scheme: Optional[Var[str]] = None # The placeholder text. - default_value: Var[int] + default_value: Optional[Var[int]] = None # The writing mode ("ltr" | "rtl") - direction: Var[LiteralChakraDirection] + direction: Optional[Var[LiteralChakraDirection]] = None # If false, the slider handle will not capture focus when value changes. - focus_thumb_on_change: Var[bool] + focus_thumb_on_change: Optional[Var[bool]] = None # If true, the slider will be disabled - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the slider will be in `read-only` state. - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the value will be incremented or decremented in reverse. - is_reversed: Var[bool] + is_reversed: Optional[Var[bool]] = None # The minimum value of the slider. - min_: Var[int] + min_: Optional[Var[int]] = None # The maximum value of the slider. - max_: Var[int] + max_: Optional[Var[int]] = None # The step in which increments/decrements have to be made - step: Var[int] + step: Optional[Var[int]] = None # The minimum distance between slider thumbs. Useful for preventing the thumbs from being too close together. - min_steps_between_thumbs: Var[int] + min_steps_between_thumbs: Optional[Var[int]] = None # Oreintation of the slider vertical | horizontal. - orientation: Var[LiteralLayout] + orientation: Optional[Var[LiteralLayout]] = None # Minimum height of the slider. - min_h: Var[str] + min_h: Optional[Var[str]] = None # Minimum width of the slider. - min_w: Var[str] + min_w: Optional[Var[str]] = None # Maximum height of the slider. - max_h: Var[str] + max_h: Optional[Var[str]] = None # Maximum width of the slider. - max_w: Var[str] + max_w: Optional[Var[str]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -124,7 +124,7 @@ class SliderThumb(ChakraComponent): tag = "SliderThumb" # The size of the thumb. - box_size: Var[str] + box_size: Optional[Var[str]] = None class SliderMark(ChakraComponent): diff --git a/reflex/components/chakra/forms/switch.py b/reflex/components/chakra/forms/switch.py index 6079de2bb..ca8dd3096 100644 --- a/reflex/components/chakra/forms/switch.py +++ b/reflex/components/chakra/forms/switch.py @@ -1,7 +1,7 @@ """A switch component.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralColorScheme from reflex.constants import EventTriggers @@ -14,37 +14,37 @@ class Switch(ChakraComponent): tag = "Switch" # If true, the switch will be checked. You'll need to set an on_change event handler to update its value (since it is now controlled) - is_checked: Var[bool] + is_checked: Optional[Var[bool]] = None # If true, the switch will be disabled - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true and is_disabled prop is set, the switch will remain tabbable but not interactive. - is_focusable: Var[bool] + is_focusable: Optional[Var[bool]] = None # If true, the switch is marked as invalid. Changes style of unchecked state. - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the switch will be readonly - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the switch will be required - is_required: Var[bool] + is_required: Optional[Var[bool]] = None # The name of the input field in a switch (Useful for form submission). - name: Var[str] + name: Optional[Var[str]] = None # The value of the input field when checked (use is_checked prop for a bool) value: Var[str] = Var.create(True) # type: ignore # The spacing between the switch and its label text (0.5rem) - spacing: Var[str] + spacing: Optional[Var[str]] = None # The placeholder text. - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # The color scheme of the switch (e.g. "blue", "green", "red", etc.) - color_scheme: Var[LiteralColorScheme] + color_scheme: Optional[Var[LiteralColorScheme]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/chakra/forms/textarea.py b/reflex/components/chakra/forms/textarea.py index ecbe15e1e..6ee816b08 100644 --- a/reflex/components/chakra/forms/textarea.py +++ b/reflex/components/chakra/forms/textarea.py @@ -1,7 +1,7 @@ """A textarea component.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralInputVariant from reflex.components.component import Component @@ -16,37 +16,37 @@ class TextArea(ChakraComponent): tag = "Textarea" # State var to bind the input. - value: Var[str] + value: Optional[Var[str]] = None # The default value of the textarea. - default_value: Var[str] + default_value: Optional[Var[str]] = None # The placeholder text. - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # The border color when the input is invalid. - error_border_color: Var[str] + error_border_color: Optional[Var[str]] = None # The border color when the input is focused. - focus_border_color: Var[str] + focus_border_color: Optional[Var[str]] = None # If true, the form control will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the form control will be invalid. - is_invalid: Var[bool] + is_invalid: Optional[Var[bool]] = None # If true, the form control will be read-only. - is_read_only: Var[bool] + is_read_only: Optional[Var[bool]] = None # If true, the form control will be required. - is_required: Var[bool] + is_required: Optional[Var[bool]] = None # "outline" | "filled" | "flushed" | "unstyled" - variant: Var[LiteralInputVariant] + variant: Optional[Var[LiteralInputVariant]] = None # The name of the form field - name: Var[str] + name: Optional[Var[str]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/chakra/layout/aspect_ratio.py b/reflex/components/chakra/layout/aspect_ratio.py index 5d0328d7e..f8d1c1530 100644 --- a/reflex/components/chakra/layout/aspect_ratio.py +++ b/reflex/components/chakra/layout/aspect_ratio.py @@ -1,4 +1,5 @@ """A AspectRatio component.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -10,4 +11,4 @@ class AspectRatio(ChakraComponent): tag = "AspectRatio" # The aspect ratio of the Box - ratio: Var[float] + ratio: Optional[Var[float]] = None diff --git a/reflex/components/chakra/layout/box.py b/reflex/components/chakra/layout/box.py index 497e514b8..e898af144 100644 --- a/reflex/components/chakra/layout/box.py +++ b/reflex/components/chakra/layout/box.py @@ -1,4 +1,5 @@ """A box component that can contain other components.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.components.tags import Tag @@ -11,13 +12,13 @@ class Box(ChakraComponent): tag = "Box" # The type element to render. You can specify an image, video, or any other HTML element such as iframe. - element: Var[str] + element: Optional[Var[str]] = None # The source of the content. - src: Var[str] + src: Optional[Var[str]] = None # The alt text of the content. - alt: Var[str] + alt: Optional[Var[str]] = None def _render(self) -> Tag: return ( diff --git a/reflex/components/chakra/layout/card.py b/reflex/components/chakra/layout/card.py index 595c5327f..9ea3d0621 100644 --- a/reflex/components/chakra/layout/card.py +++ b/reflex/components/chakra/layout/card.py @@ -1,5 +1,4 @@ """Chakra Card component.""" - from typing import Optional from reflex.components.chakra import ( @@ -36,30 +35,30 @@ class Card(ChakraComponent): tag = "Card" # [required] The flex alignment of the card - align: Var[str] + align: Optional[Var[str]] = None # [required] The flex direction of the card - direction: Var[str] + direction: Optional[Var[str]] = None # [required] The flex distribution of the card - justify: Var[str] + justify: Optional[Var[str]] = None # The visual color appearance of the component. # options: "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | # "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" | # "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" # default: "gray" - color_scheme: Var[LiteralColorScheme] + color_scheme: Optional[Var[LiteralColorScheme]] = None # The size of the Card # options: "sm" | "md" | "lg" # default: "md" - size: Var[LiteralTagSize] + size: Optional[Var[LiteralTagSize]] = None # The variant of the Card # options: "elevated" | "outline" | "filled" | "unstyled" # default: "elevated" - variant: Var[LiteralCardVariant] + variant: Optional[Var[LiteralCardVariant]] = None @classmethod def create( diff --git a/reflex/components/chakra/layout/container.py b/reflex/components/chakra/layout/container.py index 26863d018..4273d7747 100644 --- a/reflex/components/chakra/layout/container.py +++ b/reflex/components/chakra/layout/container.py @@ -1,4 +1,5 @@ """A flexbox container.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -10,4 +11,4 @@ class Container(ChakraComponent): tag = "Container" # If true, container will center its children regardless of their width. - center_content: Var[bool] + center_content: Optional[Var[bool]] = None diff --git a/reflex/components/chakra/layout/flex.py b/reflex/components/chakra/layout/flex.py index ff6e5abce..306f0984d 100644 --- a/reflex/components/chakra/layout/flex.py +++ b/reflex/components/chakra/layout/flex.py @@ -1,6 +1,5 @@ """A reflexive container component.""" - -from typing import List, Union +from typing import List, Optional, Union from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -12,22 +11,22 @@ class Flex(ChakraComponent): tag = "Flex" # How to align items in the flex. - align: Var[str] + align: Optional[Var[str]] = None # Shorthand for flexBasis style prop - basis: Var[str] + basis: Optional[Var[str]] = None # Shorthand for flexDirection style prop - direction: Var[Union[str, List[str]]] + direction: Optional[Var[Union[str, List[str]]]] = None # Shorthand for flexGrow style prop - grow: Var[str] + grow: Optional[Var[str]] = None # The way to justify the items. - justify: Var[str] + justify: Optional[Var[str]] = None # Shorthand for flexWrap style prop - wrap: Var[Union[str, List[str]]] + wrap: Optional[Var[Union[str, List[str]]]] = None # Shorthand for flexShrink style prop - shrink: Var[str] + shrink: Optional[Var[str]] = None diff --git a/reflex/components/chakra/layout/grid.py b/reflex/components/chakra/layout/grid.py index ee1d8aa33..6cfda018a 100644 --- a/reflex/components/chakra/layout/grid.py +++ b/reflex/components/chakra/layout/grid.py @@ -1,6 +1,5 @@ """Container to stack elements with spacing.""" - -from typing import List +from typing import List, Optional from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -13,32 +12,32 @@ class Grid(ChakraComponent): # Shorthand prop for gridAutoColumns to provide automatic column sizing based on content. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns)_ - auto_columns: Var[str] + auto_columns: Optional[Var[str]] = None # Shorthand prop for gridAutoFlow to specify exactly how # auto-placed items get flowed into the grid. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow)_ - auto_flow: Var[str] + auto_flow: Optional[Var[str]] = None # Shorthand prop for gridAutoRows. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows)_ - auto_rows: Var[str] + auto_rows: Optional[Var[str]] = None # Shorthand prop for gridColumn. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column)_ - column: Var[str] + column: Optional[Var[str]] = None # Shorthand prop for gridRow. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)_ - row: Var[str] + row: Optional[Var[str]] = None # Shorthand prop for gridTemplateColumns. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns)_ - template_columns: Var[str] + template_columns: Optional[Var[str]] = None # Shorthand prop for gridTemplateRows. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows)_ - template_rows: Var[str] + template_rows: Optional[Var[str]] = None class GridItem(ChakraComponent): @@ -48,27 +47,27 @@ class GridItem(ChakraComponent): # Shorthand prop for gridArea # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area)_ - area: Var[str] + area: Optional[Var[str]] = None # Shorthand prop for gridColumnEnd # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column-end)_ - col_end: Var[str] + col_end: Optional[Var[str]] = None # The column number the grid item should start. - col_start: Var[int] + col_start: Optional[Var[int]] = None # The number of columns the grid item should span. - col_span: Var[int] + col_span: Optional[Var[int]] = None # Shorthand prop for gridRowEnd # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row-end)_ - row_end: Var[str] + row_end: Optional[Var[str]] = None # The row number the grid item should start. - row_start: Var[int] + row_start: Optional[Var[int]] = None # The number of rows the grid item should span. - row_span: Var[int] + row_span: Optional[Var[int]] = None class ResponsiveGrid(ChakraComponent): @@ -78,48 +77,48 @@ class ResponsiveGrid(ChakraComponent): # Shorthand prop for gridAutoColumns to provide automatic column sizing based on content. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns)_ - auto_columns: Var[str] + auto_columns: Optional[Var[str]] = None # Shorthand prop for gridAutoFlow to specify exactly how # auto-placed items get flowed into the grid. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow)_ - auto_flow: Var[str] + auto_flow: Optional[Var[str]] = None # Shorthand prop for gridAutoRows. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows)_ - auto_rows: Var[str] + auto_rows: Optional[Var[str]] = None # Shorthand prop for gridColumn. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column)_ - column: Var[str] + column: Optional[Var[str]] = None # Shorthand prop for gridRow. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row)_ - row: Var[str] + row: Optional[Var[str]] = None # A list that defines the number of columns for each breakpoint. - columns: Var[List[int]] + columns: Optional[Var[List[int]]] = None # The width at which child elements will break into columns. Pass a number for pixel values or a string for any other valid CSS length. - min_child_width: Var[str] + min_child_width: Optional[Var[str]] = None # The gap between the grid items - spacing: Var[str] + spacing: Optional[Var[str]] = None # The column gap between the grid items - spacing_x: Var[str] + spacing_x: Optional[Var[str]] = None # The row gap between the grid items - spacing_y: Var[str] + spacing_y: Optional[Var[str]] = None # Shorthand prop for gridTemplateAreas # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas)_ - template_areas: Var[str] + template_areas: Optional[Var[str]] = None # Shorthand prop for gridTemplateColumns. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns)_ - template_columns: Var[str] + template_columns: Optional[Var[str]] = None # Shorthand prop for gridTemplateRows. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows)_ - template_rows: Var[str] + template_rows: Optional[Var[str]] = None diff --git a/reflex/components/chakra/layout/stack.py b/reflex/components/chakra/layout/stack.py index 8e2ab34e6..b37e7caa3 100644 --- a/reflex/components/chakra/layout/stack.py +++ b/reflex/components/chakra/layout/stack.py @@ -1,6 +1,5 @@ """Container to stack elements with spacing.""" - -from typing import List, Union +from typing import List, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralStackDirection from reflex.vars import Var @@ -12,28 +11,28 @@ class Stack(ChakraComponent): tag = "Stack" # Shorthand for alignItems style prop - align_items: Var[str] + align_items: Optional[Var[str]] = None # The direction to stack the items. - direction: Var[Union[LiteralStackDirection, List[str]]] + direction: Optional[Var[Union[LiteralStackDirection, List[str]]]] = None # If true the items will be stacked horizontally. - is_inline: Var[bool] + is_inline: Optional[Var[bool]] = None # Shorthand for justifyContent style prop - justify_content: Var[str] + justify_content: Optional[Var[str]] = None # If true, the children will be wrapped in a Box, and the Box will take the spacing props - should_wrap_children: Var[bool] + should_wrap_children: Optional[Var[bool]] = None # The space between each stack item - spacing: Var[str] + spacing: Optional[Var[str]] = None # Shorthand for flexWrap style prop - wrap: Var[str] + wrap: Optional[Var[str]] = None # Alignment of contents. - justify: Var[str] + justify: Optional[Var[str]] = None class Hstack(Stack): diff --git a/reflex/components/chakra/layout/wrap.py b/reflex/components/chakra/layout/wrap.py index 5d436c5b2..e72f4fc12 100644 --- a/reflex/components/chakra/layout/wrap.py +++ b/reflex/components/chakra/layout/wrap.py @@ -1,4 +1,5 @@ """Container to stack elements with spacing.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.components.component import Component @@ -11,25 +12,25 @@ class Wrap(ChakraComponent): tag = "Wrap" # How to align the items. - align: Var[str] + align: Optional[Var[str]] = None # The flex direction of the wrap. - direction: Var[str] + direction: Optional[Var[str]] = None # How to justify the items. - justify: Var[str] + justify: Optional[Var[str]] = None # Whether to wrap children in `rx.wrap_item`. - should_wrap_children: Var[bool] + should_wrap_children: Optional[Var[bool]] = None # The spacing between the items. - spacing: Var[str] + spacing: Optional[Var[str]] = None # The horizontal spacing between the items. - spacing_x: Var[str] + spacing_x: Optional[Var[str]] = None # The vertical spacing between the items. - spacing_y: Var[str] + spacing_y: Optional[Var[str]] = None @classmethod def create(cls, *children, items=None, **props) -> Component: diff --git a/reflex/components/chakra/media/avatar.py b/reflex/components/chakra/media/avatar.py index 80a0b7174..d13bee75f 100644 --- a/reflex/components/chakra/media/avatar.py +++ b/reflex/components/chakra/media/avatar.py @@ -1,7 +1,7 @@ """Avatar components.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralAvatarSize from reflex.vars import Var @@ -13,28 +13,28 @@ class Avatar(ChakraComponent): tag = "Avatar" # The default avatar used as fallback when name, and src is not specified. - icon: Var[str] + icon: Optional[Var[str]] = None # The label of the icon. - icon_label: Var[str] + icon_label: Optional[Var[str]] = None # If true, opt out of the avatar's fallback logic and renders the img at all times. - ignore_fallback: Var[bool] + ignore_fallback: Optional[Var[bool]] = None # The name of the person in the avatar. - name: Var[str] + name: Optional[Var[str]] = None # If true, the Avatar will show a border around it. Best for a group of avatars. - show_border: Var[bool] + show_border: Optional[Var[bool]] = None # The image url of the Avatar. - src: Var[str] + src: Optional[Var[str]] = None # List of sources to use for different screen resolutions. - src_set: Var[str] + src_set: Optional[Var[str]] = None # "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full" - size: Var[LiteralAvatarSize] + size: Optional[Var[LiteralAvatarSize]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. @@ -60,7 +60,7 @@ class AvatarGroup(ChakraComponent): tag = "AvatarGroup" # The maximum number of visible avatars. - max_: Var[int] + max_: Optional[Var[int]] = None # The space between the avatars in the group. - spacing: Var[int] + spacing: Optional[Var[int]] = None diff --git a/reflex/components/chakra/media/image.py b/reflex/components/chakra/media/image.py index 2b1a4e26f..6a2dd6e9a 100644 --- a/reflex/components/chakra/media/image.py +++ b/reflex/components/chakra/media/image.py @@ -14,40 +14,40 @@ class Image(ChakraComponent): tag = "Image" alias = "ChakraImage" # How to align the image within its bounds. It maps to css `object-position` property. - align: Var[str] + align: Optional[Var[str]] = None # Fallback Reflex component to show if image is loading or image fails. fallback: Optional[Component] = None # Fallback image src to show if image is loading or image fails. - fallback_src: Var[str] + fallback_src: Optional[Var[str]] = None # How the image to fit within its bounds. It maps to css `object-fit` property. - fit: Var[str] + fit: Optional[Var[str]] = None # The native HTML height attribute to the passed to the img. - html_height: Var[str] + html_height: Optional[Var[str]] = None # The native HTML width attribute to the passed to the img. - html_width: Var[str] + html_width: Optional[Var[str]] = None # If true, opt out of the fallbackSrc logic and use as img. - ignore_fallback: Var[bool] + ignore_fallback: Optional[Var[bool]] = None # "eager" | "lazy" - loading: Var[LiteralImageLoading] + loading: Optional[Var[LiteralImageLoading]] = None # The path/url to the image or PIL image object. - src: Var[Any] + src: Optional[Var[Any]] = None # The alt text of the image. - alt: Var[str] + alt: Optional[Var[str]] = None # Provide multiple sources for an image, allowing the browser # to select the most appropriate source based on factors like # screen resolution and device capabilities. # Learn more _[here](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)_ - src_set: Var[str] + src_set: Optional[Var[str]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. diff --git a/reflex/components/chakra/navigation/breadcrumb.py b/reflex/components/chakra/navigation/breadcrumb.py index 7c902bf1a..57e7d2cdc 100644 --- a/reflex/components/chakra/navigation/breadcrumb.py +++ b/reflex/components/chakra/navigation/breadcrumb.py @@ -1,4 +1,5 @@ """Breadcrumb components.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.components.chakra.navigation.link import Link @@ -13,10 +14,10 @@ class Breadcrumb(ChakraComponent): tag = "Breadcrumb" # The visual separator between each breadcrumb item - separator: Var[str] + separator: Optional[Var[str]] = None # The left and right margin applied to the separator - separator_margin: Var[str] + separator_margin: Optional[Var[str]] = None @classmethod def create(cls, *children, items=None, **props) -> Component: @@ -54,16 +55,16 @@ class BreadcrumbItem(ChakraComponent): tag = "BreadcrumbItem" # Is the current page of the breadcrumb. - is_current_page: Var[bool] + is_current_page: Optional[Var[bool]] = None # Is the last child of the breadcrumb. - is_last_child: Var[bool] + is_last_child: Optional[Var[bool]] = None # The visual separator between each breadcrumb item - separator: Var[str] + separator: Optional[Var[str]] = None # The left and right margin applied to the separator - spacing: Var[str] + spacing: Optional[Var[str]] = None @classmethod def create(cls, *children, label=None, href=None, **props): @@ -95,4 +96,4 @@ class BreadcrumbLink(Link): tag = "BreadcrumbLink" # Is the current page of the breadcrumb. - is_current_page: Var[bool] + is_current_page: Optional[Var[bool]] = None diff --git a/reflex/components/chakra/navigation/link.py b/reflex/components/chakra/navigation/link.py index a524202df..e1422b18a 100644 --- a/reflex/components/chakra/navigation/link.py +++ b/reflex/components/chakra/navigation/link.py @@ -1,5 +1,5 @@ """A link component.""" - +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.components.component import Component @@ -16,19 +16,19 @@ class Link(ChakraComponent): tag = "Link" # The rel. - rel: Var[str] + rel: Optional[Var[str]] = None # The page to link to. - href: Var[str] + href: Optional[Var[str]] = None # The text to display. - text: Var[str] + text: Optional[Var[str]] = None # What the link renders to. as_: Var[str] = BaseVar.create(value="{NextLink}", _var_is_local=False) # type: ignore # If true, the link will open in new tab. - is_external: Var[bool] + is_external: Optional[Var[bool]] = None def _get_imports(self) -> imports.ImportDict: return {**super()._get_imports(), **next_link._get_imports()} diff --git a/reflex/components/chakra/navigation/linkoverlay.py b/reflex/components/chakra/navigation/linkoverlay.py index 370e3df48..5fe8134cf 100644 --- a/reflex/components/chakra/navigation/linkoverlay.py +++ b/reflex/components/chakra/navigation/linkoverlay.py @@ -1,4 +1,5 @@ """Link overlay components.""" +from typing import Optional from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -10,10 +11,10 @@ class LinkOverlay(ChakraComponent): tag = "LinkOverlay" # If true, the link will open in new tab - is_external: Var[bool] + is_external: Optional[Var[bool]] = None # Href of the link overlay. - href: Var[str] + href: Optional[Var[str]] = None class LinkBox(ChakraComponent): diff --git a/reflex/components/chakra/navigation/stepper.py b/reflex/components/chakra/navigation/stepper.py index 7c47760e5..1a2f40270 100644 --- a/reflex/components/chakra/navigation/stepper.py +++ b/reflex/components/chakra/navigation/stepper.py @@ -1,5 +1,4 @@ """A component to indicate progress through a multi-step process.""" - from typing import List, Literal, Optional, Tuple from reflex.components.chakra import ChakraComponent, LiteralColorScheme @@ -12,19 +11,19 @@ class Stepper(ChakraComponent): tag = "Stepper" - orientation: Var[Literal["vertical", "horizontal"]] + orientation: Optional[Var[Literal["vertical", "horizontal"]]] = None # The color scheme to use for the stepper; default is blue. - colorScheme: Var[LiteralColorScheme] + colorScheme: Optional[Var[LiteralColorScheme]] = None # Chakra provides a useSteps hook to control the stepper. # Instead, use an integer state value to set progress in the stepper. # The index of the current step. - index: Var[int] + index: Optional[Var[int]] = None # The size of the steps in the stepper. - size: Var[str] + size: Optional[Var[str]] = None @classmethod def create( @@ -98,11 +97,11 @@ class StepStatus(ChakraComponent): # active, complete, and incomplete should also be able to accept StepIcon or StepNumber components # currently, these props only support strings - active: Var[str] + active: Optional[Var[str]] = None - complete: Var[str] + complete: Optional[Var[str]] = None - incomplete: Var[str] + incomplete: Optional[Var[str]] = None tag = "StepStatus" diff --git a/reflex/components/chakra/overlay/alertdialog.py b/reflex/components/chakra/overlay/alertdialog.py index 48829c5ff..d394a30c1 100644 --- a/reflex/components/chakra/overlay/alertdialog.py +++ b/reflex/components/chakra/overlay/alertdialog.py @@ -1,7 +1,7 @@ """Alert dialog components.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralAlertDialogSize from reflex.components.chakra.media.icon import Icon @@ -15,43 +15,43 @@ class AlertDialog(ChakraComponent): tag = "AlertDialog" # If true, the modal will be open. - is_open: Var[bool] + is_open: Optional[Var[bool]] = None # The least destructive element to focus when the dialog opens. - least_destructive_ref: Var[str] + least_destructive_ref: Optional[Var[str]] = None # Handle zoom/pinch gestures on iOS devices when scroll locking is enabled. Defaults to false. - allow_pinch_zoom: Var[bool] + allow_pinch_zoom: Optional[Var[bool]] = None # If true, the modal will autofocus the first enabled and interactive element within the ModalContent - auto_focus: Var[bool] + auto_focus: Optional[Var[bool]] = None # If true, scrolling will be disabled on the body when the modal opens. - block_scroll_on_mount: Var[bool] + block_scroll_on_mount: Optional[Var[bool]] = None # If true, the modal will close when the Esc key is pressed - close_on_esc: Var[bool] + close_on_esc: Optional[Var[bool]] = None # If true, the modal will close when the overlay is clicked - close_on_overlay_click: Var[bool] + close_on_overlay_click: Optional[Var[bool]] = None # If true, the modal will be centered on screen. - is_centered: Var[bool] + is_centered: Optional[Var[bool]] = None # Enables aggressive focus capturing within iframes. If true, keep focus in the lock, no matter where lock is active. If false, allows focus to move outside of iframe. - lock_focus_across_frames: Var[bool] + lock_focus_across_frames: Optional[Var[bool]] = None # If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens - preserve_scroll_bar_gap: Var[bool] + preserve_scroll_bar_gap: Optional[Var[bool]] = None # If true, the modal will return focus to the element that triggered it when it closes. - return_focus_on_close: Var[bool] + return_focus_on_close: Optional[Var[bool]] = None # "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full" - size: Var[LiteralAlertDialogSize] + size: Optional[Var[LiteralAlertDialogSize]] = None # If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert** - use_inert: Var[bool] + use_inert: Optional[Var[bool]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. diff --git a/reflex/components/chakra/overlay/drawer.py b/reflex/components/chakra/overlay/drawer.py index 7d317fe9c..8d9159930 100644 --- a/reflex/components/chakra/overlay/drawer.py +++ b/reflex/components/chakra/overlay/drawer.py @@ -1,7 +1,7 @@ """Container to stack elements with spacing.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ( ChakraComponent, @@ -19,55 +19,55 @@ class Drawer(ChakraComponent): tag = "Drawer" # If true, the modal will be open. - is_open: Var[bool] + is_open: Optional[Var[bool]] = None # Handle zoom/pinch gestures on iOS devices when scroll locking is enabled. Defaults to false. - allow_pinch_zoom: Var[bool] + allow_pinch_zoom: Optional[Var[bool]] = None # If true, the modal will autofocus the first enabled and interactive element within the ModalContent - auto_focus: Var[bool] + auto_focus: Optional[Var[bool]] = None # If true, scrolling will be disabled on the body when the modal opens. - block_scroll_on_mount: Var[bool] + block_scroll_on_mount: Optional[Var[bool]] = None # If true, the modal will close when the Esc key is pressed - close_on_esc: Var[bool] + close_on_esc: Optional[Var[bool]] = None # If true, the modal will close when the overlay is clicked - close_on_overlay_click: Var[bool] + close_on_overlay_click: Optional[Var[bool]] = None # If true, the modal will be centered on screen. - is_centered: Var[bool] + is_centered: Optional[Var[bool]] = None # If true and drawer's placement is top or bottom, the drawer will occupy the viewport height (100vh) - is_full_height: Var[bool] + is_full_height: Optional[Var[bool]] = None # Enables aggressive focus capturing within iframes. - If true: keep focus in the lock, no matter where lock is active - If false: allows focus to move outside of iframe - lock_focus_across_frames: Var[bool] + lock_focus_across_frames: Optional[Var[bool]] = None # The placement of the drawer - placement: Var[str] + placement: Optional[Var[str]] = None # If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens - preserve_scroll_bar_gap: Var[bool] + preserve_scroll_bar_gap: Optional[Var[bool]] = None # If true, the modal will return focus to the element that triggered it when it closes. - return_focus_on_close: Var[bool] + return_focus_on_close: Optional[Var[bool]] = None # "xs" | "sm" | "md" | "lg" | "xl" | "full" - size: Var[LiteralDrawerSize] + size: Optional[Var[LiteralDrawerSize]] = None # A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert** - use_inert: Var[bool] + use_inert: Optional[Var[bool]] = None # Variant of drawer - variant: Var[str] + variant: Optional[Var[str]] = None # Color scheme of the Drawer # Options: # "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" # | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" - color_scheme: Var[LiteralColorScheme] + color_scheme: Optional[Var[LiteralColorScheme]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. diff --git a/reflex/components/chakra/overlay/menu.py b/reflex/components/chakra/overlay/menu.py index 1401fce7c..74a42f44c 100644 --- a/reflex/components/chakra/overlay/menu.py +++ b/reflex/components/chakra/overlay/menu.py @@ -20,52 +20,52 @@ class Menu(ChakraComponent): tag = "Menu" # The padding required to prevent the arrow from reaching the very edge of the popper. - arrow_padding: Var[int] + arrow_padding: Optional[Var[int]] = None # If true, the first enabled menu item will receive focus and be selected when the menu opens. - auto_select: Var[bool] + auto_select: Optional[Var[bool]] = None # The boundary area for the popper. Used within the preventOverflow modifier - boundary: Var[str] + boundary: Optional[Var[str]] = None # If true, the menu will close when you click outside the menu list - close_on_blur: Var[bool] + close_on_blur: Optional[Var[bool]] = None # If true, the menu will close when a menu item is clicked - close_on_select: Var[bool] + close_on_select: Optional[Var[bool]] = None # If by default the menu is open. - default_is_open: Var[bool] + default_is_open: Optional[Var[bool]] = None # If rtl, popper placement positions will be flipped i.e. 'top-right' will become 'top-left' and vice-verse ("ltr" | "rtl") - direction: Var[LiteralChakraDirection] + direction: Optional[Var[LiteralChakraDirection]] = None # If true, the popper will change its placement and flip when it's about to overflow its boundary area. - flip: Var[bool] + flip: Optional[Var[bool]] = None # The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter. - gutter: Var[int] + gutter: Optional[Var[int]] = None # Performance 🚀: If true, the MenuItem rendering will be deferred until the menu is open. - is_lazy: Var[bool] + is_lazy: Optional[Var[bool]] = None # Performance 🚀: The lazy behavior of menu's content when not visible. Only works when `isLazy={true}` - "unmount": The menu's content is always unmounted when not open. - "keepMounted": The menu's content initially unmounted, but stays mounted when menu is open. - lazy_behavior: Var[str] + lazy_behavior: Optional[Var[str]] = None # Determines if the menu is open or not. - is_open: Var[bool] + is_open: Optional[Var[bool]] = None # If true, the popper will match the width of the reference at all times. It's useful for autocomplete, `date-picker` and select patterns. - match_width: Var[bool] + match_width: Optional[Var[bool]] = None # The placement of the popper relative to its reference. - placement: Var[str] + placement: Optional[Var[str]] = None # If true, will prevent the popper from being cut off and ensure it's visible within the boundary area. - prevent_overflow: Var[bool] + prevent_overflow: Optional[Var[bool]] = None # The CSS positioning strategy to use. ("fixed" | "absolute") - strategy: Var[LiteralMenuStrategy] + strategy: Optional[Var[LiteralMenuStrategy]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. @@ -118,13 +118,13 @@ class MenuButton(ChakraComponent): tag = "MenuButton" # The variant of the menu button. - variant: Var[str] + variant: Optional[Var[str]] = None # Components that are not allowed as children. _invalid_children: List[str] = ["Button", "MenuButton"] # The tag to use for the menu button. - as_: Var[str] + as_: Optional[Var[str]] = None class MenuList(ChakraComponent): @@ -160,19 +160,19 @@ class MenuItem(ChakraComponent): tag = "MenuItem" # Overrides the parent menu's closeOnSelect prop. - close_on_select: Var[bool] + close_on_select: Optional[Var[bool]] = None # Right-aligned label text content, useful for displaying hotkeys. - command: Var[str] + command: Optional[Var[str]] = None # The spacing between the command and menu item's label. - command_spacing: Var[int] + command_spacing: Optional[Var[int]] = None # If true, the menuitem will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true and the menuitem is disabled, it'll remain keyboard-focusable - is_focusable: Var[bool] + is_focusable: Optional[Var[bool]] = None class MenuItemOption(ChakraComponent): @@ -181,28 +181,28 @@ class MenuItemOption(ChakraComponent): tag = "MenuItemOption" # Overrides the parent menu's closeOnSelect prop. - close_on_select: Var[bool] + close_on_select: Optional[Var[bool]] = None # Right-aligned label text content, useful for displaying hotkeys. - command: Var[str] + command: Optional[Var[str]] = None # The spacing between the command and menu item's label. - command_spacing: Var[int] + command_spacing: Optional[Var[int]] = None # Determines if menu item is checked. - is_checked: Var[bool] + is_checked: Optional[Var[bool]] = None # If true, the menuitem will be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true and the menuitem is disabled, it'll remain keyboard-focusable - is_focusable: Var[bool] + is_focusable: Optional[Var[bool]] = None # "checkbox" | "radio" - type_: Var[LiteralMenuOption] + type_: Optional[Var[LiteralMenuOption]] = None # Value of the menu item. - value: Var[str] + value: Optional[Var[str]] = None class MenuGroup(ChakraComponent): @@ -217,10 +217,10 @@ class MenuOptionGroup(ChakraComponent): tag = "MenuOptionGroup" # "checkbox" | "radio" - type_: Var[LiteralMenuOption] + type_: Optional[Var[LiteralMenuOption]] = None # Value of the option group. - value: Var[str] + value: Optional[Var[str]] = None class MenuDivider(ChakraComponent): diff --git a/reflex/components/chakra/overlay/modal.py b/reflex/components/chakra/overlay/modal.py index 78b8a8164..450706e13 100644 --- a/reflex/components/chakra/overlay/modal.py +++ b/reflex/components/chakra/overlay/modal.py @@ -17,43 +17,43 @@ class Modal(ChakraComponent): tag = "Modal" # If true, the modal will be open. - is_open: Var[bool] + is_open: Optional[Var[bool]] = None # Handle zoom/pinch gestures on iOS devices when scroll locking is enabled. Defaults to false. - allow_pinch_zoom: Var[bool] + allow_pinch_zoom: Optional[Var[bool]] = None # If true, the modal will autofocus the first enabled and interactive element within the ModalContent - auto_focus: Var[bool] + auto_focus: Optional[Var[bool]] = None # If true, scrolling will be disabled on the body when the modal opens. - block_scroll_on_mount: Var[bool] + block_scroll_on_mount: Optional[Var[bool]] = None # If true, the modal will close when the Esc key is pressed - close_on_esc: Var[bool] + close_on_esc: Optional[Var[bool]] = None # If true, the modal will close when the overlay is clicked - close_on_overlay_click: Var[bool] + close_on_overlay_click: Optional[Var[bool]] = None # If true, the modal will be centered on screen. - is_centered: Var[bool] + is_centered: Optional[Var[bool]] = None # Enables aggressive focus capturing within iframes. - If true: keep focus in the lock, no matter where lock is active - If false: allows focus to move outside of iframe - lock_focus_across_frames: Var[bool] + lock_focus_across_frames: Optional[Var[bool]] = None # The transition that should be used for the modal - motion_preset: Var[str] + motion_preset: Optional[Var[str]] = None # If true, a `padding-right` will be applied to the body element that's equal to the width of the scrollbar. This can help prevent some unpleasant flickering effect and content adjustment when the modal opens - preserve_scroll_bar_gap: Var[bool] + preserve_scroll_bar_gap: Optional[Var[bool]] = None # If true, the modal will return focus to the element that triggered it when it closes. - return_focus_on_close: Var[bool] + return_focus_on_close: Optional[Var[bool]] = None # "xs" | "sm" | "md" | "lg" | "xl" | "full" - size: Var[ModalSizes] + size: Optional[Var[ModalSizes]] = None # A11y: If true, the siblings of the modal will have `aria-hidden` set to true so that screen readers can only see the modal. This is commonly known as making the other elements **inert** - use_inert: Var[bool] + use_inert: Optional[Var[bool]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. diff --git a/reflex/components/chakra/overlay/popover.py b/reflex/components/chakra/overlay/popover.py index 7e1fa3e99..db20efa16 100644 --- a/reflex/components/chakra/overlay/popover.py +++ b/reflex/components/chakra/overlay/popover.py @@ -1,7 +1,7 @@ """Popover components.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ( ChakraComponent, @@ -19,67 +19,67 @@ class Popover(ChakraComponent): tag = "Popover" # The padding required to prevent the arrow from reaching the very edge of the popper. - arrow_padding: Var[int] + arrow_padding: Optional[Var[int]] = None # The `box-shadow` of the popover arrow - arrow_shadow_color: Var[str] + arrow_shadow_color: Optional[Var[str]] = None # The size of the popover arrow - arrow_size: Var[int] + arrow_size: Optional[Var[int]] = None # If true, focus will be transferred to the first interactive element when the popover opens - auto_focus: Var[bool] + auto_focus: Optional[Var[bool]] = None # The boundary area for the popper. Used within the preventOverflow modifier - boundary: Var[str] + boundary: Optional[Var[str]] = None # If true, the popover will close when you blur out it by clicking outside or tabbing out - close_on_blur: Var[bool] + close_on_blur: Optional[Var[bool]] = None # If true, the popover will close when you hit the Esc key - close_on_esc: Var[bool] + close_on_esc: Optional[Var[bool]] = None # If true, the popover will be initially opened. - default_is_open: Var[bool] + default_is_open: Optional[Var[bool]] = None # Theme direction ltr or rtl. Popper's placement will be set accordingly - direction: Var[LiteralChakraDirection] + direction: Optional[Var[LiteralChakraDirection]] = None # If true, the popper will change its placement and flip when it's about to overflow its boundary area. - flip: Var[bool] + flip: Optional[Var[bool]] = None # The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter. - gutter: Var[int] + gutter: Optional[Var[int]] = None # The html id attribute of the popover. If not provided, we generate a unique id. This id is also used to auto-generate the `aria-labelledby` and `aria-describedby` attributes that points to the PopoverHeader and PopoverBody - id_: Var[str] + id_: Optional[Var[str]] = None # Performance 🚀: If true, the PopoverContent rendering will be deferred until the popover is open. - is_lazy: Var[bool] + is_lazy: Optional[Var[bool]] = None # Performance 🚀: The lazy behavior of popover's content when not visible. Only works when `isLazy={true}` - "unmount": The popover's content is always unmounted when not open. - "keepMounted": The popover's content initially unmounted, but stays mounted when popover is open. - lazy_behavior: Var[str] + lazy_behavior: Optional[Var[str]] = None # If true, the popover will be opened in controlled mode. - is_open: Var[bool] + is_open: Optional[Var[bool]] = None # If true, the popper will match the width of the reference at all times. It's useful for autocomplete, `date-picker` and select patterns. - match_width: Var[bool] + match_width: Optional[Var[bool]] = None # The placement of the popover. It's used internally by Popper.js. - placement: Var[str] + placement: Optional[Var[str]] = None # If true, will prevent the popper from being cut off and ensure it's visible within the boundary area. - prevent_overflow: Var[bool] + prevent_overflow: Optional[Var[bool]] = None # If true, focus will be returned to the element that triggers the popover when it closes - return_focus_on_close: Var[bool] + return_focus_on_close: Optional[Var[bool]] = None # The CSS positioning strategy to use. ("fixed" | "absolute") - strategy: Var[LiteralMenuStrategy] + strategy: Optional[Var[LiteralMenuStrategy]] = None # The interaction that triggers the popover. hover - means the popover will open when you hover with mouse or focus with keyboard on the popover trigger click - means the popover will open on click or press Enter to Space on keyboard ("click" | "hover") - trigger: Var[LiteralPopOverTrigger] + trigger: Optional[Var[LiteralPopOverTrigger]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. diff --git a/reflex/components/chakra/overlay/tooltip.py b/reflex/components/chakra/overlay/tooltip.py index bd3a062c6..eec1205f3 100644 --- a/reflex/components/chakra/overlay/tooltip.py +++ b/reflex/components/chakra/overlay/tooltip.py @@ -1,7 +1,7 @@ """Tooltip components.""" from __future__ import annotations -from typing import Any, Union +from typing import Any, Optional, Union from reflex.components.chakra import ChakraComponent, LiteralChakraDirection from reflex.vars import Var @@ -13,55 +13,55 @@ class Tooltip(ChakraComponent): tag = "Tooltip" # The padding required to prevent the arrow from reaching the very edge of the popper. - arrow_padding: Var[int] + arrow_padding: Optional[Var[int]] = None # The color of the arrow shadow. - arrow_shadow_color: Var[str] + arrow_shadow_color: Optional[Var[str]] = None # Size of the arrow. - arrow_size: Var[int] + arrow_size: Optional[Var[int]] = None # Delay (in ms) before hiding the tooltip - delay: Var[int] + delay: Optional[Var[int]] = None # If true, the tooltip will hide on click - close_on_click: Var[bool] + close_on_click: Optional[Var[bool]] = None # If true, the tooltip will hide on pressing Esc key - close_on_esc: Var[bool] + close_on_esc: Optional[Var[bool]] = None # If true, the tooltip will hide while the mouse is down - close_on_mouse_down: Var[bool] + close_on_mouse_down: Optional[Var[bool]] = None # If true, the tooltip will be initially shown - default_is_open: Var[bool] + default_is_open: Optional[Var[bool]] = None # Theme direction ltr or rtl. Popper's placement will be set accordingly - direction: Var[LiteralChakraDirection] + direction: Optional[Var[LiteralChakraDirection]] = None # The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter. - gutter: Var[int] + gutter: Optional[Var[int]] = None # If true, the tooltip will show an arrow tip - has_arrow: Var[bool] + has_arrow: Optional[Var[bool]] = None # If true, the tooltip with be disabled. - is_disabled: Var[bool] + is_disabled: Optional[Var[bool]] = None # If true, the tooltip will be open. - is_open: Var[bool] + is_open: Optional[Var[bool]] = None # The label of the tooltip - label: Var[str] + label: Optional[Var[str]] = None # Delay (in ms) before showing the tooltip - open_delay: Var[int] + open_delay: Optional[Var[int]] = None # The placement of the popper relative to its reference. - placement: Var[str] + placement: Optional[Var[str]] = None # If true, the tooltip will wrap its children in a `` with `tabIndex=0` - should_wrap_children: Var[bool] + should_wrap_children: Optional[Var[bool]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers for the component. diff --git a/reflex/components/chakra/typography/heading.py b/reflex/components/chakra/typography/heading.py index d681802fa..871dda428 100644 --- a/reflex/components/chakra/typography/heading.py +++ b/reflex/components/chakra/typography/heading.py @@ -1,5 +1,5 @@ """A heading component.""" - +from typing import Optional from reflex.components.chakra import ChakraComponent, LiteralHeadingSize from reflex.vars import Var @@ -11,7 +11,7 @@ class Heading(ChakraComponent): tag = "Heading" # Override the tag. The default tag is `

`. - as_: Var[str] + as_: Optional[Var[str]] = None # "4xl" | "3xl" | "2xl" | "xl" | "lg" | "md" | "sm" | "xs" - size: Var[LiteralHeadingSize] + size: Optional[Var[LiteralHeadingSize]] = None diff --git a/reflex/components/chakra/typography/highlight.py b/reflex/components/chakra/typography/highlight.py index 0308c091e..24e7d3b10 100644 --- a/reflex/components/chakra/typography/highlight.py +++ b/reflex/components/chakra/typography/highlight.py @@ -1,6 +1,5 @@ """A highlight component.""" - -from typing import Dict, List +from typing import Dict, List, Optional from reflex.components.chakra import ChakraComponent from reflex.components.tags import Tag @@ -13,7 +12,7 @@ class Highlight(ChakraComponent): tag = "Highlight" # A query for the text to highlight. Can be a string or a list of strings. - query: Var[List[str]] + query: Optional[Var[List[str]]] = None # The style of the content. # Note: styles and style are different prop. diff --git a/reflex/components/chakra/typography/text.py b/reflex/components/chakra/typography/text.py index e211c4d64..aed9e6e85 100644 --- a/reflex/components/chakra/typography/text.py +++ b/reflex/components/chakra/typography/text.py @@ -1,6 +1,8 @@ """A text component.""" from __future__ import annotations +from typing import Optional + from reflex.components.chakra import ChakraComponent from reflex.vars import Var @@ -11,7 +13,7 @@ class Text(ChakraComponent): tag = "Text" # Override the tag. The default tag is `

`. - as_: Var[str] + as_: Optional[Var[str]] = None # Truncate text after a specific number of lines. It will render an ellipsis when the text exceeds the width of the viewport or max_width prop. - no_of_lines: Var[int] + no_of_lines: Optional[Var[int]] = None diff --git a/reflex/components/component.py b/reflex/components/component.py index f32b476ba..af8808654 100644 --- a/reflex/components/component.py +++ b/reflex/components/component.py @@ -1,5 +1,4 @@ """Base component definitions.""" - from __future__ import annotations import copy diff --git a/reflex/components/core/cond.py b/reflex/components/core/cond.py index 66f7f6448..91350ce76 100644 --- a/reflex/components/core/cond.py +++ b/reflex/components/core/cond.py @@ -21,7 +21,7 @@ class Cond(MemoizationLeaf): """Render one of two components based on a condition.""" # The cond to determine which component to render. - cond: Var[Any] + cond: Optional[Var[Any]] = None # The component to render if the cond is true. comp1: BaseComponent = None # type: ignore diff --git a/reflex/components/core/debounce.py b/reflex/components/core/debounce.py index 28ba6ee3e..383ac43f9 100644 --- a/reflex/components/core/debounce.py +++ b/reflex/components/core/debounce.py @@ -1,7 +1,7 @@ """Wrapper around react-debounce-input.""" from __future__ import annotations -from typing import Any, Type +from typing import Any, Optional, Type from reflex.components.component import Component from reflex.constants import EventTriggers @@ -22,25 +22,25 @@ class DebounceInput(Component): tag = "DebounceInput" # Minimum input characters before triggering the on_change event - min_length: Var[int] + min_length: Optional[Var[int]] = None # Time to wait between end of input and triggering on_change debounce_timeout: Var[int] = DEFAULT_DEBOUNCE_TIMEOUT # type: ignore # If true, notify when Enter key is pressed - force_notify_by_enter: Var[bool] + force_notify_by_enter: Optional[Var[bool]] = None # If true, notify when form control loses focus - force_notify_on_blur: Var[bool] + force_notify_on_blur: Optional[Var[bool]] = None # If provided, create a fully-controlled input - value: Var[str] + value: Optional[Var[str]] = None # The ref to attach to the created input - input_ref: Var[str] + input_ref: Optional[Var[str]] = None # The element to wrap - element: Var[Type[Component]] + element: Optional[Var[Type[Component]]] = None @classmethod def create(cls, *children: Component, **props: Any) -> Component: diff --git a/reflex/components/core/foreach.py b/reflex/components/core/foreach.py index 0ef7aeefa..528ce45e9 100644 --- a/reflex/components/core/foreach.py +++ b/reflex/components/core/foreach.py @@ -18,7 +18,7 @@ class Foreach(Component): _memoization_mode = MemoizationMode(recursive=False) # The iterable to create components from. - iterable: Var[Iterable] + iterable: Optional[Var[Iterable]] = None # A function from the render args to the component. render_fn: Callable = Fragment.create diff --git a/reflex/components/core/html.py b/reflex/components/core/html.py index 987d216a3..9976acafc 100644 --- a/reflex/components/core/html.py +++ b/reflex/components/core/html.py @@ -1,5 +1,5 @@ """A html component.""" -from typing import Dict +from typing import Dict, Optional from reflex.components.el.elements.typography import Div from reflex.vars import Var @@ -13,7 +13,7 @@ class Html(Div): """ # The HTML to render. - dangerouslySetInnerHTML: Var[Dict[str, str]] + dangerouslySetInnerHTML: Optional[Var[Dict[str, str]]] = None @classmethod def create(cls, *children, **props): diff --git a/reflex/components/core/match.py b/reflex/components/core/match.py index f1f4a2096..dcd0a51d2 100644 --- a/reflex/components/core/match.py +++ b/reflex/components/core/match.py @@ -1,5 +1,4 @@ """rx.match.""" - import textwrap from typing import Any, Dict, List, Optional, Tuple, Union @@ -17,7 +16,7 @@ class Match(MemoizationLeaf): """Match cases based on a condition.""" # The condition to determine which case to match. - cond: Var[Any] + cond: Optional[Var[Any]] = None # The list of match cases to be matched. match_cases: List[Any] = [] diff --git a/reflex/components/core/upload.py b/reflex/components/core/upload.py index 0d8eaea03..70bccb0e3 100644 --- a/reflex/components/core/upload.py +++ b/reflex/components/core/upload.py @@ -173,31 +173,31 @@ class Upload(MemoizationLeaf): # The list of accepted file types. This should be a dictionary of MIME types as keys and array of file formats as # values. # supported MIME types: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types - accept: Var[Optional[Dict[str, List]]] + accept: Optional[Var[Optional[Dict[str, List]]]] = None # Whether the dropzone is disabled. - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # The maximum number of files that can be uploaded. - max_files: Var[int] + max_files: Optional[Var[int]] = None # The maximum file size (bytes) that can be uploaded. - max_size: Var[int] + max_size: Optional[Var[int]] = None # The minimum file size (bytes) that can be uploaded. - min_size: Var[int] + min_size: Optional[Var[int]] = None # Whether to allow multiple files to be uploaded. multiple: Var[bool] = True # type: ignore # Whether to disable click to upload. - no_click: Var[bool] + no_click: Optional[Var[bool]] = None # Whether to disable drag and drop. - no_drag: Var[bool] + no_drag: Optional[Var[bool]] = None # Whether to disable using the space/enter keys to upload. - no_keyboard: Var[bool] + no_keyboard: Optional[Var[bool]] = None # Marked True when any Upload component is created. is_used: ClassVar[bool] = False diff --git a/reflex/components/datadisplay/code.py b/reflex/components/datadisplay/code.py index 0ac0d4d27..4552eb4e6 100644 --- a/reflex/components/datadisplay/code.py +++ b/reflex/components/datadisplay/code.py @@ -361,22 +361,22 @@ class CodeBlock(Component): language: Var[LiteralCodeLanguage] = "python" # type: ignore # The code to display. - code: Var[str] + code: Optional[Var[str]] = None # If this is enabled line numbers will be shown next to the code block. - show_line_numbers: Var[bool] + show_line_numbers: Optional[Var[bool]] = None # The starting line number to use. - starting_line_number: Var[int] + starting_line_number: Optional[Var[int]] = None # Whether to wrap long lines. - wrap_long_lines: Var[bool] + wrap_long_lines: Optional[Var[bool]] = None # A custom style for the code block. custom_style: Dict[str, str] = {} # Props passed down to the code tag. - code_tag_props: Var[Dict[str, str]] + code_tag_props: Optional[Var[Dict[str, str]]] = None def _get_imports(self) -> imports.ImportDict: merged_imports = super()._get_imports() diff --git a/reflex/components/datadisplay/dataeditor.py b/reflex/components/datadisplay/dataeditor.py index ce9e3134f..fa8370a29 100644 --- a/reflex/components/datadisplay/dataeditor.py +++ b/reflex/components/datadisplay/dataeditor.py @@ -116,94 +116,94 @@ class DataEditor(NoSSRComponent): ] # Number of rows. - rows: Var[int] + rows: Optional[Var[int]] = None # Headers of the columns for the data grid. - columns: Var[List[Dict[str, Any]]] + columns: Optional[Var[List[Dict[str, Any]]]] = None # The data. - data: Var[List[List[Any]]] + data: Optional[Var[List[List[Any]]]] = None # The name of the callback used to find the data to display. - get_cell_content: Var[str] + get_cell_content: Optional[Var[str]] = None # Allow selection for copying. - get_cell_for_selection: Var[bool] + get_cell_for_selection: Optional[Var[bool]] = None # Allow paste. - on_paste: Var[bool] + on_paste: Optional[Var[bool]] = None # Controls the drawing of the focus ring. - draw_focus_ring: Var[bool] + draw_focus_ring: Optional[Var[bool]] = None # Enables or disables the overlay shadow when scrolling horizontally. - fixed_shadow_x: Var[bool] + fixed_shadow_x: Optional[Var[bool]] = None # Enables or disables the overlay shadow when scrolling vertically. - fixed_shadow_y: Var[bool] + fixed_shadow_y: Optional[Var[bool]] = None # The number of columns which should remain in place when scrolling horizontally. Doesn't include rowMarkers. - freeze_columns: Var[int] + freeze_columns: Optional[Var[int]] = None # Controls the header of the group header row. - group_header_height: Var[int] + group_header_height: Optional[Var[int]] = None # Controls the height of the header row. - header_height: Var[int] + header_height: Optional[Var[int]] = None # Additional header icons: # header_icons: Var[Any] # (TODO: must be a map of name: svg) # The maximum width a column can be automatically sized to. - max_column_auto_width: Var[int] + max_column_auto_width: Optional[Var[int]] = None # The maximum width a column can be resized to. - max_column_width: Var[int] + max_column_width: Optional[Var[int]] = None # The minimum width a column can be resized to. - min_column_width: Var[int] + min_column_width: Optional[Var[int]] = None # Determins the height of each row. - row_height: Var[int] + row_height: Optional[Var[int]] = None # Kind of row markers. - row_markers: Var[LiteralRowMarker] + row_markers: Optional[Var[LiteralRowMarker]] = None # Changes the starting index for row markers. - row_marker_start_index: Var[int] + row_marker_start_index: Optional[Var[int]] = None # Sets the width of row markers in pixels, if unset row markers will automatically size. - row_marker_width: Var[int] + row_marker_width: Optional[Var[int]] = None # Enable horizontal smooth scrolling. - smooth_scroll_x: Var[bool] + smooth_scroll_x: Optional[Var[bool]] = None # Enable vertical smooth scrolling. - smooth_scroll_y: Var[bool] + smooth_scroll_y: Optional[Var[bool]] = None # Controls the drawing of the left hand vertical border of a column. If set to a boolean value it controls all borders. vertical_border: Var[bool] # TODO: support a mapping (dict[int, bool]) # Allow columns selections. ("none", "single", "multi") - column_select: Var[Literal["none", "single", "multi"]] + column_select: Optional[Var[Literal["none", "single", "multi"]]] = None # Prevent diagonal scrolling. - prevent_diagonal_scrolling: Var[bool] + prevent_diagonal_scrolling: Optional[Var[bool]] = None # Allow to scroll past the limit of the actual content on the horizontal axis. - overscroll_x: Var[int] + overscroll_x: Optional[Var[int]] = None # Allow to scroll past the limit of the actual content on the vertical axis. - overscroll_y: Var[int] + overscroll_y: Optional[Var[int]] = None # Initial scroll offset on the horizontal axis. - scroll_offset_x: Var[int] + scroll_offset_x: Optional[Var[int]] = None # Initial scroll offset on the vertical axis. - scroll_offset_y: Var[int] + scroll_offset_y: Optional[Var[int]] = None # global theme - theme: Var[Union[DataEditorTheme, Dict]] + theme: Optional[Var[Union[DataEditorTheme, Dict]]] = None def _get_imports(self): return imports.merge_imports( diff --git a/reflex/components/el/elements/base.py b/reflex/components/el/elements/base.py index fefbfdb56..4cc993e9a 100644 --- a/reflex/components/el/elements/base.py +++ b/reflex/components/el/elements/base.py @@ -1,4 +1,4 @@ -from typing import Union, Optional +from typing import Optional, Union from reflex.components.el.element import Element from reflex.vars import Var as Var diff --git a/reflex/components/el/elements/forms.py b/reflex/components/el/elements/forms.py index bdeff695b..ed4903dc2 100644 --- a/reflex/components/el/elements/forms.py +++ b/reflex/components/el/elements/forms.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union from reflex.components.el.element import Element from reflex.constants.event import EventTriggers @@ -14,37 +14,37 @@ class Button(BaseHTML): tag = "button" # Automatically focuses the button when the page loads - auto_focus: Var[Union[str, int, bool]] + auto_focus: Optional[Var[Union[str, int, bool]]] = None # Disables the button - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # Associates the button with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # URL to send the form data to (for type="submit" buttons) - form_action: Var[Union[str, int, bool]] + form_action: Optional[Var[Union[str, int, bool]]] = None # How the form data should be encoded when submitting to the server (for type="submit" buttons) - form_enc_type: Var[Union[str, int, bool]] + form_enc_type: Optional[Var[Union[str, int, bool]]] = None # HTTP method to use for sending form data (for type="submit" buttons) - form_method: Var[Union[str, int, bool]] + form_method: Optional[Var[Union[str, int, bool]]] = None # Bypasses form validation when submitting (for type="submit" buttons) - form_no_validate: Var[Union[str, int, bool]] + form_no_validate: Optional[Var[Union[str, int, bool]]] = None # Specifies where to display the response after submitting the form (for type="submit" buttons) - form_target: Var[Union[str, int, bool]] + form_target: Optional[Var[Union[str, int, bool]]] = None # Name of the button, used when sending form data - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None # Type of the button (submit, reset, or button) - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None # Value of the button, used when sending form data - value: Var[Union[str, int, bool]] + value: Optional[Var[Union[str, int, bool]]] = None class Datalist(BaseHTML): @@ -60,13 +60,13 @@ class Fieldset(Element): tag = "fieldset" # Disables all the form control descendants of the fieldset - disabled: Var[Union[str, int, bool]] + disabled: Optional[Var[Union[str, int, bool]]] = None # Associates the fieldset with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # Name of the fieldset, used for scripting - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None class Form(BaseHTML): @@ -75,31 +75,31 @@ class Form(BaseHTML): tag = "form" # MIME types the server accepts for file upload - accept: Var[Union[str, int, bool]] + accept: Optional[Var[Union[str, int, bool]]] = None # Character encodings to be used for form submission - accept_charset: Var[Union[str, int, bool]] + accept_charset: Optional[Var[Union[str, int, bool]]] = None # URL where the form's data should be submitted - action: Var[Union[str, int, bool]] + action: Optional[Var[Union[str, int, bool]]] = None # Whether the form should have autocomplete enabled - auto_complete: Var[Union[str, int, bool]] + auto_complete: Optional[Var[Union[str, int, bool]]] = None # Encoding type for the form data when submitted - enc_type: Var[Union[str, int, bool]] + enc_type: Optional[Var[Union[str, int, bool]]] = None # HTTP method to use for form submission - method: Var[Union[str, int, bool]] + method: Optional[Var[Union[str, int, bool]]] = None # Name of the form - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None # Indicates that the form should not be validated on submit - no_validate: Var[Union[str, int, bool]] + no_validate: Optional[Var[Union[str, int, bool]]] = None # Where to display the response after submitting the form - target: Var[Union[str, int, bool]] + target: Optional[Var[Union[str, int, bool]]] = None class Input(BaseHTML): @@ -108,103 +108,103 @@ class Input(BaseHTML): tag = "input" # Accepted types of files when the input is file type - accept: Var[Union[str, int, bool]] + accept: Optional[Var[Union[str, int, bool]]] = None # Alternate text for input type="image" - alt: Var[Union[str, int, bool]] + alt: Optional[Var[Union[str, int, bool]]] = None # Whether the input should have autocomplete enabled - auto_complete: Var[Union[str, int, bool]] + auto_complete: Optional[Var[Union[str, int, bool]]] = None # Automatically focuses the input when the page loads - auto_focus: Var[Union[str, int, bool]] + auto_focus: Optional[Var[Union[str, int, bool]]] = None # Captures media from the user (camera or microphone) - capture: Var[Union[str, int, bool]] + capture: Optional[Var[Union[str, int, bool]]] = None # Indicates whether the input is checked (for checkboxes and radio buttons) - checked: Var[Union[str, int, bool]] + checked: Optional[Var[Union[str, int, bool]]] = None # The initial value (for checkboxes and radio buttons) - default_checked: Var[bool] + default_checked: Optional[Var[bool]] = None # The initial value for a text field - default_value: Var[str] + default_value: Optional[Var[str]] = None # Name part of the input to submit in 'dir' and 'name' pair when form is submitted - dirname: Var[Union[str, int, bool]] + dirname: Optional[Var[Union[str, int, bool]]] = None # Disables the input - disabled: Var[Union[str, int, bool]] + disabled: Optional[Var[Union[str, int, bool]]] = None # Associates the input with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # URL to send the form data to (for type="submit" buttons) - form_action: Var[Union[str, int, bool]] + form_action: Optional[Var[Union[str, int, bool]]] = None # How the form data should be encoded when submitting to the server (for type="submit" buttons) - form_enc_type: Var[Union[str, int, bool]] + form_enc_type: Optional[Var[Union[str, int, bool]]] = None # HTTP method to use for sending form data (for type="submit" buttons) - form_method: Var[Union[str, int, bool]] + form_method: Optional[Var[Union[str, int, bool]]] = None # Bypasses form validation when submitting (for type="submit" buttons) - form_no_validate: Var[Union[str, int, bool]] + form_no_validate: Optional[Var[Union[str, int, bool]]] = None # Specifies where to display the response after submitting the form (for type="submit" buttons) - form_target: Var[Union[str, int, bool]] + form_target: Optional[Var[Union[str, int, bool]]] = None # References a datalist for suggested options - list: Var[Union[str, int, bool]] + list: Optional[Var[Union[str, int, bool]]] = None # Specifies the maximum value for the input - max: Var[Union[str, int, bool]] + max: Optional[Var[Union[str, int, bool]]] = None # Specifies the maximum number of characters allowed in the input - max_length: Var[Union[str, int, bool]] + max_length: Optional[Var[Union[str, int, bool]]] = None # Specifies the minimum number of characters required in the input - min_length: Var[Union[str, int, bool]] + min_length: Optional[Var[Union[str, int, bool]]] = None # Specifies the minimum value for the input - min: Var[Union[str, int, bool]] + min: Optional[Var[Union[str, int, bool]]] = None # Indicates whether multiple values can be entered in an input of the type email or file - multiple: Var[Union[str, int, bool]] + multiple: Optional[Var[Union[str, int, bool]]] = None # Name of the input, used when sending form data - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None # Regex pattern the input's value must match to be valid - pattern: Var[Union[str, int, bool]] + pattern: Optional[Var[Union[str, int, bool]]] = None # Placeholder text in the input - placeholder: Var[Union[str, int, bool]] + placeholder: Optional[Var[Union[str, int, bool]]] = None # Indicates whether the input is read-only - read_only: Var[Union[str, int, bool]] + read_only: Optional[Var[Union[str, int, bool]]] = None # Indicates that the input is required - required: Var[Union[str, int, bool]] + required: Optional[Var[Union[str, int, bool]]] = None # Specifies the visible width of a text control - size: Var[Union[str, int, bool]] + size: Optional[Var[Union[str, int, bool]]] = None # URL for image inputs - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None # Specifies the legal number intervals for an input - step: Var[Union[str, int, bool]] + step: Optional[Var[Union[str, int, bool]]] = None # Specifies the type of input - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None # Name of the image map used with the input - use_map: Var[Union[str, int, bool]] + use_map: Optional[Var[Union[str, int, bool]]] = None # Value of the input - value: Var[Union[str, int, bool]] + value: Optional[Var[Union[str, int, bool]]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the event triggers that pass the component's value to the handler. @@ -228,10 +228,10 @@ class Label(BaseHTML): tag = "label" # ID of a form control with which the label is associated - html_for: Var[Union[str, int, bool]] + html_for: Optional[Var[Union[str, int, bool]]] = None # Associates the label with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None class Legend(BaseHTML): @@ -247,25 +247,25 @@ class Meter(BaseHTML): tag = "meter" # Associates the meter with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # High limit of range (above this is considered high value) - high: Var[Union[str, int, bool]] + high: Optional[Var[Union[str, int, bool]]] = None # Low limit of range (below this is considered low value) - low: Var[Union[str, int, bool]] + low: Optional[Var[Union[str, int, bool]]] = None # Maximum value of the range - max: Var[Union[str, int, bool]] + max: Optional[Var[Union[str, int, bool]]] = None # Minimum value of the range - min: Var[Union[str, int, bool]] + min: Optional[Var[Union[str, int, bool]]] = None # Optimum value in the range - optimum: Var[Union[str, int, bool]] + optimum: Optional[Var[Union[str, int, bool]]] = None # Current value of the meter - value: Var[Union[str, int, bool]] + value: Optional[Var[Union[str, int, bool]]] = None class Optgroup(BaseHTML): @@ -274,10 +274,10 @@ class Optgroup(BaseHTML): tag = "optgroup" # Disables the optgroup - disabled: Var[Union[str, int, bool]] + disabled: Optional[Var[Union[str, int, bool]]] = None # Label for the optgroup - label: Var[Union[str, int, bool]] + label: Optional[Var[Union[str, int, bool]]] = None class Option(BaseHTML): @@ -286,16 +286,16 @@ class Option(BaseHTML): tag = "option" # Disables the option - disabled: Var[Union[str, int, bool]] + disabled: Optional[Var[Union[str, int, bool]]] = None # Label for the option, if the text is not the label - label: Var[Union[str, int, bool]] + label: Optional[Var[Union[str, int, bool]]] = None # Indicates that the option is initially selected - selected: Var[Union[str, int, bool]] + selected: Optional[Var[Union[str, int, bool]]] = None # Value to be sent as form data - value: Var[Union[str, int, bool]] + value: Optional[Var[Union[str, int, bool]]] = None class Output(BaseHTML): @@ -304,13 +304,13 @@ class Output(BaseHTML): tag = "output" # Associates the output with one or more elements (by their IDs) - html_for: Var[Union[str, int, bool]] + html_for: Optional[Var[Union[str, int, bool]]] = None # Associates the output with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # Name of the output element for form submission - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None class Progress(BaseHTML): @@ -319,13 +319,13 @@ class Progress(BaseHTML): tag = "progress" # Associates the progress element with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # Maximum value of the progress indicator - max: Var[Union[str, int, bool]] + max: Optional[Var[Union[str, int, bool]]] = None # Current value of the progress indicator - value: Var[Union[str, int, bool]] + value: Optional[Var[Union[str, int, bool]]] = None class Select(BaseHTML): @@ -334,28 +334,28 @@ class Select(BaseHTML): tag = "select" # Whether the form control should have autocomplete enabled - auto_complete: Var[Union[str, int, bool]] + auto_complete: Optional[Var[Union[str, int, bool]]] = None # Automatically focuses the select when the page loads - auto_focus: Var[Union[str, int, bool]] + auto_focus: Optional[Var[Union[str, int, bool]]] = None # Disables the select control - disabled: Var[Union[str, int, bool]] + disabled: Optional[Var[Union[str, int, bool]]] = None # Associates the select with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # Indicates that multiple options can be selected - multiple: Var[Union[str, int, bool]] + multiple: Optional[Var[Union[str, int, bool]]] = None # Name of the select, used when submitting the form - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None # Indicates that the select control must have a selected option - required: Var[Union[str, int, bool]] + required: Optional[Var[Union[str, int, bool]]] = None # Number of visible options in a drop-down list - size: Var[Union[str, int, bool]] + size: Optional[Var[Union[str, int, bool]]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the event triggers that pass the component's value to the handler. @@ -375,49 +375,49 @@ class Textarea(BaseHTML): tag = "textarea" # Whether the form control should have autocomplete enabled - auto_complete: Var[Union[str, int, bool]] + auto_complete: Optional[Var[Union[str, int, bool]]] = None # Automatically focuses the textarea when the page loads - auto_focus: Var[Union[str, int, bool]] + auto_focus: Optional[Var[Union[str, int, bool]]] = None # Visible width of the text control, in average character widths - cols: Var[Union[str, int, bool]] + cols: Optional[Var[Union[str, int, bool]]] = None # Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted - dirname: Var[Union[str, int, bool]] + dirname: Optional[Var[Union[str, int, bool]]] = None # Disables the textarea - disabled: Var[Union[str, int, bool]] + disabled: Optional[Var[Union[str, int, bool]]] = None # Associates the textarea with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # Maximum number of characters allowed in the textarea - max_length: Var[Union[str, int, bool]] + max_length: Optional[Var[Union[str, int, bool]]] = None # Minimum number of characters required in the textarea - min_length: Var[Union[str, int, bool]] + min_length: Optional[Var[Union[str, int, bool]]] = None # Name of the textarea, used when submitting the form - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None # Placeholder text in the textarea - placeholder: Var[Union[str, int, bool]] + placeholder: Optional[Var[Union[str, int, bool]]] = None # Indicates whether the textarea is read-only - read_only: Var[Union[str, int, bool]] + read_only: Optional[Var[Union[str, int, bool]]] = None # Indicates that the textarea is required - required: Var[Union[str, int, bool]] + required: Optional[Var[Union[str, int, bool]]] = None # Visible number of lines in the text control - rows: Var[Union[str, int, bool]] + rows: Optional[Var[Union[str, int, bool]]] = None # The controlled value of the textarea, read only unless used with on_change - value: Var[Union[str, int, bool]] + value: Optional[Var[Union[str, int, bool]]] = None # How the text in the textarea is to be wrapped when submitting the form - wrap: Var[Union[str, int, bool]] + wrap: Optional[Var[Union[str, int, bool]]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/el/elements/inline.py b/reflex/components/el/elements/inline.py index a8454217b..9cacf99c2 100644 --- a/reflex/components/el/elements/inline.py +++ b/reflex/components/el/elements/inline.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Union +from typing import Optional, Union from reflex.vars import Var @@ -12,31 +12,31 @@ class A(BaseHTML): # Inherits common attributes from BaseMeta tag = "a" # Specifies that the target (the file specified in the href attribute) will be downloaded when a user clicks on the hyperlink. - download: Var[Union[str, int, bool]] + download: Optional[Var[Union[str, int, bool]]] = None # Specifies the URL of the page the link goes to - href: Var[Union[str, int, bool]] + href: Optional[Var[Union[str, int, bool]]] = None # Specifies the language of the linked document - href_lang: Var[Union[str, int, bool]] + href_lang: Optional[Var[Union[str, int, bool]]] = None # Specifies what media/device the linked document is optimized for - media: Var[Union[str, int, bool]] + media: Optional[Var[Union[str, int, bool]]] = None # Specifies which referrer is sent when fetching the resource - ping: Var[Union[str, int, bool]] + ping: Optional[Var[Union[str, int, bool]]] = None # Specifies the relationship between the current document and the linked document - referrer_policy: Var[Union[str, int, bool]] + referrer_policy: Optional[Var[Union[str, int, bool]]] = None # Specifies the relationship between the linked document and the current document - rel: Var[Union[str, int, bool]] + rel: Optional[Var[Union[str, int, bool]]] = None # Specifies the shape of the area - shape: Var[Union[str, int, bool]] + shape: Optional[Var[Union[str, int, bool]]] = None # Specifies where to open the linked document - target: Var[Union[str, int, bool]] + target: Optional[Var[Union[str, int, bool]]] = None class Abbr(BaseHTML): @@ -87,7 +87,7 @@ class Data(BaseHTML): tag = "data" # Specifies the machine-readable translation of the data element. - value: Var[Union[str, int, bool]] + value: Optional[Var[Union[str, int, bool]]] = None class Dfn(BaseHTML): @@ -126,7 +126,7 @@ class Q(BaseHTML): tag = "q" # Specifies the source URL of the quote. - cite: Var[Union[str, int, bool]] + cite: Optional[Var[Union[str, int, bool]]] = None class Rp(BaseHTML): @@ -195,7 +195,7 @@ class Time(BaseHTML): tag = "time" # Specifies the date and/or time of the element. - date_time: Var[Union[str, int, bool]] + date_time: Optional[Var[Union[str, int, bool]]] = None class U(BaseHTML): diff --git a/reflex/components/el/elements/media.py b/reflex/components/el/elements/media.py index 2865ca66a..95b95c5d7 100644 --- a/reflex/components/el/elements/media.py +++ b/reflex/components/el/elements/media.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Any, Union +from typing import Any, Optional, Union from reflex.vars import Var as Var @@ -12,37 +12,37 @@ class Area(BaseHTML): tag = "area" # Alternate text for the area, used for accessibility - alt: Var[Union[str, int, bool]] + alt: Optional[Var[Union[str, int, bool]]] = None # Coordinates to define the shape of the area - coords: Var[Union[str, int, bool]] + coords: Optional[Var[Union[str, int, bool]]] = None # Specifies that the target will be downloaded when clicked - download: Var[Union[str, int, bool]] + download: Optional[Var[Union[str, int, bool]]] = None # Hyperlink reference for the area - href: Var[Union[str, int, bool]] + href: Optional[Var[Union[str, int, bool]]] = None # Language of the linked resource - href_lang: Var[Union[str, int, bool]] + href_lang: Optional[Var[Union[str, int, bool]]] = None # Specifies what media/device the linked resource is optimized for - media: Var[Union[str, int, bool]] + media: Optional[Var[Union[str, int, bool]]] = None # A list of URLs to be notified if the user follows the hyperlink - ping: Var[Union[str, int, bool]] + ping: Optional[Var[Union[str, int, bool]]] = None # Specifies which referrer information to send with the link - referrer_policy: Var[Union[str, int, bool]] + referrer_policy: Optional[Var[Union[str, int, bool]]] = None # Specifies the relationship of the target object to the link object - rel: Var[Union[str, int, bool]] + rel: Optional[Var[Union[str, int, bool]]] = None # Defines the shape of the area (rectangle, circle, polygon) - shape: Var[Union[str, int, bool]] + shape: Optional[Var[Union[str, int, bool]]] = None # Specifies where to open the linked document - target: Var[Union[str, int, bool]] + target: Optional[Var[Union[str, int, bool]]] = None class Audio(BaseHTML): @@ -51,28 +51,28 @@ class Audio(BaseHTML): tag = "audio" # Specifies that the audio will start playing as soon as it is ready - auto_play: Var[Union[str, int, bool]] + auto_play: Optional[Var[Union[str, int, bool]]] = None # Represents the time range of the buffered media - buffered: Var[Union[str, int, bool]] + buffered: Optional[Var[Union[str, int, bool]]] = None # Displays the standard audio controls - controls: Var[Union[str, int, bool]] + controls: Optional[Var[Union[str, int, bool]]] = None # Configures the CORS requests for the element - cross_origin: Var[Union[str, int, bool]] + cross_origin: Optional[Var[Union[str, int, bool]]] = None # Specifies that the audio will loop - loop: Var[Union[str, int, bool]] + loop: Optional[Var[Union[str, int, bool]]] = None # Indicates whether the audio is muted by default - muted: Var[Union[str, int, bool]] + muted: Optional[Var[Union[str, int, bool]]] = None # Specifies how the audio file should be preloaded - preload: Var[Union[str, int, bool]] + preload: Optional[Var[Union[str, int, bool]]] = None # URL of the audio to play - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None class Img(BaseHTML): @@ -81,40 +81,40 @@ class Img(BaseHTML): tag = "img" # Image alignment with respect to its surrounding elements - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None # Alternative text for the image - alt: Var[Union[str, int, bool]] + alt: Optional[Var[Union[str, int, bool]]] = None # Configures the CORS requests for the image - cross_origin: Var[Union[str, int, bool]] + cross_origin: Optional[Var[Union[str, int, bool]]] = None # How the image should be decoded - decoding: Var[Union[str, int, bool]] + decoding: Optional[Var[Union[str, int, bool]]] = None # Specifies an intrinsic size for the image - intrinsicsize: Var[Union[str, int, bool]] + intrinsicsize: Optional[Var[Union[str, int, bool]]] = None # Whether the image is a server-side image map - ismap: Var[Union[str, int, bool]] + ismap: Optional[Var[Union[str, int, bool]]] = None # Specifies the loading behavior of the image - loading: Var[Union[str, int, bool]] + loading: Optional[Var[Union[str, int, bool]]] = None # Referrer policy for the image - referrer_policy: Var[Union[str, int, bool]] + referrer_policy: Optional[Var[Union[str, int, bool]]] = None # Sizes of the image for different layouts - sizes: Var[Union[str, int, bool]] + sizes: Optional[Var[Union[str, int, bool]]] = None # URL of the image to display - src: Var[Any] + src: Optional[Var[Any]] = None # A set of source sizes and URLs for responsive images - src_set: Var[Union[str, int, bool]] + src_set: Optional[Var[Union[str, int, bool]]] = None # The name of the map to use with the image - use_map: Var[Union[str, int, bool]] + use_map: Optional[Var[Union[str, int, bool]]] = None class Map(BaseHTML): @@ -123,7 +123,7 @@ class Map(BaseHTML): tag = "map" # Name of the map, referenced by the 'usemap' attribute in 'img' and 'object' elements - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None class Track(BaseHTML): @@ -132,19 +132,19 @@ class Track(BaseHTML): tag = "track" # Indicates that the track should be enabled unless the user's preferences indicate otherwise - default: Var[Union[str, int, bool]] + default: Optional[Var[Union[str, int, bool]]] = None # Specifies the kind of text track - kind: Var[Union[str, int, bool]] + kind: Optional[Var[Union[str, int, bool]]] = None # Title of the text track, used by the browser when listing available text tracks - label: Var[Union[str, int, bool]] + label: Optional[Var[Union[str, int, bool]]] = None # URL of the track file - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None # Language of the track text data - src_lang: Var[Union[str, int, bool]] + src_lang: Optional[Var[Union[str, int, bool]]] = None class Video(BaseHTML): @@ -153,34 +153,34 @@ class Video(BaseHTML): tag = "video" # Specifies that the video will start playing as soon as it is ready - auto_play: Var[Union[str, int, bool]] + auto_play: Optional[Var[Union[str, int, bool]]] = None # Represents the time range of the buffered media - buffered: Var[Union[str, int, bool]] + buffered: Optional[Var[Union[str, int, bool]]] = None # Displays the standard video controls - controls: Var[Union[str, int, bool]] + controls: Optional[Var[Union[str, int, bool]]] = None # Configures the CORS requests for the video - cross_origin: Var[Union[str, int, bool]] + cross_origin: Optional[Var[Union[str, int, bool]]] = None # Specifies that the video will loop - loop: Var[Union[str, int, bool]] + loop: Optional[Var[Union[str, int, bool]]] = None # Indicates whether the video is muted by default - muted: Var[Union[str, int, bool]] + muted: Optional[Var[Union[str, int, bool]]] = None # Indicates that the video should play 'inline', inside its element's playback area - plays_inline: Var[Union[str, int, bool]] + plays_inline: Optional[Var[Union[str, int, bool]]] = None # URL of an image to show while the video is downloading, or until the user hits the play button - poster: Var[Union[str, int, bool]] + poster: Optional[Var[Union[str, int, bool]]] = None # Specifies how the video file should be preloaded - preload: Var[Union[str, int, bool]] + preload: Optional[Var[Union[str, int, bool]]] = None # URL of the video to play - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None class Embed(BaseHTML): @@ -189,10 +189,10 @@ class Embed(BaseHTML): tag = "embed" # URL of the embedded content - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None # Media type of the embedded content - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None class Iframe(BaseHTML): @@ -201,31 +201,31 @@ class Iframe(BaseHTML): tag = "iframe" # Alignment of the iframe within the page or surrounding elements - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None # Permissions policy for the iframe - allow: Var[Union[str, int, bool]] + allow: Optional[Var[Union[str, int, bool]]] = None # Content Security Policy to apply to the iframe's content - csp: Var[Union[str, int, bool]] + csp: Optional[Var[Union[str, int, bool]]] = None # Specifies the loading behavior of the iframe - loading: Var[Union[str, int, bool]] + loading: Optional[Var[Union[str, int, bool]]] = None # Name of the iframe, used as a target for hyperlinks and forms - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None # Referrer policy for the iframe - referrer_policy: Var[Union[str, int, bool]] + referrer_policy: Optional[Var[Union[str, int, bool]]] = None # Security restrictions for the content in the iframe - sandbox: Var[Union[str, int, bool]] + sandbox: Optional[Var[Union[str, int, bool]]] = None # URL of the document to display in the iframe - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None # HTML content to embed directly within the iframe - src_doc: Var[Union[str, int, bool]] + src_doc: Optional[Var[Union[str, int, bool]]] = None class Object(BaseHTML): @@ -234,19 +234,19 @@ class Object(BaseHTML): tag = "object" # URL of the data to be used by the object - data: Var[Union[str, int, bool]] + data: Optional[Var[Union[str, int, bool]]] = None # Associates the object with a form element - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # Name of the object, used for scripting or as a target for forms and links - name: Var[Union[str, int, bool]] + name: Optional[Var[Union[str, int, bool]]] = None # Media type of the data specified in the data attribute - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None # Name of an image map to use with the object - use_map: Var[Union[str, int, bool]] + use_map: Optional[Var[Union[str, int, bool]]] = None class Picture(BaseHTML): @@ -269,19 +269,19 @@ class Source(BaseHTML): tag = "source" # Media query indicating what device the linked resource is optimized for - media: Var[Union[str, int, bool]] + media: Optional[Var[Union[str, int, bool]]] = None # Sizes of the source for different layouts - sizes: Var[Union[str, int, bool]] + sizes: Optional[Var[Union[str, int, bool]]] = None # URL of the media file or an image for the element to use - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None # A set of source sizes and URLs for responsive images - src_set: Var[Union[str, int, bool]] + src_set: Optional[Var[Union[str, int, bool]]] = None # Media type of the source - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None class Svg(BaseHTML): @@ -296,4 +296,4 @@ class Path(BaseHTML): tag = "path" # Defines the shape of the path - d: Var[Union[str, int, bool]] + d: Optional[Var[Union[str, int, bool]]] = None diff --git a/reflex/components/el/elements/metadata.py b/reflex/components/el/elements/metadata.py index 2ff25755e..0ec97645c 100644 --- a/reflex/components/el/elements/metadata.py +++ b/reflex/components/el/elements/metadata.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Union +from typing import Optional, Union from reflex.components.el.element import Element from reflex.vars import Var as Var @@ -13,8 +13,8 @@ class Base(BaseHTML): # noqa: E742 tag = "base" tag = "base" - href: Var[Union[str, int, bool]] - target: Var[Union[str, int, bool]] + href: Optional[Var[Union[str, int, bool]]] = None + target: Optional[Var[Union[str, int, bool]]] = None class Head(BaseHTML): # noqa: E742 @@ -28,25 +28,25 @@ class Link(BaseHTML): # noqa: E742 tag = "link" - cross_origin: Var[Union[str, int, bool]] - href: Var[Union[str, int, bool]] - href_lang: Var[Union[str, int, bool]] - integrity: Var[Union[str, int, bool]] - media: Var[Union[str, int, bool]] - referrer_policy: Var[Union[str, int, bool]] - rel: Var[Union[str, int, bool]] - sizes: Var[Union[str, int, bool]] - type: Var[Union[str, int, bool]] + cross_origin: Optional[Var[Union[str, int, bool]]] = None + href: Optional[Var[Union[str, int, bool]]] = None + href_lang: Optional[Var[Union[str, int, bool]]] = None + integrity: Optional[Var[Union[str, int, bool]]] = None + media: Optional[Var[Union[str, int, bool]]] = None + referrer_policy: Optional[Var[Union[str, int, bool]]] = None + rel: Optional[Var[Union[str, int, bool]]] = None + sizes: Optional[Var[Union[str, int, bool]]] = None + type: Optional[Var[Union[str, int, bool]]] = None class Meta(BaseHTML): # Inherits common attributes from BaseHTML """Display the meta element.""" tag = "meta" - char_set: Var[Union[str, int, bool]] - content: Var[Union[str, int, bool]] - http_equiv: Var[Union[str, int, bool]] - name: Var[Union[str, int, bool]] + char_set: Optional[Var[Union[str, int, bool]]] = None + content: Optional[Var[Union[str, int, bool]]] = None + http_equiv: Optional[Var[Union[str, int, bool]]] = None + name: Optional[Var[Union[str, int, bool]]] = None class Title(Element): # noqa: E742 diff --git a/reflex/components/el/elements/other.py b/reflex/components/el/elements/other.py index 26dbf6050..9d034a645 100644 --- a/reflex/components/el/elements/other.py +++ b/reflex/components/el/elements/other.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Union +from typing import Optional, Union from reflex.vars import Var as Var @@ -12,7 +12,7 @@ class Details(BaseHTML): tag = "details" # Indicates whether the details will be visible (expanded) to the user - open: Var[Union[str, int, bool]] + open: Optional[Var[Union[str, int, bool]]] = None class Dialog(BaseHTML): @@ -21,7 +21,7 @@ class Dialog(BaseHTML): tag = "dialog" # Indicates whether the dialog is active and can be interacted with - open: Var[Union[str, int, bool]] + open: Optional[Var[Union[str, int, bool]]] = None class Summary(BaseHTML): @@ -58,4 +58,4 @@ class Html(BaseHTML): tag = "html" # Specifies the URL of the document's cache manifest (obsolete in HTML5) - manifest: Var[Union[str, int, bool]] + manifest: Optional[Var[Union[str, int, bool]]] = None diff --git a/reflex/components/el/elements/scripts.py b/reflex/components/el/elements/scripts.py index a37a32494..ebe608322 100644 --- a/reflex/components/el/elements/scripts.py +++ b/reflex/components/el/elements/scripts.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Union +from typing import Optional, Union from reflex.vars import Var as Var @@ -25,28 +25,28 @@ class Script(BaseHTML): tag = "script" # Indicates that the script should be executed asynchronously - async_: Var[Union[str, int, bool]] + async_: Optional[Var[Union[str, int, bool]]] = None # Character encoding of the external script - char_set: Var[Union[str, int, bool]] + char_set: Optional[Var[Union[str, int, bool]]] = None # Configures the CORS requests for the script - cross_origin: Var[Union[str, int, bool]] + cross_origin: Optional[Var[Union[str, int, bool]]] = None # Indicates that the script should be executed after the page has finished parsing - defer: Var[Union[str, int, bool]] + defer: Optional[Var[Union[str, int, bool]]] = None # Security feature allowing browsers to verify what they fetch - integrity: Var[Union[str, int, bool]] + integrity: Optional[Var[Union[str, int, bool]]] = None # Specifies the scripting language used in the type attribute - language: Var[Union[str, int, bool]] + language: Optional[Var[Union[str, int, bool]]] = None # Specifies which referrer information to send when fetching the script - referrer_policy: Var[Union[str, int, bool]] + referrer_policy: Optional[Var[Union[str, int, bool]]] = None # URL of an external script - src: Var[Union[str, int, bool]] + src: Optional[Var[Union[str, int, bool]]] = None # Specifies the MIME type of the script - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None diff --git a/reflex/components/el/elements/tables.py b/reflex/components/el/elements/tables.py index 1277e1bea..e81ab86cd 100644 --- a/reflex/components/el/elements/tables.py +++ b/reflex/components/el/elements/tables.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Union +from typing import Optional, Union from reflex.vars import Var as Var @@ -12,7 +12,7 @@ class Caption(BaseHTML): tag = "caption" # Alignment of the caption - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None class Col(BaseHTML): @@ -21,10 +21,10 @@ class Col(BaseHTML): tag = "col" # Alignment of the content within the column - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None # Number of columns the col element spans - span: Var[Union[str, int, bool]] + span: Optional[Var[Union[str, int, bool]]] = None class Colgroup(BaseHTML): @@ -33,10 +33,10 @@ class Colgroup(BaseHTML): tag = "colgroup" # Alignment of the content within the column group - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None # Number of columns the colgroup element spans - span: Var[Union[str, int, bool]] + span: Optional[Var[Union[str, int, bool]]] = None class Table(BaseHTML): @@ -45,10 +45,10 @@ class Table(BaseHTML): tag = "table" # Alignment of the table - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None # Provides a summary of the table's purpose and structure - summary: Var[Union[str, int, bool]] + summary: Optional[Var[Union[str, int, bool]]] = None class Tbody(BaseHTML): @@ -57,7 +57,7 @@ class Tbody(BaseHTML): tag = "tbody" # Alignment of the content within the table body - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None class Td(BaseHTML): @@ -66,16 +66,16 @@ class Td(BaseHTML): tag = "td" # Alignment of the content within the table cell - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None # Number of columns a cell should span - col_span: Var[Union[str, int, bool]] + col_span: Optional[Var[Union[str, int, bool]]] = None # IDs of the headers associated with this cell - headers: Var[Union[str, int, bool]] + headers: Optional[Var[Union[str, int, bool]]] = None # Number of rows a cell should span - row_span: Var[Union[str, int, bool]] + row_span: Optional[Var[Union[str, int, bool]]] = None class Tfoot(BaseHTML): @@ -84,7 +84,7 @@ class Tfoot(BaseHTML): tag = "tfoot" # Alignment of the content within the table footer - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None class Th(BaseHTML): @@ -93,19 +93,19 @@ class Th(BaseHTML): tag = "th" # Alignment of the content within the table header cell - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None # Number of columns a header cell should span - col_span: Var[Union[str, int, bool]] + col_span: Optional[Var[Union[str, int, bool]]] = None # IDs of the headers associated with this header cell - headers: Var[Union[str, int, bool]] + headers: Optional[Var[Union[str, int, bool]]] = None # Number of rows a header cell should span - row_span: Var[Union[str, int, bool]] + row_span: Optional[Var[Union[str, int, bool]]] = None # Scope of the header cell (row, col, rowgroup, colgroup) - scope: Var[Union[str, int, bool]] + scope: Optional[Var[Union[str, int, bool]]] = None class Thead(BaseHTML): @@ -114,7 +114,7 @@ class Thead(BaseHTML): tag = "thead" # Alignment of the content within the table header - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None class Tr(BaseHTML): @@ -123,4 +123,4 @@ class Tr(BaseHTML): tag = "tr" # Alignment of the content within the table row - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None diff --git a/reflex/components/el/elements/typography.py b/reflex/components/el/elements/typography.py index f8e3769fa..617660041 100644 --- a/reflex/components/el/elements/typography.py +++ b/reflex/components/el/elements/typography.py @@ -1,5 +1,5 @@ """Element classes. This is an auto-generated file. Do not edit. See ../generate.py.""" -from typing import Union +from typing import Optional, Union from reflex.vars import Var as Var @@ -12,7 +12,7 @@ class Blockquote(BaseHTML): tag = "blockquote" # Define the title of a work. - cite: Var[Union[str, int, bool]] + cite: Optional[Var[Union[str, int, bool]]] = None class Dd(BaseHTML): @@ -51,7 +51,7 @@ class Hr(BaseHTML): tag = "hr" # Used to specify the alignment of text content of The Element. this attribute is used in all elements. - align: Var[Union[str, int, bool]] + align: Optional[Var[Union[str, int, bool]]] = None class Li(BaseHTML): @@ -66,7 +66,7 @@ class Menu(BaseHTML): tag = "menu" # Specifies that the menu element is a context menu. - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None class Ol(BaseHTML): @@ -75,13 +75,13 @@ class Ol(BaseHTML): tag = "ol" # Reverses the order of the list. - reversed: Var[Union[str, int, bool]] + reversed: Optional[Var[Union[str, int, bool]]] = None # Specifies the start value of the first list item in an ordered list. - start: Var[Union[str, int, bool]] + start: Optional[Var[Union[str, int, bool]]] = None # Specifies the kind of marker to use in the list (letters or numbers). - type: Var[Union[str, int, bool]] + type: Optional[Var[Union[str, int, bool]]] = None class P(BaseHTML): @@ -108,10 +108,10 @@ class Ins(BaseHTML): tag = "ins" # Specifies the URL of the document that explains the reason why the text was inserted/changed. - cite: Var[Union[str, int, bool]] + cite: Optional[Var[Union[str, int, bool]]] = None # Specifies the date and time of when the text was inserted/changed. - date_time: Var[Union[str, int, bool]] + date_time: Optional[Var[Union[str, int, bool]]] = None class Del(BaseHTML): @@ -120,7 +120,7 @@ class Del(BaseHTML): tag = "del" # Specifies the URL of the document that explains the reason why the text was deleted. - cite: Var[Union[str, int, bool]] + cite: Optional[Var[Union[str, int, bool]]] = None # Specifies the date and time of when the text was deleted. - date_time: Var[Union[str, int, bool]] + date_time: Optional[Var[Union[str, int, bool]]] = None diff --git a/reflex/components/gridjs/datatable.py b/reflex/components/gridjs/datatable.py index 6c05dfd81..1cbfeb72a 100644 --- a/reflex/components/gridjs/datatable.py +++ b/reflex/components/gridjs/datatable.py @@ -1,8 +1,7 @@ """Table components.""" - from __future__ import annotations -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union from reflex.components.component import Component from reflex.components.tags import Tag @@ -31,19 +30,19 @@ class DataTable(Gridjs): # The list of columns to display. Required if data is a list and should not be provided # if the data field is a dataframe - columns: Var[List] + columns: Optional[Var[List]] = None # Enable a search bar. - search: Var[bool] + search: Optional[Var[bool]] = None # Enable sorting on columns. - sort: Var[bool] + sort: Optional[Var[bool]] = None # Enable resizable columns. - resizable: Var[bool] + resizable: Optional[Var[bool]] = None # Enable pagination. - pagination: Var[Union[bool, Dict]] + pagination: Optional[Var[Union[bool, Dict]]] = None @classmethod def create(cls, *children, **props): diff --git a/reflex/components/moment/moment.py b/reflex/components/moment/moment.py index 53e199c4e..65dcde23a 100644 --- a/reflex/components/moment/moment.py +++ b/reflex/components/moment/moment.py @@ -1,5 +1,4 @@ """Moment component for humanized date rendering.""" - from typing import Any, Dict, List, Optional from reflex.base import Base @@ -31,64 +30,64 @@ class Moment(NoSSRComponent): lib_dependencies: List[str] = ["moment"] # How often the date update (how often time update / 0 to disable). - interval: Var[int] + interval: Optional[Var[int]] = None # Formats the date according to the given format string. - format: Var[str] + format: Optional[Var[str]] = None # When formatting duration time, the largest-magnitude tokens are automatically trimmed when they have no value. - trim: Var[bool] + trim: Optional[Var[bool]] = None # Use the parse attribute to tell moment how to parse the given date when non-standard. - parse: Var[str] + parse: Optional[Var[str]] = None # Add a delta to the base date (keys are "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds") - add: Var[MomentDelta] + add: Optional[Var[MomentDelta]] = None # Subtract a delta to the base date (keys are "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds") - subtract: Var[MomentDelta] + subtract: Optional[Var[MomentDelta]] = None # Displays the date as the time from now, e.g. "5 minutes ago". - from_now: Var[bool] + from_now: Optional[Var[bool]] = None # Setting fromNowDuring will display the relative time as with fromNow but just during its value in milliseconds, after that format will be used instead. - from_now_during: Var[int] + from_now_during: Optional[Var[int]] = None # Similar to fromNow, but gives the opposite interval. - to_now: Var[bool] + to_now: Optional[Var[bool]] = None # Adds a title attribute to the element with the complete date. - with_title: Var[bool] + with_title: Optional[Var[bool]] = None # How the title date is formatted when using the withTitle attribute. - title_format: Var[str] + title_format: Optional[Var[str]] = None # Show the different between this date and the rendered child. - diff: Var[str] + diff: Optional[Var[str]] = None # Display the diff as decimal. - decimal: Var[bool] + decimal: Optional[Var[bool]] = None # Display the diff in given unit. - unit: Var[str] + unit: Optional[Var[str]] = None # Shows the duration (elapsed time) between two dates. duration property should be behind date property time-wise. - duration: Var[str] + duration: Optional[Var[str]] = None # The date to display (also work if passed as children). - date: Var[str] + date: Optional[Var[str]] = None # Shows the duration (elapsed time) between now and the provided datetime. - duration_from_now: Var[bool] + duration_from_now: Optional[Var[bool]] = None # Tells Moment to parse the given date value as a unix timestamp. - unix: Var[bool] + unix: Optional[Var[bool]] = None # Outputs the result in local time. - local: Var[bool] + local: Optional[Var[bool]] = None # Display the date in the given timezone. - tz: Var[str] + tz: Optional[Var[str]] = None def _get_imports(self) -> imports.ImportDict: merged_imports = super()._get_imports() diff --git a/reflex/components/next/image.py b/reflex/components/next/image.py index 10556d5ad..ef99217b1 100644 --- a/reflex/components/next/image.py +++ b/reflex/components/next/image.py @@ -1,5 +1,4 @@ """Image component from next/image.""" - from typing import Any, Dict, Literal, Optional, Union from reflex.utils import types @@ -16,43 +15,43 @@ class Image(NextComponent): is_default = True # This can be either an absolute external URL, or an internal path - src: Var[Any] + src: Optional[Var[Any]] = None # Represents the rendered width in pixels, so it will affect how large the image appears. - width: Var[Any] + width: Optional[Var[Any]] = None # Represents the rendered height in pixels, so it will affect how large the image appears. - height: Var[Any] + height: Optional[Var[Any]] = None # Used to describe the image for screen readers and search engines. - alt: Var[str] + alt: Optional[Var[str]] = None # A custom function used to resolve image URLs. - loader: Var[Any] + loader: Optional[Var[Any]] = None # A boolean that causes the image to fill the parent element, which is useful when the width and height are unknown. Default to True - fill: Var[bool] + fill: Optional[Var[bool]] = None # A string, similar to a media query, that provides information about how wide the image will be at different breakpoints. - sizes: Var[str] + sizes: Optional[Var[str]] = None # The quality of the optimized image, an integer between 1 and 100, where 100 is the best quality and therefore largest file size. Defaults to 75. - quality: Var[int] + quality: Optional[Var[int]] = None # When true, the image will be considered high priority and preload. Lazy loading is automatically disabled for images using priority. - priority: Var[bool] + priority: Optional[Var[bool]] = None # A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty. - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # Allows passing CSS styles to the underlying image element. - # style: Var[Any] + # style: Optional[Var[Any]] = None # The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead. - loading: Var[Literal["lazy", "eager"]] + loading: Optional[Var[Literal["lazy", "eager"]]] = None # A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur". - blurDataURL: Var[str] + blurDataURL: Optional[Var[str]] = None def get_event_triggers(self) -> Dict[str, Any]: """The event triggers of the component. diff --git a/reflex/components/next/video.py b/reflex/components/next/video.py index ae6007671..faa79e625 100644 --- a/reflex/components/next/video.py +++ b/reflex/components/next/video.py @@ -1,5 +1,4 @@ """Wrapping of the next-video component.""" - from typing import Optional from reflex.components.component import Component @@ -15,7 +14,7 @@ class Video(NextComponent): library = "next-video" is_default = True # the URL - src: Var[str] + src: Optional[Var[str]] = None as_: Optional[Component] diff --git a/reflex/components/plotly/plotly.py b/reflex/components/plotly/plotly.py index 7a0dd835f..80a07ac62 100644 --- a/reflex/components/plotly/plotly.py +++ b/reflex/components/plotly/plotly.py @@ -1,6 +1,5 @@ """Component for displaying a plotly graph.""" - -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional from reflex.components.component import NoSSRComponent from reflex.vars import Var @@ -27,19 +26,19 @@ class Plotly(PlotlyLib): is_default = True # The figure to display. This can be a plotly figure or a plotly data json. - data: Var[Figure] + data: Optional[Var[Figure]] = None # The layout of the graph. - layout: Var[Dict] + layout: Optional[Var[Dict]] = None # The config of the graph. - config: Var[Dict] + config: Optional[Var[Dict]] = None # The width of the graph. - width: Var[str] + width: Optional[Var[str]] = None # The height of the graph. - height: Var[str] + height: Optional[Var[str]] = None # If true, the graph will resize when the window is resized. - use_resize_handler: Var[bool] + use_resize_handler: Optional[Var[bool]] = None diff --git a/reflex/components/radix/primitives/accordion.py b/reflex/components/radix/primitives/accordion.py index 2cf37c34f..ecb4e4107 100644 --- a/reflex/components/radix/primitives/accordion.py +++ b/reflex/components/radix/primitives/accordion.py @@ -1,5 +1,4 @@ """Radix accordion components.""" - from __future__ import annotations from typing import Any, Dict, List, Literal, Optional, Union @@ -311,25 +310,25 @@ class AccordionRoot(AccordionComponent): alias = "RadixAccordionRoot" # The type of accordion (single or multiple). - type: Var[LiteralAccordionType] + type: Optional[Var[LiteralAccordionType]] = None # The value of the item to expand. - value: Var[Optional[Union[str, List[str]]]] + value: Optional[Var[Optional[Union[str, List[str]]]]] = None # The default value of the item to expand. - default_value: Var[Optional[Union[str, List[str]]]] + default_value: Optional[Var[Optional[Union[str, List[str]]]]] = None # Whether or not the accordion is collapsible. - collapsible: Var[bool] + collapsible: Optional[Var[bool]] = None # Whether or not the accordion is disabled. - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # The reading direction of the accordion when applicable. - dir: Var[LiteralAccordionDir] + dir: Optional[Var[LiteralAccordionDir]] = None # The orientation of the accordion. - orientation: Var[LiteralAccordionOrientation] + orientation: Optional[Var[LiteralAccordionOrientation]] = None # The variant of the accordion. variant: Var[LiteralAccordionRootVariant] = "classic" # type: ignore @@ -475,10 +474,10 @@ class AccordionItem(AccordionComponent): alias = "RadixAccordionItem" # A unique identifier for the item. - value: Var[str] + value: Optional[Var[str]] = None # When true, prevents the user from interacting with the item. - disabled: Var[bool] + disabled: Optional[Var[bool]] = None _valid_children: List[str] = [ "AccordionHeader", diff --git a/reflex/components/radix/primitives/base.py b/reflex/components/radix/primitives/base.py index bd1690c3b..f096f9ace 100644 --- a/reflex/components/radix/primitives/base.py +++ b/reflex/components/radix/primitives/base.py @@ -1,5 +1,5 @@ """The base component for Radix primitives.""" -from typing import List +from typing import List, Optional from reflex.components.component import Component from reflex.components.tags.tag import Tag @@ -11,7 +11,7 @@ class RadixPrimitiveComponent(Component): """Basic component for radix Primitives.""" # Change the default rendered element for the one passed as a child. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None lib_dependencies: List[str] = ["@emotion/react@^11.11.1"] diff --git a/reflex/components/radix/primitives/drawer.py b/reflex/components/radix/primitives/drawer.py index a149a434f..96411c21a 100644 --- a/reflex/components/radix/primitives/drawer.py +++ b/reflex/components/radix/primitives/drawer.py @@ -32,31 +32,31 @@ class DrawerRoot(DrawerComponent): alias = "Vaul" + tag # Whether the drawer is open or not. - open: Var[bool] + open: Optional[Var[bool]] = None # Enable background scaling, it requires an element with [vaul-drawer-wrapper] data attribute to scale its background. - should_scale_background: Var[bool] + should_scale_background: Optional[Var[bool]] = None # Number between 0 and 1 that determines when the drawer should be closed. - close_threshold: Var[float] + close_threshold: Optional[Var[float]] = None # Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account. snap_points: Optional[List[Union[str, float]]] # Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point. - fade_from_index: Var[int] + fade_from_index: Optional[Var[int]] = None # Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms - scroll_lock_timeout: Var[int] + scroll_lock_timeout: Optional[Var[int]] = None # When `False`, it allows to interact with elements outside of the drawer without closing it. Defaults to `True`. - modal: Var[bool] + modal: Optional[Var[bool]] = None # Direction of the drawer. Defaults to `"bottom"` - direction: Var[LiteralDirectionType] + direction: Optional[Var[LiteralDirectionType]] = None # When `True`, it prevents scroll restoration. Defaults to `True`. - preventScrollRestoration: Var[bool] + preventScrollRestoration: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the event triggers that pass the component's value to the handler. diff --git a/reflex/components/radix/primitives/form.py b/reflex/components/radix/primitives/form.py index d6b57799a..7ff63bc81 100644 --- a/reflex/components/radix/primitives/form.py +++ b/reflex/components/radix/primitives/form.py @@ -1,9 +1,8 @@ """Radix form component.""" - from __future__ import annotations from hashlib import md5 -from typing import Any, Dict, Iterator, Literal +from typing import Any, Dict, Iterator, Literal, Optional from jinja2 import Environment @@ -54,7 +53,7 @@ class FormRoot(FormComponent): reset_on_submit: Var[bool] = False # type: ignore # The name used to make this form's submit handler function unique. - handle_submit_unique_name: Var[str] + handle_submit_unique_name: Optional[Var[str]] = None def get_event_triggers(self) -> Dict[str, Any]: """Event triggers for radix form root. @@ -173,10 +172,10 @@ class FormField(FormComponent): alias = "RadixFormField" # The name of the form field, that is passed down to the control and used to match with validation messages. - name: Var[str] + name: Optional[Var[str]] = None # Flag to mark the form field as invalid, for server side validation. - server_invalid: Var[bool] + server_invalid: Optional[Var[bool]] = None def _apply_theme(self, theme: Component): return { @@ -258,13 +257,13 @@ class FormMessage(FormComponent): alias = "RadixFormMessage" # Used to target a specific field by name when rendering outside of a Field part. - name: Var[str] + name: Optional[Var[str]] = None # Used to indicate on which condition the message should be visible. - match: Var[LiteralMatcher] + match: Optional[Var[LiteralMatcher]] = None # Forces the message to be shown. This is useful when using server-side validation. - force_match: Var[bool] + force_match: Optional[Var[bool]] = None def _apply_theme(self, theme: Component): return { diff --git a/reflex/components/radix/primitives/progress.py b/reflex/components/radix/primitives/progress.py index 08fa14b05..827e31304 100644 --- a/reflex/components/radix/primitives/progress.py +++ b/reflex/components/radix/primitives/progress.py @@ -1,5 +1,4 @@ """Progress.""" - from __future__ import annotations from typing import Optional @@ -26,7 +25,7 @@ class ProgressRoot(ProgressComponent): alias = "RadixProgressRoot" # Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full" - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None def _apply_theme(self, theme: Component): if self.radius is not None: @@ -57,13 +56,13 @@ class ProgressIndicator(ProgressComponent): alias = "RadixProgressIndicator" # The current progress value. - value: Var[Optional[int]] + value: Optional[Var[Optional[int]]] = None # The maximum progress value. - max: Var[Optional[int]] + max: Optional[Var[Optional[int]]] = None # The color scheme of the progress indicator. - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None def _apply_theme(self, theme: Component): if self.color_scheme is not None: @@ -92,13 +91,13 @@ class Progress(ProgressRoot): """The high-level Progress component.""" # Override theme color for progress bar indicator - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # The current progress value. - value: Var[Optional[int]] + value: Optional[Var[Optional[int]]] = None # The maximum progress value. - max: Var[Optional[int]] + max: Optional[Var[Optional[int]]] = None @classmethod def create(cls, **props) -> Component: diff --git a/reflex/components/radix/primitives/slider.py b/reflex/components/radix/primitives/slider.py index 94560c3f0..185aa0d38 100644 --- a/reflex/components/radix/primitives/slider.py +++ b/reflex/components/radix/primitives/slider.py @@ -1,8 +1,7 @@ """Radix slider components.""" - from __future__ import annotations -from typing import Any, Dict, List, Literal +from typing import Any, Dict, List, Literal, Optional from reflex.components.component import Component, ComponentNamespace from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName @@ -25,27 +24,27 @@ class SliderRoot(SliderComponent): tag = "Root" alias = "RadixSliderRoot" - default_value: Var[List[int]] + default_value: Optional[Var[List[int]]] = None - value: Var[List[int]] + value: Optional[Var[List[int]]] = None - name: Var[str] + name: Optional[Var[str]] = None - disabled: Var[bool] + disabled: Optional[Var[bool]] = None - orientation: Var[LiteralSliderOrientation] + orientation: Optional[Var[LiteralSliderOrientation]] = None - dir: Var[LiteralSliderDir] + dir: Optional[Var[LiteralSliderDir]] = None - inverted: Var[bool] + inverted: Optional[Var[bool]] = None - min: Var[int] + min: Optional[Var[int]] = None - max: Var[int] + max: Optional[Var[int]] = None - step: Var[int] + step: Optional[Var[int]] = None - min_steps_between_thumbs: Var[int] + min_steps_between_thumbs: Optional[Var[int]] = None def get_event_triggers(self) -> Dict[str, Any]: """Event triggers for radix slider primitive. diff --git a/reflex/components/radix/themes/base.py b/reflex/components/radix/themes/base.py index daa437195..95f213256 100644 --- a/reflex/components/radix/themes/base.py +++ b/reflex/components/radix/themes/base.py @@ -1,5 +1,4 @@ """Base classes for radix-themes components.""" - from __future__ import annotations from typing import Any, Dict, Literal, Optional, Union @@ -52,25 +51,25 @@ class CommonMarginProps(Component): """Many radix-themes elements accept shorthand margin props.""" # Margin: "0" - "9" - m: Var[LiteralSpacing] + m: Optional[Var[LiteralSpacing]] = None # Margin horizontal: "0" - "9" - mx: Var[LiteralSpacing] + mx: Optional[Var[LiteralSpacing]] = None # Margin vertical: "0" - "9" - my: Var[LiteralSpacing] + my: Optional[Var[LiteralSpacing]] = None # Margin top: "0" - "9" - mt: Var[LiteralSpacing] + mt: Optional[Var[LiteralSpacing]] = None # Margin right: "0" - "9" - mr: Var[LiteralSpacing] + mr: Optional[Var[LiteralSpacing]] = None # Margin bottom: "0" - "9" - mb: Var[LiteralSpacing] + mb: Optional[Var[LiteralSpacing]] = None # Margin left: "0" - "9" - ml: Var[LiteralSpacing] + ml: Optional[Var[LiteralSpacing]] = None class RadixThemesComponent(Component): @@ -215,7 +214,7 @@ class ThemePanel(RadixThemesComponent): tag = "ThemePanel" # Whether the panel is open. Defaults to False. - default_open: Var[bool] + default_open: Optional[Var[bool]] = None class RadixThemesColorModeProvider(Component): diff --git a/reflex/components/radix/themes/components/alert_dialog.py b/reflex/components/radix/themes/components/alert_dialog.py index 81b8bb0af..f257ae006 100644 --- a/reflex/components/radix/themes/components/alert_dialog.py +++ b/reflex/components/radix/themes/components/alert_dialog.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, Literal +from typing import Any, Dict, Literal, Optional from reflex import el from reflex.components.component import ComponentNamespace @@ -17,7 +17,7 @@ class AlertDialogRoot(RadixThemesComponent): tag = "AlertDialog.Root" # The controlled open state of the dialog. - open: Var[bool] + open: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -43,10 +43,10 @@ class AlertDialogContent(el.Div, RadixThemesComponent): tag = "AlertDialog.Content" # The size of the content. - size: Var[LiteralContentSize] + size: Optional[Var[LiteralContentSize]] = None # Whether to force mount the content on open. - force_mount: Var[bool] + force_mount: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. diff --git a/reflex/components/radix/themes/components/aspect_ratio.py b/reflex/components/radix/themes/components/aspect_ratio.py index 1b6847a18..1c8b000a1 100644 --- a/reflex/components/radix/themes/components/aspect_ratio.py +++ b/reflex/components/radix/themes/components/aspect_ratio.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Union +from typing import Optional, Union from reflex.vars import Var @@ -12,7 +12,7 @@ class AspectRatio(RadixThemesComponent): tag = "AspectRatio" # The ratio of the width to the height of the element - ratio: Var[Union[float, int]] + ratio: Optional[Var[Union[float, int]]] = None aspect_ratio = AspectRatio.create diff --git a/reflex/components/radix/themes/components/avatar.py b/reflex/components/radix/themes/components/avatar.py index 0b64831c3..41eb58a1a 100644 --- a/reflex/components/radix/themes/components/avatar.py +++ b/reflex/components/radix/themes/components/avatar.py @@ -1,6 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" - -from typing import Literal +from typing import Literal, Optional from reflex.vars import Var @@ -19,25 +18,25 @@ class Avatar(RadixThemesComponent): tag = "Avatar" # The variant of the avatar - variant: Var[Literal["solid", "soft"]] + variant: Optional[Var[Literal["solid", "soft"]]] = None # The size of the avatar: "1" - "9" - size: Var[LiteralSize] + size: Optional[Var[LiteralSize]] = None # Color theme of the avatar - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the avatar with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full" - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None # The src of the avatar image - src: Var[str] + src: Optional[Var[str]] = None # The rendered fallback text - fallback: Var[str] + fallback: Optional[Var[str]] = None avatar = Avatar.create diff --git a/reflex/components/radix/themes/components/badge.py b/reflex/components/radix/themes/components/badge.py index f279ee0cf..2bdb5d18c 100644 --- a/reflex/components/radix/themes/components/badge.py +++ b/reflex/components/radix/themes/components/badge.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Literal +from typing import Literal, Optional from reflex import el from reflex.vars import Var @@ -17,19 +17,19 @@ class Badge(el.Span, RadixThemesComponent): tag = "Badge" # The variant of the badge - variant: Var[Literal["solid", "soft", "surface", "outline"]] + variant: Optional[Var[Literal["solid", "soft", "surface", "outline"]]] = None # The size of the badge - size: Var[Literal["1", "2"]] + size: Optional[Var[Literal["1", "2"]]] = None # Color theme of the badge - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the badge with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Override theme radius for badge: "none" | "small" | "medium" | "large" | "full" - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None badge = Badge.create diff --git a/reflex/components/radix/themes/components/button.py b/reflex/components/radix/themes/components/button.py index a9d681f8e..2ed920ffb 100644 --- a/reflex/components/radix/themes/components/button.py +++ b/reflex/components/radix/themes/components/button.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Literal +from typing import Literal, Optional from reflex import el from reflex.vars import Var @@ -20,22 +20,22 @@ class Button(el.Button, RadixThemesComponent): tag = "Button" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Button size "1" - "4" - size: Var[LiteralButtonSize] + size: Optional[Var[LiteralButtonSize]] = None # Variant of button: "solid" | "soft" | "outline" | "ghost" - variant: Var[LiteralVariant] + variant: Optional[Var[LiteralVariant]] = None # Override theme color for button - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the button with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Override theme radius for button: "none" | "small" | "medium" | "large" | "full" - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None button = Button.create diff --git a/reflex/components/radix/themes/components/callout.py b/reflex/components/radix/themes/components/callout.py index 5eaf1cac0..b3eb71e31 100644 --- a/reflex/components/radix/themes/components/callout.py +++ b/reflex/components/radix/themes/components/callout.py @@ -1,6 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" - -from typing import Literal, Union +from typing import Literal, Optional, Union import reflex as rx from reflex import el @@ -22,19 +21,19 @@ class CalloutRoot(el.Div, RadixThemesComponent): tag = "Callout.Root" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Size "1" - "3" - size: Var[Literal["1", "2", "3"]] + size: Optional[Var[Literal["1", "2", "3"]]] = None # Variant of button: "soft" | "surface" | "outline" - variant: Var[CalloutVariant] + variant: Optional[Var[CalloutVariant]] = None # Override theme color for button - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the button with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None class CalloutIcon(el.Div, RadixThemesComponent): @@ -53,10 +52,10 @@ class Callout(CalloutRoot): """A short message to attract user's attention.""" # The text of the callout. - text: Var[str] + text: Optional[Var[str]] = None # The icon of the callout. - icon: Var[str] + icon: Optional[Var[str]] = None @classmethod def create(cls, text: Union[str, Var[str]], **props) -> Component: diff --git a/reflex/components/radix/themes/components/card.py b/reflex/components/radix/themes/components/card.py index ab4cf2b88..0d70baaab 100644 --- a/reflex/components/radix/themes/components/card.py +++ b/reflex/components/radix/themes/components/card.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Literal +from typing import Literal, Optional from reflex import el from reflex.vars import Var @@ -15,13 +15,13 @@ class Card(el.Div, RadixThemesComponent): tag = "Card" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Card size: "1" - "5" - size: Var[Literal["1", "2", "3", "4", "5"]] + size: Optional[Var[Literal["1", "2", "3", "4", "5"]]] = None # Variant of Card: "solid" | "soft" | "outline" | "ghost" - variant: Var[Literal["surface", "classic", "ghost"]] + variant: Optional[Var[Literal["surface", "classic", "ghost"]]] = None card = Card.create diff --git a/reflex/components/radix/themes/components/checkbox.py b/reflex/components/radix/themes/components/checkbox.py index 250a1da4c..7dbd05882 100644 --- a/reflex/components/radix/themes/components/checkbox.py +++ b/reflex/components/radix/themes/components/checkbox.py @@ -1,6 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" - -from typing import Any, Dict, Literal +from typing import Any, Dict, Literal, Optional from reflex.components.component import Component, ComponentNamespace from reflex.components.radix.themes.layout.flex import Flex @@ -24,37 +23,37 @@ class Checkbox(RadixThemesComponent): tag = "Checkbox" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Checkbox size "1" - "3" - size: Var[LiteralCheckboxSize] + size: Optional[Var[LiteralCheckboxSize]] = None # Variant of checkbox: "classic" | "surface" | "soft" - variant: Var[LiteralCheckboxVariant] + variant: Optional[Var[LiteralCheckboxVariant]] = None # Override theme color for checkbox - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the checkbox with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Whether the checkbox is checked by default - default_checked: Var[bool] + default_checked: Optional[Var[bool]] = None # Whether the checkbox is checked - checked: Var[bool] + checked: Optional[Var[bool]] = None # Whether the checkbox is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # Whether the checkbox is required - required: Var[bool] + required: Optional[Var[bool]] = None # The name of the checkbox control when submitting the form. - name: Var[str] + name: Optional[Var[str]] = None # The value of the checkbox control when submitting the form. - value: Var[str] + value: Optional[Var[str]] = None # Props to rename _rename_props = {"onChange": "onCheckedChange"} @@ -77,43 +76,43 @@ class HighLevelCheckbox(RadixThemesComponent): tag = "Checkbox" # The text label for the checkbox. - text: Var[str] + text: Optional[Var[str]] = None # The gap between the checkbox and the label. - spacing: Var[LiteralSpacing] + spacing: Optional[Var[LiteralSpacing]] = None # The size of the checkbox "1" - "3". - size: Var[LiteralCheckboxSize] + size: Optional[Var[LiteralCheckboxSize]] = None # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Variant of checkbox: "classic" | "surface" | "soft" - variant: Var[LiteralCheckboxVariant] + variant: Optional[Var[LiteralCheckboxVariant]] = None # Override theme color for checkbox - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the checkbox with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Whether the checkbox is checked by default - default_checked: Var[bool] + default_checked: Optional[Var[bool]] = None # Whether the checkbox is checked - checked: Var[bool] + checked: Optional[Var[bool]] = None # Whether the checkbox is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # Whether the checkbox is required - required: Var[bool] + required: Optional[Var[bool]] = None # The name of the checkbox control when submitting the form. - name: Var[str] + name: Optional[Var[str]] = None # The value of the checkbox control when submitting the form. - value: Var[str] + value: Optional[Var[str]] = None # Props to rename _rename_props = {"onChange": "onCheckedChange"} diff --git a/reflex/components/radix/themes/components/context_menu.py b/reflex/components/radix/themes/components/context_menu.py index 7631d7970..c1719c319 100644 --- a/reflex/components/radix/themes/components/context_menu.py +++ b/reflex/components/radix/themes/components/context_menu.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, List, Literal +from typing import Any, Dict, List, Literal, Optional from reflex.components.component import ComponentNamespace from reflex.constants import EventTriggers @@ -17,7 +17,7 @@ class ContextMenuRoot(RadixThemesComponent): tag = "ContextMenu.Root" # The modality of the context menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers. - modal: Var[bool] + modal: Optional[Var[bool]] = None _invalid_children: List[str] = ["ContextMenuItem"] @@ -39,7 +39,7 @@ class ContextMenuTrigger(RadixThemesComponent): tag = "ContextMenu.Trigger" # Whether the trigger is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None _valid_parents: List[str] = ["ContextMenuRoot"] @@ -52,22 +52,22 @@ class ContextMenuContent(RadixThemesComponent): tag = "ContextMenu.Content" # Button size "1" - "4" - size: Var[Literal["1", "2"]] + size: Optional[Var[Literal["1", "2"]]] = None # Variant of button: "solid" | "soft" | "outline" | "ghost" - variant: Var[Literal["solid", "soft"]] + variant: Optional[Var[Literal["solid", "soft"]]] = None # Override theme color for button - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the button with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # The vertical distance in pixels from the anchor. - align_offset: Var[int] + align_offset: Optional[Var[int]] = None # When true, overrides the side and aligns preferences to prevent collisions with boundary edges. - avoid_collisions: Var[bool] + avoid_collisions: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -97,7 +97,7 @@ class ContextMenuSubTrigger(RadixThemesComponent): tag = "ContextMenu.SubTrigger" # Whether the trigger is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None _valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSub"] @@ -108,7 +108,7 @@ class ContextMenuSubContent(RadixThemesComponent): tag = "ContextMenu.SubContent" # When true, keyboard navigation will loop from last item to first, and vice versa. - loop: Var[bool] + loop: Optional[Var[bool]] = None _valid_parents: List[str] = ["ContextMenuSub"] @@ -133,10 +133,10 @@ class ContextMenuItem(RadixThemesComponent): tag = "ContextMenu.Item" # Override theme color for button - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Shortcut to render a menu item as a link - shortcut: Var[str] + shortcut: Optional[Var[str]] = None _valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSubContent"] diff --git a/reflex/components/radix/themes/components/dialog.py b/reflex/components/radix/themes/components/dialog.py index ebc80b5a3..5a664758f 100644 --- a/reflex/components/radix/themes/components/dialog.py +++ b/reflex/components/radix/themes/components/dialog.py @@ -1,6 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" - -from typing import Any, Dict, Literal +from typing import Any, Dict, Literal, Optional from reflex import el from reflex.components.component import ComponentNamespace @@ -18,7 +17,7 @@ class DialogRoot(RadixThemesComponent): tag = "Dialog.Root" # The controlled open state of the dialog. - open: Var[bool] + open: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -50,7 +49,7 @@ class DialogContent(el.Div, RadixThemesComponent): tag = "Dialog.Content" # DialogContent size "1" - "4" - size: Var[Literal["1", "2", "3", "4"]] + size: Optional[Var[Literal["1", "2", "3", "4"]]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. diff --git a/reflex/components/radix/themes/components/dropdown_menu.py b/reflex/components/radix/themes/components/dropdown_menu.py index 013684975..ae5a9c160 100644 --- a/reflex/components/radix/themes/components/dropdown_menu.py +++ b/reflex/components/radix/themes/components/dropdown_menu.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, List, Literal, Union +from typing import Any, Dict, List, Literal, Optional, Union from reflex.components.component import ComponentNamespace from reflex.constants import EventTriggers @@ -33,16 +33,16 @@ class DropdownMenuRoot(RadixThemesComponent): tag = "DropdownMenu.Root" # The open state of the dropdown menu when it is initially rendered. Use when you do not need to control its open state. - default_open: Var[bool] + default_open: Optional[Var[bool]] = None # The controlled open state of the dropdown menu. Must be used in conjunction with onOpenChange. - open: Var[bool] + open: Optional[Var[bool]] = None # The modality of the dropdown menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers. Defaults to True. - modal: Var[bool] + modal: Optional[Var[bool]] = None # The reading direction of submenus when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode. - dir: Var[LiteralDirType] + dir: Optional[Var[LiteralDirType]] = None _invalid_children: List[str] = ["DropdownMenuItem"] @@ -64,7 +64,7 @@ class DropdownMenuTrigger(RadixThemesComponent): tag = "DropdownMenu.Trigger" # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None _valid_parents: List[str] = ["DropdownMenuRoot"] @@ -77,52 +77,52 @@ class DropdownMenuContent(RadixThemesComponent): tag = "DropdownMenu.Content" # Dropdown Menu Content size "1" - "2" - size: Var[LiteralSizeType] + size: Optional[Var[LiteralSizeType]] = None # Variant of Dropdown Menu Content: "solid" | "soft" - variant: Var[LiteralVariantType] + variant: Optional[Var[LiteralVariantType]] = None # Override theme color for Dropdown Menu Content - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Renders the Dropdown Menu Content in higher contrast - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False. - loop: Var[bool] + loop: Optional[Var[bool]] = None # Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. - force_mount: Var[bool] + force_mount: Optional[Var[bool]] = None # The preferred side of the trigger to render against when open. Will be reversed when collisions occur and `avoid_collisions` is enabled.The position of the tooltip. Defaults to "top". - side: Var[LiteralSideType] + side: Optional[Var[LiteralSideType]] = None # The distance in pixels from the trigger. Defaults to 0. - side_offset: Var[Union[float, int]] + side_offset: Optional[Var[Union[float, int]]] = None # The preferred alignment against the trigger. May change when collisions occur. Defaults to "center". - align: Var[LiteralAlignType] + align: Optional[Var[LiteralAlignType]] = None # An offset in pixels from the "start" or "end" alignment options. - align_offset: Var[Union[float, int]] + align_offset: Optional[Var[Union[float, int]]] = None # When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True. - avoid_collisions: Var[bool] + avoid_collisions: Optional[Var[bool]] = None # The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0. - collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]] + collision_padding: Optional[Var[Union[float, int, Dict[str, Union[float, int]]]]] = None # The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0. - arrow_padding: Var[Union[float, int]] + arrow_padding: Optional[Var[Union[float, int]]] = None # The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial". - sticky: Var[LiteralStickyType] + sticky: Optional[Var[LiteralStickyType]] = None # Whether to hide the content when the trigger becomes fully occluded. Defaults to False. - hide_when_detached: Var[bool] + hide_when_detached: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -146,13 +146,13 @@ class DropdownMenuSubTrigger(RadixThemesComponent): tag = "DropdownMenu.SubTrigger" # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # When true, prevents the user from interacting with the item. - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside. - text_value: Var[str] + text_value: Optional[Var[str]] = None _valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSub"] @@ -163,10 +163,10 @@ class DropdownMenuSub(RadixThemesComponent): tag = "DropdownMenu.Sub" # The controlled open state of the submenu. Must be used in conjunction with `on_open_change`. - open: Var[bool] + open: Optional[Var[bool]] = None # The open state of the submenu when it is initially rendered. Use when you do not need to control its open state. - default_open: Var[bool] + default_open: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -186,34 +186,34 @@ class DropdownMenuSubContent(RadixThemesComponent): tag = "DropdownMenu.SubContent" # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False. - loop: Var[bool] + loop: Optional[Var[bool]] = None # Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. - force_mount: Var[bool] + force_mount: Optional[Var[bool]] = None # The distance in pixels from the trigger. Defaults to 0. - side_offset: Var[Union[float, int]] + side_offset: Optional[Var[Union[float, int]]] = None # An offset in pixels from the "start" or "end" alignment options. - align_offset: Var[Union[float, int]] + align_offset: Optional[Var[Union[float, int]]] = None # When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True. - avoid_collisions: Var[bool] + avoid_collisions: Optional[Var[bool]] = None # The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0. - collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]] + collision_padding: Optional[Var[Union[float, int, Dict[str, Union[float, int]]]]] = None # The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0. - arrow_padding: Var[Union[float, int]] + arrow_padding: Optional[Var[Union[float, int]]] = None # The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial". - sticky: Var[LiteralStickyType] + sticky: Optional[Var[LiteralStickyType]] = None # Whether to hide the content when the trigger becomes fully occluded. Defaults to False. - hide_when_detached: Var[bool] + hide_when_detached: Optional[Var[bool]] = None _valid_parents: List[str] = ["DropdownMenuSub"] @@ -238,19 +238,19 @@ class DropdownMenuItem(RadixThemesComponent): tag = "DropdownMenu.Item" # Override theme color for Dropdown Menu Item - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Shortcut to render a menu item as a link - shortcut: Var[str] + shortcut: Optional[Var[str]] = None # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # When true, prevents the user from interacting with the item. - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside. - text_value: Var[str] + text_value: Optional[Var[str]] = None _valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSubContent"] diff --git a/reflex/components/radix/themes/components/hover_card.py b/reflex/components/radix/themes/components/hover_card.py index aee639302..94ed6fd62 100644 --- a/reflex/components/radix/themes/components/hover_card.py +++ b/reflex/components/radix/themes/components/hover_card.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, Literal +from typing import Any, Dict, Literal, Optional from reflex import el from reflex.components.component import ComponentNamespace @@ -17,16 +17,16 @@ class HoverCardRoot(RadixThemesComponent): tag = "HoverCard.Root" # The open state of the hover card when it is initially rendered. Use when you do not need to control its open state. - default_open: Var[bool] + default_open: Optional[Var[bool]] = None # The controlled open state of the hover card. Must be used in conjunction with onOpenChange. - open: Var[bool] + open: Optional[Var[bool]] = None # The duration from when the mouse enters the trigger until the hover card opens. - open_delay: Var[int] + open_delay: Optional[Var[int]] = None # The duration from when the mouse leaves the trigger until the hover card closes. - close_delay: Var[int] + close_delay: Optional[Var[int]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -52,16 +52,16 @@ class HoverCardContent(el.Div, RadixThemesComponent): tag = "HoverCard.Content" # The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled. - side: Var[Literal["top", "right", "bottom", "left"]] + side: Optional[Var[Literal["top", "right", "bottom", "left"]]] = None # The distance in pixels from the trigger. - side_offset: Var[int] + side_offset: Optional[Var[int]] = None # The preferred alignment against the trigger. May change when collisions occur. - align: Var[Literal["start", "center", "end"]] + align: Optional[Var[Literal["start", "center", "end"]]] = None # Whether or not the hover card should avoid collisions with its trigger. - avoid_collisions: Var[bool] + avoid_collisions: Optional[Var[bool]] = None class HoverCard(ComponentNamespace): diff --git a/reflex/components/radix/themes/components/icon_button.py b/reflex/components/radix/themes/components/icon_button.py index 47dc1be86..d7a6a7402 100644 --- a/reflex/components/radix/themes/components/icon_button.py +++ b/reflex/components/radix/themes/components/icon_button.py @@ -1,6 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" - -from typing import Literal +from typing import Literal, Optional from reflex import el from reflex.components.component import Component @@ -25,22 +24,22 @@ class IconButton(el.Button, RadixThemesComponent): tag = "IconButton" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Button size "1" - "4" - size: Var[LiteralButtonSize] + size: Optional[Var[LiteralButtonSize]] = None # Variant of button: "classic" | "solid" | "soft" | "surface" | "outline" | "ghost" - variant: Var[LiteralVariant] + variant: Optional[Var[LiteralVariant]] = None # Override theme color for button - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the button with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Override theme radius for button: "none" | "small" | "medium" | "large" | "full" - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/radix/themes/components/inset.py b/reflex/components/radix/themes/components/inset.py index fcdafc6a0..59f22d71e 100644 --- a/reflex/components/radix/themes/components/inset.py +++ b/reflex/components/radix/themes/components/inset.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Literal, Union +from typing import Literal, Optional, Union from reflex import el from reflex.vars import Var @@ -17,31 +17,31 @@ class Inset(el.Div, RadixThemesComponent): tag = "Inset" # The side - side: Var[Literal["x", "y", "top", "bottom", "right", "left"]] + side: Optional[Var[Literal["x", "y", "top", "bottom", "right", "left"]]] = None # How to clip the element's content: "border-box" | "padding-box" - clip: Var[Literal["border-box", "padding-box"]] + clip: Optional[Var[Literal["border-box", "padding-box"]]] = None # Padding - p: Var[Union[int, str]] + p: Optional[Var[Union[int, str]]] = None # Padding on the x axis - px: Var[Union[int, str]] + px: Optional[Var[Union[int, str]]] = None # Padding on the y axis - py: Var[Union[int, str]] + py: Optional[Var[Union[int, str]]] = None # Padding on the top - pt: Var[Union[int, str]] + pt: Optional[Var[Union[int, str]]] = None # Padding on the right - pr: Var[Union[int, str]] + pr: Optional[Var[Union[int, str]]] = None # Padding on the bottom - pb: Var[Union[int, str]] + pb: Optional[Var[Union[int, str]]] = None # Padding on the left - pl: Var[Union[int, str]] + pl: Optional[Var[Union[int, str]]] = None inset = Inset.create diff --git a/reflex/components/radix/themes/components/popover.py b/reflex/components/radix/themes/components/popover.py index 97250fc0e..cd5c048c8 100644 --- a/reflex/components/radix/themes/components/popover.py +++ b/reflex/components/radix/themes/components/popover.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, Literal +from typing import Any, Dict, Literal, Optional from reflex import el from reflex.components.component import ComponentNamespace @@ -17,10 +17,10 @@ class PopoverRoot(RadixThemesComponent): tag = "Popover.Root" # The controlled open state of the popover. - open: Var[bool] + open: Optional[Var[bool]] = None # The modality of the popover. When set to true, interaction with outside elements will be disabled and only popover content will be visible to screen readers. - modal: Var[bool] + modal: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -46,22 +46,22 @@ class PopoverContent(el.Div, RadixThemesComponent): tag = "Popover.Content" # Size of the button: "1" | "2" | "3" | "4" - size: Var[Literal["1", "2", "3", "4"]] + size: Optional[Var[Literal["1", "2", "3", "4"]]] = None # The preferred side of the anchor to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled. - side: Var[Literal["top", "right", "bottom", "left"]] + side: Optional[Var[Literal["top", "right", "bottom", "left"]]] = None # The distance in pixels from the anchor. - side_offset: Var[int] + side_offset: Optional[Var[int]] = None # The preferred alignment against the anchor. May change when collisions occur. - align: Var[Literal["start", "center", "end"]] + align: Optional[Var[Literal["start", "center", "end"]]] = None # The vertical distance in pixels from the anchor. - align_offset: Var[int] + align_offset: Optional[Var[int]] = None # When true, overrides the side andalign preferences to prevent collisions with boundary edges. - avoid_collisions: Var[bool] + avoid_collisions: Optional[Var[bool]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. diff --git a/reflex/components/radix/themes/components/radio_group.py b/reflex/components/radix/themes/components/radio_group.py index 7ff901f37..1f4175331 100644 --- a/reflex/components/radix/themes/components/radio_group.py +++ b/reflex/components/radix/themes/components/radio_group.py @@ -1,5 +1,4 @@ """Interactive components provided by @radix-ui/themes.""" - from typing import Any, Dict, List, Literal, Optional, Union import reflex as rx @@ -24,31 +23,31 @@ class RadioGroupRoot(RadixThemesComponent): tag = "RadioGroup.Root" # The size of the radio group: "1" | "2" | "3" - size: Var[Literal["1", "2", "3"]] + size: Optional[Var[Literal["1", "2", "3"]]] = None # The variant of the radio group - variant: Var[Literal["classic", "surface", "soft"]] + variant: Optional[Var[Literal["classic", "surface", "soft"]]] = None # The color of the radio group - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the radio group with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # The controlled value of the radio item to check. Should be used in conjunction with on_change. - value: Var[str] + value: Optional[Var[str]] = None # The initial value of checked radio item. Should be used in conjunction with on_change. - default_value: Var[str] + default_value: Optional[Var[str]] = None # Whether the radio group is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # The name of the group. Submitted with its owning form as part of a name/value pair. - name: Var[str] + name: Optional[Var[str]] = None # Whether the radio group is required - required: Var[bool] + required: Optional[Var[bool]] = None # Props to rename _rename_props = {"onChange": "onValueChange"} @@ -71,23 +70,23 @@ class RadioGroupItem(RadixThemesComponent): tag = "RadioGroup.Item" # The value of the radio item to check. Should be used in conjunction with on_change. - value: Var[str] + value: Optional[Var[str]] = None # When true, prevents the user from interacting with the radio item. - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # When true, indicates that the user must check the radio item before the owning form can be submitted. - required: Var[bool] + required: Optional[Var[bool]] = None class HighLevelRadioGroup(RadixThemesComponent): """High level wrapper for the RadioGroup component.""" # The items of the radio group. - items: Var[List[str]] + items: Optional[Var[List[str]]] = None # The direction of the radio group. - direction: Var[LiteralFlexDirection] + direction: Optional[Var[LiteralFlexDirection]] = None # The gap between the items of the radio group. spacing: Var[LiteralSpacing] = Var.create_safe("2") @@ -96,28 +95,28 @@ class HighLevelRadioGroup(RadixThemesComponent): size: Var[Literal["1", "2", "3"]] = Var.create_safe("2") # The variant of the radio group - variant: Var[Literal["classic", "surface", "soft"]] + variant: Optional[Var[Literal["classic", "surface", "soft"]]] = None # The color of the radio group - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the radio group with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # The controlled value of the radio item to check. Should be used in conjunction with on_change. - value: Var[str] + value: Optional[Var[str]] = None # The initial value of checked radio item. Should be used in conjunction with on_change. - default_value: Var[str] + default_value: Optional[Var[str]] = None # Whether the radio group is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # The name of the group. Submitted with its owning form as part of a name/value pair. - name: Var[str] + name: Optional[Var[str]] = None # Whether the radio group is required - required: Var[bool] + required: Optional[Var[bool]] = None # Props to rename _rename_props = {"onChange": "onValueChange"} diff --git a/reflex/components/radix/themes/components/scroll_area.py b/reflex/components/radix/themes/components/scroll_area.py index b7b79286b..35831b7e2 100644 --- a/reflex/components/radix/themes/components/scroll_area.py +++ b/reflex/components/radix/themes/components/scroll_area.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Literal +from typing import Literal, Optional from reflex.vars import Var @@ -14,13 +14,13 @@ class ScrollArea(RadixThemesComponent): tag = "ScrollArea" # The alignment of the scroll area - scrollbars: Var[Literal["vertical", "horizontal", "both"]] + scrollbars: Optional[Var[Literal["vertical", "horizontal", "both"]]] = None # Describes the nature of scrollbar visibility, similar to how the scrollbar preferences in MacOS control visibility of native scrollbars. "auto" | "always" | "scroll" | "hover" - type: Var[Literal["auto", "always", "scroll", "hover"]] + type: Optional[Var[Literal["auto", "always", "scroll", "hover"]]] = None # If type is set to either "scroll" or "hover", this prop determines the length of time, in milliseconds, before the scrollbars are hidden after the user stops interacting with scrollbars. - scroll_hide_delay: Var[int] + scroll_hide_delay: Optional[Var[int]] = None scroll_area = ScrollArea.create diff --git a/reflex/components/radix/themes/components/select.py b/reflex/components/radix/themes/components/select.py index eb597f4fc..b5c8b8b28 100644 --- a/reflex/components/radix/themes/components/select.py +++ b/reflex/components/radix/themes/components/select.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, List, Literal, Union +from typing import Any, Dict, List, Literal, Optional, Union import reflex as rx from reflex.components.component import Component, ComponentNamespace @@ -19,28 +19,28 @@ class SelectRoot(RadixThemesComponent): tag = "Select.Root" # The size of the select: "1" | "2" | "3" - size: Var[Literal["1", "2", "3"]] + size: Optional[Var[Literal["1", "2", "3"]]] = None # The value of the select when initially rendered. Use when you do not need to control the state of the select. - default_value: Var[str] + default_value: Optional[Var[str]] = None # The controlled value of the select. Should be used in conjunction with on_change. - value: Var[str] + value: Optional[Var[str]] = None # The open state of the select when it is initially rendered. Use when you do not need to control its open state. - default_open: Var[bool] + default_open: Optional[Var[bool]] = None # The controlled open state of the select. Must be used in conjunction with on_open_change. - open: Var[bool] + open: Optional[Var[bool]] = None # The name of the select control when submitting the form. - name: Var[str] + name: Optional[Var[str]] = None # When True, prevents the user from interacting with select. - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # When True, indicates that the user must select a value before the owning form can be submitted. - required: Var[bool] + required: Optional[Var[bool]] = None # Props to rename _rename_props = {"onChange": "onValueChange"} @@ -64,16 +64,16 @@ class SelectTrigger(RadixThemesComponent): tag = "Select.Trigger" # Variant of the select trigger - variant: Var[Literal["classic", "surface", "soft", "ghost"]] + variant: Optional[Var[Literal["classic", "surface", "soft", "ghost"]]] = None # The color of the select trigger - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # The radius of the select trigger - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None # The placeholder of the select trigger - placeholder: Var[str] + placeholder: Optional[Var[str]] = None _valid_parents: List[str] = ["SelectRoot"] @@ -84,28 +84,28 @@ class SelectContent(RadixThemesComponent): tag = "Select.Content" # The variant of the select content - variant: Var[Literal["solid", "soft"]] + variant: Optional[Var[Literal["solid", "soft"]]] = None # The color of the select content - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the select content with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # The positioning mode to use, item-aligned is the default and behaves similarly to a native MacOS menu by positioning content relative to the active item. popper positions content in the same way as our other primitives, for example Popover or DropdownMenu. - position: Var[Literal["item-aligned", "popper"]] + position: Optional[Var[Literal["item-aligned", "popper"]]] = None # The preferred side of the anchor to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled. Only available when position is set to popper. - side: Var[Literal["top", "right", "bottom", "left"]] + side: Optional[Var[Literal["top", "right", "bottom", "left"]]] = None # The distance in pixels from the anchor. Only available when position is set to popper. - side_offset: Var[int] + side_offset: Optional[Var[int]] = None # The preferred alignment against the anchor. May change when collisions occur. Only available when position is set to popper. - align: Var[Literal["start", "center", "end"]] + align: Optional[Var[Literal["start", "center", "end"]]] = None # The vertical distance in pixels from the anchor. Only available when position is set to popper. - align_offset: Var[int] + align_offset: Optional[Var[int]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -135,10 +135,10 @@ class SelectItem(RadixThemesComponent): tag = "Select.Item" # The value given as data when submitting a form with a name. - value: Var[str] + value: Optional[Var[str]] = None # Whether the select item is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None _valid_parents: List[str] = ["SelectGroup", "SelectContent"] @@ -161,28 +161,28 @@ class HighLevelSelect(SelectRoot): """High level wrapper for the Select component.""" # The items of the select. - items: Var[List[str]] + items: Optional[Var[List[str]]] = None # The placeholder of the select. - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # The label of the select. - label: Var[str] + label: Optional[Var[str]] = None # The color of the select. - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the select with higher contrast color against background. - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # The variant of the select. - variant: Var[Literal["classic", "surface", "soft", "ghost"]] + variant: Optional[Var[Literal["classic", "surface", "soft", "ghost"]]] = None # The radius of the select. - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None # The width of the select. - width: Var[str] + width: Optional[Var[str]] = None @classmethod def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component: diff --git a/reflex/components/radix/themes/components/separator.py b/reflex/components/radix/themes/components/separator.py index 92d2e8b85..567d284c6 100644 --- a/reflex/components/radix/themes/components/separator.py +++ b/reflex/components/radix/themes/components/separator.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Literal +from typing import Literal, Optional from reflex.vars import Var @@ -20,13 +20,13 @@ class Separator(RadixThemesComponent): size: Var[LiteralSeperatorSize] = Var.create_safe("4") # The color of the select - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # The orientation of the separator. - orientation: Var[Literal["horizontal", "vertical"]] + orientation: Optional[Var[Literal["horizontal", "vertical"]]] = None # When true, signifies that it is purely visual, carries no semantic meaning, and ensures it is not present in the accessibility tree. - decorative: Var[bool] + decorative: Optional[Var[bool]] = None # Alias to divider. diff --git a/reflex/components/radix/themes/components/slider.py b/reflex/components/radix/themes/components/slider.py index 6d8bd90f1..9fb32b706 100644 --- a/reflex/components/radix/themes/components/slider.py +++ b/reflex/components/radix/themes/components/slider.py @@ -17,46 +17,46 @@ class Slider(RadixThemesComponent): tag = "Slider" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Button size "1" - "3" - size: Var[Literal["1", "2", "3"]] + size: Optional[Var[Literal["1", "2", "3"]]] = None # Variant of button - variant: Var[Literal["classic", "surface", "soft"]] + variant: Optional[Var[Literal["classic", "surface", "soft"]]] = None # Override theme color for button - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the button with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Override theme radius for button: "none" | "small" | "full" - radius: Var[Literal["none", "small", "full"]] + radius: Optional[Var[Literal["none", "small", "full"]]] = None # The value of the slider when initially rendered. Use when you do not need to control the state of the slider. - default_value: Var[Union[List[Union[float, int]], float, int]] + default_value: Optional[Var[Union[List[Union[float, int]], float, int]]] = None # The controlled value of the slider. Must be used in conjunction with onValueChange. - value: Var[List[Union[float, int]]] + value: Optional[Var[List[Union[float, int]]]] = None # The name of the slider. Submitted with its owning form as part of a name/value pair. - name: Var[str] + name: Optional[Var[str]] = None # The minimum value of the slider. - min: Var[Union[float, int]] + min: Optional[Var[Union[float, int]]] = None # The maximum value of the slider. - max: Var[Union[float, int]] + max: Optional[Var[Union[float, int]]] = None # The step value of the slider. - step: Var[Union[float, int]] + step: Optional[Var[Union[float, int]]] = None # Whether the slider is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # The orientation of the slider. - orientation: Var[Literal["horizontal", "vertical"]] + orientation: Optional[Var[Literal["horizontal", "vertical"]]] = None # Props to rename _rename_props = {"onChange": "onValueChange"} diff --git a/reflex/components/radix/themes/components/switch.py b/reflex/components/radix/themes/components/switch.py index 14ac152b2..a83cf3ec4 100644 --- a/reflex/components/radix/themes/components/switch.py +++ b/reflex/components/radix/themes/components/switch.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, Literal +from typing import Any, Dict, Literal, Optional from reflex.constants import EventTriggers from reflex.vars import Var @@ -18,40 +18,40 @@ class Switch(RadixThemesComponent): tag = "Switch" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Whether the switch is checked by default - default_checked: Var[bool] + default_checked: Optional[Var[bool]] = None # Whether the switch is checked - checked: Var[bool] + checked: Optional[Var[bool]] = None # If true, prevent the user from interacting with the switch - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # If true, the user must interact with the switch to submit the form - required: Var[bool] + required: Optional[Var[bool]] = None # The name of the switch (when submitting a form) - name: Var[str] + name: Optional[Var[str]] = None # The value associated with the "on" position - value: Var[str] + value: Optional[Var[str]] = None # Switch size "1" - "4" - size: Var[LiteralSwitchSize] + size: Optional[Var[LiteralSwitchSize]] = None # Variant of switch: "classic" | "surface" | "soft" - variant: Var[Literal["classic", "surface", "soft"]] + variant: Optional[Var[Literal["classic", "surface", "soft"]]] = None # Override theme color for switch - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the switch with higher contrast color against background - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # Override theme radius for switch: "none" | "small" | "full" - radius: Var[Literal["none", "small", "full"]] + radius: Optional[Var[Literal["none", "small", "full"]]] = None # Props to rename _rename_props = {"onChange": "onCheckedChange"} diff --git a/reflex/components/radix/themes/components/table.py b/reflex/components/radix/themes/components/table.py index a2b3bada3..1f5ee4775 100644 --- a/reflex/components/radix/themes/components/table.py +++ b/reflex/components/radix/themes/components/table.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import List, Literal +from typing import List, Literal, Optional from reflex import el from reflex.components.component import ComponentNamespace @@ -16,10 +16,10 @@ class TableRoot(el.Table, RadixThemesComponent): tag = "Table.Root" # The size of the table: "1" | "2" | "3" - size: Var[Literal["1", "2", "3"]] + size: Optional[Var[Literal["1", "2", "3"]]] = None # The variant of the table - variant: Var[Literal["surface", "ghost"]] + variant: Optional[Var[Literal["surface", "ghost"]]] = None class TableHeader(el.Thead, RadixThemesComponent): @@ -38,7 +38,7 @@ class TableRow(el.Tr, RadixThemesComponent): tag = "Table.Row" # The alignment of the row - align: Var[Literal["start", "center", "end", "baseline"]] + align: Optional[Var[Literal["start", "center", "end", "baseline"]]] = None _invalid_children: List[str] = ["TableBody", "TableHeader", "TableRow"] @@ -49,7 +49,7 @@ class TableColumnHeaderCell(el.Th, RadixThemesComponent): tag = "Table.ColumnHeaderCell" # The justification of the column - justify: Var[Literal["start", "center", "end"]] + justify: Optional[Var[Literal["start", "center", "end"]]] = None _invalid_children: List[str] = [ "TableBody", @@ -82,7 +82,7 @@ class TableCell(el.Td, RadixThemesComponent): tag = "Table.Cell" # The justification of the column - justify: Var[Literal["start", "center", "end"]] + justify: Optional[Var[Literal["start", "center", "end"]]] = None _invalid_children: List[str] = [ "TableBody", @@ -99,7 +99,7 @@ class TableRowHeaderCell(el.Th, RadixThemesComponent): tag = "Table.RowHeaderCell" # The justification of the column - justify: Var[Literal["start", "center", "end"]] + justify: Optional[Var[Literal["start", "center", "end"]]] = None _invalid_children: List[str] = [ "TableBody", diff --git a/reflex/components/radix/themes/components/tabs.py b/reflex/components/radix/themes/components/tabs.py index b0a169741..a60f04f11 100644 --- a/reflex/components/radix/themes/components/tabs.py +++ b/reflex/components/radix/themes/components/tabs.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, List, Literal +from typing import Any, Dict, List, Literal, Optional from reflex.components.component import ComponentNamespace from reflex.constants import EventTriggers @@ -16,13 +16,13 @@ class TabsRoot(RadixThemesComponent): tag = "Tabs.Root" # The value of the tab that should be active when initially rendered. Use when you do not need to control the state of the tabs. - default_value: Var[str] + default_value: Optional[Var[str]] = None # The controlled value of the tab that should be active. Use when you need to control the state of the tabs. - value: Var[str] + value: Optional[Var[str]] = None # The orientation of the tabs. - orientation: Var[Literal["horizontal", "vertical"]] + orientation: Optional[Var[Literal["horizontal", "vertical"]]] = None # Props to rename _rename_props = {"onChange": "onValueChange"} @@ -45,7 +45,7 @@ class TabsList(RadixThemesComponent): tag = "Tabs.List" # Tabs size "1" - "2" - size: Var[Literal["1", "2"]] + size: Optional[Var[Literal["1", "2"]]] = None class TabsTrigger(RadixThemesComponent): @@ -54,10 +54,10 @@ class TabsTrigger(RadixThemesComponent): tag = "Tabs.Trigger" # The value of the tab. Must be unique for each tab. - value: Var[str] + value: Optional[Var[str]] = None # Whether the tab is disabled - disabled: Var[bool] + disabled: Optional[Var[bool]] = None _valid_parents: List[str] = ["TabsList"] @@ -68,7 +68,7 @@ class TabsContent(RadixThemesComponent): tag = "Tabs.Content" # The value of the tab. Must be unique for each tab. - value: Var[str] + value: Optional[Var[str]] = None class Tabs(ComponentNamespace): diff --git a/reflex/components/radix/themes/components/text_area.py b/reflex/components/radix/themes/components/text_area.py index 2eec48631..a21f0125f 100644 --- a/reflex/components/radix/themes/components/text_area.py +++ b/reflex/components/radix/themes/components/text_area.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, Literal, Union +from typing import Any, Dict, Literal, Optional, Union from reflex import el from reflex.components.component import Component @@ -21,55 +21,55 @@ class TextArea(RadixThemesComponent, el.Textarea): tag = "TextArea" # The size of the text area: "1" | "2" | "3" - size: Var[LiteralTextAreaSize] + size: Optional[Var[LiteralTextAreaSize]] = None # The variant of the text area - variant: Var[Literal["classic", "surface", "soft"]] + variant: Optional[Var[Literal["classic", "surface", "soft"]]] = None # The color of the text area - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether the form control should have autocomplete enabled - auto_complete: Var[bool] + auto_complete: Optional[Var[bool]] = None # Automatically focuses the textarea when the page loads - auto_focus: Var[bool] + auto_focus: Optional[Var[bool]] = None # Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted - dirname: Var[str] + dirname: Optional[Var[str]] = None # Disables the textarea - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # Associates the textarea with a form (by id) - form: Var[Union[str, int, bool]] + form: Optional[Var[Union[str, int, bool]]] = None # Maximum number of characters allowed in the textarea - max_length: Var[int] + max_length: Optional[Var[int]] = None # Minimum number of characters required in the textarea - min_length: Var[int] + min_length: Optional[Var[int]] = None # Name of the textarea, used when submitting the form - name: Var[str] + name: Optional[Var[str]] = None # Placeholder text in the textarea - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # Indicates whether the textarea is read-only - read_only: Var[bool] + read_only: Optional[Var[bool]] = None # Indicates that the textarea is required - required: Var[bool] + required: Optional[Var[bool]] = None # Visible number of lines in the text control - rows: Var[str] + rows: Optional[Var[str]] = None # The controlled value of the textarea, read only unless used with on_change - value: Var[str] + value: Optional[Var[str]] = None # How the text in the textarea is to be wrapped when submitting the form - wrap: Var[str] + wrap: Optional[Var[str]] = None @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/radix/themes/components/text_field.py b/reflex/components/radix/themes/components/text_field.py index 74b88fd27..84810ac7f 100644 --- a/reflex/components/radix/themes/components/text_field.py +++ b/reflex/components/radix/themes/components/text_field.py @@ -1,6 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" - -from typing import Any, Dict, Literal +from typing import Any, Dict, Literal, Optional from reflex.components import el from reflex.components.component import Component, ComponentNamespace @@ -24,16 +23,16 @@ class TextFieldRoot(el.Div, RadixThemesComponent): tag = "TextField.Root" # Text field size "1" - "3" - size: Var[LiteralTextFieldSize] + size: Optional[Var[LiteralTextFieldSize]] = None # Variant of text field: "classic" | "surface" | "soft" - variant: Var[LiteralTextFieldVariant] + variant: Optional[Var[LiteralTextFieldVariant]] = None # Override theme color for text field - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Override theme radius for text field: "none" | "small" | "medium" | "large" | "full" - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None class TextFieldInput(el.Input, TextFieldRoot): @@ -79,56 +78,56 @@ class TextFieldSlot(RadixThemesComponent): tag = "TextField.Slot" # Override theme color for text field slot - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None class Input(RadixThemesComponent): """High level wrapper for the Input component.""" # Text field size "1" - "3" - size: Var[LiteralTextFieldSize] + size: Optional[Var[LiteralTextFieldSize]] = None # Variant of text field: "classic" | "surface" | "soft" - variant: Var[LiteralTextFieldVariant] + variant: Optional[Var[LiteralTextFieldVariant]] = None # Override theme color for text field - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Override theme radius for text field: "none" | "small" | "medium" | "large" | "full" - radius: Var[LiteralRadius] + radius: Optional[Var[LiteralRadius]] = None # Whether the input should have autocomplete enabled - auto_complete: Var[bool] + auto_complete: Optional[Var[bool]] = None # The value of the input when initially rendered. - default_value: Var[str] + default_value: Optional[Var[str]] = None # Disables the input - disabled: Var[bool] + disabled: Optional[Var[bool]] = None # Specifies the maximum number of characters allowed in the input - max_length: Var[str] + max_length: Optional[Var[str]] = None # Specifies the minimum number of characters required in the input - min_length: Var[str] + min_length: Optional[Var[str]] = None # Name of the input, used when sending form data - name: Var[str] + name: Optional[Var[str]] = None # Placeholder text in the input - placeholder: Var[str] + placeholder: Optional[Var[str]] = None # Indicates whether the input is read-only - read_only: Var[bool] + read_only: Optional[Var[bool]] = None # Indicates that the input is required - required: Var[bool] + required: Optional[Var[bool]] = None # Specifies the type of input - type: Var[str] + type: Optional[Var[str]] = None # Value of the input - value: Var[str] + value: Optional[Var[str]] = None @classmethod def create(cls, **props): diff --git a/reflex/components/radix/themes/components/tooltip.py b/reflex/components/radix/themes/components/tooltip.py index 29bac80d0..01859ee08 100644 --- a/reflex/components/radix/themes/components/tooltip.py +++ b/reflex/components/radix/themes/components/tooltip.py @@ -1,5 +1,5 @@ """Interactive components provided by @radix-ui/themes.""" -from typing import Any, Dict, Literal, Union +from typing import Any, Dict, Literal, Optional, Union from reflex.components.component import Component from reflex.constants import EventTriggers @@ -36,52 +36,52 @@ class Tooltip(RadixThemesComponent): tag = "Tooltip" # The content of the tooltip. - content: Var[str] + content: Optional[Var[str]] = None # The open state of the tooltip when it is initially rendered. Use when you do not need to control its open state. - default_open: Var[bool] + default_open: Optional[Var[bool]] = None # The controlled open state of the tooltip. Must be used in conjunction with `on_open_change`. - open: Var[bool] + open: Optional[Var[bool]] = None # The preferred side of the trigger to render against when open. Will be reversed when collisions occur and `avoid_collisions` is enabled.The position of the tooltip. Defaults to "top". - side: Var[LiteralSideType] + side: Optional[Var[LiteralSideType]] = None # The distance in pixels from the trigger. Defaults to 0. - side_offset: Var[Union[float, int]] + side_offset: Optional[Var[Union[float, int]]] = None # The preferred alignment against the trigger. May change when collisions occur. Defaults to "center". - align: Var[LiteralAlignType] + align: Optional[Var[LiteralAlignType]] = None # An offset in pixels from the "start" or "end" alignment options. - align_offset: Var[Union[float, int]] + align_offset: Optional[Var[Union[float, int]]] = None # When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True. - avoid_collisions: Var[bool] + avoid_collisions: Optional[Var[bool]] = None # The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0. - collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]] + collision_padding: Optional[Var[Union[float, int, Dict[str, Union[float, int]]]]] = None # The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0. - arrow_padding: Var[Union[float, int]] + arrow_padding: Optional[Var[Union[float, int]]] = None # The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial". - sticky: Var[LiteralStickyType] + sticky: Optional[Var[LiteralStickyType]] = None # Whether to hide the content when the trigger becomes fully occluded. Defaults to False. - hide_when_detached: Var[bool] + hide_when_detached: Optional[Var[bool]] = None # Override the duration in milliseconds to customize the open delay for a specific tooltip. Default is 700. - delay_duration: Var[Union[float, int]] + delay_duration: Optional[Var[Union[float, int]]] = None # Prevents Tooltip content from remaining open when hovering. - disable_hoverable_content: Var[bool] + disable_hoverable_content: Optional[Var[bool]] = None # Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. - force_mount: Var[bool] + force_mount: Optional[Var[bool]] = None # By default, screenreaders will announce the content inside the component. If this is not descriptive enough, or you have content that cannot be announced, use aria-label as a more descriptive label. - aria_label: Var[str] + aria_label: Optional[Var[str]] = None def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. diff --git a/reflex/components/radix/themes/layout/base.py b/reflex/components/radix/themes/layout/base.py index f18ed34a8..c3f669609 100644 --- a/reflex/components/radix/themes/layout/base.py +++ b/reflex/components/radix/themes/layout/base.py @@ -1,8 +1,7 @@ """Declarative layout and common spacing props.""" - from __future__ import annotations -from typing import Literal +from typing import Literal, Optional from reflex.vars import Var @@ -22,28 +21,28 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent): """ # Padding: "0" - "9" - p: Var[LiteralSpacing] + p: Optional[Var[LiteralSpacing]] = None # Padding horizontal: "0" - "9" - px: Var[LiteralSpacing] + px: Optional[Var[LiteralSpacing]] = None # Padding vertical: "0" - "9" - py: Var[LiteralSpacing] + py: Optional[Var[LiteralSpacing]] = None # Padding top: "0" - "9" - pt: Var[LiteralSpacing] + pt: Optional[Var[LiteralSpacing]] = None # Padding right: "0" - "9" - pr: Var[LiteralSpacing] + pr: Optional[Var[LiteralSpacing]] = None # Padding bottom: "0" - "9" - pb: Var[LiteralSpacing] + pb: Optional[Var[LiteralSpacing]] = None # Padding left: "0" - "9" - pl: Var[LiteralSpacing] + pl: Optional[Var[LiteralSpacing]] = None # Whether the element will take up the smallest possible space: "0" | "1" - shrink: Var[LiteralBoolNumber] + shrink: Optional[Var[LiteralBoolNumber]] = None # Whether the element will take up the largest possible space: "0" | "1" - grow: Var[LiteralBoolNumber] + grow: Optional[Var[LiteralBoolNumber]] = None diff --git a/reflex/components/radix/themes/layout/container.py b/reflex/components/radix/themes/layout/container.py index 2e049df7d..0b1bff0c5 100644 --- a/reflex/components/radix/themes/layout/container.py +++ b/reflex/components/radix/themes/layout/container.py @@ -1,7 +1,7 @@ """Declarative layout and common spacing props.""" from __future__ import annotations -from typing import Literal +from typing import Literal, Optional from reflex import el from reflex.vars import Var @@ -20,4 +20,4 @@ class Container(el.Div, RadixThemesComponent): tag = "Container" # The size of the container: "1" - "4" (default "4") - size: Var[LiteralContainerSize] + size: Optional[Var[LiteralContainerSize]] = None diff --git a/reflex/components/radix/themes/layout/flex.py b/reflex/components/radix/themes/layout/flex.py index ef7aed16c..fe2dba4de 100644 --- a/reflex/components/radix/themes/layout/flex.py +++ b/reflex/components/radix/themes/layout/flex.py @@ -1,8 +1,7 @@ """Declarative layout and common spacing props.""" - from __future__ import annotations -from typing import Dict, Literal +from typing import Dict, Literal, Optional from reflex import el from reflex.vars import Var @@ -24,22 +23,22 @@ class Flex(el.Div, RadixThemesComponent): tag = "Flex" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse" - direction: Var[LiteralFlexDirection] + direction: Optional[Var[LiteralFlexDirection]] = None # Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch" - align: Var[LiteralAlign] + align: Optional[Var[LiteralAlign]] = None # Alignment of children along the cross axis: "start" | "center" | "end" | "between" - justify: Var[LiteralJustify] + justify: Optional[Var[LiteralJustify]] = None # Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse" - wrap: Var[LiteralFlexWrap] + wrap: Optional[Var[LiteralFlexWrap]] = None # Gap between children: "0" - "9" - spacing: Var[LiteralSpacing] + spacing: Optional[Var[LiteralSpacing]] = None # Reflex maps the "spacing" prop to "gap" prop. _rename_props: Dict[str, str] = {"spacing": "gap"} diff --git a/reflex/components/radix/themes/layout/grid.py b/reflex/components/radix/themes/layout/grid.py index 565703643..ea1653d02 100644 --- a/reflex/components/radix/themes/layout/grid.py +++ b/reflex/components/radix/themes/layout/grid.py @@ -1,8 +1,7 @@ """Declarative layout and common spacing props.""" - from __future__ import annotations -from typing import Dict, Literal +from typing import Dict, Literal, Optional from reflex import el from reflex.vars import Var @@ -23,31 +22,31 @@ class Grid(el.Div, RadixThemesComponent): tag = "Grid" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Number of columns - columns: Var[str] + columns: Optional[Var[str]] = None # Number of rows - rows: Var[str] + rows: Optional[Var[str]] = None # How the grid items are layed out: "row" | "column" | "dense" | "row-dense" | "column-dense" - flow: Var[LiteralGridFlow] + flow: Optional[Var[LiteralGridFlow]] = None # Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch" - align: Var[LiteralAlign] + align: Optional[Var[LiteralAlign]] = None # Alignment of children along the cross axis: "start" | "center" | "end" | "between" - justify: Var[LiteralJustify] + justify: Optional[Var[LiteralJustify]] = None # Gap between children: "0" - "9" - spacing: Var[LiteralSpacing] + spacing: Optional[Var[LiteralSpacing]] = None # Gap between children horizontal: "0" - "9" - spacing_x: Var[LiteralSpacing] + spacing_x: Optional[Var[LiteralSpacing]] = None # Gap between children vertical: "0" - "9" - spacing_y: Var[LiteralSpacing] + spacing_y: Optional[Var[LiteralSpacing]] = None # Reflex maps the "spacing" prop to "gap" prop. _rename_props: Dict[str, str] = { diff --git a/reflex/components/radix/themes/layout/section.py b/reflex/components/radix/themes/layout/section.py index 5f17b270c..faf179aa4 100644 --- a/reflex/components/radix/themes/layout/section.py +++ b/reflex/components/radix/themes/layout/section.py @@ -1,7 +1,7 @@ """Declarative layout and common spacing props.""" from __future__ import annotations -from typing import Literal +from typing import Literal, Optional from reflex import el from reflex.vars import Var @@ -17,4 +17,4 @@ class Section(el.Section, RadixThemesComponent): tag = "Section" # The size of the section: "1" - "3" (default "3") - size: Var[LiteralSectionSize] + size: Optional[Var[LiteralSectionSize]] = None diff --git a/reflex/components/radix/themes/typography/blockquote.py b/reflex/components/radix/themes/typography/blockquote.py index 6525064d5..0e5da9d92 100644 --- a/reflex/components/radix/themes/typography/blockquote.py +++ b/reflex/components/radix/themes/typography/blockquote.py @@ -1,9 +1,11 @@ """Components for rendering heading. - -https://www.radix-ui.com/themes/docs/theme/typography +from typing import Optional +https://www.radix-ui.com/themes/docs/theme/typography. """ from __future__ import annotations +from typing import Optional + from reflex import el from reflex.vars import Var @@ -23,13 +25,13 @@ class Blockquote(el.Blockquote, RadixThemesComponent): tag = "Blockquote" # Text size: "1" - "9" - size: Var[LiteralTextSize] + size: Optional[Var[LiteralTextSize]] = None # Thickness of text: "light" | "regular" | "medium" | "bold" - weight: Var[LiteralTextWeight] + weight: Optional[Var[LiteralTextWeight]] = None # Overrides the accent color inherited from the Theme. - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the text with higher contrast color - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None diff --git a/reflex/components/radix/themes/typography/code.py b/reflex/components/radix/themes/typography/code.py index 8ee0d2be2..c5937a530 100644 --- a/reflex/components/radix/themes/typography/code.py +++ b/reflex/components/radix/themes/typography/code.py @@ -1,9 +1,11 @@ """Components for rendering heading. - -https://www.radix-ui.com/themes/docs/theme/typography +from typing import Optional +https://www.radix-ui.com/themes/docs/theme/typography. """ from __future__ import annotations +from typing import Optional + from reflex import el from reflex.vars import Var @@ -24,16 +26,16 @@ class Code(el.Code, RadixThemesComponent): tag = "Code" # The visual variant to apply: "solid" | "soft" | "outline" | "ghost" - variant: Var[LiteralVariant] + variant: Optional[Var[LiteralVariant]] = None # Text size: "1" - "9" - size: Var[LiteralTextSize] + size: Optional[Var[LiteralTextSize]] = None # Thickness of text: "light" | "regular" | "medium" | "bold" - weight: Var[LiteralTextWeight] + weight: Optional[Var[LiteralTextWeight]] = None # Overrides the accent color inherited from the Theme. - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the text with higher contrast color - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None diff --git a/reflex/components/radix/themes/typography/heading.py b/reflex/components/radix/themes/typography/heading.py index 94b19577b..d20bc22c8 100644 --- a/reflex/components/radix/themes/typography/heading.py +++ b/reflex/components/radix/themes/typography/heading.py @@ -4,9 +4,10 @@ https://www.radix-ui.com/themes/docs/theme/typography """ from __future__ import annotations +from typing import Optional + from reflex import el from reflex.vars import Var -from typing import Optional from ..base import ( LiteralAccentColor, diff --git a/reflex/components/radix/themes/typography/link.py b/reflex/components/radix/themes/typography/link.py index a5d969b6c..c358e4582 100644 --- a/reflex/components/radix/themes/typography/link.py +++ b/reflex/components/radix/themes/typography/link.py @@ -1,10 +1,10 @@ """Components for rendering heading. - -https://www.radix-ui.com/themes/docs/theme/typography +from typing import Optional +https://www.radix-ui.com/themes/docs/theme/typography. """ from __future__ import annotations -from typing import Literal +from typing import Literal, Optional from reflex.components.component import Component, MemoizationLeaf from reflex.components.core.cond import cond @@ -34,28 +34,28 @@ class Link(RadixThemesComponent, A, MemoizationLeaf): tag = "Link" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Text size: "1" - "9" - size: Var[LiteralTextSize] + size: Optional[Var[LiteralTextSize]] = None # Thickness of text: "light" | "regular" | "medium" | "bold" - weight: Var[LiteralTextWeight] + weight: Optional[Var[LiteralTextWeight]] = None # Removes the leading trim space: "normal" | "start" | "end" | "both" - trim: Var[LiteralTextTrim] + trim: Optional[Var[LiteralTextTrim]] = None # Sets the visibility of the underline affordance: "auto" | "hover" | "always" - underline: Var[LiteralLinkUnderline] + underline: Optional[Var[LiteralLinkUnderline]] = None # Overrides the accent color inherited from the Theme. - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the text with higher contrast color - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None # If True, the link will open in a new tab - is_external: Var[bool] + is_external: Optional[Var[bool]] = None def _get_imports(self) -> imports.ImportDict: return {**super()._get_imports(), **next_link._get_imports()} diff --git a/reflex/components/radix/themes/typography/text.py b/reflex/components/radix/themes/typography/text.py index 96512fe58..1706c2dff 100644 --- a/reflex/components/radix/themes/typography/text.py +++ b/reflex/components/radix/themes/typography/text.py @@ -1,11 +1,10 @@ """Components for rendering text. - -https://www.radix-ui.com/themes/docs/theme/typography +from typing import Optional +https://www.radix-ui.com/themes/docs/theme/typography. """ - from __future__ import annotations -from typing import Literal +from typing import Literal, Optional from reflex import el from reflex.components.component import ComponentNamespace @@ -50,28 +49,28 @@ class Text(el.Span, RadixThemesComponent): tag = "Text" # Change the default rendered element for the one passed as a child, merging their props and behavior. - as_child: Var[bool] + as_child: Optional[Var[bool]] = None # Change the default rendered element into a semantically appropriate alternative (cannot be used with asChild) as_: Var[LiteralType] = "p" # type: ignore # Text size: "1" - "9" - size: Var[LiteralTextSize] + size: Optional[Var[LiteralTextSize]] = None # Thickness of text: "light" | "regular" | "medium" | "bold" - weight: Var[LiteralTextWeight] + weight: Optional[Var[LiteralTextWeight]] = None # Alignment of text in element: "left" | "center" | "right" - align: Var[LiteralTextAlign] + align: Optional[Var[LiteralTextAlign]] = None # Removes the leading trim space: "normal" | "start" | "end" | "both" - trim: Var[LiteralTextTrim] + trim: Optional[Var[LiteralTextTrim]] = None # Overrides the accent color inherited from the Theme. - color_scheme: Var[LiteralAccentColor] + color_scheme: Optional[Var[LiteralAccentColor]] = None # Whether to render the text with higher contrast color - high_contrast: Var[bool] + high_contrast: Optional[Var[bool]] = None class Span(Text): @@ -92,7 +91,7 @@ class Kbd(el.Kbd, RadixThemesComponent): tag = "Kbd" # Text size: "1" - "9" - size: Var[LiteralTextSize] + size: Optional[Var[LiteralTextSize]] = None class Quote(el.Q, RadixThemesComponent): diff --git a/reflex/components/react_player/react_player.py b/reflex/components/react_player/react_player.py index 2e09d4bf9..516498d0d 100644 --- a/reflex/components/react_player/react_player.py +++ b/reflex/components/react_player/react_player.py @@ -1,7 +1,8 @@ """React-Player component.""" - from __future__ import annotations +from typing import Optional + from reflex.components.component import NoSSRComponent from reflex.vars import Var @@ -18,28 +19,28 @@ class ReactPlayer(NoSSRComponent): is_default = True # The url of a video or song to play - url: Var[str] + url: Optional[Var[str]] = None # Set to true or false to pause or play the media - playing: Var[bool] + playing: Optional[Var[bool]] = None # Set to true or false to loop the media - loop: Var[bool] + loop: Optional[Var[bool]] = None # Set to true or false to display native player controls. controls: Var[bool] = True # type: ignore # Set to true to show just the video thumbnail, which loads the full player on click - light: Var[bool] + light: Optional[Var[bool]] = None # Set the volume of the player, between 0 and 1 - volume: Var[float] + volume: Optional[Var[float]] = None # Mutes the player - muted: Var[bool] + muted: Optional[Var[bool]] = None # Set the width of the player: ex:640px - width: Var[str] + width: Optional[Var[str]] = None # Set the height of the player: ex:640px - height: Var[str] + height: Optional[Var[str]] = None diff --git a/reflex/components/recharts/cartesian.py b/reflex/components/recharts/cartesian.py index 136bddf9f..1150c90f8 100644 --- a/reflex/components/recharts/cartesian.py +++ b/reflex/components/recharts/cartesian.py @@ -1,7 +1,7 @@ """Cartesian charts in Recharts.""" from __future__ import annotations -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union from reflex.constants import EventTriggers from reflex.vars import Var @@ -27,46 +27,46 @@ class Axis(Recharts): """A base class for axes in Recharts.""" # The key of a group of data which should be unique in an area chart. - data_key: Var[Union[str, int]] + data_key: Optional[Var[Union[str, int]]] = None # If set true, the axis do not display in the chart. - hide: Var[bool] + hide: Optional[Var[bool]] = None # The orientation of axis 'top' | 'bottom' - orientation: Var[LiteralOrientationTopBottom] + orientation: Optional[Var[LiteralOrientationTopBottom]] = None # The type of axis 'number' | 'category' - type_: Var[LiteralPolarRadiusType] + type_: Optional[Var[LiteralPolarRadiusType]] = None # Allow the ticks of XAxis to be decimals or not. - allow_decimals: Var[bool] + allow_decimals: Optional[Var[bool]] = None # When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain. - allow_data_overflow: Var[bool] + allow_data_overflow: Optional[Var[bool]] = None # Allow the axis has duplicated categorys or not when the type of axis is "category". - allow_duplicated_category: Var[bool] + allow_duplicated_category: Optional[Var[bool]] = None # If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. - axis_line: Var[bool] + axis_line: Optional[Var[bool]] = None # If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. - tick_line: Var[bool] + tick_line: Optional[Var[bool]] = None # If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. - mirror: Var[bool] + mirror: Optional[Var[bool]] = None # Reverse the ticks or not. - reversed: Var[bool] + reversed: Optional[Var[bool]] = None # If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function - scale: Var[LiteralScale] + scale: Optional[Var[LiteralScale]] = None # The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. - unit: Var[Union[str, int]] + unit: Optional[Var[Union[str, int]]] = None # The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. - name: Var[Union[str, int]] + name: Optional[Var[Union[str, int]]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -100,7 +100,7 @@ class YAxis(Axis): alias = "RechartsYAxis" # The key of data displayed in the axis. - data_key: Var[Union[str, int]] + data_key: Optional[Var[Union[str, int]]] = None class ZAxis(Recharts): @@ -111,19 +111,19 @@ class ZAxis(Recharts): alias = "RechartszAxis" # The key of data displayed in the axis. - data_key: Var[Union[str, int]] + data_key: Optional[Var[Union[str, int]]] = None # The range of axis. - range: Var[List[int]] + range: Optional[Var[List[int]]] = None # The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. - unit: Var[Union[str, int]] + unit: Optional[Var[Union[str, int]]] = None # The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. - name: Var[Union[str, int]] + name: Optional[Var[Union[str, int]]] = None # If 'auto' set, the scale function is decided by the type of chart, and the props type. - scale: Var[LiteralScale] + scale: Optional[Var[LiteralScale]] = None class Brush(Recharts): @@ -134,37 +134,37 @@ class Brush(Recharts): alias = "RechartsBrush" # Stroke color - stroke: Var[str] + stroke: Optional[Var[str]] = None # The key of data displayed in the axis. - data_key: Var[Union[str, int]] + data_key: Optional[Var[Union[str, int]]] = None # The x-coordinate of brush. - x: Var[int] + x: Optional[Var[int]] = None # The y-coordinate of brush. - y: Var[int] + y: Optional[Var[int]] = None # The width of brush. - width: Var[int] + width: Optional[Var[int]] = None # The height of brush. - height: Var[int] + height: Optional[Var[int]] = None # The data domain of brush, [min, max]. - data: Var[List[Any]] + data: Optional[Var[List[Any]]] = None # The width of each traveller. - traveller_width: Var[int] + traveller_width: Optional[Var[int]] = None # The data with gap of refreshing chart. If the option is not set, the chart will be refreshed every time - gap: Var[int] + gap: Optional[Var[int]] = None # The default start index of brush. If the option is not set, the start index will be 0. - start_index: Var[int] + start_index: Optional[Var[int]] = None # The default end index of brush. If the option is not set, the end index will be 1. - end_index: Var[int] + end_index: Optional[Var[int]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -181,19 +181,19 @@ class Cartesian(Recharts): """A base class for cartesian charts in Recharts.""" # The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical' - layout: Var[LiteralLayout] + layout: Optional[Var[LiteralLayout]] = None # The key of a group of data which should be unique in an area chart. - data_key: Var[Union[str, int]] + data_key: Optional[Var[Union[str, int]]] = None # The id of x-axis which is corresponding to the data. - x_axis_id: Var[Union[str, int]] + x_axis_id: Optional[Var[Union[str, int]]] = None # The id of y-axis which is corresponding to the data. - y_axis_id: Var[Union[str, int]] + y_axis_id: Optional[Var[Union[str, int]]] = None # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional - # legend_type: Var[LiteralLegendType] + # legend_type: Optional[Var[LiteralLegendType]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -219,28 +219,28 @@ class Area(Cartesian): alias = "RechartsArea" # The color of the line stroke. - stroke: Var[str] + stroke: Optional[Var[str]] = None # The width of the line stroke. - stroke_width: Var[int] + stroke_width: Optional[Var[int]] = None # The color of the area fill. - fill: Var[str] + fill: Optional[Var[str]] = None # The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' | - type_: Var[LiteralAreaType] + type_: Optional[Var[LiteralAreaType]] = None # If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. - dot: Var[bool] + dot: Optional[Var[bool]] = None # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. - active_dot: Var[bool] + active_dot: Optional[Var[bool]] = None # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. - label: Var[bool] + label: Optional[Var[bool]] = None # The stack id of area, when two areas have the same value axis and same stackId, then the two areas area stacked in order. - stack_id: Var[str] + stack_id: Optional[Var[str]] = None # Valid children components _valid_children: List[str] = ["LabelList"] @@ -254,28 +254,28 @@ class Bar(Cartesian): alias = "RechartsBar" # The color of the line stroke. - stroke: Var[str] + stroke: Optional[Var[str]] = None # The width of the line stroke. - stroke_width: Var[int] + stroke_width: Optional[Var[int]] = None # The width of the line stroke. - fill: Var[str] + fill: Optional[Var[str]] = None # If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. - background: Var[bool] + background: Optional[Var[bool]] = None # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. - label: Var[bool] + label: Optional[Var[bool]] = None # The stack id of bar, when two areas have the same value axis and same stackId, then the two areas area stacked in order. - stack_id: Var[str] + stack_id: Optional[Var[str]] = None # Size of the bar - bar_size: Var[int] + bar_size: Optional[Var[int]] = None # Max size of the bar - max_bar_size: Var[int] + max_bar_size: Optional[Var[int]] = None # Valid children components _valid_children: List[str] = ["Cell", "LabelList", "ErrorBar"] @@ -289,28 +289,28 @@ class Line(Cartesian): alias = "RechartsLine" # The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area. - type_: Var[LiteralAreaType] + type_: Optional[Var[LiteralAreaType]] = None # The color of the line stroke. - stroke: Var[str] + stroke: Optional[Var[str]] = None # The width of the line stroke. - stoke_width: Var[int] + stoke_width: Optional[Var[int]] = None # The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. - dot: Var[bool] + dot: Optional[Var[bool]] = None # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. - active_dot: Var[bool] + active_dot: Optional[Var[bool]] = None # If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. - label: Var[bool] + label: Optional[Var[bool]] = None # Hides the line when true, useful when toggling visibility state via legend. - hide: Var[bool] + hide: Optional[Var[bool]] = None # Whether to connect a graph line across null points. - connect_nulls: Var[bool] + connect_nulls: Optional[Var[bool]] = None # Valid children components _valid_children: List[str] = ["LabelList", "ErrorBar"] @@ -324,25 +324,25 @@ class Scatter(Cartesian): alias = "RechartsScatter" # The source data, in which each element is an object. - data: Var[List[Dict[str, Any]]] + data: Optional[Var[List[Dict[str, Any]]]] = None # The id of z-axis which is corresponding to the data. - z_axis_id: Var[str] + z_axis_id: Optional[Var[str]] = None # If false set, line will not be drawn. If true set, line will be drawn which have the props calculated internally. - line: Var[bool] + line: Optional[Var[bool]] = None # If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' - shape: Var[LiteralShape] + shape: Optional[Var[LiteralShape]] = None # If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting' - line_type: Var[LiteralLineType] + line_type: Optional[Var[LiteralLineType]] = None # The fill - fill: Var[str] + fill: Optional[Var[str]] = None # the name - name: Var[Union[str, int]] + name: Optional[Var[Union[str, int]]] = None # Valid children components. _valid_children: List[str] = ["LabelList", "ErrorBar"] @@ -356,16 +356,16 @@ class Funnel(Cartesian): alias = "RechartsFunnel" # The source data, in which each element is an object. - data: Var[List[Dict[str, Any]]] + data: Optional[Var[List[Dict[str, Any]]]] = None # Specifies when the animation should begin, the unit of this option is ms. - animation_begin: Var[int] + animation_begin: Optional[Var[int]] = None # Specifies the duration of animation, the unit of this option is ms. - animation_duration: Var[int] + animation_duration: Optional[Var[int]] = None # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' - animation_easing: Var[LiteralAnimationEasing] + animation_easing: Optional[Var[LiteralAnimationEasing]] = None # Valid children components _valid_children: List[str] = ["LabelList", "Cell"] @@ -379,41 +379,41 @@ class ErrorBar(Recharts): alias = "RechartsErrorBar" # The direction of error bar. 'x' | 'y' | 'both' - direction: Var[LiteralDirection] + direction: Optional[Var[LiteralDirection]] = None # The key of a group of data which should be unique in an area chart. - data_key: Var[Union[str, int]] + data_key: Optional[Var[Union[str, int]]] = None # The width of the error bar ends. - width: Var[int] + width: Optional[Var[int]] = None # The stroke color of error bar. - stroke: Var[str] + stroke: Optional[Var[str]] = None # The stroke width of error bar. - stroke_width: Var[int] + stroke_width: Optional[Var[int]] = None class Reference(Recharts): """A base class for reference components in Reference.""" # The id of x-axis which is corresponding to the data. - x_axis_id: Var[Union[str, int]] + x_axis_id: Optional[Var[Union[str, int]]] = None # The id of y-axis which is corresponding to the data. - y_axis_id: Var[Union[str, int]] + y_axis_id: Optional[Var[Union[str, int]]] = None # If set a string or a number, a vertical line perpendicular to the x-axis specified by xAxisId will be drawn. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys, otherwise no line will be drawn. - x: Var[str] + x: Optional[Var[str]] = None # If set a string or a number, a horizontal line perpendicular to the y-axis specified by yAxisId will be drawn. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys, otherwise no line will be drawn. - y: Var[str] + y: Optional[Var[str]] = None # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. - if_overflow: Var[LiteralIfOverflow] + if_overflow: Optional[Var[LiteralIfOverflow]] = None # If set true, the line will be rendered in front of bars in BarChart, etc. - is_front: Var[bool] + is_front: Optional[Var[bool]] = None class ReferenceLine(Reference): @@ -424,7 +424,7 @@ class ReferenceLine(Reference): alias = "RechartsReferenceLine" # The width of the stroke. - stroke_width: Var[int] + stroke_width: Optional[Var[int]] = None # Valid children components _valid_children: List[str] = ["Label"] @@ -464,37 +464,37 @@ class ReferenceArea(Recharts): alias = "RechartsReferenceArea" # Stroke color - stroke: Var[str] + stroke: Optional[Var[str]] = None # Fill color - fill: Var[str] + fill: Optional[Var[str]] = None # The opacity of area. - fill_opacity: Var[float] + fill_opacity: Optional[Var[float]] = None # The id of x-axis which is corresponding to the data. - x_axis_id: Var[Union[str, int]] + x_axis_id: Optional[Var[Union[str, int]]] = None # The id of y-axis which is corresponding to the data. - y_axis_id: Var[Union[str, int]] + y_axis_id: Optional[Var[Union[str, int]]] = None # A boundary value of the area. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys. If one of x1 or x2 is invalidate, the area will cover along x-axis. - x1: Var[Union[str, int]] + x1: Optional[Var[Union[str, int]]] = None # A boundary value of the area. If the specified x-axis is a number axis, the type of x must be Number. If the specified x-axis is a category axis, the value of x must be one of the categorys. If one of x1 or x2 is invalidate, the area will cover along x-axis. - x2: Var[Union[str, int]] + x2: Optional[Var[Union[str, int]]] = None # A boundary value of the area. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys. If one of y1 or y2 is invalidate, the area will cover along y-axis. - y1: Var[Union[str, int]] + y1: Optional[Var[Union[str, int]]] = None # A boundary value of the area. If the specified y-axis is a number axis, the type of y must be Number. If the specified y-axis is a category axis, the value of y must be one of the categorys. If one of y1 or y2 is invalidate, the area will cover along y-axis. - y2: Var[Union[str, int]] + y2: Optional[Var[Union[str, int]]] = None # Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. - if_overflow: Var[LiteralIfOverflow] + if_overflow: Optional[Var[LiteralIfOverflow]] = None # If set true, the line will be rendered in front of bars in BarChart, etc. - is_front: Var[bool] + is_front: Optional[Var[bool]] = None # Valid children components _valid_children: List[str] = ["Label"] @@ -504,16 +504,16 @@ class Grid(Recharts): """A base class for grid components in Recharts.""" # The x-coordinate of grid. - x: Var[int] + x: Optional[Var[int]] = None # The y-coordinate of grid. - y: Var[int] + y: Optional[Var[int]] = None # The width of grid. - width: Var[int] + width: Optional[Var[int]] = None # The height of grid. - height: Var[int] + height: Optional[Var[int]] = None class CartesianGrid(Grid): @@ -524,19 +524,19 @@ class CartesianGrid(Grid): alias = "RechartsCartesianGrid" # The horizontal line configuration. - horizontal: Var[Dict[str, Any]] + horizontal: Optional[Var[Dict[str, Any]]] = None # The vertical line configuration. - vertical: Var[Dict[str, Any]] + vertical: Optional[Var[Dict[str, Any]]] = None # The background of grid. - fill: Var[str] + fill: Optional[Var[str]] = None # The opacity of the background used to fill the space between grid lines - fill_opacity: Var[float] + fill_opacity: Optional[Var[float]] = None # The pattern of dashes and gaps used to paint the lines of the grid - stroke_dasharray: Var[str] + stroke_dasharray: Optional[Var[str]] = None class CartesianAxis(Grid): @@ -547,28 +547,28 @@ class CartesianAxis(Grid): alias = "RechartsCartesianAxis" # The orientation of axis 'top' | 'bottom' | 'left' | 'right' - orientation: Var[LiteralOrientationTopBottomLeftRight] + orientation: Optional[Var[LiteralOrientationTopBottomLeftRight]] = None # If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. - axis_line: Var[bool] + axis_line: Optional[Var[bool]] = None # If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. - tick_line: Var[bool] + tick_line: Optional[Var[bool]] = None # The length of tick line. - tick_size: Var[int] + tick_size: Optional[Var[int]] = None # If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically. - interval: Var[LiteralInterval] + interval: Optional[Var[LiteralInterval]] = None # If set false, no ticks will be drawn. - ticks: Var[bool] + ticks: Optional[Var[bool]] = None # If set a string or a number, default label will be drawn, and the option is content. - label: Var[str] + label: Optional[Var[str]] = None # If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. - mirror: Var[bool] + mirror: Optional[Var[bool]] = None # The margin between tick line and tick. - tick_margin: Var[int] + tick_margin: Optional[Var[int]] = None diff --git a/reflex/components/recharts/charts.py b/reflex/components/recharts/charts.py index 5a29cc2aa..6640391ad 100644 --- a/reflex/components/recharts/charts.py +++ b/reflex/components/recharts/charts.py @@ -1,7 +1,7 @@ """A module that defines the chart components in Recharts.""" from __future__ import annotations -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union from reflex.components.component import Component from reflex.components.recharts.general import ResponsiveContainer @@ -22,13 +22,13 @@ class ChartBase(RechartsCharts): """A component that wraps a Recharts charts.""" # The source data, in which each element is an object. - data: Var[List[Dict[str, Any]]] + data: Optional[Var[List[Dict[str, Any]]]] = None # If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. - sync_id: Var[str] + sync_id: Optional[Var[str]] = None # When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - sync_method: Var[LiteralSyncMethod] + sync_method: Optional[Var[LiteralSyncMethod]] = None # The width of chart container. String or Integer width: Var[Union[str, int]] = "100%" # type: ignore @@ -37,13 +37,13 @@ class ChartBase(RechartsCharts): height: Var[Union[str, int]] = "100%" # type: ignore # The layout of area in the chart. 'horizontal' | 'vertical' - layout: Var[LiteralLayout] + layout: Optional[Var[LiteralLayout]] = None # The sizes of whitespace around the chart. - margin: Var[Dict[str, Any]] + margin: Optional[Var[Dict[str, Any]]] = None # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' - stack_offset: Var[LiteralStackOffset] + stack_offset: Optional[Var[LiteralStackOffset]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -124,10 +124,10 @@ class AreaChart(ChartBase): alias = "RechartsAreaChart" # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' - base_value: Var[Union[int, LiteralComposedChartBaseValue]] + base_value: Optional[Var[Union[int, LiteralComposedChartBaseValue]]] = None # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. - stack_offset: Var[LiteralStackOffset] + stack_offset: Optional[Var[LiteralStackOffset]] = None # Valid children components _valid_children: List[str] = [ @@ -158,16 +158,16 @@ class BarChart(ChartBase): bar_gap: Var[Union[str, int]] # type: ignore # The width of all the bars in the chart. Number - bar_size: Var[int] + bar_size: Optional[Var[int]] = None # The maximum width of all the bars in a horizontal BarChart, or maximum height in a vertical BarChart. - max_bar_size: Var[int] + max_bar_size: Optional[Var[int]] = None # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. - stack_offset: Var[LiteralStackOffset] + stack_offset: Optional[Var[LiteralStackOffset]] = None # If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) - reverse_stack_order: Var[bool] + reverse_stack_order: Optional[Var[bool]] = None # Valid children components _valid_children: List[str] = [ @@ -214,19 +214,19 @@ class ComposedChart(ChartBase): alias = "RechartsComposedChart" # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' - base_value: Var[Union[int, LiteralComposedChartBaseValue]] + base_value: Optional[Var[Union[int, LiteralComposedChartBaseValue]]] = None # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number bar_category_gap: Var[Union[str, int]] # type: ignore # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number - bar_gap: Var[int] + bar_gap: Optional[Var[int]] = None # The width of all the bars in the chart. Number - bar_size: Var[int] + bar_size: Optional[Var[int]] = None # If false set, stacked items will be rendered left to right. If true set, stacked items will be rendered right to left. (Render direction affects SVG layering, not x position.) - reverse_stack_order: Var[bool] + reverse_stack_order: Optional[Var[bool]] = None # Valid children components _valid_children: List[str] = [ @@ -283,22 +283,22 @@ class RadarChart(ChartBase): alias = "RechartsRadarChart" # The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage - cx: Var[Union[int, str]] + cx: Optional[Var[Union[int, str]]] = None # The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage - cy: Var[Union[int, str]] + cy: Optional[Var[Union[int, str]]] = None # The angle of first radial direction line. - start_angle: Var[int] + start_angle: Optional[Var[int]] = None # The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. - end_angle: Var[int] + end_angle: Optional[Var[int]] = None # The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage - inner_radius: Var[Union[int, str]] + inner_radius: Optional[Var[Union[int, str]]] = None # The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage - outer_radius: Var[Union[int, str]] + outer_radius: Optional[Var[Union[int, str]]] = None # Valid children components _valid_children: List[str] = [ @@ -332,31 +332,31 @@ class RadialBarChart(ChartBase): alias = "RechartsRadialBarChart" # The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage - cx: Var[Union[int, str]] + cx: Optional[Var[Union[int, str]]] = None # The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage - cy: Var[Union[int, str]] + cy: Optional[Var[Union[int, str]]] = None # The angle of first radial direction line. - start_angle: Var[int] + start_angle: Optional[Var[int]] = None # The angle of last point in the circle which should be startAngle - 360 or startAngle + 360. We'll calculate the direction of chart by 'startAngle' and 'endAngle'. - end_angle: Var[int] + end_angle: Optional[Var[int]] = None # The inner radius of first circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage - inner_radius: Var[Union[int, str]] + inner_radius: Optional[Var[Union[int, str]]] = None # The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage - outer_radius: Var[Union[int, str]] + outer_radius: Optional[Var[Union[int, str]]] = None # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number - bar_category_gap: Var[Union[int, str]] + bar_category_gap: Optional[Var[Union[int, str]]] = None # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number - bar_gap: Var[str] + bar_gap: Optional[Var[str]] = None # The size of each bar. If the barSize is not specified, the size of bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups. - bar_size: Var[int] + bar_size: Optional[Var[int]] = None # Valid children components _valid_children: List[str] = [ @@ -428,13 +428,13 @@ class FunnelChart(RechartsCharts): alias = "RechartsFunnelChart" # The source data, in which each element is an object. - data: Var[List[Dict[str, Any]]] + data: Optional[Var[List[Dict[str, Any]]]] = None # If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush. - sync_id: Var[str] + sync_id: Optional[Var[str]] = None # When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function - sync_method: Var[str] + sync_method: Optional[Var[str]] = None # The width of chart container. String or Integer width: Var[Union[str, int]] = "100%" # type: ignore @@ -443,16 +443,16 @@ class FunnelChart(RechartsCharts): height: Var[Union[str, int]] = "100%" # type: ignore # The layout of area in the chart. 'horizontal' | 'vertical' - layout: Var[LiteralLayout] + layout: Optional[Var[LiteralLayout]] = None # The sizes of whitespace around the chart. - margin: Var[Dict[str, Any]] + margin: Optional[Var[Dict[str, Any]]] = None # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette' - stack_offset: Var[LiteralStackOffset] + stack_offset: Optional[Var[LiteralStackOffset]] = None # The layout of bars in the chart. centeric - layout: Var[str] + layout: Optional[Var[str]] = None # Valid children components _valid_children: List[str] = ["Legend", "GraphingTooltip", "Funnel"] @@ -485,25 +485,25 @@ class Treemap(RechartsCharts): height: Var[Union[str, int]] = "100%" # type: ignore # data of treemap. Array - data: Var[List[Dict[str, Any]]] + data: Optional[Var[List[Dict[str, Any]]]] = None # The key of a group of data which should be unique in a treemap. String | Number | Function - data_key: Var[Union[str, int]] + data_key: Optional[Var[Union[str, int]]] = None # The treemap will try to keep every single rectangle's aspect ratio near the aspectRatio given. Number - aspect_ratio: Var[int] + aspect_ratio: Optional[Var[int]] = None # If set false, animation of area will be disabled. - is_animation_active: Var[bool] + is_animation_active: Optional[Var[bool]] = None # Specifies when the animation should begin, the unit of this option is ms. - animation_begin: Var[int] + animation_begin: Optional[Var[int]] = None # Specifies the duration of animation, the unit of this option is ms. - animation_duration: Var[int] + animation_duration: Optional[Var[int]] = None # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' - animation_easing: Var[LiteralAnimationEasing] + animation_easing: Optional[Var[LiteralAnimationEasing]] = None @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/recharts/general.py b/reflex/components/recharts/general.py index ad23204d6..70a17cdf0 100644 --- a/reflex/components/recharts/general.py +++ b/reflex/components/recharts/general.py @@ -1,7 +1,7 @@ """General components for Recharts.""" from __future__ import annotations -from typing import Any, Dict, List, Union +from typing import Any, Dict, List, Optional, Union from reflex.components.component import MemoizationLeaf from reflex.constants import EventTriggers @@ -25,22 +25,22 @@ class ResponsiveContainer(Recharts, MemoizationLeaf): alias = "RechartsResponsiveContainer" # The aspect ratio of the container. The final aspect ratio of the SVG element will be (width / height) * aspect. Number - aspect: Var[int] + aspect: Optional[Var[int]] = None # The width of chart container. Can be a number or string - width: Var[Union[int, str]] + width: Optional[Var[Union[int, str]]] = None # The height of chart container. Number - height: Var[Union[int, str]] + height: Optional[Var[Union[int, str]]] = None # The minimum width of chart container. - min_width: Var[int] + min_width: Optional[Var[int]] = None # The minimum height of chart container. Number - min_height: Var[int] + min_height: Optional[Var[int]] = None # If specified a positive number, debounced function will be used to handle the resize event. - debounce: Var[int] + debounce: Optional[Var[int]] = None # Valid children components _valid_children: List[str] = [ @@ -64,34 +64,34 @@ class Legend(Recharts): alias = "RechartsLegend" # The width of legend container. Number - width: Var[int] + width: Optional[Var[int]] = None # The height of legend container. Number - height: Var[int] + height: Optional[Var[int]] = None # The layout of legend items. 'horizontal' | 'vertical' - layout: Var[LiteralLayout] + layout: Optional[Var[LiteralLayout]] = None # The alignment of legend items in 'horizontal' direction, which can be 'left', 'center', 'right'. - align: Var[LiteralLegendAlign] + align: Optional[Var[LiteralLegendAlign]] = None # The alignment of legend items in 'vertical' direction, which can be 'top', 'middle', 'bottom'. - vertical_align: Var[LiteralVerticalAlign] + vertical_align: Optional[Var[LiteralVerticalAlign]] = None # The size of icon in each legend item. - icon_size: Var[int] + icon_size: Optional[Var[int]] = None # The type of icon in each legend item. 'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' - icon_type: Var[LiteralIconType] + icon_type: Optional[Var[LiteralIconType]] = None # The width of chart container, usually calculated internally. - chart_width: Var[int] + chart_width: Optional[Var[int]] = None # The height of chart container, usually calculated internally. - chart_height: Var[int] + chart_height: Optional[Var[int]] = None # The margin of chart container, usually calculated internally. - margin: Var[Dict[str, Any]] + margin: Optional[Var[Dict[str, Any]]] = None def get_event_triggers(self) -> dict[str, Union[Var, Any]]: """Get the event triggers that pass the component's value to the handler. @@ -117,28 +117,28 @@ class GraphingTooltip(Recharts): alias = "RechartsTooltip" # The separator between name and value. - separator: Var[str] + separator: Optional[Var[str]] = None # The offset size of tooltip. Number - offset: Var[int] + offset: Optional[Var[int]] = None # When an item of the payload has value null or undefined, this item won't be displayed. - filter_null: Var[bool] + filter_null: Optional[Var[bool]] = None # If set false, no cursor will be drawn when tooltip is active. - cursor: Var[bool] + cursor: Optional[Var[bool]] = None # The box of viewing area, which has the shape of {x: someVal, y: someVal, width: someVal, height: someVal}, usually calculated internally. - view_box: Var[Dict[str, Any]] + view_box: Optional[Var[Dict[str, Any]]] = None # If set true, the tooltip is displayed. If set false, the tooltip is hidden, usually calculated internally. - active: Var[bool] + active: Optional[Var[bool]] = None # If this field is set, the tooltip position will be fixed and will not move anymore. - position: Var[Dict[str, Any]] + position: Optional[Var[Dict[str, Any]]] = None # The coordinate of tooltip which is usually calculated internally. - coordinate: Var[Dict[str, Any]] + coordinate: Optional[Var[Dict[str, Any]]] = None class Label(Recharts): @@ -149,16 +149,16 @@ class Label(Recharts): alias = "RechartsLabel" # The box of viewing area, which has the shape of {x: someVal, y: someVal, width: someVal, height: someVal}, usually calculated internally. - view_box: Var[Dict[str, Any]] + view_box: Optional[Var[Dict[str, Any]]] = None # The value of label, which can be specified by this props or the children of