From bcaab3015d4077c8f626753d77ec13c373028894 Mon Sep 17 00:00:00 2001 From: Benedikt Bartscher Date: Fri, 1 Mar 2024 23:05:59 +0100 Subject: [PATCH] add Component.alias str type annotation --- reflex/components/chakra/forms/multiselect.py | 2 +- reflex/components/chakra/media/image.py | 2 +- reflex/components/datadisplay/code.py | 2 +- reflex/components/gridjs/datatable.py | 2 +- .../components/radix/primitives/accordion.py | 10 +++---- reflex/components/radix/primitives/drawer.py | 16 +++++----- reflex/components/radix/primitives/form.py | 14 ++++----- .../components/radix/primitives/progress.py | 4 +-- reflex/components/radix/primitives/slider.py | 8 ++--- reflex/components/recharts/cartesian.py | 30 +++++++++---------- reflex/components/recharts/charts.py | 20 ++++++------- reflex/components/recharts/general.py | 10 +++---- reflex/components/recharts/polar.py | 12 ++++---- 13 files changed, 66 insertions(+), 66 deletions(-) diff --git a/reflex/components/chakra/forms/multiselect.py b/reflex/components/chakra/forms/multiselect.py index 1d425ab54..c0a10dd80 100644 --- a/reflex/components/chakra/forms/multiselect.py +++ b/reflex/components/chakra/forms/multiselect.py @@ -48,7 +48,7 @@ class Select(Component): library: str = "chakra-react-select@4.7.5" tag: str = "Select" - alias = "MultiSelect" + alias: str = "MultiSelect" # Focus the control when it is mounted auto_focus: Optional[Var[bool]] = None diff --git a/reflex/components/chakra/media/image.py b/reflex/components/chakra/media/image.py index 82927cc7b..0c85b169b 100644 --- a/reflex/components/chakra/media/image.py +++ b/reflex/components/chakra/media/image.py @@ -12,7 +12,7 @@ class Image(ChakraComponent): """Display an image.""" tag: str = "Image" - alias = "ChakraImage" + alias: str = "ChakraImage" # How to align the image within its bounds. It maps to css `object-position` property. align: Optional[Var[str]] = None diff --git a/reflex/components/datadisplay/code.py b/reflex/components/datadisplay/code.py index 7f106292e..a33e11641 100644 --- a/reflex/components/datadisplay/code.py +++ b/reflex/components/datadisplay/code.py @@ -352,7 +352,7 @@ class CodeBlock(Component): tag: str = "PrismAsyncLight" - alias = "SyntaxHighlighter" + alias: str = "SyntaxHighlighter" # The theme to use ("light" or "dark"). theme: Var[LiteralCodeBlockTheme] = "one-light" # type: ignore diff --git a/reflex/components/gridjs/datatable.py b/reflex/components/gridjs/datatable.py index 09130d008..c3ce480f8 100644 --- a/reflex/components/gridjs/datatable.py +++ b/reflex/components/gridjs/datatable.py @@ -23,7 +23,7 @@ class DataTable(Gridjs): tag: str = "Grid" - alias = "DataTableGrid" + alias: str = "DataTableGrid" # The data to display. Either a list of lists or a pandas dataframe. data: Any diff --git a/reflex/components/radix/primitives/accordion.py b/reflex/components/radix/primitives/accordion.py index 897e076d7..cecfb5dff 100644 --- a/reflex/components/radix/primitives/accordion.py +++ b/reflex/components/radix/primitives/accordion.py @@ -307,7 +307,7 @@ class AccordionRoot(AccordionComponent): tag: str = "Root" - alias = "RadixAccordionRoot" + alias: str = "RadixAccordionRoot" # The type of accordion (single or multiple). type: Optional[Var[LiteralAccordionType]] = None @@ -471,7 +471,7 @@ class AccordionItem(AccordionComponent): tag: str = "Item" - alias = "RadixAccordionItem" + alias: str = "RadixAccordionItem" # A unique identifier for the item. value: Optional[Var[str]] = None @@ -540,7 +540,7 @@ class AccordionHeader(AccordionComponent): tag: str = "Header" - alias = "RadixAccordionHeader" + alias: str = "RadixAccordionHeader" @classmethod def create(cls, *children, **props) -> Component: @@ -569,7 +569,7 @@ class AccordionTrigger(AccordionComponent): tag: str = "Trigger" - alias = "RadixAccordionTrigger" + alias: str = "RadixAccordionTrigger" @classmethod def create(cls, *children, **props) -> Component: @@ -620,7 +620,7 @@ class AccordionContent(AccordionComponent): tag: str = "Content" - alias = "RadixAccordionContent" + alias: str = "RadixAccordionContent" @classmethod def create(cls, *children, **props) -> Component: diff --git a/reflex/components/radix/primitives/drawer.py b/reflex/components/radix/primitives/drawer.py index 5fcde30cd..74110bd14 100644 --- a/reflex/components/radix/primitives/drawer.py +++ b/reflex/components/radix/primitives/drawer.py @@ -29,7 +29,7 @@ class DrawerRoot(DrawerComponent): tag: str = "Drawer.Root" - alias = "Vaul" + tag + alias: str = "Vaul" + tag # Whether the drawer is open or not. open: Optional[Var[bool]] = None @@ -75,7 +75,7 @@ class DrawerTrigger(DrawerComponent): tag: str = "Drawer.Trigger" - alias = "Vaul" + tag + alias: str = "Vaul" + tag # Defaults to true, if the first child acts as the trigger. as_child: Var[bool] = True # type: ignore @@ -86,7 +86,7 @@ class DrawerPortal(DrawerComponent): tag: str = "Drawer.Portal" - alias = "Vaul" + tag + alias: str = "Vaul" + tag # Based on https://www.radix-ui.com/primitives/docs/components/dialog#content @@ -95,7 +95,7 @@ class DrawerContent(DrawerComponent): tag: str = "Drawer.Content" - alias = "Vaul" + tag + alias: str = "Vaul" + tag # Style set partially based on the source code at https://ui.shadcn.com/docs/components/drawer def _get_style(self) -> dict: @@ -159,7 +159,7 @@ class DrawerOverlay(DrawerComponent): tag: str = "Drawer.Overlay" - alias = "Vaul" + tag + alias: str = "Vaul" + tag # Style set based on the source code at https://ui.shadcn.com/docs/components/drawer def _get_style(self) -> dict: @@ -187,7 +187,7 @@ class DrawerClose(DrawerComponent): tag: str = "Drawer.Close" - alias = "Vaul" + tag + alias: str = "Vaul" + tag class DrawerTitle(DrawerComponent): @@ -195,7 +195,7 @@ class DrawerTitle(DrawerComponent): tag: str = "Drawer.Title" - alias = "Vaul" + tag + alias: str = "Vaul" + tag # Style set based on the source code at https://ui.shadcn.com/docs/components/drawer def _get_style(self) -> dict: @@ -220,7 +220,7 @@ class DrawerDescription(DrawerComponent): tag: str = "Drawer.Description" - alias = "Vaul" + tag + alias: str = "Vaul" + tag # Style set based on the source code at https://ui.shadcn.com/docs/components/drawer def _get_style(self) -> dict: diff --git a/reflex/components/radix/primitives/form.py b/reflex/components/radix/primitives/form.py index 822653e04..66b752489 100644 --- a/reflex/components/radix/primitives/form.py +++ b/reflex/components/radix/primitives/form.py @@ -47,7 +47,7 @@ class FormRoot(FormComponent): tag: str = "Root" - alias = "RadixFormRoot" + alias: str = "RadixFormRoot" # If true, the form will be cleared after submit. reset_on_submit: Var[bool] = False # type: ignore @@ -169,7 +169,7 @@ class FormField(FormComponent): tag: str = "Field" - alias = "RadixFormField" + alias: str = "RadixFormField" # The name of the form field, that is passed down to the control and used to match with validation messages. name: Optional[Var[str]] = None @@ -190,7 +190,7 @@ class FormLabel(FormComponent): tag: str = "Label" - alias = "RadixFormLabel" + alias: str = "RadixFormLabel" def _apply_theme(self, theme: Component): return { @@ -206,7 +206,7 @@ class FormControl(FormComponent): tag: str = "Control" - alias = "RadixFormControl" + alias: str = "RadixFormControl" @classmethod def create(cls, *children, **props): @@ -254,7 +254,7 @@ class FormMessage(FormComponent): tag: str = "Message" - alias = "RadixFormMessage" + alias: str = "RadixFormMessage" # Used to target a specific field by name when rendering outside of a Field part. name: Optional[Var[str]] = None @@ -278,14 +278,14 @@ class FormValidityState(FormComponent): """A form validity state component.""" tag: str = "ValidityState" - alias = "RadixFormValidityState" + alias: str = "RadixFormValidityState" class FormSubmit(FormComponent): """A form submit component.""" tag: str = "Submit" - alias = "RadixFormSubmit" + alias: str = "RadixFormSubmit" # This class is created mainly for reflex-web docs. diff --git a/reflex/components/radix/primitives/progress.py b/reflex/components/radix/primitives/progress.py index f290c5ca1..908981a56 100644 --- a/reflex/components/radix/primitives/progress.py +++ b/reflex/components/radix/primitives/progress.py @@ -22,7 +22,7 @@ class ProgressRoot(ProgressComponent): """The Progress Root component.""" tag: str = "Root" - alias = "RadixProgressRoot" + alias: str = "RadixProgressRoot" # Override theme radius for progress bar: "none" | "small" | "medium" | "large" | "full" radius: Optional[Var[LiteralRadius]] = None @@ -53,7 +53,7 @@ class ProgressIndicator(ProgressComponent): tag: str = "Indicator" - alias = "RadixProgressIndicator" + alias: str = "RadixProgressIndicator" # The current progress value. value: Optional[Var[Optional[int]]] = None diff --git a/reflex/components/radix/primitives/slider.py b/reflex/components/radix/primitives/slider.py index dfe360b6c..a0fd6236a 100644 --- a/reflex/components/radix/primitives/slider.py +++ b/reflex/components/radix/primitives/slider.py @@ -22,7 +22,7 @@ class SliderRoot(SliderComponent): """The Slider component comtaining all slider parts.""" tag: str = "Root" - alias = "RadixSliderRoot" + alias: str = "RadixSliderRoot" default_value: Optional[Var[List[int]]] = None @@ -82,7 +82,7 @@ class SliderTrack(SliderComponent): """A Slider Track component.""" tag: str = "Track" - alias = "RadixSliderTrack" + alias: str = "RadixSliderTrack" def _apply_theme(self, theme: Component): self.style = Style( @@ -104,7 +104,7 @@ class SliderRange(SliderComponent): """A SliderRange component.""" tag: str = "Range" - alias = "RadixSliderRange" + alias: str = "RadixSliderRange" def _apply_theme(self, theme: Component): self.style = Style( @@ -124,7 +124,7 @@ class SliderThumb(SliderComponent): """A SliderThumb component.""" tag: str = "Thumb" - alias = "RadixSliderThumb" + alias: str = "RadixSliderThumb" def _apply_theme(self, theme: Component): self.style = Style( diff --git a/reflex/components/recharts/cartesian.py b/reflex/components/recharts/cartesian.py index e7bf110a1..a6af6c677 100644 --- a/reflex/components/recharts/cartesian.py +++ b/reflex/components/recharts/cartesian.py @@ -89,7 +89,7 @@ class XAxis(Axis): tag: str = "XAxis" - alias = "RechartsXAxis" + alias: str = "RechartsXAxis" class YAxis(Axis): @@ -97,7 +97,7 @@ class YAxis(Axis): tag: str = "YAxis" - alias = "RechartsYAxis" + alias: str = "RechartsYAxis" # The key of data displayed in the axis. data_key: Optional[Var[Union[str, int]]] = None @@ -108,7 +108,7 @@ class ZAxis(Recharts): tag: str = "ZAxis" - alias = "RechartszAxis" + alias: str = "RechartszAxis" # The key of data displayed in the axis. data_key: Optional[Var[Union[str, int]]] = None @@ -131,7 +131,7 @@ class Brush(Recharts): tag: str = "Brush" - alias = "RechartsBrush" + alias: str = "RechartsBrush" # Stroke color stroke: Optional[Var[str]] = None @@ -216,7 +216,7 @@ class Area(Cartesian): tag: str = "Area" - alias = "RechartsArea" + alias: str = "RechartsArea" # The color of the line stroke. stroke: Optional[Var[str]] = None @@ -251,7 +251,7 @@ class Bar(Cartesian): tag: str = "Bar" - alias = "RechartsBar" + alias: str = "RechartsBar" # The color of the line stroke. stroke: Optional[Var[str]] = None @@ -286,7 +286,7 @@ class Line(Cartesian): tag: str = "Line" - alias = "RechartsLine" + alias: str = "RechartsLine" # The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area. type_: Optional[Var[LiteralAreaType]] = None @@ -321,7 +321,7 @@ class Scatter(Cartesian): tag: str = "Scatter" - alias = "RechartsScatter" + alias: str = "RechartsScatter" # The source data, in which each element is an object. data: Optional[Var[List[Dict[str, Any]]]] = None @@ -353,7 +353,7 @@ class Funnel(Cartesian): tag: str = "Funnel" - alias = "RechartsFunnel" + alias: str = "RechartsFunnel" # The source data, in which each element is an object. data: Optional[Var[List[Dict[str, Any]]]] = None @@ -376,7 +376,7 @@ class ErrorBar(Recharts): tag: str = "ErrorBar" - alias = "RechartsErrorBar" + alias: str = "RechartsErrorBar" # The direction of error bar. 'x' | 'y' | 'both' direction: Optional[Var[LiteralDirection]] = None @@ -421,7 +421,7 @@ class ReferenceLine(Reference): tag: str = "ReferenceLine" - alias = "RechartsReferenceLine" + alias: str = "RechartsReferenceLine" # The width of the stroke. stroke_width: Optional[Var[int]] = None @@ -435,7 +435,7 @@ class ReferenceDot(Reference): tag: str = "ReferenceDot" - alias = "RechartsReferenceDot" + alias: str = "RechartsReferenceDot" # Valid children components _valid_children: List[str] = ["Label"] @@ -461,7 +461,7 @@ class ReferenceArea(Recharts): tag: str = "ReferenceArea" - alias = "RechartsReferenceArea" + alias: str = "RechartsReferenceArea" # Stroke color stroke: Optional[Var[str]] = None @@ -521,7 +521,7 @@ class CartesianGrid(Grid): tag: str = "CartesianGrid" - alias = "RechartsCartesianGrid" + alias: str = "RechartsCartesianGrid" # The horizontal line configuration. horizontal: Optional[Var[Dict[str, Any]]] = None @@ -544,7 +544,7 @@ class CartesianAxis(Grid): tag: str = "CartesianAxis" - alias = "RechartsCartesianAxis" + alias: str = "RechartsCartesianAxis" # The orientation of axis 'top' | 'bottom' | 'left' | 'right' orientation: Optional[Var[LiteralOrientationTopBottomLeftRight]] = None diff --git a/reflex/components/recharts/charts.py b/reflex/components/recharts/charts.py index fcb9b689c..0980a5cd7 100644 --- a/reflex/components/recharts/charts.py +++ b/reflex/components/recharts/charts.py @@ -121,7 +121,7 @@ class AreaChart(ChartBase): tag: str = "AreaChart" - alias = "RechartsAreaChart" + alias: str = "RechartsAreaChart" # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' base_value: Optional[Var[Union[int, LiteralComposedChartBaseValue]]] = None @@ -149,7 +149,7 @@ class BarChart(ChartBase): tag: str = "BarChart" - alias = "RechartsBarChart" + alias: str = "RechartsBarChart" # 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 @@ -189,7 +189,7 @@ class LineChart(ChartBase): tag: str = "LineChart" - alias = "RechartsLineChart" + alias: str = "RechartsLineChart" # Valid children components _valid_children: List[str] = [ @@ -211,7 +211,7 @@ class ComposedChart(ChartBase): tag: str = "ComposedChart" - alias = "RechartsComposedChart" + alias: str = "RechartsComposedChart" # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto' base_value: Optional[Var[Union[int, LiteralComposedChartBaseValue]]] = None @@ -250,7 +250,7 @@ class PieChart(ChartBase): tag: str = "PieChart" - alias = "RechartsPieChart" + alias: str = "RechartsPieChart" # Valid children components _valid_children: List[str] = [ @@ -280,7 +280,7 @@ class RadarChart(ChartBase): tag: str = "RadarChart" - alias = "RechartsRadarChart" + alias: str = "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: Optional[Var[Union[int, str]]] = None @@ -329,7 +329,7 @@ class RadialBarChart(ChartBase): tag: str = "RadialBarChart" - alias = "RechartsRadialBarChart" + alias: str = "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: Optional[Var[Union[int, str]]] = None @@ -387,7 +387,7 @@ class ScatterChart(ChartBase): tag: str = "ScatterChart" - alias = "RechartsScatterChart" + alias: str = "RechartsScatterChart" # Valid children components _valid_children: List[str] = [ @@ -425,7 +425,7 @@ class FunnelChart(RechartsCharts): tag: str = "FunnelChart" - alias = "RechartsFunnelChart" + alias: str = "RechartsFunnelChart" # The source data, in which each element is an object. data: Optional[Var[List[Dict[str, Any]]]] = None @@ -476,7 +476,7 @@ class Treemap(RechartsCharts): tag: str = "Treemap" - alias = "RechartsTreemap" + alias: str = "RechartsTreemap" # The width of chart container. String or Integer width: Var[Union[str, int]] = "100%" # type: ignore diff --git a/reflex/components/recharts/general.py b/reflex/components/recharts/general.py index 19c7b5749..19ee2396e 100644 --- a/reflex/components/recharts/general.py +++ b/reflex/components/recharts/general.py @@ -22,7 +22,7 @@ class ResponsiveContainer(Recharts, MemoizationLeaf): tag: str = "ResponsiveContainer" - alias = "RechartsResponsiveContainer" + alias: str = "RechartsResponsiveContainer" # The aspect ratio of the container. The final aspect ratio of the SVG element will be (width / height) * aspect. Number aspect: Optional[Var[int]] = None @@ -61,7 +61,7 @@ class Legend(Recharts): tag: str = "Legend" - alias = "RechartsLegend" + alias: str = "RechartsLegend" # The width of legend container. Number width: Optional[Var[int]] = None @@ -114,7 +114,7 @@ class GraphingTooltip(Recharts): tag: str = "Tooltip" - alias = "RechartsTooltip" + alias: str = "RechartsTooltip" # The separator between name and value. separator: Optional[Var[str]] = None @@ -146,7 +146,7 @@ class Label(Recharts): tag: str = "Label" - alias = "RechartsLabel" + alias: str = "RechartsLabel" # The box of viewing area, which has the shape of {x: someVal, y: someVal, width: someVal, height: someVal}, usually calculated internally. view_box: Optional[Var[Dict[str, Any]]] = None @@ -166,7 +166,7 @@ class LabelList(Recharts): tag: str = "LabelList" - alias = "RechartsLabelList" + alias: str = "RechartsLabelList" # The key of a group of label values in data. data_key: Optional[Var[Union[str, int]]] = None diff --git a/reflex/components/recharts/polar.py b/reflex/components/recharts/polar.py index b47dc5d7f..0f9adf5f7 100644 --- a/reflex/components/recharts/polar.py +++ b/reflex/components/recharts/polar.py @@ -20,7 +20,7 @@ class Pie(Recharts): tag: str = "Pie" - alias = "RechartsPie" + alias: str = "RechartsPie" # data data: Optional[Var[List[Dict[str, Any]]]] = None @@ -94,7 +94,7 @@ class Radar(Recharts): tag: str = "Radar" - alias = "RechartsRadar" + alias: str = "RechartsRadar" # The key of a group of data which should be unique in a radar chart. data_key: Optional[Var[Union[str, int]]] = None @@ -138,7 +138,7 @@ class RadialBar(Recharts): tag: str = "RadialBar" - alias = "RechartsRadialBar" + alias: str = "RechartsRadialBar" # The source data which each element is an object. data: Optional[Var[List[Dict[str, Any]]]] = None @@ -179,7 +179,7 @@ class PolarAngleAxis(Recharts): tag: str = "PolarAngleAxis" - alias = "RechartsPolarAngleAxis" + alias: str = "RechartsPolarAngleAxis" # The key of a group of data which should be unique to show the meaning of angle axis. data_key: Optional[Var[Union[str, int]]] = None @@ -238,7 +238,7 @@ class PolarGrid(Recharts): tag: str = "PolarGrid" - alias = "RechartsPolarGrid" + alias: str = "RechartsPolarGrid" # The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width. cx: Optional[Var[Union[int, str]]] = None @@ -270,7 +270,7 @@ class PolarRadiusAxis(Recharts): tag: str = "PolarRadiusAxis" - alias = "RechartsPolarRadiusAxis" + alias: str = "RechartsPolarRadiusAxis" # The angle of radial direction line to display axis text. angle: Optional[Var[int]] = None