pyright fix
This commit is contained in:
parent
5862672794
commit
c8ea434cc1
@ -166,7 +166,7 @@ class ConnectionBanner(Component):
|
|||||||
"""A connection banner component."""
|
"""A connection banner component."""
|
||||||
|
|
||||||
# The component to render when there's a server connection error.
|
# The component to render when there's a server connection error.
|
||||||
comp: Var[Optional[Component]] = None
|
comp: Var[Optional[Component]] = Var.create(None)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, **props) -> Component:
|
def create(cls, **props) -> Component:
|
||||||
@ -198,7 +198,7 @@ class ConnectionModal(Component):
|
|||||||
"""A connection status modal window."""
|
"""A connection status modal window."""
|
||||||
|
|
||||||
# The component to render when there's a server connection error.
|
# The component to render when there's a server connection error.
|
||||||
comp: Var[Optional[Component]] = None
|
comp: Var[Optional[Component]] = Var.create(None)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, **props) -> Component:
|
def create(cls, **props) -> Component:
|
||||||
|
@ -391,7 +391,7 @@ class CodeBlock(Component):
|
|||||||
theme: Var[Union[Theme, str]] = Theme.one_light
|
theme: Var[Union[Theme, str]] = Theme.one_light
|
||||||
|
|
||||||
# The language to use.
|
# The language to use.
|
||||||
language: Var[LiteralCodeLanguage] = "python" # type: ignore
|
language: Var[LiteralCodeLanguage] = Var.create("python")
|
||||||
|
|
||||||
# The code to display.
|
# The code to display.
|
||||||
code: Var[str]
|
code: Var[str]
|
||||||
@ -412,10 +412,10 @@ class CodeBlock(Component):
|
|||||||
code_tag_props: Var[Dict[str, str]]
|
code_tag_props: Var[Dict[str, str]]
|
||||||
|
|
||||||
# Whether a copy button should appear.
|
# Whether a copy button should appear.
|
||||||
can_copy: Var[Optional[bool]] = False
|
can_copy: Var[Optional[bool]] = Var.create(False)
|
||||||
|
|
||||||
# A custom copy button to override the default one.
|
# A custom copy button to override the default one.
|
||||||
copy_button: Var[Optional[Union[bool, Component]]] = None
|
copy_button: Var[Optional[Union[bool, Component]]] = Var.create(None)
|
||||||
|
|
||||||
def add_imports(self) -> ImportDict:
|
def add_imports(self) -> ImportDict:
|
||||||
"""Add imports for the CodeBlock component.
|
"""Add imports for the CodeBlock component.
|
||||||
|
@ -194,10 +194,10 @@ class AccordionItem(AccordionComponent):
|
|||||||
disabled: Var[bool]
|
disabled: Var[bool]
|
||||||
|
|
||||||
# The header of the accordion item.
|
# The header of the accordion item.
|
||||||
header: Var[Optional[Union[Component, str]]] = None
|
header: Var[Optional[Union[Component, str]]] = Var.create(None)
|
||||||
|
|
||||||
# The content of the accordion item.
|
# The content of the accordion item.
|
||||||
content: Var[Optional[Union[Component, str]]] = None
|
content: Var[Optional[Union[Component, str]]] = Var.create(None)
|
||||||
|
|
||||||
_valid_children: List[str] = [
|
_valid_children: List[str] = [
|
||||||
"AccordionHeader",
|
"AccordionHeader",
|
||||||
|
@ -97,10 +97,10 @@ class ColorModeIconButton(IconButton):
|
|||||||
"""Icon Button for toggling light / dark mode via toggle_color_mode."""
|
"""Icon Button for toggling light / dark mode via toggle_color_mode."""
|
||||||
|
|
||||||
# The position of the icon button. Follow document flow if None.
|
# The position of the icon button. Follow document flow if None.
|
||||||
position: Var[Optional[LiteralPosition]] = None
|
position: Var[Optional[LiteralPosition]] = Var.create(None)
|
||||||
|
|
||||||
# Allow picking the "system" value for the color mode.
|
# Allow picking the "system" value for the color mode.
|
||||||
allow_system: Var[bool] = False
|
allow_system: Var[bool] = Var.create(False)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
@ -62,7 +62,7 @@ class Slider(RadixThemesComponent):
|
|||||||
name: Var[str]
|
name: Var[str]
|
||||||
|
|
||||||
# The width of the slider.
|
# The width of the slider.
|
||||||
width: Var[Optional[str]] = "100%"
|
width: Var[Optional[str]] = Var.create("100%")
|
||||||
|
|
||||||
# The minimum value of the slider.
|
# The minimum value of the slider.
|
||||||
min: Var[Union[float, int]]
|
min: Var[Union[float, int]]
|
||||||
|
@ -99,26 +99,28 @@ class UnorderedList(BaseList, Ul):
|
|||||||
|
|
||||||
tag = "ul"
|
tag = "ul"
|
||||||
|
|
||||||
|
# The style of the list.
|
||||||
|
list_style_type: Var[LiteralListStyleTypeOrdered] = Var.create("disc")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
cls,
|
cls,
|
||||||
*children,
|
*children,
|
||||||
items: Optional[Var[Iterable]] = None,
|
|
||||||
list_style_type: LiteralListStyleTypeUnordered = "disc",
|
|
||||||
**props,
|
**props,
|
||||||
):
|
):
|
||||||
"""Create an unordered list component.
|
"""Create an unordered list component.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
*children: The children of the component.
|
*children: The children of the component.
|
||||||
items: A list of items to add to the list.
|
|
||||||
list_style_type: The style of the list.
|
|
||||||
**props: The properties of the component.
|
**props: The properties of the component.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The list component.
|
The list component.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
items = props.pop("items", None)
|
||||||
|
list_style_type = props.pop("list_style_type", "disc")
|
||||||
|
|
||||||
props["margin_left"] = props.get("margin_left", "1.5rem")
|
props["margin_left"] = props.get("margin_left", "1.5rem")
|
||||||
return super().create(
|
return super().create(
|
||||||
*children, items=items, list_style_type=list_style_type, **props
|
*children, items=items, list_style_type=list_style_type, **props
|
||||||
@ -131,7 +133,7 @@ class OrderedList(BaseList, Ol):
|
|||||||
tag = "ol"
|
tag = "ol"
|
||||||
|
|
||||||
# The style of the list.
|
# The style of the list.
|
||||||
list_style_type: Var[LiteralListStyleTypeOrdered] = "decimal"
|
list_style_type: Var[LiteralListStyleTypeOrdered] = Var.create("decimal")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
@ -13,10 +13,10 @@ class Stack(Flex):
|
|||||||
"""A stack component."""
|
"""A stack component."""
|
||||||
|
|
||||||
# The spacing between each stack item.
|
# The spacing between each stack item.
|
||||||
spacing: LiteralSpacing = "3"
|
spacing: Var[LiteralSpacing] = Var.create("3")
|
||||||
|
|
||||||
# The alignment of the stack items.
|
# The alignment of the stack items.
|
||||||
align: LiteralAlign = "start"
|
align: Var[LiteralAlign] = Var.create("start")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
Loading…
Reference in New Issue
Block a user