diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5c417e7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,80 @@ +name: ci +env: + OPENAI_API_KEY: "dummy" +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + type-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install UV + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.10" + enable-cache: true + activate-environment: true + - name: Install dependencies + run: uv sync + - name: Run Type Checking + uses: jakebailey/pyright-action@v2 + with: + extra-args: reflex_chakra + version: PATH + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install UV + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.10" + enable-cache: true + activate-environment: true + - name: Install dependencies + run: uv sync + - name: Run Ruff Linter + run: ruff check --output-format=github reflex_chakra + - name: Run Ruff Formatter + run: ruff format --check --diff reflex_chakra + check-pyi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install UV + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.13" + enable-cache: true + activate-environment: true + - name: Install dependencies + run: uv sync + - name: Run PYI generation + run: python regenerate_pyi.py + - name: Check if there are any changes + run: git diff --exit-code -- "*.pyi" || (echo "PYI files have changed. Please commit the changes." && exit 1) + check-export: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install UV + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.10" + enable-cache: true + activate-environment: true + - name: Install Reflex + working-directory: ./docs/rcweb + run: uv pip install $(grep -ivE "reflex-chakra" requirements.txt) + + - name: Initialize Reflex + working-directory: ./docs/rcweb + run: uv run reflex init + + - name: Build frontend + working-directory: ./docs/rcweb + run: uv run reflex export diff --git a/.github/workflows/export_docs.yml b/.github/workflows/export_docs.yml deleted file mode 100644 index 24b0c17..0000000 --- a/.github/workflows/export_docs.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: ci -env: - OPENAI_API_KEY: "dummy" -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - check-export: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install UV - uses: astral-sh/setup-uv@v6 - with: - python-version: "3.10" - enable-cache: true - activate-environment: true - - name: Install Reflex - working-directory: ./docs/rcweb - run: uv pip install $(grep -ivE "reflex-chakra" requirements.txt) - - - name: Initialize Reflex - working-directory: ./docs/rcweb - run: uv run reflex init - - - name: Build frontend - working-directory: ./docs/rcweb - run: uv run reflex export diff --git a/.gitignore b/.gitignore index 82f9275..0d898f6 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,5 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +assets/chakra_color_mode_provider.js \ No newline at end of file diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..3a4f41e --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13 \ No newline at end of file diff --git a/docs/rcweb/rcweb/constants/css.py b/docs/rcweb/rcweb/constants/css.py index 125712c..c8916e5 100644 --- a/docs/rcweb/rcweb/constants/css.py +++ b/docs/rcweb/rcweb/constants/css.py @@ -1,9 +1,11 @@ """App styling.""" import reflex as rx -from . import fonts + import reflex_chakra as rc +from . import fonts + font_weights = { "bold": "800", "heading": "700", @@ -40,23 +42,6 @@ def get_code_style_rdx(color: str): "line_height": "1.5", } -tab_style = { - "color": rx.color("slate", 9), - "cursor": "pointer", - "_hover": { - "color": rx.color("slate", 11), - }, - **fonts.small, - "padding_x": "0.5em", - "padding_y": "0.25em", - "&[data-state='active']": { - "color": rx.color("violet", 9), - }, - "not:&[data-state='active']": { - "color": rx.color("slate", 11), - }, -} - # General styles. SANS = "Instrument Sans" diff --git a/docs/rcweb/rcweb/rcweb.py b/docs/rcweb/rcweb/rcweb.py index 32cc27e..ec848c3 100644 --- a/docs/rcweb/rcweb/rcweb.py +++ b/docs/rcweb/rcweb/rcweb.py @@ -1,33 +1,19 @@ """Welcome to Reflex! This file outlines the steps to create a basic app.""" import os -from pathlib import Path from collections import defaultdict +from pathlib import Path from types import SimpleNamespace -import reflex as rx -import reflex_chakra as rc import flexdown +import reflex as rx +from reflex.utils.format import to_kebab_case, to_snake_case -from .utils.flexdown import xd -from .utils.docpage import multi_docs -from .constants import css - - -def should_skip_compile(doc: flexdown.Document): - """Skip compilation if the markdown file has not been modified since the last compilation.""" - if not os.environ.get("REFLEX_PERSIST_WEB_DIR", False): - return False +import reflex_chakra as rc # noqa: F401 - # Check if the doc has been compiled already. - compiled_output = f".web/pages/{doc.replace('.md', '.js')}" - # Get the timestamp of the compiled file. - compiled_time = ( - os.path.getmtime(compiled_output) if os.path.exists(compiled_output) else 0 - ) - # Get the timestamp of the source file. - source_time = os.path.getmtime(doc) - return compiled_time > source_time +from .constants import css +from .utils.docpage import Route, multi_docs +from .utils.flexdown import xd def find_flexdown_files(directory: str) -> list[str]: @@ -40,14 +26,16 @@ def find_flexdown_files(directory: str) -> list[str]: A list of paths to Flexdown files. """ return [ - os.path.join(root, file).replace("\\", "/") + (Path(root) / file).as_posix() for root, _, files in os.walk(directory) for file in files if file.endswith(".md") ] -def extract_components_from_metadata(document) -> list: +def extract_components_from_metadata( + document: flexdown.Document, +) -> list[tuple[type, str]]: """Extract components from the document metadata. Args: @@ -56,14 +44,14 @@ def extract_components_from_metadata(document) -> list: Returns: A list of tuples containing component instances and their string representation. """ - components = [] + components: list[tuple[type, str]] = [] for comp_str in document.metadata.get("components", []): component = eval(comp_str) if isinstance(component, type): components.append((component, comp_str)) elif hasattr(component, "__self__"): components.append((component.__self__, comp_str)) - elif isinstance(component, SimpleNamespace) and hasattr(component, "__call__"): + elif isinstance(component, SimpleNamespace) and hasattr(component, "__call__"): # noqa: B004 components.append((component.__call__.__self__, comp_str)) return components @@ -99,8 +87,10 @@ def convert_to_title_case(text: str) -> str: def create_doc_component( - doc_path: str, base_dir: str, component_registry: defaultdict -) -> rx.Component: + doc_path: str, + base_dir: str, + component_registry: defaultdict[str, list[tuple[str, list[tuple[type, str]]]]], +) -> Route: """Create a document component for a given file path. Args: @@ -112,13 +102,14 @@ def create_doc_component( A component object representing the document page. """ doc_path = doc_path.replace("\\", "/") - route_path = rx.utils.format.to_kebab_case( + doc_path_path = Path(doc_path) + route_path = to_kebab_case( f"/{doc_path.removeprefix(base_dir).replace('.md', '/')}" ).replace("//", "/") - category = os.path.basename(os.path.dirname(doc_path)).title() + category = doc_path_path.parent.name.title() document = flexdown.parse_file(doc_path) - title = rx.utils.format.to_snake_case(os.path.basename(doc_path).replace(".md", "")) - component_list = [title, *extract_components_from_metadata(document)] + title = to_snake_case(doc_path_path.name.replace(".md", "")) + component_list = (title, extract_components_from_metadata(document)) component_registry[category].append(component_list) return multi_docs( path=route_path, @@ -129,7 +120,7 @@ def create_doc_component( ) -def generate_document_routes(doc_paths: list[str], base_dir: str) -> list[rx.Component]: +def generate_document_routes(doc_paths: list[str], base_dir: str) -> list[Route]: """Generate document components and routes from Flexdown file paths. Args: @@ -146,9 +137,7 @@ def generate_document_routes(doc_paths: list[str], base_dir: str) -> list[rx.Com ] -def setup_application_routes( - app: rx.App, doc_routes: list[rx.Component], base_path: str -): +def setup_application_routes(app: rx.App, doc_routes: list[Route], base_path: str): """Set up application routes based on document components. Args: diff --git a/docs/rcweb/rcweb/utils/blocks/code.py b/docs/rcweb/rcweb/utils/blocks/code.py index 49f514a..59cb541 100644 --- a/docs/rcweb/rcweb/utils/blocks/code.py +++ b/docs/rcweb/rcweb/utils/blocks/code.py @@ -1,7 +1,8 @@ """Code block components for documentation pages.""" import reflex as rx -from ...constants import css, fonts + +from rcweb.constants import css, fonts @rx.memo @@ -20,8 +21,6 @@ def code_block(code: str, language: str): padding="20px", style=fonts.code, margin="0", - # TODO: use this when it's looking good - # can_copy=True, ), rx.button( rx.icon( @@ -76,8 +75,6 @@ def code_block_dark(code: str, language: str): }, padding="20px", margin="0", - # TODO: use this when it's looking good - # can_copy=True, ), rx.button( rx.icon( diff --git a/docs/rcweb/rcweb/utils/blocks/headings.py b/docs/rcweb/rcweb/utils/blocks/headings.py index 491cf7b..0fb99cd 100644 --- a/docs/rcweb/rcweb/utils/blocks/headings.py +++ b/docs/rcweb/rcweb/utils/blocks/headings.py @@ -1,7 +1,8 @@ """Template for documentation pages.""" import reflex as rx -from ...constants import css, fonts + +from rcweb.constants import css, fonts icon_margins = { "h1": "10px", @@ -12,7 +13,7 @@ def h_comp_common( - text: rx.Var[str], + text: rx.Var[str] | rx.Var[list[str]], heading: str, font_size: list[str] | str = "", font_weight: str = "", @@ -20,12 +21,13 @@ def h_comp_common( margin_top: str = "", margin_bottom: str = "", convert_to_str: bool = False, - style: dict = {}, + style: dict | None = None, ) -> rx.Component: + style = style or {} if convert_to_str: - id_ = text.to(list[str])[0].lower().split().join("-") + id_ = text.to(list)[0].to(str).lower().split(" ").join("-") else: - id_ = text.lower().split().join("-") + id_ = text.to(str).lower().split(" ").join("-") href = rx.State.router.page.full_path + "#" + id_ return rx.box( @@ -70,7 +72,6 @@ def h_comp_common( on_click=lambda: rx.set_clipboard(href), margin_bottom="0.5em", ), - # border_top=f"1px solid {rx.color('mauve', 3)}" if heading == "h2" else None, _hover={ "color": rx.color("violet", 9), }, @@ -86,7 +87,6 @@ def h1_comp(text: rx.Var[str]) -> rx.Component: text=text, heading="h1", style={ - # "color": c_color("slate", 12), "font-size": ["32px", "48px"], "font-style": "normal", "font-weight": "600", @@ -105,7 +105,6 @@ def h1_comp_xd(text: rx.Var[str]) -> rx.Component: heading="h1", style=fonts.xx_large, margin_bottom="24px", - # margin_top="1.5em", scroll_margin="4em", convert_to_str=True, ) diff --git a/docs/rcweb/rcweb/utils/blocks/typography.py b/docs/rcweb/rcweb/utils/blocks/typography.py index f4c41a0..cfe6291 100644 --- a/docs/rcweb/rcweb/utils/blocks/typography.py +++ b/docs/rcweb/rcweb/utils/blocks/typography.py @@ -1,7 +1,8 @@ """Typography blocks for doc pages.""" import reflex as rx -from ...constants import fonts + +from rcweb.constants import fonts def definition(title: str, *children) -> rx.Component: diff --git a/docs/rcweb/rcweb/utils/docpage.py b/docs/rcweb/rcweb/utils/docpage.py index fde63a4..d862e55 100644 --- a/docs/rcweb/rcweb/utils/docpage.py +++ b/docs/rcweb/rcweb/utils/docpage.py @@ -1,39 +1,42 @@ """Utility functions for the component docs page.""" -from collections.abc import Callable +import dataclasses import functools +import hashlib import inspect -import reflex_chakra as rc -import os import re +import textwrap +from collections.abc import Callable, Sequence from types import UnionType from typing import ( Any, - Sequence, - Type, Literal, Union, get_args, get_origin, ) + +import flexdown +import flexdown.blocks import mistletoe -from ..utils.flexdown import xd, markdown, docdemobox -from ..utils.sidebar import sidebar as sb -from ..utils.sidebar import MobileAndTabletSidebarState -from ..utils.blocks.headings import h2_comp, h1_comp +import mistletoe.block_token +import mistletoe.token import reflex as rx -import flexdown -import textwrap -from reflex.base import Base -from reflex.components.component import Component from reflex.components.base.fragment import Fragment +from reflex.components.component import Component from reflex.components.el.elements.base import BaseHTML -import hashlib +from reflex.constants.colors import ColorType + +import reflex_chakra as rc +from rcweb.utils.blocks.headings import h1_comp, h2_comp +from rcweb.utils.flexdown import docdemobox, markdown, xd +from rcweb.utils.sidebar import MobileAndTabletSidebarState +from rcweb.utils.sidebar import sidebar as sb flat_items = [] # Mapping from types to colors. -TYPE_COLORS = { +TYPE_COLORS: dict[str, ColorType] = { "int": "red", "float": "orange", "str": "yellow", @@ -307,8 +310,7 @@ def get_default_value(lines: list[str], start_index: int) -> str: if comment_line.startswith("#"): default_match = re.search(r"Default:\s*(.+)$", comment_line) if default_match: - default_value = default_match.group(1).strip() - return default_value + return default_match.group(1).strip() # Get the initial line line = lines[start_index] @@ -337,8 +339,7 @@ def get_default_value(lines: list[str], start_index: int) -> str: def process_var_create_safe(match): content = match.group(1) # Extract only the first argument - first_arg = re.split(r",", content)[0].strip() - return first_arg + return re.split(r",", content)[0].strip() value = re.sub(r"Var\.create_safe\((.*?)\)", process_var_create_safe, value) value = re.sub(r"\bColor\s*\(", "rx.color(", value) @@ -346,7 +347,8 @@ def process_var_create_safe(match): return value.strip() -class Prop(Base): +@dataclasses.dataclass +class Prop: """Hold information about a prop.""" # The name of the prop. @@ -362,7 +364,8 @@ class Prop(Base): default_value: str -class Route(Base): +@dataclasses.dataclass(kw_only=True) +class Route: """A page route.""" # The path of the route. @@ -403,6 +406,10 @@ def get_path(component_fn: Callable): """ module = inspect.getmodule(component_fn) + if module is None: + msg = f"Could not find module for {component_fn}" + raise ValueError(msg) + # Create a path based on the module name. return ( module.__name__.replace(".", "/").replace("_", "-").split("pcweb/pages")[1] @@ -411,12 +418,12 @@ def get_path(component_fn: Callable): def docpage( + chakra_components: dict[str, list[tuple[str, list[tuple[type, str]]]]], set_path: str | None = None, t: str | None = None, right_sidebar: bool = True, page_title: str | None = None, pseudo_right_bar: bool = False, - chakra_components={}, ): """A template that most pages on the reflex.dev site should use. @@ -430,7 +437,10 @@ def docpage( A wrapper function that returns the full webpage. """ - def docpage(contents: Callable[[], Route]) -> Route: + def docpage( + contents: Callable[[], Component] + | Callable[[], tuple[list[tuple[int, str]], Component]], + ) -> Route: """Wrap a component in a docpage template. Args: @@ -511,16 +521,16 @@ def wrapper(*args, **kwargs) -> rx.Component: else: links.append(rx.fragment()) - toc = [] + table_of_contents = [] if not isinstance(contents, rx.Component): comp = contents(*args, **kwargs) else: comp = contents if isinstance(comp, tuple): - toc, comp = comp + table_of_contents, comp = comp - show_right_sidebar = right_sidebar and len(toc) >= 2 + show_right_sidebar = right_sidebar and len(table_of_contents) >= 2 main_content_width = " lg:w-[60%]" if show_right_sidebar else " lg:w-full" @@ -626,7 +636,7 @@ def wrapper(*args, **kwargs) -> rx.Component: ) ) ) - for level, text in toc + for level, text in table_of_contents ], class_name="flex flex-col gap-4 list-none", ), @@ -672,18 +682,19 @@ def wrapper(*args, **kwargs) -> rx.Component: return docpage -class Source(Base): +@dataclasses.dataclass(init=False) +class Source: """Parse the source code of a component.""" # The component to parse. - component: Type[Component] + component: type[Component] # The source code. - code: list[str] = [] + code: list[str] = dataclasses.field(default_factory=list) - def __init__(self, *args, **kwargs): + def __init__(self, component: type[Component]): """Initialize the source code parser.""" - super().__init__(*args, **kwargs) + self.component = component # Get the source code. self.code = [ @@ -698,7 +709,7 @@ def get_docs(self) -> str: Returns: The docstring of the component. """ - return self.component.__doc__ + return self.component.__doc__ or "" def get_props(self) -> list[Prop]: """Get a dictionary of the props and their descriptions. @@ -752,9 +763,9 @@ def _get_props(self) -> list[Prop]: if i > 0: comment_above = self.code[i - 1].strip() - assert comment_above.startswith("#"), ( - f"Expected comment, got {comment_above}" - ) + if not comment_above.startswith("#"): + msg = f"Expected comment above prop {prop}, got {comment_above}" + raise ValueError(msg) comment = Source.get_comment(comments) comments.clear() @@ -777,7 +788,7 @@ def get_comment(comments: list[str]): return "".join([comment.strip().strip("#") for comment in comments]) -def get_code_style(color: str): +def get_code_style(color: ColorType): return { "color": rx.color(color, 11), "border_radius": "0.25rem", @@ -840,20 +851,20 @@ def prop_docs(prop: Prop) -> list[rx.Component]: """Generate the docs for a prop.""" # Get the type of the prop. type_ = prop.type_ - if rx.utils.types._issubclass(prop.type_, rx.Var): + if get_origin(type_) is rx.Var: # For vars, get the type of the var. - type_ = rx.utils.types.get_args(type_)[0] + type_ = get_args(type_)[0] origin = get_origin(type_) args = get_args(type_) literal_values = [] # Literal values of the prop all_types = [] # List for all the prop types - MAX_PROP_VALUES = 2 + max_prop_values = 2 short_type_name = None - COMMON_TYPES = {} # Used to exclude common types from the MAX_PROP_VALUES + common_types = {} # Used to exclude common types from the MAX_PROP_VALUES if origin in (Union, UnionType): non_literal_types = [] # List for all the non-literal types @@ -891,7 +902,7 @@ def prop_docs(prop: Prop) -> list[rx.Component]: elif origin is Literal: literal_values = list(map(str, args)) - if len(literal_values) > MAX_PROP_VALUES and prop.name not in COMMON_TYPES: + if len(literal_values) > max_prop_values and prop.name not in common_types: type_name = "Literal" else: type_name = " | ".join([f'"{value}"' for value in literal_values]) @@ -925,14 +936,14 @@ def prop_docs(prop: Prop) -> list[rx.Component]: rx.table.cell( rx.box( rx.cond( - (len(literal_values) > 0) & (prop.name not in COMMON_TYPES), + (len(literal_values) > 0) & (prop.name not in common_types), rx.code( ( " | ".join( - [f'"{v}"' for v in literal_values[:MAX_PROP_VALUES]] + [f'"{v}"' for v in literal_values[:max_prop_values]] + ["..."] ) - if len(literal_values) > MAX_PROP_VALUES + if len(literal_values) > max_prop_values else type_name ), style=get_code_style(color), @@ -945,8 +956,8 @@ def prop_docs(prop: Prop) -> list[rx.Component]: ), ), rx.cond( - len(literal_values) > MAX_PROP_VALUES - and prop.name not in COMMON_TYPES, + len(literal_values) > max_prop_values + and prop.name not in common_types, hovercard( rx.icon( tag="circle-ellipsis", @@ -1034,7 +1045,7 @@ def generate_props(src, component, comp): else: comp = rx.fragment() except Exception as e: - print(f"Failed to create component {component.__name__}, error: {e}") + print(f"Failed to create component {component.__name__}, error: {e}") # noqa: T201 comp = rx.fragment() interactive_component = ( @@ -1214,12 +1225,12 @@ def component_docs(component_tuple, comp): ) -def get_headings(comp): +def get_headings( + comp: mistletoe.Document | mistletoe.token.Token, +) -> list[tuple[int, str]]: """Get the strings from markdown component.""" if isinstance(comp, mistletoe.block_token.Heading): - heading_text = "".join( - token.content for token in comp.children if hasattr(token, "content") - ) + heading_text = comp.content return [(comp.level, heading_text)] # Recursively get the strings from the children. @@ -1232,9 +1243,12 @@ def get_headings(comp): return headings -def get_toc(source, href, component_list=None): +def get_table_of_contents( + source: flexdown.Document, + href: str, + component_list: list[tuple[type, str]] | None = None, +): component_list = component_list or [] - component_list = component_list[1:] # Generate the TOC # The environment used for execing and evaling code. @@ -1242,11 +1256,11 @@ def get_toc(source, href, component_list=None): env["__xd"] = xd # Get the content of the document. - source = source.content + source_str = source.content # Get the blocks in the source code. # Note: we must use reflex-web's special flexdown instance xd here - it knows about all custom block types (like DemoBlock) - blocks = xd.get_blocks(source, href) + blocks = xd.get_blocks(source_str, href) content_pieces = [] for block in blocks: @@ -1268,96 +1282,31 @@ def get_toc(source, href, component_list=None): if len(component_list): headings.append((1, "API Reference")) - for component_tuple in component_list: - headings.append((2, component_tuple[1])) + for _, component_name in component_list: + headings.append((2, component_name)) return headings -def multi_docs(path, comp, component_list, title, chakra_components): +def multi_docs( + path: str, + comp: flexdown.Document, + component_list: tuple[str, list[tuple[type, str]]], + title: str, + chakra_components: dict[str, list[tuple[str, list[tuple[type, str]]]]], +): components = [ - component_docs(component_tuple, comp) for component_tuple in component_list[1:] + component_docs(component_tuple, comp) for component_tuple in component_list[1] ] fname = path.strip("/") + ".md" - ll_doc_exists = os.path.exists(fname.replace(".md", "-ll.md")) - - active_class_name = "font-small bg-slate-2 p-2 text-slate-11 rounded-xl shadow-large w-28 cursor-default border border-slate-4 text-center" - - non_active_class_name = "font-small w-28 transition-color hover:text-slate-11 text-slate-9 p-2 text-center" - - def links(current_page, ll_doc_exists, path): - path = str(path).rstrip("/") - if ll_doc_exists: - if current_page == "hl": - return rx.box( - rx.box(class_name="flex-grow"), - rx.box( - rx.link( - rx.box(rx.text("High Level"), class_name=active_class_name), - underline="none", - ), - rx.link( - rx.box( - rx.text("Low Level"), class_name=non_active_class_name - ), - href=path + "/low", - underline="none", - ), - class_name="bg-slate-3 rounded-[1.125rem] p-2 gap-2 flex items-center justify-center", - ), - class_name="flex mb-2", - ) - else: - return rx.box( - rx.box(class_name="flex-grow"), - rx.flex( - rx.link( - rx.box( - rx.text("High Level"), class_name=non_active_class_name - ), - href=path, - underline="none", - ), - rx.link( - rx.box(rx.text("Low Level"), class_name=active_class_name), - href=path + "/low", - underline="none", - ), - class_name="bg-slate-3 rounded-[1.125rem] p-2 gap-2 flex items-center justify-center", - ), - class_name="flex mb-2", - ) - return rx.fragment() @docpage(set_path=path, t=title, chakra_components=chakra_components) def out(): - toc = get_toc(comp, fname, component_list) - return toc, rx.box( - links("hl", ll_doc_exists, path), + table_of_contents = get_table_of_contents(comp, fname, component_list[1]) + return table_of_contents, rx.box( xd.render(comp, filename=fname), h1_comp(text="API Reference"), rx.box(*components, class_name="flex flex-col"), class_name="flex flex-col w-full", ) - @docpage( - set_path=path + "low", - t=title + " (Low Level)", - chakra_components=chakra_components, - ) - def ll(): - nonlocal fname - fname = fname.replace(".md", "-ll.md") - d2 = flexdown.parse_file(fname) - toc = get_toc(d2, fname, component_list) - return toc, rx.box( - links("ll", ll_doc_exists, path), - xd.render_file(fname), - h1_comp(text="API Reference"), - rx.box(*components, class_name="flex flex-col"), - class_name="flex flex-col w-full", - ) - - if ll_doc_exists: - return (out, ll) - else: - return out + return out diff --git a/docs/rcweb/rcweb/utils/flexdown.py b/docs/rcweb/rcweb/utils/flexdown.py index eb31d68..4c097b5 100644 --- a/docs/rcweb/rcweb/utils/flexdown.py +++ b/docs/rcweb/rcweb/utils/flexdown.py @@ -1,11 +1,14 @@ -import flexdown -import reflex as rx -import reflex_chakra as rc -import black import textwrap from typing import Any -from .blocks import headings, typography, code -from ..constants import fonts + +import black +import flexdown +import reflex as rx + +import reflex_chakra as rc # noqa: F401 +from rcweb.constants import fonts + +from .blocks import code, headings, typography demo_box_style = { "padding": "24px", @@ -35,8 +38,6 @@ def code_block(code: str, language: str): padding="20px", style=fonts.code, margin="0", - # TODO: use this when it's looking good - # can_copy=True, ), rx.button( rx.icon( @@ -88,8 +89,6 @@ def code_block_dark(code: str, language: str): }, padding="20px", margin="0", - # TODO: use this when it's looking good - # can_copy=True, ), rx.button( rx.icon( @@ -223,14 +222,12 @@ def docdemo( rx.hstack( "UI", ), - # style=tab_style, value="tab1", ), rx.tabs.trigger( rx.hstack( "Code", ), - # style=tab_style, value="tab2", ), justify_content="end", diff --git a/docs/rcweb/rcweb/utils/sidebar.py b/docs/rcweb/rcweb/utils/sidebar.py index b27c41b..b77989c 100644 --- a/docs/rcweb/rcweb/utils/sidebar.py +++ b/docs/rcweb/rcweb/utils/sidebar.py @@ -1,13 +1,18 @@ from __future__ import annotations +import dataclasses + import reflex as rx +from reflex.utils.format import to_kebab_case, to_snake_case, to_title_case + import reflex_chakra as rc -from ..constants import fonts +from rcweb.constants import fonts chakra_lib_items = [] -class SidebarItem(rx.Base): +@dataclasses.dataclass +class SidebarItem: """A single item in the sidebar.""" # The name to display in the sidebar. @@ -19,118 +24,66 @@ class SidebarItem(rx.Base): link: str = "" # The children items. - children: list[SidebarItem] = [] + children: list[SidebarItem] = dataclasses.field(default_factory=list) # Whether the item is a category. Occurs if a single item is at the top level of the sidebar for asthetics. outer = False -def calculate_index(sidebar_items, url: str): - if isinstance(sidebar_items, list): - return None - if not isinstance(sidebar_items, list): - sidebar_items = [sidebar_items] - if url is None: - return None - for item in sidebar_items: - if not item.link.endswith("/"): - item.link = item.link + "/" - if not url.endswith("/"): - url = url + "/" - sub = 0 - for i, item in enumerate(sidebar_items): - if len(item.children) == 0: - sub += 1 - if item.link == url: - return [i - sub] - index = calculate_index(item.children, url) - if index is not None: - return [i - sub] + index - return None - - -def get_component_link(category: str | None, clist, prefix="") -> str: - component_name = rx.utils.format.to_kebab_case(clist[0]) +def get_component_link(category: str | None, category_title: str): + component_name = to_kebab_case(category_title) # construct the component link. The component name points to the name of the md file. - return "/".join( - [prefix, category.lower().replace(' ', '-') if category else '', component_name.lower()]).replace("//", "/") + return "/" + ( + "/".join( + [ + category.lower().replace(" ", "-") if category else "", + component_name.lower(), + ] + ) + .replace("//", "/") + .removeprefix("/") + ) -def get_category_children(category, category_list, prefix="") -> SidebarItem | list[SidebarItem]: +def get_category_children( + category: str, category_list: list[tuple[str, list[tuple[type, str]]]] +) -> SidebarItem | list[SidebarItem]: category = category.replace("-", " ") - if isinstance(category_list, dict): - category_children = [] - for c in category_list: - category_child = get_category_children(c, category_list[c]) - category_children.extend(category_child) if isinstance(category_child, list) else category_children.append( - category_child) - - return SidebarItem( - names=category, - children=[ - category_children - ], - ) category_item_children = [] - for c in category_list: - component_name = rx.utils.format.to_snake_case(c[0]) - name = rx.utils.format.to_title_case(component_name) + for component_title, _ in category_list: + component_name = to_snake_case(component_title) + name = to_title_case(component_name) item = SidebarItem( names=name, - link=get_component_link(category, c) if not category == "Markdowns" else get_component_link(None, c), + link=get_component_link(category, component_title) + if category != "Markdowns" + else get_component_link(None, component_title), ) category_item_children.append(item) - return SidebarItem(names=category, - children=category_item_children) if not category == "Markdowns" else category_item_children + return ( + SidebarItem(names=category, children=category_item_children) + if category != "Markdowns" + else category_item_children + ) -def get_sidebar_items_other_libraries(chakra_components): - chakra_children = [] - for category in chakra_components: - category_item = get_category_children( - category, - chakra_components[category], - ) - chakra_children.extend(category_item) if isinstance(category_item, list) else chakra_children.append( - category_item) +def get_sidebar_items_other_libraries( + chakra_components: dict[str, list[tuple[str, list[tuple[type, str]]]]], +) -> list[SidebarItem]: + chakra_children: list[SidebarItem] = [] + for category, category_list in chakra_components.items(): + category_item = get_category_children(category, category_list) + if isinstance(category_item, list): + chakra_children.extend(category_item) + else: + chakra_children.append(category_item) return chakra_children -class NavbarState(rx.State): - """The state for the navbar component.""" - - # Whether the sidebar is open. - sidebar_open: bool = False - - search_input: str = "" - - enter: bool = False - - banner: bool = True - - ai_chat: bool = True - - current_category = "All" - - def toggle_banner(self): - self.banner = not self.banner - - def toggle_sidebar(self): - self.sidebar_open = not self.sidebar_open - - def toggle_ai_chat(self): - self.ai_chat = not self.ai_chat - - def update_category(self, tag): - self.current_category = tag - - def sidebar_link(*children, **props): """Create a sidebar link that closes the sidebar when clicked.""" - on_click = props.pop("on_click", NavbarState.set_sidebar_open(False)) return rx.link( *children, - on_click=on_click, underline="none", **props, ) @@ -143,8 +96,8 @@ def format_sidebar_route(route: str) -> str: def sidebar_leaf( - item: SidebarItem, - url: str, + item: SidebarItem, + url: str, ) -> rx.Component: """Get the leaf node of the sidebar.""" item.link = item.link.replace("_", "-") @@ -222,35 +175,17 @@ def sidebar_leaf( ) -def sidebar_icon(name): - mappings = { - "Getting Started": "rocket", - "Tutorial": "life-buoy", - "Components": "layers", - } - - if name in mappings: - return rx.icon( - tag=mappings[name], - size=16, - margin_right="20px", - ) - else: - return rx.fragment() - - def sidebar_item_comp( - item: SidebarItem, - index: list[int], - url: str, + item: SidebarItem, + index: list[int], + url: str, ): return rx.cond( len(item.children) == 0, sidebar_leaf(item=item, url=url) - if not item.names in ("Introduction",) + if item.names not in ("Introduction",) else rc.accordion_item( rc.accordion_button( - sidebar_icon(item.names), rx.link( rx.text( item.names, @@ -265,9 +200,8 @@ def sidebar_item_comp( "text_decoration": "none", }, ), - href=format_sidebar_route(item.link) + href=format_sidebar_route(item.link), ), - rx.box( flex_grow=1, ), @@ -292,7 +226,6 @@ def sidebar_item_comp( ), rc.accordion_item( rc.accordion_button( - sidebar_icon(item.names), rx.text( item.names, style=fonts.small, @@ -345,8 +278,7 @@ def sidebar_item_comp( ) -def create_sidebar_section(items, index, url): - nested = False +def create_sidebar_section(items: list[SidebarItem], url: str): return rx.list_item( rc.accordion( *[ @@ -358,7 +290,7 @@ def create_sidebar_section(items, index, url): for item in items ], allow_multiple=True, - default_index=rx.cond(index, index, []), + default_index=[], width="100%", padding_left="0em", margin_left="0em", @@ -375,9 +307,8 @@ def create_sidebar_section(items, index, url): @rx.memo def sidebar_comp( - url: str, - other_libs_index: list[int], - width: str = "100%", + url: str, + width: str = "100%", ): ul_style = { "display": "flex", @@ -388,7 +319,6 @@ def sidebar_comp( rx.unordered_list( create_sidebar_section( chakra_lib_items, - other_libs_index, url, ), style=ul_style, @@ -422,6 +352,7 @@ def sidebar_comp( class MobileAndTabletSidebarState(rx.State): drawer_is_open: bool = False + @rx.event def toggle_drawer(self): self.drawer_is_open = not (self.drawer_is_open) @@ -458,29 +389,44 @@ def sidebar_on_mobile_and_tablet(component): ), size="full", is_open=MobileAndTabletSidebarState.drawer_is_open, - width="100vw" + width="100vw", ), on_unmount=MobileAndTabletSidebarState.set_drawer_is_open(False), - ) -def get_sidebar_content(chakra_components, url=None, width: str = "100%"): +def get_sidebar_content( + chakra_components: dict[str, list[tuple[str, list[tuple[type, str]]]]], + url: str | None = None, + width: str = "100%", +): global chakra_lib_items chakra_lib_items = get_sidebar_items_other_libraries(chakra_components) - other_libs_index = calculate_index(chakra_lib_items, url) return sidebar_comp( url=url, - other_libs_index=other_libs_index, width=width, ) -def sidebar(chakra_components, url=None, width: str = "100%") -> rx.Component: - """Render the sidebar.""" +def sidebar( + chakra_components: dict[str, list[tuple[str, list[tuple[type, str]]]]], + url: str | None = None, + width: str = "100%", +) -> rx.Component: + """Render the sidebar. + + Args: + chakra_components: The components to display in the sidebar. + url: The current URL to highlight the active link. + width: The width of the sidebar. + Returns: + A sidebar component with the given components and URL. + """ return rx.flex( - sidebar_on_mobile_and_tablet(get_sidebar_content(chakra_components, url, "100%")), + sidebar_on_mobile_and_tablet( + get_sidebar_content(chakra_components, url, "100%") + ), get_sidebar_content(chakra_components, url, width), width="100%", height="100%", diff --git a/docs/rcweb/requirements.txt b/docs/rcweb/requirements.txt index f3647e8..ce46e9a 100644 --- a/docs/rcweb/requirements.txt +++ b/docs/rcweb/requirements.txt @@ -1,4 +1,4 @@ -reflex>=0.7.11 +reflex>=0.8.0a4 reflex-chakra mistletoe==1.4.0 flexdown==0.1.5a12 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 79ed16f..8fbf406 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "reflex-chakra" -version = "0.8.0" +version = "0.8.1" description = "reflex using chakra components" authors = [{ name = "Elijah Ahianyo", email = "elijahahianyo@gmail.com" }] maintainers = [ @@ -11,7 +11,7 @@ maintainers = [ readme = "README.md" requires-python = ">=3.10" license.text = "Apache-2.0" -dependencies = ["reflex >=0.8.0a"] +dependencies = ["reflex >=0.8.0dev"] [build-system] @@ -21,7 +21,40 @@ build-backend = "hatchling.build" [tool.hatch.build] include = ["reflex_chakra"] +[dependency-groups] +dev = ["ruff", "pyright"] + [tool.ruff] target-version = "py310" +lint.select = ["ALL"] +lint.pydocstyle.convention = "google" +lint.ignore = [ + "A", + "ANN001", + "ANN002", + "ANN003", + "ANN2", + "ANN4", + "BLE", + "COM", + "E501", + "ERA001", + "F403", + "F405", + "FBT", + "PLR", + "PLW", + "PYI021", + "S307", + "SLF", + "TC002", + "UP038", +] +lint.allowed-confusables = ["’"] + +[tool.ruff.lint.per-file-ignores] +"*.pyi" = ["D301", "D415", "D417", "N803"] +"docs/*" = ["D", "INP001"] [tool.pyright] +reportIncompatibleMethodOverride = "warning" diff --git a/reflex_chakra/__init__.py b/reflex_chakra/__init__.py index bd16084..80e589a 100644 --- a/reflex_chakra/__init__.py +++ b/reflex_chakra/__init__.py @@ -1 +1,3 @@ -from .components import * \ No newline at end of file +"""Chakra UI bindings for Reflex.""" + +from .components import * diff --git a/reflex_chakra/components/__init__.py b/reflex_chakra/components/__init__.py index c0104bb..41785c7 100644 --- a/reflex_chakra/components/__init__.py +++ b/reflex_chakra/components/__init__.py @@ -1,5 +1,7 @@ """Chakra components.""" -from . import media + +from reflex.components.component import Component + from .base import * from .datadisplay import * from .disclosure import * @@ -111,8 +113,6 @@ modal_footer = ModalFooter.create modal_header = ModalHeader.create modal_overlay = ModalOverlay.create -multi_select = MultiSelect.create -multi_select_option = MultiSelectOption number_decrement_stepper = NumberDecrementStepper.create number_increment_stepper = NumberIncrementStepper.create number_input = NumberInput.create diff --git a/reflex_chakra/components/base.py b/reflex_chakra/components/base.py index 3e72328..493ec76 100644 --- a/reflex_chakra/components/base.py +++ b/reflex_chakra/components/base.py @@ -3,11 +3,10 @@ from __future__ import annotations import shutil -from functools import lru_cache from pathlib import Path -from typing import List, Literal +from typing import Literal -from reflex.components.component import Component +from reflex.components.component import Component, field from reflex.utils.imports import ImportDict, ImportVar from reflex.vars.base import Var @@ -17,14 +16,16 @@ class ChakraComponent(Component): """A component that wraps a Chakra component.""" - library: str = "@chakra-ui/react@2.6.1" # type: ignore - lib_dependencies: List[str] = [ - "@chakra-ui/system@2.5.7", - "framer-motion@10.16.4", - ] + library = "@chakra-ui/react@2.6.1" + lib_dependencies: list[str] = field( + default_factory=lambda: [ + "@chakra-ui/system@2.5.7", + "framer-motion@10.16.4", + ], + is_javascript_property=False, + ) @staticmethod - @lru_cache(maxsize=None) def _get_app_wrap_components() -> dict[tuple[int, str], Component]: return { (60, "ChakraProvider"): chakra_provider, @@ -39,23 +40,16 @@ def _get_style(self) -> dict: return {"sx": self.style} @classmethod - @lru_cache(maxsize=None) - def _get_dependencies_imports(cls) -> ImportDict: - """Get the imports from lib_dependencies for installing. + def create(cls, *children, **props) -> Component: + """Create a new Chakra component. + + Args: + *children: The children of the component. + **props: The properties of the component. Returns: - The dependencies imports of the component. + A new Chakra component. """ - return { - dep: [ImportVar(tag=None, render=False)] - for dep in [ - "@chakra-ui/system@2.5.7", - "framer-motion@10.16.4", - ] - } - - @classmethod - def create(cls, *children, **props) -> Component: # copy color mode provider file to client's asset dir if it doesnt exist. client_asset_dir = Path.cwd() / constants.ASSETS_DIR_NAME if ( @@ -83,7 +77,6 @@ def create(cls, *children, **props) -> Component: for prop in new_prop_names: under_prop = f"{prop}_" if under_prop in props: - # TODO: decide whether to deprecate this prop namespace conversion props[prop] = props.pop(under_prop) return super().create(*children, **props) @@ -114,12 +107,11 @@ def add_imports(self) -> ImportDict: The import dict for the component. """ return { - self.library: ImportVar(tag="extendTheme", is_default=False), + self.library or "": ImportVar(tag="extendTheme", is_default=False), "$/utils/theme": ImportVar(tag="theme", is_default=True), } @staticmethod - @lru_cache(maxsize=None) def _get_app_wrap_components() -> dict[tuple[int, str], Component]: return { (50, "ChakraColorModeProvider"): chakra_color_mode_provider, @@ -215,7 +207,7 @@ class ChakraColorModeProvider(Component): "it", ] LiteralInputVariant = Literal["outline", "filled", "flushed", "unstyled"] -LiteralInputNumberMode = [ +LiteralInputNumberMode = Literal[ "text", "search", "none", @@ -230,14 +222,14 @@ class ChakraColorModeProvider(Component): LiteralStackDirection = Literal["row", "column"] LiteralImageLoading = Literal["eager", "lazy"] LiteralTagSize = Literal["sm", "md", "lg"] -LiteralSpinnerSize = Literal[Literal[LiteralTagSize], "xs", "xl"] -LiteralAvatarSize = Literal[Literal[LiteralTagSize], "xl", "xs", "2xl", "full", "2xs"] +LiteralSpinnerSize = Literal[LiteralTagSize, "xs", "xl"] +LiteralAvatarSize = Literal[LiteralTagSize, "xl", "xs", "2xl", "full", "2xs"] LiteralButtonSize = Literal["sm", "md", "lg", "xs"] # Applies to AlertDialog and Modal LiteralAlertDialogSize = Literal[ "sm", "md", "lg", "xs", "2xl", "full", "3xl", "4xl", "5xl", "6xl" ] -LiteralDrawerSize = Literal[Literal[LiteralSpinnerSize], "xl", "full"] +LiteralDrawerSize = Literal[LiteralSpinnerSize, "xl", "full"] LiteralMenuStrategy = Literal["fixed", "absolute"] LiteralMenuOption = Literal["checkbox", "radio"] diff --git a/reflex_chakra/components/base.pyi b/reflex_chakra/components/base.pyi index baa3bc7..5dfbe0b 100644 --- a/reflex_chakra/components/base.pyi +++ b/reflex_chakra/components/base.pyi @@ -1,192 +1,154 @@ -"""Stub file for reflex/components/chakra/base.py""" +"""Stub file for reflex_chakra/components/base.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, + TypeAlias, +) from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var class ChakraComponent(Component): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ChakraComponent": - """Create the component. + ) -> ChakraComponent: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ChakraProvider(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - theme: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + theme: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ChakraProvider": + ) -> ChakraProvider: """Create a new ChakraProvider component. Returns: A new ChakraProvider component. """ - ... def add_imports(self) -> ImportDict: ... chakra_provider = ChakraProvider.create() class ChakraColorModeProvider(Component): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ChakraColorModeProvider": + ) -> ChakraColorModeProvider: """Create the component. Args: @@ -194,6 +156,7 @@ class ChakraColorModeProvider(Component): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -202,10 +165,9 @@ class ChakraColorModeProvider(Component): Returns: The component. """ - ... chakra_color_mode_provider = ChakraColorModeProvider.create() -LiteralColorScheme = Literal[ +LiteralColorScheme: TypeAlias = Literal[ "none", "gray", "red", @@ -226,21 +188,23 @@ LiteralColorScheme = Literal[ "twitter", "telegram", ] -LiteralVariant = Literal["solid", "subtle", "outline"] -LiteralDividerVariant = Literal["solid", "dashed"] -LiteralTheme = Literal["light", "dark"] -LiteralTagColorScheme = Literal[ +LiteralVariant: TypeAlias = Literal["solid", "subtle", "outline"] +LiteralDividerVariant: TypeAlias = Literal["solid", "dashed"] +LiteralTheme: TypeAlias = Literal["light", "dark"] +LiteralTagColorScheme: TypeAlias = Literal[ "gray", "red", "orange", "yellow", "green", "teal", "blue", "cyan", "purple", "pink" ] -LiteralTagAlign = Literal["center", "end", "start"] -LiteralTabsVariant = Literal[ +LiteralTagAlign: TypeAlias = Literal["center", "end", "start"] +LiteralTabsVariant: TypeAlias = Literal[ "line", "enclosed", "enclosed-colored", "soft-rounded", "solid-rounded", "unstyled" ] -LiteralStatus = Literal["success", "info", "warning", "error"] -LiteralAlertVariant = Literal["subtle", "left-accent", "top-accent", "solid"] -LiteralButtonVariant = Literal["ghost", "outline", "solid", "link", "unstyled"] -LiteralSpinnerPlacement = Literal["start", "end"] -LiteralLanguage = Literal[ +LiteralStatus: TypeAlias = Literal["success", "info", "warning", "error"] +LiteralAlertVariant: TypeAlias = Literal["subtle", "left-accent", "top-accent", "solid"] +LiteralButtonVariant: TypeAlias = Literal[ + "ghost", "outline", "solid", "link", "unstyled" +] +LiteralSpinnerPlacement: TypeAlias = Literal["start", "end"] +LiteralLanguage: TypeAlias = Literal[ "en", "da", "de", @@ -260,30 +224,25 @@ LiteralLanguage = Literal[ "he", "it", ] -LiteralInputVariant = Literal["outline", "filled", "flushed", "unstyled"] -LiteralInputNumberMode = [ - "text", - "search", - "none", - "tel", - "url", - "email", - "numeric", - "decimal", +LiteralInputVariant: TypeAlias = Literal["outline", "filled", "flushed", "unstyled"] +LiteralInputNumberMode: TypeAlias = Literal[ + "text", "search", "none", "tel", "url", "email", "numeric", "decimal" ] -LiteralChakraDirection = Literal["ltr", "rtl"] -LiteralCardVariant = Literal["outline", "filled", "elevated", "unstyled"] -LiteralStackDirection = Literal["row", "column"] -LiteralImageLoading = Literal["eager", "lazy"] -LiteralTagSize = Literal["sm", "md", "lg"] -LiteralSpinnerSize = Literal[Literal[LiteralTagSize], "xs", "xl"] -LiteralAvatarSize = Literal[Literal[LiteralTagSize], "xl", "xs", "2xl", "full", "2xs"] -LiteralButtonSize = Literal["sm", "md", "lg", "xs"] -LiteralAlertDialogSize = Literal[ +LiteralChakraDirection: TypeAlias = Literal["ltr", "rtl"] +LiteralCardVariant: TypeAlias = Literal["outline", "filled", "elevated", "unstyled"] +LiteralStackDirection: TypeAlias = Literal["row", "column"] +LiteralImageLoading: TypeAlias = Literal["eager", "lazy"] +LiteralTagSize: TypeAlias = Literal["sm", "md", "lg"] +LiteralSpinnerSize: TypeAlias = Literal[LiteralTagSize, "xs", "xl"] +LiteralAvatarSize: TypeAlias = Literal[LiteralTagSize, "xl", "xs", "2xl", "full", "2xs"] +LiteralButtonSize: TypeAlias = Literal["sm", "md", "lg", "xs"] +LiteralAlertDialogSize: TypeAlias = Literal[ "sm", "md", "lg", "xs", "2xl", "full", "3xl", "4xl", "5xl", "6xl" ] -LiteralDrawerSize = Literal[Literal[LiteralSpinnerSize], "xl", "full"] -LiteralMenuStrategy = Literal["fixed", "absolute"] -LiteralMenuOption = Literal["checkbox", "radio"] -LiteralPopOverTrigger = Literal["click", "hover"] -LiteralHeadingSize = Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"] +LiteralDrawerSize: TypeAlias = Literal[LiteralSpinnerSize, "xl", "full"] +LiteralMenuStrategy: TypeAlias = Literal["fixed", "absolute"] +LiteralMenuOption: TypeAlias = Literal["checkbox", "radio"] +LiteralPopOverTrigger: TypeAlias = Literal["click", "hover"] +LiteralHeadingSize: TypeAlias = Literal[ + "lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl" +] diff --git a/reflex_chakra/components/datadisplay/__init__.py b/reflex_chakra/components/datadisplay/__init__.py index b20d172..71919fc 100644 --- a/reflex_chakra/components/datadisplay/__init__.py +++ b/reflex_chakra/components/datadisplay/__init__.py @@ -8,3 +8,34 @@ from .stat import Stat, StatArrow, StatGroup, StatHelpText, StatLabel, StatNumber from .table import Table, TableCaption, TableContainer, Tbody, Td, Tfoot, Th, Thead, Tr from .tag import Tag, TagCloseButton, TagLabel, TagLeftIcon, TagRightIcon + +__all__ = [ + "Badge", + "Code", + "Divider", + "Kbd", + "List", + "ListItem", + "OrderedList", + "Stat", + "StatArrow", + "StatGroup", + "StatHelpText", + "StatLabel", + "StatNumber", + "Table", + "TableCaption", + "TableContainer", + "Tag", + "TagCloseButton", + "TagLabel", + "TagLeftIcon", + "TagRightIcon", + "Tbody", + "Td", + "Tfoot", + "Th", + "Thead", + "Tr", + "UnorderedList", +] diff --git a/reflex_chakra/components/datadisplay/badge.py b/reflex_chakra/components/datadisplay/badge.py index 8e95320..edce551 100644 --- a/reflex_chakra/components/datadisplay/badge.py +++ b/reflex_chakra/components/datadisplay/badge.py @@ -1,7 +1,8 @@ """Badge component.""" +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent, LiteralVariant -from reflex.vars import Var class Badge(ChakraComponent): diff --git a/reflex_chakra/components/datadisplay/badge.pyi b/reflex_chakra/components/datadisplay/badge.pyi index 2462cf6..9212f48 100644 --- a/reflex_chakra/components/datadisplay/badge.pyi +++ b/reflex_chakra/components/datadisplay/badge.pyi @@ -1,72 +1,62 @@ -"""Stub file for reflex/components/chakra/datadisplay/badge.py""" +"""Stub file for reflex_chakra/components/datadisplay/badge.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Badge(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - variant: Optional[ - Union[ - Var[Literal["solid", "subtle", "outline"]], - Literal["solid", "subtle", "outline"], - ] - ] = None, - color_scheme: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + variant: Literal["outline", "solid", "subtle"] + | Var[Literal["outline", "solid", "subtle"]] + | None = None, + color_scheme: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Badge": - """Create the component. + ) -> Badge: + """Create a new Chakra component. Args: *children: The children of the component. @@ -75,12 +65,12 @@ class Badge(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/datadisplay/code.pyi b/reflex_chakra/components/datadisplay/code.pyi index 0a8003e..450ca0f 100644 --- a/reflex_chakra/components/datadisplay/code.pyi +++ b/reflex_chakra/components/datadisplay/code.pyi @@ -1,77 +1,69 @@ -"""Stub file for reflex/components/chakra/datadisplay/code.py""" +"""Stub file for reflex_chakra/components/datadisplay/code.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Code(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Code": - """Create the component. + ) -> Code: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/datadisplay/divider.py b/reflex_chakra/components/datadisplay/divider.py index 4a45d24..38c2203 100644 --- a/reflex_chakra/components/datadisplay/divider.py +++ b/reflex_chakra/components/datadisplay/divider.py @@ -2,8 +2,9 @@ from typing import Literal +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent, LiteralDividerVariant -from reflex.vars import Var LiteralLayout = Literal["horizontal", "vertical"] diff --git a/reflex_chakra/components/datadisplay/divider.pyi b/reflex_chakra/components/datadisplay/divider.pyi index 7afda15..0852fdb 100644 --- a/reflex_chakra/components/datadisplay/divider.pyi +++ b/reflex_chakra/components/datadisplay/divider.pyi @@ -1,76 +1,67 @@ -"""Stub file for reflex/components/chakra/datadisplay/divider.py""" +"""Stub file for reflex_chakra/components/datadisplay/divider.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, + TypeAlias, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var -LiteralLayout = Literal["horizontal", "vertical"] +LiteralLayout: TypeAlias = Literal["horizontal", "vertical"] class Divider(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - orientation: Optional[ - Union[ - Var[Literal["horizontal", "vertical"]], - Literal["horizontal", "vertical"], - ] - ] = None, - variant: Optional[ - Union[Var[Literal["solid", "dashed"]], Literal["solid", "dashed"]] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + orientation: Literal["horizontal", "vertical"] + | Var[Literal["horizontal", "vertical"]] + | None = None, + variant: Literal["dashed", "solid"] + | Var[Literal["dashed", "solid"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Divider": - """Create the component. + ) -> Divider: + """Create a new Chakra component. Args: *children: The children of the component. @@ -79,12 +70,12 @@ class Divider(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/datadisplay/keyboard_key.pyi b/reflex_chakra/components/datadisplay/keyboard_key.pyi index c5d4756..95c9dd9 100644 --- a/reflex_chakra/components/datadisplay/keyboard_key.pyi +++ b/reflex_chakra/components/datadisplay/keyboard_key.pyi @@ -1,77 +1,69 @@ -"""Stub file for reflex/components/chakra/datadisplay/keyboard_key.py""" +"""Stub file for reflex_chakra/components/datadisplay/keyboard_key.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class KeyboardKey(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "KeyboardKey": - """Create the component. + ) -> KeyboardKey: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/datadisplay/list.py b/reflex_chakra/components/datadisplay/list.py index f60befe..0f239cd 100644 --- a/reflex_chakra/components/datadisplay/list.py +++ b/reflex_chakra/components/datadisplay/list.py @@ -2,10 +2,11 @@ from __future__ import annotations -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component from reflex.components.core.foreach import Foreach -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class List(ChakraComponent): diff --git a/reflex_chakra/components/datadisplay/list.pyi b/reflex_chakra/components/datadisplay/list.pyi index 3d0120a..270a77c 100644 --- a/reflex_chakra/components/datadisplay/list.pyi +++ b/reflex_chakra/components/datadisplay/list.pyi @@ -1,68 +1,60 @@ -"""Stub file for reflex/components/chakra/datadisplay/list.py""" +"""Stub file for reflex_chakra/components/datadisplay/list.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class List(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - items: Optional[Union[Var[list], list]] = None, - spacing: Optional[Union[Var[str], str]] = None, - style_position: Optional[Union[Var[str], str]] = None, - style_type: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + items: Var[list] | list | None = None, + spacing: Var[str] | str | None = None, + style_position: Var[str] | str | None = None, + style_type: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "List": + ) -> List: """Create a list component. Args: @@ -74,6 +66,7 @@ class List(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -82,127 +75,96 @@ class List(ChakraComponent): Returns: The list component. """ - ... class ListItem(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ListItem": - """Create the component. + ) -> ListItem: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class OrderedList(List): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - items: Optional[Union[Var[list], list]] = None, - spacing: Optional[Union[Var[str], str]] = None, - style_position: Optional[Union[Var[str], str]] = None, - style_type: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + items: Var[list] | list | None = None, + spacing: Var[str] | str | None = None, + style_position: Var[str] | str | None = None, + style_type: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "OrderedList": + ) -> OrderedList: """Create a list component. Args: @@ -214,6 +176,7 @@ class OrderedList(List): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -222,61 +185,45 @@ class OrderedList(List): Returns: The list component. """ - ... class UnorderedList(List): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - items: Optional[Union[Var[list], list]] = None, - spacing: Optional[Union[Var[str], str]] = None, - style_position: Optional[Union[Var[str], str]] = None, - style_type: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + items: Var[list] | list | None = None, + spacing: Var[str] | str | None = None, + style_position: Var[str] | str | None = None, + style_type: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "UnorderedList": + ) -> UnorderedList: """Create a list component. Args: @@ -288,6 +235,7 @@ class UnorderedList(List): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -296,4 +244,3 @@ class UnorderedList(List): Returns: The list component. """ - ... diff --git a/reflex_chakra/components/datadisplay/stat.py b/reflex_chakra/components/datadisplay/stat.py index 841f282..699ac47 100644 --- a/reflex_chakra/components/datadisplay/stat.py +++ b/reflex_chakra/components/datadisplay/stat.py @@ -1,8 +1,9 @@ """Statistics components.""" -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class Stat(ChakraComponent): diff --git a/reflex_chakra/components/datadisplay/stat.pyi b/reflex_chakra/components/datadisplay/stat.pyi index 8a4da36..953fc35 100644 --- a/reflex_chakra/components/datadisplay/stat.pyi +++ b/reflex_chakra/components/datadisplay/stat.pyi @@ -1,68 +1,60 @@ -"""Stub file for reflex/components/chakra/datadisplay/stat.py""" +"""Stub file for reflex_chakra/components/datadisplay/stat.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Stat(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, label=None, number=0, help_text=None, arrow_type=None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Stat": + ) -> Stat: """Create a stat component. Args: @@ -74,6 +66,7 @@ class Stat(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -82,257 +75,196 @@ class Stat(ChakraComponent): Returns: The stat component. """ - ... class StatLabel(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StatLabel": - """Create the component. + ) -> StatLabel: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StatNumber(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StatNumber": - """Create the component. + ) -> StatNumber: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StatHelpText(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StatHelpText": - """Create the component. + ) -> StatHelpText: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StatArrow(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type_: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type_: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StatArrow": - """Create the component. + ) -> StatArrow: + """Create a new Chakra component. Args: *children: The children of the component. @@ -340,78 +272,63 @@ class StatArrow(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StatGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StatGroup": - """Create the component. + ) -> StatGroup: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/datadisplay/table.py b/reflex_chakra/components/datadisplay/table.py index e3102e6..b70eb06 100644 --- a/reflex_chakra/components/datadisplay/table.py +++ b/reflex_chakra/components/datadisplay/table.py @@ -1,12 +1,13 @@ """Table components.""" -from typing import List, Tuple +from typing import ClassVar -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component from reflex.components.core.foreach import Foreach from reflex.utils import types -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class Table(ChakraComponent): @@ -66,7 +67,7 @@ class Thead(ChakraComponent): tag = "Thead" # invalid children components - _invalid_children: List[str] = ["Tbody", "Thead", "Tfoot"] + _invalid_children: ClassVar[list[str]] = ["Tbody", "Thead", "Tfoot"] @classmethod def create(cls, *children, headers=None, **props) -> Component: @@ -100,16 +101,14 @@ def validate_headers(headers): """ allowed_types = (list, tuple) if ( - ( - isinstance(headers, Var) - and not types.check_type_in_allowed_types( - headers._var_type, allowed_types - ) - ) - or not isinstance(headers, Var) + isinstance(headers, Var) + and not types.check_type_in_allowed_types(headers._var_type, allowed_types) + ) or ( + not isinstance(headers, Var) and not types.check_type_in_allowed_types(type(headers), allowed_types) ): - raise TypeError("table headers should be a list or tuple") + msg = "table headers should be a list or tuple" + raise TypeError(msg) class Tbody(ChakraComponent): @@ -118,7 +117,7 @@ class Tbody(ChakraComponent): tag = "Tbody" # invalid children components - _invalid_children: List[str] = ["Tbody", "Thead", "Tfoot", "Td", "Th"] + _invalid_children: ClassVar[list[str]] = ["Tbody", "Thead", "Tfoot", "Td", "Th"] @classmethod def create(cls, *children, rows=None, **props) -> Component: @@ -157,7 +156,7 @@ def validate_rows(rows): Raises: TypeError: If rows are not lists or tuples containing inner lists or tuples. """ - allowed_subclasses = (List, Tuple) + allowed_subclasses = (list, tuple) if isinstance(rows, Var): outer_type = rows._var_type inner_type = ( @@ -174,16 +173,16 @@ def validate_rows(rows): ) ) ): - raise TypeError( - f"table rows should be a list or tuple containing inner lists or tuples. Got {outer_type} instead" - ) + msg = f"table rows should be a list or tuple containing inner lists or tuples. Got {outer_type} instead" + raise TypeError(msg) elif not ( types._issubclass(type(rows), allowed_subclasses) and (not rows or types._issubclass(type(rows[0]), allowed_subclasses)) ): - raise TypeError( + msg = ( "table rows should be a list or tuple containing inner lists or tuples." ) + raise TypeError(msg) class Tfoot(ChakraComponent): @@ -192,7 +191,7 @@ class Tfoot(ChakraComponent): tag = "Tfoot" # invalid children components - _invalid_children: List[str] = ["Tbody", "Thead", "Td", "Th", "Tfoot"] + _invalid_children: ClassVar[list[str]] = ["Tbody", "Thead", "Td", "Th", "Tfoot"] @classmethod def create(cls, *children, footers=None, **props) -> Component: @@ -223,16 +222,14 @@ def validate_footers(footers): """ allowed_types = (list, tuple) if ( - ( - isinstance(footers, Var) - and not types.check_type_in_allowed_types( - footers._var_type, allowed_types - ) - ) - or not isinstance(footers, Var) + isinstance(footers, Var) + and not types.check_type_in_allowed_types(footers._var_type, allowed_types) + ) or ( + not isinstance(footers, Var) and not types.check_type_in_allowed_types(type(footers), allowed_types) ): - raise TypeError("table headers should be a list or tuple") + msg = "table headers should be a list or tuple" + raise TypeError(msg) class Tr(ChakraComponent): @@ -241,7 +238,7 @@ class Tr(ChakraComponent): tag = "Tr" # invalid children components - _invalid_children: List[str] = ["Tbody", "Thead", "Tfoot", "Tr"] + _invalid_children: ClassVar[list[str]] = ["Tbody", "Thead", "Tfoot", "Tr"] @classmethod def create(cls, *children, cell_type: str = "", cells=None, **props) -> Component: @@ -272,7 +269,7 @@ class Th(ChakraComponent): tag = "Th" # invalid children components - _invalid_children: List[str] = ["Tbody", "Thead", "Tr", "Td", "Th"] + _invalid_children: ClassVar[list[str]] = ["Tbody", "Thead", "Tr", "Td", "Th"] # Aligns the cell content to the right. is_numeric: Var[bool] @@ -284,7 +281,7 @@ class Td(ChakraComponent): tag = "Td" # invalid children components - _invalid_children: List[str] = ["Tbody", "Thead"] + _invalid_children: ClassVar[list[str]] = ["Tbody", "Thead"] # Aligns the cell content to the right. is_numeric: Var[bool] diff --git a/reflex_chakra/components/datadisplay/table.pyi b/reflex_chakra/components/datadisplay/table.pyi index 48b47fd..b3e073c 100644 --- a/reflex_chakra/components/datadisplay/table.pyi +++ b/reflex_chakra/components/datadisplay/table.pyi @@ -1,72 +1,64 @@ -"""Stub file for reflex/components/chakra/datadisplay/table.py""" +"""Stub file for reflex_chakra/components/datadisplay/table.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Table(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, caption=None, headers=None, rows=None, footers=None, - color_scheme: Optional[Union[Var[str], str]] = None, - variant: Optional[Union[Var[str], str]] = None, - size: Optional[Union[Var[str], str]] = None, - placement: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + color_scheme: Var[str] | str | None = None, + variant: Var[str] | str | None = None, + size: Var[str] | str | None = None, + placement: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Table": + ) -> Table: """Create a table component. Args: @@ -82,6 +74,7 @@ class Table(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -90,58 +83,42 @@ class Table(ChakraComponent): Returns: The table component. """ - ... class Thead(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, headers=None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Thead": + ) -> Thead: """Create a table header component. Args: @@ -150,6 +127,7 @@ class Thead(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -157,63 +135,46 @@ class Thead(ChakraComponent): Returns: The table header component. - """ - ... @staticmethod def validate_headers(headers): ... class Tbody(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, rows=None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Tbody": + ) -> Tbody: """Create a table body component. Args: @@ -222,6 +183,7 @@ class Tbody(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -230,61 +192,45 @@ class Tbody(ChakraComponent): Returns: Component: The table body component """ - ... @staticmethod def validate_rows(rows): ... class Tfoot(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, footers=None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Tfoot": + ) -> Tfoot: """Create a table footer component. Args: @@ -293,6 +239,7 @@ class Tfoot(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -301,62 +248,46 @@ class Tfoot(ChakraComponent): Returns: The table footer component. """ - ... @staticmethod def validate_footers(footers): ... class Tr(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - cell_type: Optional[str] = "", + cell_type: str | None = "", cells=None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Tr": + ) -> Tr: """Create a table row component. Args: @@ -366,6 +297,7 @@ class Tr(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -374,59 +306,43 @@ class Tr(ChakraComponent): Returns: The table row component """ - ... class Th(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_numeric: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_numeric: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Th": - """Create the component. + ) -> Th: + """Create a new Chakra component. Args: *children: The children of the component. @@ -434,67 +350,52 @@ class Th(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Td(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_numeric: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_numeric: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Td": - """Create the component. + ) -> Td: + """Create a new Chakra component. Args: *children: The children of the component. @@ -502,67 +403,52 @@ class Td(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TableCaption(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - placement: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + placement: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TableCaption": - """Create the component. + ) -> TableCaption: + """Create a new Chakra component. Args: *children: The children of the component. @@ -570,78 +456,63 @@ class TableCaption(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TableContainer(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TableContainer": - """Create the component. + ) -> TableContainer: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/datadisplay/tag.py b/reflex_chakra/components/datadisplay/tag.py index ef8f5eb..38b29c6 100644 --- a/reflex_chakra/components/datadisplay/tag.py +++ b/reflex_chakra/components/datadisplay/tag.py @@ -1,6 +1,7 @@ """Chakra Tag Component.""" -from typing import Optional +from reflex.components.component import Component +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, @@ -8,8 +9,6 @@ LiteralTagSize, LiteralVariant, ) -from reflex.components.component import Component -from reflex.vars import Var class TagLabel(ChakraComponent): @@ -62,9 +61,9 @@ def create( cls, label: Component, *, - left_icon: Optional[Component] = None, - right_icon: Optional[Component] = None, - close_button: Optional[Component] = None, + left_icon: Component | None = None, + right_icon: Component | None = None, + close_button: Component | None = None, **props, ) -> Component: """Creates a Chakra Tag with a label and optionally left_icon, right_icon, and close_button, and returns it. diff --git a/reflex_chakra/components/datadisplay/tag.pyi b/reflex_chakra/components/datadisplay/tag.pyi index e194ecd..9a42bdf 100644 --- a/reflex_chakra/components/datadisplay/tag.pyi +++ b/reflex_chakra/components/datadisplay/tag.pyi @@ -1,373 +1,298 @@ -"""Stub file for reflex/components/chakra/datadisplay/tag.py""" +"""Stub file for reflex_chakra/components/datadisplay/tag.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.component import Component +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class TagLabel(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TagLabel": - """Create the component. + ) -> TagLabel: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TagLeftIcon(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TagLeftIcon": - """Create the component. + ) -> TagLeftIcon: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TagRightIcon(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TagRightIcon": - """Create the component. + ) -> TagRightIcon: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TagCloseButton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TagCloseButton": - """Create the component. + ) -> TagCloseButton: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Tag(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - left_icon: Optional[Component] = None, - right_icon: Optional[Component] = None, - close_button: Optional[Component] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - ] - ], - Literal[ - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - ], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg"]], Literal["sm", "md", "lg"]] - ] = None, - variant: Optional[ - Union[ - Var[Literal["solid", "subtle", "outline"]], - Literal["solid", "subtle", "outline"], + left_icon: Component | None = None, + right_icon: Component | None = None, + close_button: Component | None = None, + color_scheme: Literal[ + "blue", + "cyan", + "gray", + "green", + "orange", + "pink", + "purple", + "red", + "teal", + "yellow", + ] + | Var[ + Literal[ + "blue", + "cyan", + "gray", + "green", + "orange", + "pink", + "purple", + "red", + "teal", + "yellow", ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + size: Literal["lg", "md", "sm"] | Var[Literal["lg", "md", "sm"]] | None = None, + variant: Literal["outline", "solid", "subtle"] + | Var[Literal["outline", "solid", "subtle"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Tag": + ) -> Tag: """Creates a Chakra Tag with a label and optionally left_icon, right_icon, and close_button, and returns it. Args: @@ -380,4 +305,3 @@ class Tag(ChakraComponent): Returns: The `create()` method returns a Tag object. """ - ... diff --git a/reflex_chakra/components/disclosure/__init__.py b/reflex_chakra/components/disclosure/__init__.py index 7a756c6..5505899 100644 --- a/reflex_chakra/components/disclosure/__init__.py +++ b/reflex_chakra/components/disclosure/__init__.py @@ -11,4 +11,21 @@ from .transition import Collapse, Fade, ScaleFade, Slide, SlideFade from .visuallyhidden import VisuallyHidden -__all__ = [f for f in dir() if f[0].isupper()] # type: ignore +__all__ = [ + "Accordion", + "AccordionButton", + "AccordionIcon", + "AccordionItem", + "AccordionPanel", + "Collapse", + "Fade", + "ScaleFade", + "Slide", + "SlideFade", + "Tab", + "TabList", + "TabPanel", + "TabPanels", + "Tabs", + "VisuallyHidden", +] diff --git a/reflex_chakra/components/disclosure/accordion.py b/reflex_chakra/components/disclosure/accordion.py index c01933b..e1c19fd 100644 --- a/reflex_chakra/components/disclosure/accordion.py +++ b/reflex_chakra/components/disclosure/accordion.py @@ -1,10 +1,9 @@ """Container to stack elements with spacing.""" -from typing import List, Optional, Union +from reflex.components.component import Component +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.components.component import Component -from reflex.vars import Var class Accordion(ChakraComponent): @@ -19,10 +18,10 @@ class Accordion(ChakraComponent): allow_toggle: Var[bool] # The initial index(es) of the expanded accordion item(s). - default_index: Var[Optional[List[int]]] + default_index: Var[list[int] | None] # The index(es) of the expanded accordion item - index: Var[Union[int, List[int]]] + index: Var[int | list[int]] # If true, height animation and transitions will be disabled. reduce_motion: Var[bool] @@ -33,8 +32,8 @@ def create( *children, items=None, icon_pos="right", - allow_multiple: Optional[Var[bool]] = None, - allow_toggle: Optional[Var[bool]] = None, + allow_multiple: Var[bool] | None = None, + allow_toggle: Var[bool] | None = None, **props, ) -> Component: """Create an accordion component. diff --git a/reflex_chakra/components/disclosure/accordion.pyi b/reflex_chakra/components/disclosure/accordion.pyi index 0b9c016..bdb82c2 100644 --- a/reflex_chakra/components/disclosure/accordion.pyi +++ b/reflex_chakra/components/disclosure/accordion.pyi @@ -1,71 +1,63 @@ -"""Stub file for reflex/components/chakra/disclosure/accordion.py""" +"""Stub file for reflex_chakra/components/disclosure/accordion.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Accordion(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, items=None, icon_pos="right", - allow_multiple: Optional[Union[Var[bool], bool]] = None, - allow_toggle: Optional[Union[Var[bool], bool]] = None, - default_index: Optional[Union[Var[Optional[List[int]]], List[int]]] = None, - index: Optional[Union[Var[Union[List[int], int]], int, List[int]]] = None, - reduce_motion: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + allow_multiple: Var[bool] | bool | None = None, + allow_toggle: Var[bool] | bool | None = None, + default_index: Var[list[int] | None] | list[int] | None = None, + index: Var[int | list[int]] | int | list[int] | None = None, + reduce_motion: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Accordion": + ) -> Accordion: """Create an accordion component. Args: @@ -80,6 +72,7 @@ class Accordion(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -88,61 +81,45 @@ class Accordion(ChakraComponent): Returns: The accordion component """ - ... class AccordionItem(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - id_: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_focusable: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + id_: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_focusable: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AccordionItem": - """Create the component. + ) -> AccordionItem: + """Create a new Chakra component. Args: *children: The children of the component. @@ -152,210 +129,165 @@ class AccordionItem(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AccordionButton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AccordionButton": - """Create the component. + ) -> AccordionButton: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AccordionPanel(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AccordionPanel": - """Create the component. + ) -> AccordionPanel: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AccordionIcon(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AccordionIcon": - """Create the component. + ) -> AccordionIcon: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/disclosure/tabs.py b/reflex_chakra/components/disclosure/tabs.py index 3d49cc4..414f633 100644 --- a/reflex_chakra/components/disclosure/tabs.py +++ b/reflex_chakra/components/disclosure/tabs.py @@ -1,6 +1,9 @@ """Tab components.""" -from typing import List, Optional, Tuple +from typing import ClassVar + +from reflex.components.component import Component +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, @@ -8,8 +11,6 @@ LiteralTabsVariant, LiteralTagAlign, ) -from reflex.components.component import Component -from reflex.vars import Var class Tabs(ChakraComponent): @@ -49,7 +50,7 @@ class Tabs(ChakraComponent): @classmethod def create( - cls, *children, items: Optional[List[Tuple[str, str]]] = None, **props + cls, *children, items: list[tuple[str, str]] | None = None, **props ) -> Component: """Create a tab component. @@ -69,7 +70,7 @@ def create( for label, panel in items: tabs.append(Tab.create(label)) panels.append(TabPanel.create(panel)) - children = [TabList.create(*tabs), TabPanels.create(*panels)] # type: ignore + children = [TabList.create(*tabs), TabPanels.create(*panels)] return super().create(*children, **props) @@ -90,7 +91,7 @@ class Tab(ChakraComponent): # The id of the panel. panel_id: Var[str] - _valid_parents: List[str] = ["TabList"] + _valid_parents: ClassVar[list[str]] = ["TabList"] class TabList(ChakraComponent): @@ -98,7 +99,7 @@ class TabList(ChakraComponent): tag = "TabList" - _valid_parents: List[str] = ["Tabs"] + _valid_parents: ClassVar[list[str]] = ["Tabs"] class TabPanels(ChakraComponent): @@ -106,7 +107,7 @@ class TabPanels(ChakraComponent): tag = "TabPanels" - _valid_parents: List[str] = ["Tabs"] + _valid_parents: ClassVar[list[str]] = ["Tabs"] class TabPanel(ChakraComponent): @@ -114,4 +115,4 @@ class TabPanel(ChakraComponent): tag = "TabPanel" - _valid_parents: List[str] = ["TabPanels"] + _valid_parents: ClassVar[list[str]] = ["TabPanels"] diff --git a/reflex_chakra/components/disclosure/tabs.pyi b/reflex_chakra/components/disclosure/tabs.pyi index c84c7b1..926b04c 100644 --- a/reflex_chakra/components/disclosure/tabs.pyi +++ b/reflex_chakra/components/disclosure/tabs.pyi @@ -1,150 +1,134 @@ -"""Stub file for reflex/components/chakra/disclosure/tabs.py""" +"""Stub file for reflex_chakra/components/disclosure/tabs.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Tabs(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - items: Optional[List[Tuple[str, str]]] = None, - align: Optional[ - Union[ - Var[Literal["center", "end", "start"]], - Literal["center", "end", "start"], - ] - ] = None, - default_index: Optional[Union[Var[int], int]] = None, - id_: Optional[Union[Var[str], str]] = None, - is_fitted: Optional[Union[Var[bool], bool]] = None, - is_lazy: Optional[Union[Var[bool], bool]] = None, - is_manual: Optional[Union[Var[bool], bool]] = None, - orientation: Optional[Union[Var[str], str]] = None, - variant: Optional[ - Union[ - Var[ - Literal[ - "line", - "enclosed", - "enclosed-colored", - "soft-rounded", - "solid-rounded", - "unstyled", - ] - ], - Literal[ - "line", - "enclosed", - "enclosed-colored", - "soft-rounded", - "solid-rounded", - "unstyled", - ], + items: list[tuple[str, str]] | None = None, + align: Literal["center", "end", "start"] + | Var[Literal["center", "end", "start"]] + | None = None, + default_index: Var[int] | int | None = None, + id_: Var[str] | str | None = None, + is_fitted: Var[bool] | bool | None = None, + is_lazy: Var[bool] | bool | None = None, + is_manual: Var[bool] | bool | None = None, + orientation: Var[str] | str | None = None, + variant: Literal[ + "enclosed", + "enclosed-colored", + "line", + "soft-rounded", + "solid-rounded", + "unstyled", + ] + | Var[ + Literal[ + "enclosed", + "enclosed-colored", + "line", + "soft-rounded", + "solid-rounded", + "unstyled", ] - ] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], + ] + | None = None, + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - index: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + index: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Tabs": + ) -> Tabs: """Create a tab component. Args: @@ -163,6 +147,7 @@ class Tabs(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -171,62 +156,46 @@ class Tabs(ChakraComponent): Returns: The tab component """ - ... class Tab(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_selected: Optional[Union[Var[bool], bool]] = None, - id_: Optional[Union[Var[str], str]] = None, - panel_id: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_disabled: Var[bool] | bool | None = None, + is_selected: Var[bool] | bool | None = None, + id_: Var[str] | str | None = None, + panel_id: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Tab": - """Create the component. + ) -> Tab: + """Create a new Chakra component. Args: *children: The children of the component. @@ -237,210 +206,165 @@ class Tab(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TabList(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TabList": - """Create the component. + ) -> TabList: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TabPanels(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TabPanels": - """Create the component. + ) -> TabPanels: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class TabPanel(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TabPanel": - """Create the component. + ) -> TabPanel: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/disclosure/transition.py b/reflex_chakra/components/disclosure/transition.py index abad0d5..6e09f8f 100644 --- a/reflex_chakra/components/disclosure/transition.py +++ b/reflex_chakra/components/disclosure/transition.py @@ -1,9 +1,8 @@ """A transition Component.""" -from typing import Union +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Transition(ChakraComponent): @@ -49,10 +48,10 @@ class SlideFade(Transition): tag = "SlideFade" # The offset on the horizontal or x axis - offsetX: Var[Union[str, int]] + offsetX: Var[str | int] # noqa: N815 # The offset on the vertical or y axis - offsetY: Var[Union[str, int]] + offsetY: Var[str | int] # noqa: N815 # If true, the element will be transitioned back to the offset when it leaves. Otherwise, it'll only fade out reverse: Var[bool] @@ -64,10 +63,10 @@ class Collapse(Transition): tag = "Collapse" # If true, the opacity of the content will be animated - animateOpacity: Var[bool] + animateOpacity: Var[bool] # noqa: N815 # The height you want the content in its expanded state. - endingHeight: Var[str] + endingHeight: Var[str] # noqa: N815 # The height you want the content in its collapsed state. - startingHeight: Var[Union[str, int]] + startingHeight: Var[str | int] # noqa: N815 diff --git a/reflex_chakra/components/disclosure/transition.pyi b/reflex_chakra/components/disclosure/transition.pyi index b83ce95..6b5dbda 100644 --- a/reflex_chakra/components/disclosure/transition.pyi +++ b/reflex_chakra/components/disclosure/transition.pyi @@ -1,67 +1,59 @@ -"""Stub file for reflex/components/chakra/disclosure/transition.py""" +"""Stub file for reflex_chakra/components/disclosure/transition.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Transition(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - in_: Optional[Union[Var[bool], bool]] = None, - unmount_on_exit: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + in_: Var[bool] | bool | None = None, + unmount_on_exit: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Transition": - """Create the component. + ) -> Transition: + """Create a new Chakra component. Args: *children: The children of the component. @@ -70,68 +62,53 @@ class Transition(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Fade(Transition): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - in_: Optional[Union[Var[bool], bool]] = None, - unmount_on_exit: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + in_: Var[bool] | bool | None = None, + unmount_on_exit: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Fade": - """Create the component. + ) -> Fade: + """Create a new Chakra component. Args: *children: The children of the component. @@ -140,70 +117,55 @@ class Fade(Transition): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ScaleFade(Transition): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - initial_scale: Optional[Union[Var[float], float]] = None, - reverse: Optional[Union[Var[bool], bool]] = None, - in_: Optional[Union[Var[bool], bool]] = None, - unmount_on_exit: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + initial_scale: Var[float] | float | None = None, + reverse: Var[bool] | bool | None = None, + in_: Var[bool] | bool | None = None, + unmount_on_exit: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ScaleFade": - """Create the component. + ) -> ScaleFade: + """Create a new Chakra component. Args: *children: The children of the component. @@ -214,69 +176,54 @@ class ScaleFade(Transition): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Slide(Transition): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - direction: Optional[Union[Var[str], str]] = None, - in_: Optional[Union[Var[bool], bool]] = None, - unmount_on_exit: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + direction: Var[str] | str | None = None, + in_: Var[bool] | bool | None = None, + unmount_on_exit: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Slide": - """Create the component. + ) -> Slide: + """Create a new Chakra component. Args: *children: The children of the component. @@ -286,71 +233,56 @@ class Slide(Transition): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class SlideFade(Transition): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - offsetX: Optional[Union[Var[Union[int, str]], str, int]] = None, - offsetY: Optional[Union[Var[Union[int, str]], str, int]] = None, - reverse: Optional[Union[Var[bool], bool]] = None, - in_: Optional[Union[Var[bool], bool]] = None, - unmount_on_exit: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + offsetX: Var[int | str] | int | str | None = None, + offsetY: Var[int | str] | int | str | None = None, + reverse: Var[bool] | bool | None = None, + in_: Var[bool] | bool | None = None, + unmount_on_exit: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "SlideFade": - """Create the component. + ) -> SlideFade: + """Create a new Chakra component. Args: *children: The children of the component. @@ -362,71 +294,56 @@ class SlideFade(Transition): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Collapse(Transition): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - animateOpacity: Optional[Union[Var[bool], bool]] = None, - endingHeight: Optional[Union[Var[str], str]] = None, - startingHeight: Optional[Union[Var[Union[int, str]], str, int]] = None, - in_: Optional[Union[Var[bool], bool]] = None, - unmount_on_exit: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + animateOpacity: Var[bool] | bool | None = None, + endingHeight: Var[str] | str | None = None, + startingHeight: Var[int | str] | int | str | None = None, + in_: Var[bool] | bool | None = None, + unmount_on_exit: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Collapse": - """Create the component. + ) -> Collapse: + """Create a new Chakra component. Args: *children: The children of the component. @@ -438,12 +355,12 @@ class Collapse(Transition): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/disclosure/visuallyhidden.pyi b/reflex_chakra/components/disclosure/visuallyhidden.pyi index 1a99bb6..0d8f867 100644 --- a/reflex_chakra/components/disclosure/visuallyhidden.pyi +++ b/reflex_chakra/components/disclosure/visuallyhidden.pyi @@ -1,77 +1,69 @@ -"""Stub file for reflex/components/chakra/disclosure/visuallyhidden.py""" +"""Stub file for reflex_chakra/components/disclosure/visuallyhidden.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class VisuallyHidden(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "VisuallyHidden": - """Create the component. + ) -> VisuallyHidden: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/feedback/__init__.py b/reflex_chakra/components/feedback/__init__.py index 8037e36..8cad6a9 100644 --- a/reflex_chakra/components/feedback/__init__.py +++ b/reflex_chakra/components/feedback/__init__.py @@ -5,3 +5,17 @@ from .progress import Progress from .skeleton import Skeleton, SkeletonCircle, SkeletonText from .spinner import Spinner + +__all__ = [ + "Alert", + "AlertDescription", + "AlertIcon", + "AlertTitle", + "CircularProgress", + "CircularProgressLabel", + "Progress", + "Skeleton", + "SkeletonCircle", + "SkeletonText", + "Spinner", +] diff --git a/reflex_chakra/components/feedback/alert.py b/reflex_chakra/components/feedback/alert.py index 82f5301..fd50bfa 100644 --- a/reflex_chakra/components/feedback/alert.py +++ b/reflex_chakra/components/feedback/alert.py @@ -1,12 +1,13 @@ """Alert components.""" +from reflex.components.component import Component +from reflex.vars.base import Var + from reflex_chakra.components import ( ChakraComponent, LiteralAlertVariant, LiteralStatus, ) -from reflex.components.component import Component -from reflex.vars import Var class Alert(ChakraComponent): diff --git a/reflex_chakra/components/feedback/alert.pyi b/reflex_chakra/components/feedback/alert.pyi index 7a2e827..e29dae1 100644 --- a/reflex_chakra/components/feedback/alert.pyi +++ b/reflex_chakra/components/feedback/alert.pyi @@ -1,79 +1,66 @@ -"""Stub file for reflex/components/chakra/feedback/alert.py""" +"""Stub file for reflex_chakra/components/feedback/alert.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Alert(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, icon=True, title="Alert title", desc=None, - status: Optional[ - Union[ - Var[Literal["success", "info", "warning", "error"]], - Literal["success", "info", "warning", "error"], - ] - ] = None, - variant: Optional[ - Union[ - Var[Literal["subtle", "left-accent", "top-accent", "solid"]], - Literal["subtle", "left-accent", "top-accent", "solid"], - ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + status: Literal["error", "info", "success", "warning"] + | Var[Literal["error", "info", "success", "warning"]] + | None = None, + variant: Literal["left-accent", "solid", "subtle", "top-accent"] + | Var[Literal["left-accent", "solid", "subtle", "top-accent"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Alert": + ) -> Alert: """Create an alert component. Args: @@ -86,6 +73,7 @@ class Alert(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -94,202 +82,156 @@ class Alert(ChakraComponent): Returns: The alert component. """ - ... class AlertIcon(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertIcon": - """Create the component. + ) -> AlertIcon: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AlertTitle(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertTitle": - """Create the component. + ) -> AlertTitle: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AlertDescription(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDescription": - """Create the component. + ) -> AlertDescription: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/feedback/circularprogress.py b/reflex_chakra/components/feedback/circularprogress.py index 8847dc7..91cb080 100644 --- a/reflex_chakra/components/feedback/circularprogress.py +++ b/reflex_chakra/components/feedback/circularprogress.py @@ -1,10 +1,9 @@ """Container to stack elements with spacing.""" -from typing import Union +from reflex.components.component import Component +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.components.component import Component -from reflex.vars import Var class CircularProgress(ChakraComponent): @@ -25,7 +24,7 @@ class CircularProgress(ChakraComponent): min_: Var[int] # This defines the stroke width of the svg circle. - thickness: Var[Union[str, int]] + thickness: Var[str | int] # The color name of the progress track. Use a color key in the theme object track_color: Var[str] diff --git a/reflex_chakra/components/feedback/circularprogress.pyi b/reflex_chakra/components/feedback/circularprogress.pyi index 8bf368c..e1a5234 100644 --- a/reflex_chakra/components/feedback/circularprogress.pyi +++ b/reflex_chakra/components/feedback/circularprogress.pyi @@ -1,75 +1,67 @@ -"""Stub file for reflex/components/chakra/feedback/circularprogress.py""" +"""Stub file for reflex_chakra/components/feedback/circularprogress.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class CircularProgress(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, label=None, - cap_is_round: Optional[Union[Var[bool], bool]] = None, - is_indeterminate: Optional[Union[Var[bool], bool]] = None, - max_: Optional[Union[Var[int], int]] = None, - min_: Optional[Union[Var[int], int]] = None, - thickness: Optional[Union[Var[Union[int, str]], str, int]] = None, - track_color: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[int], int]] = None, - value_text: Optional[Union[Var[str], str]] = None, - color: Optional[Union[Var[str], str]] = None, - size: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + cap_is_round: Var[bool] | bool | None = None, + is_indeterminate: Var[bool] | bool | None = None, + max_: Var[int] | int | None = None, + min_: Var[int] | int | None = None, + thickness: Var[int | str] | int | str | None = None, + track_color: Var[str] | str | None = None, + value: Var[int] | int | None = None, + value_text: Var[str] | str | None = None, + color: Var[str] | str | None = None, + size: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "CircularProgress": + ) -> CircularProgress: """Create a circular progress component. Args: @@ -88,6 +80,7 @@ class CircularProgress(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -96,70 +89,54 @@ class CircularProgress(ChakraComponent): Returns: The circular progress component. """ - ... class CircularProgressLabel(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "CircularProgressLabel": - """Create the component. + ) -> CircularProgressLabel: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/feedback/progress.py b/reflex_chakra/components/feedback/progress.py index 63fda11..287af86 100644 --- a/reflex_chakra/components/feedback/progress.py +++ b/reflex_chakra/components/feedback/progress.py @@ -1,9 +1,8 @@ """Container to stack elements with spacing.""" -from typing import Union +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Progress(ChakraComponent): @@ -27,7 +26,7 @@ class Progress(ChakraComponent): min_: Var[int] # The value of the progress indicator. If undefined the progress bar will be in indeterminate state - value: Var[Union[int, float]] + value: Var[int | float] # The color scheme of the progress bar. color_scheme: Var[str] diff --git a/reflex_chakra/components/feedback/progress.pyi b/reflex_chakra/components/feedback/progress.pyi index 6ba5c5d..a1cdd8c 100644 --- a/reflex_chakra/components/feedback/progress.pyi +++ b/reflex_chakra/components/feedback/progress.pyi @@ -1,72 +1,64 @@ -"""Stub file for reflex/components/chakra/feedback/progress.py""" +"""Stub file for reflex_chakra/components/feedback/progress.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Progress(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - has_stripe: Optional[Union[Var[bool], bool]] = None, - is_animated: Optional[Union[Var[bool], bool]] = None, - is_indeterminate: Optional[Union[Var[bool], bool]] = None, - max_: Optional[Union[Var[int], int]] = None, - min_: Optional[Union[Var[int], int]] = None, - value: Optional[Union[Var[Union[float, int]], int, float]] = None, - color_scheme: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + has_stripe: Var[bool] | bool | None = None, + is_animated: Var[bool] | bool | None = None, + is_indeterminate: Var[bool] | bool | None = None, + max_: Var[int] | int | None = None, + min_: Var[int] | int | None = None, + value: Var[float | int] | float | None = None, + color_scheme: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Progress": - """Create the component. + ) -> Progress: + """Create a new Chakra component. Args: *children: The children of the component. @@ -80,12 +72,12 @@ class Progress(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/feedback/skeleton.py b/reflex_chakra/components/feedback/skeleton.py index 8e97e17..9b4781a 100644 --- a/reflex_chakra/components/feedback/skeleton.py +++ b/reflex_chakra/components/feedback/skeleton.py @@ -1,7 +1,8 @@ """Container to stack elements with spacing.""" +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Skeleton(ChakraComponent): diff --git a/reflex_chakra/components/feedback/skeleton.pyi b/reflex_chakra/components/feedback/skeleton.pyi index fd95c41..ba9f694 100644 --- a/reflex_chakra/components/feedback/skeleton.pyi +++ b/reflex_chakra/components/feedback/skeleton.pyi @@ -1,70 +1,62 @@ -"""Stub file for reflex/components/chakra/feedback/skeleton.py""" +"""Stub file for reflex_chakra/components/feedback/skeleton.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Skeleton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - end_color: Optional[Union[Var[str], str]] = None, - fade_duration: Optional[Union[Var[float], float]] = None, - is_loaded: Optional[Union[Var[bool], bool]] = None, - speed: Optional[Union[Var[float], float]] = None, - start_color: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + end_color: Var[str] | str | None = None, + fade_duration: Var[float] | float | None = None, + is_loaded: Var[bool] | bool | None = None, + speed: Var[float] | float | None = None, + start_color: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Skeleton": - """Create the component. + ) -> Skeleton: + """Create a new Chakra component. Args: *children: The children of the component. @@ -76,71 +68,56 @@ class Skeleton(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class SkeletonCircle(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - end_color: Optional[Union[Var[str], str]] = None, - fade_duration: Optional[Union[Var[float], float]] = None, - is_loaded: Optional[Union[Var[bool], bool]] = None, - speed: Optional[Union[Var[float], float]] = None, - start_color: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + end_color: Var[str] | str | None = None, + fade_duration: Var[float] | float | None = None, + is_loaded: Var[bool] | bool | None = None, + speed: Var[float] | float | None = None, + start_color: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "SkeletonCircle": - """Create the component. + ) -> SkeletonCircle: + """Create a new Chakra component. Args: *children: The children of the component. @@ -152,72 +129,57 @@ class SkeletonCircle(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class SkeletonText(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - end_color: Optional[Union[Var[str], str]] = None, - fade_duration: Optional[Union[Var[float], float]] = None, - is_loaded: Optional[Union[Var[bool], bool]] = None, - speed: Optional[Union[Var[float], float]] = None, - start_color: Optional[Union[Var[str], str]] = None, - no_of_lines: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + end_color: Var[str] | str | None = None, + fade_duration: Var[float] | float | None = None, + is_loaded: Var[bool] | bool | None = None, + speed: Var[float] | float | None = None, + start_color: Var[str] | str | None = None, + no_of_lines: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "SkeletonText": - """Create the component. + ) -> SkeletonText: + """Create a new Chakra component. Args: *children: The children of the component. @@ -230,12 +192,12 @@ class SkeletonText(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/feedback/spinner.py b/reflex_chakra/components/feedback/spinner.py index 1096668..92adf07 100644 --- a/reflex_chakra/components/feedback/spinner.py +++ b/reflex_chakra/components/feedback/spinner.py @@ -1,7 +1,8 @@ """Container to stack elements with spacing.""" +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent, LiteralSpinnerSize -from reflex.vars import Var class Spinner(ChakraComponent): diff --git a/reflex_chakra/components/feedback/spinner.pyi b/reflex_chakra/components/feedback/spinner.pyi index 5c06019..a0c2ef2 100644 --- a/reflex_chakra/components/feedback/spinner.pyi +++ b/reflex_chakra/components/feedback/spinner.pyi @@ -1,75 +1,65 @@ -"""Stub file for reflex/components/chakra/feedback/spinner.py""" +"""Stub file for reflex_chakra/components/feedback/spinner.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Spinner(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - empty_color: Optional[Union[Var[str], str]] = None, - label: Optional[Union[Var[str], str]] = None, - speed: Optional[Union[Var[str], str]] = None, - thickness: Optional[Union[Var[int], int]] = None, - size: Optional[ - Union[ - Var[Literal["sm", "md", "lg", "xs", "xl"]], - Literal["sm", "md", "lg", "xs", "xl"], - ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + empty_color: Var[str] | str | None = None, + label: Var[str] | str | None = None, + speed: Var[str] | str | None = None, + thickness: Var[int] | int | None = None, + size: Literal["lg", "md", "sm", "xl", "xs"] + | Var[Literal["lg", "md", "sm", "xl", "xs"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Spinner": - """Create the component. + ) -> Spinner: + """Create a new Chakra component. Args: *children: The children of the component. @@ -81,12 +71,12 @@ class Spinner(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/__init__.py b/reflex_chakra/components/forms/__init__.py index b3a4b1b..56aea9d 100644 --- a/reflex_chakra/components/forms/__init__.py +++ b/reflex_chakra/components/forms/__init__.py @@ -1,10 +1,11 @@ """Convenience functions to define core components.""" +from reflex.components.el.elements.forms import Option + from .button import Button, ButtonGroup from .checkbox import Checkbox, CheckboxGroup from .colormodeswitch import ( ColorModeButton, - color_mode_icon, ColorModeScript, ColorModeSwitch, ) @@ -22,8 +23,6 @@ InputRightAddon, InputRightElement, ) -from .multiselect import Option as MultiSelectOption -from .multiselect import Select as MultiSelect from .numberinput import ( NumberDecrementStepper, NumberIncrementStepper, @@ -40,10 +39,61 @@ RangeSliderThumb, RangeSliderTrack, ) -from .select import Option, Select +from .select import Select from .slider import Slider, SliderFilledTrack, SliderMark, SliderThumb, SliderTrack from .switch import Switch from .textarea import TextArea from .time_picker import TimePicker -__all__ = [f for f in dir() if f[0].isupper()] # type: ignore +__all__ = [ + "Button", + "ButtonGroup", + "Checkbox", + "CheckboxGroup", + "ColorModeButton", + "ColorModeScript", + "ColorModeSwitch", + "DatePicker", + "DateTimePicker", + "Editable", + "EditableInput", + "EditablePreview", + "EditableTextarea", + "Email", + "Form", + "FormControl", + "FormErrorMessage", + "FormHelperText", + "FormLabel", + "IconButton", + "Input", + "InputGroup", + "InputLeftAddon", + "InputLeftElement", + "InputRightAddon", + "InputRightElement", + "NumberDecrementStepper", + "NumberIncrementStepper", + "NumberInput", + "NumberInputField", + "NumberInputStepper", + "Option", + "Password", + "PinInput", + "PinInputField", + "Radio", + "RadioGroup", + "RangeSlider", + "RangeSliderFilledTrack", + "RangeSliderThumb", + "RangeSliderTrack", + "Select", + "Slider", + "SliderFilledTrack", + "SliderMark", + "SliderThumb", + "SliderTrack", + "Switch", + "TextArea", + "TimePicker", +] diff --git a/reflex_chakra/components/forms/button.py b/reflex_chakra/components/forms/button.py index 1ed9345..d4a6789 100644 --- a/reflex_chakra/components/forms/button.py +++ b/reflex_chakra/components/forms/button.py @@ -1,6 +1,8 @@ """A button component.""" -from typing import List +from typing import ClassVar + +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, @@ -9,7 +11,6 @@ LiteralColorScheme, LiteralSpinnerPlacement, ) -from reflex.vars import Var class Button(ChakraComponent): @@ -56,7 +57,7 @@ class Button(ChakraComponent): type_: Var[str] # Components that are not allowed as children. - _invalid_children: List[str] = ["Button", "MenuButton"] + _invalid_children: ClassVar[list[str]] = ["Button", "MenuButton"] # The name of the form field name: Var[str] diff --git a/reflex_chakra/components/forms/button.pyi b/reflex_chakra/components/forms/button.pyi index 3c1816e..18334a3 100644 --- a/reflex_chakra/components/forms/button.pyi +++ b/reflex_chakra/components/forms/button.pyi @@ -1,135 +1,122 @@ -"""Stub file for reflex/components/chakra/forms/button.py""" +"""Stub file for reflex_chakra/components/forms/button.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Button(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - icon_spacing: Optional[Union[Var[int], int]] = None, - is_active: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_full_width: Optional[Union[Var[bool], bool]] = None, - is_loading: Optional[Union[Var[bool], bool]] = None, - loading_text: Optional[Union[Var[str], str]] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - variant: Optional[ - Union[ - Var[Literal["ghost", "outline", "solid", "link", "unstyled"]], - Literal["ghost", "outline", "solid", "link", "unstyled"], + icon_spacing: Var[int] | int | None = None, + is_active: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_full_width: Var[bool] | bool | None = None, + is_loading: Var[bool] | bool | None = None, + loading_text: Var[str] | str | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + variant: Literal["ghost", "link", "outline", "solid", "unstyled"] + | Var[Literal["ghost", "link", "outline", "solid", "unstyled"]] + | None = None, + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], - ] - ] = None, - spinner_placement: Optional[ - Union[Var[Literal["start", "end"]], Literal["start", "end"]] - ] = None, - type_: Optional[Union[Var[str], str]] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + spinner_placement: Literal["end", "start"] + | Var[Literal["end", "start"]] + | None = None, + type_: Var[str] | str | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Button": - """Create the component. + ) -> Button: + """Create a new Chakra component. Args: *children: The children of the component. @@ -148,78 +135,60 @@ class Button(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ButtonGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_attached: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - spacing: Optional[Union[Var[int], int]] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - variant: Optional[ - Union[ - Var[Literal["ghost", "outline", "solid", "link", "unstyled"]], - Literal["ghost", "outline", "solid", "link", "unstyled"], - ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_attached: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + spacing: Var[int] | int | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + variant: Literal["ghost", "link", "outline", "solid", "unstyled"] + | Var[Literal["ghost", "link", "outline", "solid", "unstyled"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ButtonGroup": - """Create the component. + ) -> ButtonGroup: + """Create a new Chakra component. Args: *children: The children of the component. @@ -231,12 +200,12 @@ class ButtonGroup(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/checkbox.py b/reflex_chakra/components/forms/checkbox.py index 8c06a0d..0fb9d58 100644 --- a/reflex_chakra/components/forms/checkbox.py +++ b/reflex_chakra/components/forms/checkbox.py @@ -2,13 +2,14 @@ from __future__ import annotations +from reflex.event import EventHandler +from reflex.vars.base import Var + from reflex_chakra.components import ( ChakraComponent, LiteralColorScheme, LiteralTagSize, ) -from reflex.event import EventHandler -from reflex.vars import Var class Checkbox(ChakraComponent): diff --git a/reflex_chakra/components/forms/checkbox.pyi b/reflex_chakra/components/forms/checkbox.pyi index 20c0ab0..ed62d7d 100644 --- a/reflex_chakra/components/forms/checkbox.pyi +++ b/reflex_chakra/components/forms/checkbox.pyi @@ -1,127 +1,115 @@ -"""Stub file for reflex/components/chakra/forms/checkbox.py""" +"""Stub file for reflex_chakra/components/forms/checkbox.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Checkbox(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg"]], Literal["sm", "md", "lg"]] - ] = None, - is_checked: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_focusable: Optional[Union[Var[bool], bool]] = None, - is_indeterminate: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - name: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - spacing: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + size: Literal["lg", "md", "sm"] | Var[Literal["lg", "md", "sm"]] | None = None, + is_checked: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_focusable: Var[bool] | bool | None = None, + is_indeterminate: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + name: Var[str] | str | None = None, + value: Var[str] | str | None = None, + spacing: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Checkbox": - """Create the component. + ) -> Checkbox: + """Create a new Chakra component. Args: *children: The children of the component. @@ -137,73 +125,59 @@ class Checkbox(ChakraComponent): name: The name of the input field in a checkbox (Useful for form submission). value: The value of the input field when checked (use is_checked prop for a bool) spacing: The spacing between the checkbox and its label text (0.5rem) + on_change: Fired when the checkbox is checked or unchecked style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class CheckboxGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_native: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_native: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "CheckboxGroup": - """Create the component. + ) -> CheckboxGroup: + """Create a new Chakra component. Args: *children: The children of the component. @@ -214,12 +188,12 @@ class CheckboxGroup(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/colormodeswitch.py b/reflex_chakra/components/forms/colormodeswitch.py index 1751a8f..8433eed 100644 --- a/reflex_chakra/components/forms/colormodeswitch.py +++ b/reflex_chakra/components/forms/colormodeswitch.py @@ -17,12 +17,13 @@ from __future__ import annotations -from reflex_chakra.components import ChakraComponent -from reflex_chakra.components.media.icon import Icon from reflex.components.component import BaseComponent from reflex.components.core.cond import color_mode_cond from reflex.style import LIGHT_COLOR_MODE, color_mode, toggle_color_mode +from reflex_chakra.components import ChakraComponent +from reflex_chakra.components.media.icon import Icon + from .button import Button from .switch import Switch @@ -96,4 +97,4 @@ class ColorModeScript(ChakraComponent): """Chakra color mode script.""" tag = "ColorModeScript" - initialColorMode = LIGHT_COLOR_MODE + initialColorMode = LIGHT_COLOR_MODE # noqa: N815 diff --git a/reflex_chakra/components/forms/colormodeswitch.pyi b/reflex_chakra/components/forms/colormodeswitch.pyi index 9ff616c..0213f13 100644 --- a/reflex_chakra/components/forms/colormodeswitch.pyi +++ b/reflex_chakra/components/forms/colormodeswitch.pyi @@ -1,16 +1,24 @@ -"""Stub file for reflex/components/chakra/forms/colormodeswitch.py""" +"""Stub file for reflex_chakra/components/forms/colormodeswitch.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.component import BaseComponent +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent from reflex_chakra.components.media.icon import Icon -from reflex.components.component import BaseComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var from .button import Button from .switch import Switch @@ -19,128 +27,100 @@ DEFAULT_LIGHT_ICON: Icon DEFAULT_DARK_ICON: Icon def color_mode_icon( - light_component: Optional[Union[BaseComponent, None]] = None, - dark_component: Optional[Union[BaseComponent, None]] = None, -): - """Create an icon component based on color_mode. - - Args: - light_component: the component to display when color mode is default - dark_component: the component to display when color mode is dark (non-default) - - Returns: - The conditionally rendered component - """ - ... + light_component: BaseComponent | None = None, + dark_component: BaseComponent | None = None, +): ... class ColorModeSwitch(Switch): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_checked: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_focusable: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - name: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - spacing: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], + is_checked: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_focusable: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + name: Var[str] | str | None = None, + value: Var[str] | str | None = None, + spacing: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ColorModeSwitch": + ) -> ColorModeSwitch: """Create a switch component bound to color_mode. Args: @@ -156,9 +136,11 @@ class ColorModeSwitch(Switch): spacing: The spacing between the switch and its label text (0.5rem) placeholder: The placeholder text. color_scheme: The color scheme of the switch (e.g. "blue", "green", "red", etc.) + on_change: Fired when the switch value changes style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -167,125 +149,103 @@ class ColorModeSwitch(Switch): Returns: The switch component. """ - ... class ColorModeButton(Button): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - icon_spacing: Optional[Union[Var[int], int]] = None, - is_active: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_full_width: Optional[Union[Var[bool], bool]] = None, - is_loading: Optional[Union[Var[bool], bool]] = None, - loading_text: Optional[Union[Var[str], str]] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - variant: Optional[ - Union[ - Var[Literal["ghost", "outline", "solid", "link", "unstyled"]], - Literal["ghost", "outline", "solid", "link", "unstyled"], - ] - ] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], + icon_spacing: Var[int] | int | None = None, + is_active: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_full_width: Var[bool] | bool | None = None, + is_loading: Var[bool] | bool | None = None, + loading_text: Var[str] | str | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + variant: Literal["ghost", "link", "outline", "solid", "unstyled"] + | Var[Literal["ghost", "link", "outline", "solid", "unstyled"]] + | None = None, + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - spinner_placement: Optional[ - Union[Var[Literal["start", "end"]], Literal["start", "end"]] - ] = None, - type_: Optional[Union[Var[str], str]] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + spinner_placement: Literal["end", "start"] + | Var[Literal["end", "start"]] + | None = None, + type_: Var[str] | str | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ColorModeButton": + ) -> ColorModeButton: """Create a button component that calls toggle_color_mode on click. Args: @@ -305,6 +265,7 @@ class ColorModeButton(Button): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -313,70 +274,54 @@ class ColorModeButton(Button): Returns: The switch component. """ - ... class ColorModeScript(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ColorModeScript": - """Create the component. + ) -> ColorModeScript: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/date_picker.py b/reflex_chakra/components/forms/date_picker.py index 9aed7ff..41c000f 100644 --- a/reflex_chakra/components/forms/date_picker.py +++ b/reflex_chakra/components/forms/date_picker.py @@ -1,11 +1,12 @@ """A date input component.""" +from reflex.vars.base import Var + from reflex_chakra.components.forms.input import Input -from reflex.vars import Var class DatePicker(Input): """A date input component.""" # The type of input. - type_: Var[str] = "date" # type: ignore + type_: Var[str] = Var.create("date") diff --git a/reflex_chakra/components/forms/date_picker.pyi b/reflex_chakra/components/forms/date_picker.pyi index 7f3923e..3586421 100644 --- a/reflex_chakra/components/forms/date_picker.pyi +++ b/reflex_chakra/components/forms/date_picker.pyi @@ -1,89 +1,77 @@ -"""Stub file for reflex/components/chakra/forms/date_picker.py""" +"""Stub file for reflex_chakra/components/forms/date_picker.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components.forms.input import Input -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class DatePicker(Input): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type_: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type_: Var[str] | str | None = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[Any] | None = None, + on_key_down: EventType[Any] | None = None, + on_key_up: EventType[Any] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DatePicker": + ) -> DatePicker: """Create an Input component. Args: @@ -101,9 +89,15 @@ class DatePicker(Input): variant: "outline" | "filled" | "flushed" | "unstyled" size: "lg" | "md" | "sm" | "xs" name: The name of the form field + on_change: Fired when the input value changes. + on_focus: Fired when the input is focused. + on_blur: Fired when the input lose focus. + on_key_down: Fired when a key is pressed down. + on_key_up: Fired when a key is released. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -112,4 +106,3 @@ class DatePicker(Input): Returns: The component. """ - ... diff --git a/reflex_chakra/components/forms/date_time_picker.py b/reflex_chakra/components/forms/date_time_picker.py index 3d45b49..81be238 100644 --- a/reflex_chakra/components/forms/date_time_picker.py +++ b/reflex_chakra/components/forms/date_time_picker.py @@ -1,11 +1,12 @@ """A datetime-local input component.""" +from reflex.vars.base import Var + from reflex_chakra.components.forms.input import Input -from reflex.vars import Var class DateTimePicker(Input): """A datetime-local input component.""" # The type of input. - type_: Var[str] = "datetime-local" # type: ignore + type_: Var[str] = Var.create("datetime-local") diff --git a/reflex_chakra/components/forms/date_time_picker.pyi b/reflex_chakra/components/forms/date_time_picker.pyi index b8c6972..a07de89 100644 --- a/reflex_chakra/components/forms/date_time_picker.pyi +++ b/reflex_chakra/components/forms/date_time_picker.pyi @@ -1,89 +1,77 @@ -"""Stub file for reflex/components/chakra/forms/date_time_picker.py""" +"""Stub file for reflex_chakra/components/forms/date_time_picker.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components.forms.input import Input -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class DateTimePicker(Input): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type_: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type_: Var[str] | str | None = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[Any] | None = None, + on_key_down: EventType[Any] | None = None, + on_key_up: EventType[Any] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DateTimePicker": + ) -> DateTimePicker: """Create an Input component. Args: @@ -101,9 +89,15 @@ class DateTimePicker(Input): variant: "outline" | "filled" | "flushed" | "unstyled" size: "lg" | "md" | "sm" | "xs" name: The name of the form field + on_change: Fired when the input value changes. + on_focus: Fired when the input is focused. + on_blur: Fired when the input lose focus. + on_key_down: Fired when a key is pressed down. + on_key_up: Fired when a key is released. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -112,4 +106,3 @@ class DateTimePicker(Input): Returns: The component. """ - ... diff --git a/reflex_chakra/components/forms/editable.py b/reflex_chakra/components/forms/editable.py index 5f5032f..13aa8e5 100644 --- a/reflex_chakra/components/forms/editable.py +++ b/reflex_chakra/components/forms/editable.py @@ -2,9 +2,10 @@ from __future__ import annotations -from reflex_chakra.components import ChakraComponent from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class Editable(ChakraComponent): diff --git a/reflex_chakra/components/forms/editable.pyi b/reflex_chakra/components/forms/editable.pyi index d4e079f..ebee6a3 100644 --- a/reflex_chakra/components/forms/editable.pyi +++ b/reflex_chakra/components/forms/editable.pyi @@ -1,77 +1,69 @@ -"""Stub file for reflex/components/chakra/forms/editable.py""" +"""Stub file for reflex_chakra/components/forms/editable.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Editable(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_preview_focusable: Optional[Union[Var[bool], bool]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - select_all_on_focus: Optional[Union[Var[bool], bool]] = None, - start_with_edit_view: Optional[Union[Var[bool], bool]] = None, - submit_on_blur: Optional[Union[Var[bool], bool]] = None, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_cancel: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_edit: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_submit: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_disabled: Var[bool] | bool | None = None, + is_preview_focusable: Var[bool] | bool | None = None, + placeholder: Var[str] | str | None = None, + select_all_on_focus: Var[bool] | bool | None = None, + start_with_edit_view: Var[bool] | bool | None = None, + submit_on_blur: Var[bool] | bool | None = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_cancel: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_edit: EventType[Any] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_submit: EventType[Any] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Editable": - """Create the component. + ) -> Editable: + """Create a new Chakra component. Args: *children: The children of the component. @@ -83,213 +75,172 @@ class Editable(ChakraComponent): submit_on_blur: If true, it'll update the value onBlur and turn off the edit mode. value: The value of the Editable in both edit & preview mode default_value: The initial value of the Editable in both edit and preview mode. + on_change: Fired when the Editable is changed. + on_edit: Fired when the Editable is in edit mode. + on_submit: Fired when the Editable is submitted. + on_cancel: Fired when the Editable is canceled. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class EditableInput(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "EditableInput": - """Create the component. + ) -> EditableInput: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class EditableTextarea(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "EditableTextarea": - """Create the component. + ) -> EditableTextarea: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class EditablePreview(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "EditablePreview": - """Create the component. + ) -> EditablePreview: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/email.py b/reflex_chakra/components/forms/email.py index bd0e9f2..e45d4a7 100644 --- a/reflex_chakra/components/forms/email.py +++ b/reflex_chakra/components/forms/email.py @@ -1,11 +1,12 @@ """An email input component.""" +from reflex.vars.base import Var + from reflex_chakra.components.forms.input import Input -from reflex.vars import Var class Email(Input): """An email input component.""" # The type of input. - type_: Var[str] = "email" # type: ignore + type_: Var[str] = Var.create("email") diff --git a/reflex_chakra/components/forms/email.pyi b/reflex_chakra/components/forms/email.pyi index 4c6e6fa..2fab836 100644 --- a/reflex_chakra/components/forms/email.pyi +++ b/reflex_chakra/components/forms/email.pyi @@ -1,89 +1,77 @@ -"""Stub file for reflex/components/chakra/forms/email.py""" +"""Stub file for reflex_chakra/components/forms/email.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components.forms.input import Input -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Email(Input): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type_: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type_: Var[str] | str | None = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[Any] | None = None, + on_key_down: EventType[Any] | None = None, + on_key_up: EventType[Any] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Email": + ) -> Email: """Create an Input component. Args: @@ -101,9 +89,15 @@ class Email(Input): variant: "outline" | "filled" | "flushed" | "unstyled" size: "lg" | "md" | "sm" | "xs" name: The name of the form field + on_change: Fired when the input value changes. + on_focus: Fired when the input is focused. + on_blur: Fired when the input lose focus. + on_key_down: Fired when a key is pressed down. + on_key_up: Fired when a key is released. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -112,4 +106,3 @@ class Email(Input): Returns: The component. """ - ... diff --git a/reflex_chakra/components/forms/form.py b/reflex_chakra/components/forms/form.py index bb0a1fc..c8a8dbc 100644 --- a/reflex_chakra/components/forms/form.py +++ b/reflex_chakra/components/forms/form.py @@ -2,10 +2,11 @@ from __future__ import annotations -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component from reflex.components.el.elements.forms import Form as HTMLForm -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class Form(ChakraComponent, HTMLForm): @@ -14,7 +15,7 @@ class Form(ChakraComponent, HTMLForm): tag = "Box" # What the form renders to. - as_: Var[str] = "form" # type: ignore + as_: Var[str] = Var.create("form") class FormControl(ChakraComponent): @@ -70,7 +71,8 @@ def create( children.append(FormLabel.create(*label)) if not input: - raise AttributeError("input keyword argument is required") + msg = "input keyword argument is required" + raise AttributeError(msg) children.append(input) if help_text: diff --git a/reflex_chakra/components/forms/form.pyi b/reflex_chakra/components/forms/form.pyi index 52465bd..adca10e 100644 --- a/reflex_chakra/components/forms/form.pyi +++ b/reflex_chakra/components/forms/form.pyi @@ -1,110 +1,256 @@ -"""Stub file for reflex/components/chakra/forms/form.py""" +"""Stub file for reflex_chakra/components/forms/form.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) -from reflex_chakra.components import ChakraComponent +from reflex.components.core.breakpoints import Breakpoints from reflex.components.el.elements.forms import Form as HTMLForm -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class Form(ChakraComponent, HTMLForm): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - as_: Optional[Union[Var[str], str]] = None, - accept: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - accept_charset: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] - ] = None, - action: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - auto_complete: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] - ] = None, - enc_type: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - method: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - name: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - no_validate: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - target: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - reset_on_submit: Optional[Union[Var[bool], bool]] = None, - handle_submit_unique_name: Optional[Union[Var[str], str]] = None, - access_key: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - auto_capitalize: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] - ] = None, - content_editable: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] - ] = None, - context_menu: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] - ] = None, - dir: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - draggable: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - enter_key_hint: Optional[ - Union[Var[Union[bool, int, str]], str, int, bool] - ] = None, - hidden: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - input_mode: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - item_prop: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - lang: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - role: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - slot: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - spell_check: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - tab_index: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - title: Optional[Union[Var[Union[bool, int, str]], str, int, bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_submit: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + as_: Var[str] | str | None = None, + accept: Var[str] | str | None = None, + accept_charset: Var[str] | str | None = None, + action: Var[str] | str | None = None, + auto_complete: Var[str] | str | None = None, + enc_type: Var[str] | str | None = None, + method: Var[str] | str | None = None, + name: Var[str] | str | None = None, + no_validate: Var[bool] | bool | None = None, + target: Var[str] | str | None = None, + reset_on_submit: Var[bool] | bool | None = None, + handle_submit_unique_name: Var[str] | str | None = None, + access_key: Var[str] | str | None = None, + auto_capitalize: Literal[ + "characters", "none", "off", "on", "sentences", "words" + ] + | Var[Literal["characters", "none", "off", "on", "sentences", "words"]] + | None = None, + content_editable: Literal["inherit", "plaintext-only", False, True] + | Var[Literal["inherit", "plaintext-only", False, True]] + | None = None, + context_menu: Var[str] | str | None = None, + dir: Var[str] | str | None = None, + draggable: Var[bool] | bool | None = None, + enter_key_hint: Literal[ + "done", "enter", "go", "next", "previous", "search", "send" + ] + | Var[Literal["done", "enter", "go", "next", "previous", "search", "send"]] + | None = None, + hidden: Var[bool] | bool | None = None, + input_mode: Literal[ + "decimal", "email", "none", "numeric", "search", "tel", "text", "url" + ] + | Var[ + Literal[ + "decimal", "email", "none", "numeric", "search", "tel", "text", "url" + ] + ] + | None = None, + item_prop: Var[str] | str | None = None, + lang: Var[str] | str | None = None, + role: Literal[ + "alert", + "alertdialog", + "application", + "article", + "banner", + "button", + "cell", + "checkbox", + "columnheader", + "combobox", + "complementary", + "contentinfo", + "definition", + "dialog", + "directory", + "document", + "feed", + "figure", + "form", + "grid", + "gridcell", + "group", + "heading", + "img", + "link", + "list", + "listbox", + "listitem", + "log", + "main", + "marquee", + "math", + "menu", + "menubar", + "menuitem", + "menuitemcheckbox", + "menuitemradio", + "navigation", + "none", + "note", + "option", + "presentation", + "progressbar", + "radio", + "radiogroup", + "region", + "row", + "rowgroup", + "rowheader", + "scrollbar", + "search", + "searchbox", + "separator", + "slider", + "spinbutton", + "status", + "switch", + "tab", + "table", + "tablist", + "tabpanel", + "term", + "textbox", + "timer", + "toolbar", + "tooltip", + "tree", + "treegrid", + "treeitem", + ] + | Var[ + Literal[ + "alert", + "alertdialog", + "application", + "article", + "banner", + "button", + "cell", + "checkbox", + "columnheader", + "combobox", + "complementary", + "contentinfo", + "definition", + "dialog", + "directory", + "document", + "feed", + "figure", + "form", + "grid", + "gridcell", + "group", + "heading", + "img", + "link", + "list", + "listbox", + "listitem", + "log", + "main", + "marquee", + "math", + "menu", + "menubar", + "menuitem", + "menuitemcheckbox", + "menuitemradio", + "navigation", + "none", + "note", + "option", + "presentation", + "progressbar", + "radio", + "radiogroup", + "region", + "row", + "rowgroup", + "rowheader", + "scrollbar", + "search", + "searchbox", + "separator", + "slider", + "spinbutton", + "status", + "switch", + "tab", + "table", + "tablist", + "tabpanel", + "term", + "textbox", + "timer", + "toolbar", + "tooltip", + "tree", + "treegrid", + "treeitem", + ] + ] + | None = None, + slot: Var[str] | str | None = None, + spell_check: Var[bool] | bool | None = None, + tab_index: Var[int] | int | None = None, + title: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_submit: EventType[()] + | EventType[dict[str, Any]] + | EventType[dict[str, str]] + | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Form": - """Create a form component. + ) -> Form: + """Create a new Chakra component. Args: - *children: The children of the form. + *children: The children of the component. as_: What the form renders to. accept: MIME types the server accepts for file upload accept_charset: Character encodings to be used for form submission @@ -117,7 +263,8 @@ class Form(ChakraComponent, HTMLForm): target: Where to display the response after submitting the form reset_on_submit: If true, the form will be cleared after submit. handle_submit_unique_name: The name used to make this form's submit handler function unique. - access_key: Provides a hint for generating a keyboard shortcut for the current element. + on_submit: Fired when the form is submitted + access_key: Provides a hint for generating a keyboard shortcut for the current element. auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user. content_editable: Indicates whether the element's content is editable. context_menu: Defines the ID of a element which will serve as the element's context menu. @@ -136,73 +283,58 @@ class Form(ChakraComponent, HTMLForm): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The properties of the form. + **props: The properties of the component. Returns: - The form component. + A new Chakra component. """ - ... class FormControl(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, label=None, input=None, help_text=None, error_message=None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "FormControl": + ) -> FormControl: """Create a form control component. Args: @@ -218,6 +350,7 @@ class FormControl(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -229,125 +362,94 @@ class FormControl(ChakraComponent): Returns: The form control component. """ - ... class FormHelperText(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "FormHelperText": - """Create the component. + ) -> FormHelperText: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class FormLabel(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - html_for: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + html_for: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "FormLabel": - """Create the component. + ) -> FormLabel: + """Create a new Chakra component. Args: *children: The children of the component. @@ -355,78 +457,63 @@ class FormLabel(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class FormErrorMessage(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "FormErrorMessage": - """Create the component. + ) -> FormErrorMessage: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/iconbutton.py b/reflex_chakra/components/forms/iconbutton.py index 42dcd2f..7e603bf 100644 --- a/reflex_chakra/components/forms/iconbutton.py +++ b/reflex_chakra/components/forms/iconbutton.py @@ -1,10 +1,9 @@ """An icon button component.""" -from typing import Optional +from reflex.components.component import Component +from reflex.vars.base import Var from reflex_chakra.components.typography.text import Text -from reflex.components.component import Component -from reflex.vars import Var class IconButton(Text): @@ -20,7 +19,7 @@ class IconButton(Text): aria_label: Var[str] # The icon to be used in the button. - icon: Optional[Component] + icon: Var[Component] # If true, the button will be styled in its active state. is_active: Var[bool] diff --git a/reflex_chakra/components/forms/iconbutton.pyi b/reflex_chakra/components/forms/iconbutton.pyi index 60329e7..7a0002f 100644 --- a/reflex_chakra/components/forms/iconbutton.pyi +++ b/reflex_chakra/components/forms/iconbutton.pyi @@ -1,76 +1,68 @@ -"""Stub file for reflex/components/chakra/forms/iconbutton.py""" +"""Stub file for reflex_chakra/components/forms/iconbutton.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) -from reflex_chakra.components.typography.text import Text from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var + +from reflex_chakra.components.typography.text import Text class IconButton(Text): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type: Optional[Union[Var[str], str]] = None, - aria_label: Optional[Union[Var[str], str]] = None, - icon: Optional[Component] = None, - is_active: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_loading: Optional[Union[Var[bool], bool]] = None, - is_round: Optional[Union[Var[bool], bool]] = None, - spinner: Optional[Union[Var[str], str]] = None, - as_: Optional[Union[Var[str], str]] = None, - no_of_lines: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type: Var[str] | str | None = None, + aria_label: Var[str] | str | None = None, + icon: Component | Var[Component] | None = None, + is_active: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_loading: Var[bool] | bool | None = None, + is_round: Var[bool] | bool | None = None, + spinner: Var[str] | str | None = None, + as_: Var[str] | str | None = None, + no_of_lines: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "IconButton": - """Create the component. + ) -> IconButton: + """Create a new Chakra component. Args: *children: The children of the component. @@ -87,12 +79,12 @@ class IconButton(Text): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/input.py b/reflex_chakra/components/forms/input.py index 4b9ae31..a0c3a5d 100644 --- a/reflex_chakra/components/forms/input.py +++ b/reflex_chakra/components/forms/input.py @@ -1,17 +1,18 @@ """An input component.""" -from reflex_chakra.components import ( - ChakraComponent, - LiteralButtonSize, - LiteralInputVariant, -) from reflex.components.component import Component from reflex.components.core.debounce import DebounceInput from reflex.components.literals import LiteralInputType from reflex.constants import MemoizationMode from reflex.event import EventHandler from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ( + ChakraComponent, + LiteralButtonSize, + LiteralInputVariant, +) class Input(ChakraComponent): diff --git a/reflex_chakra/components/forms/input.pyi b/reflex_chakra/components/forms/input.pyi index 4b86092..4735e09 100644 --- a/reflex_chakra/components/forms/input.pyi +++ b/reflex_chakra/components/forms/input.pyi @@ -1,146 +1,131 @@ -"""Stub file for reflex/components/chakra/forms/input.py""" +"""Stub file for reflex_chakra/components/forms/input.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.utils.imports import ImportDict +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.utils.imports import ImportDict -from reflex.vars import Var class Input(ChakraComponent): def add_imports(self) -> ImportDict: ... - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - type_: Optional[ - Union[ - Var[ - Literal[ - "button", - "checkbox", - "color", - "date", - "datetime-local", - "email", - "file", - "hidden", - "image", - "month", - "number", - "password", - "radio", - "range", - "reset", - "search", - "submit", - "tel", - "text", - "time", - "url", - "week", - ] - ], - Literal[ - "button", - "checkbox", - "color", - "date", - "datetime-local", - "email", - "file", - "hidden", - "image", - "month", - "number", - "password", - "radio", - "range", - "reset", - "search", - "submit", - "tel", - "text", - "time", - "url", - "week", - ], - ] - ] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + type_: Literal[ + "button", + "checkbox", + "color", + "date", + "datetime-local", + "email", + "file", + "hidden", + "image", + "month", + "number", + "password", + "radio", + "range", + "reset", + "search", + "submit", + "tel", + "text", + "time", + "url", + "week", + ] + | Var[ + Literal[ + "button", + "checkbox", + "color", + "date", + "datetime-local", + "email", + "file", + "hidden", + "image", + "month", + "number", + "password", + "radio", + "range", + "reset", + "search", + "submit", + "tel", + "text", + "time", + "url", + "week", ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[Any] | None = None, + on_key_down: EventType[Any] | None = None, + on_key_up: EventType[Any] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Input": + ) -> Input: """Create an Input component. Args: @@ -158,9 +143,15 @@ class Input(ChakraComponent): variant: "outline" | "filled" | "flushed" | "unstyled" size: "lg" | "md" | "sm" | "xs" name: The name of the form field + on_change: Fired when the input value changes. + on_focus: Fired when the input is focused. + on_blur: Fired when the input lose focus. + on_key_down: Fired when a key is pressed down. + on_key_up: Fired when a key is released. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -169,334 +160,258 @@ class Input(ChakraComponent): Returns: The component. """ - ... class InputGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "InputGroup": - """Create the component. + ) -> InputGroup: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class InputLeftAddon(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "InputLeftAddon": - """Create the component. + ) -> InputLeftAddon: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class InputRightAddon(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "InputRightAddon": - """Create the component. + ) -> InputRightAddon: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class InputLeftElement(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "InputLeftElement": - """Create the component. + ) -> InputLeftElement: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class InputRightElement(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "InputRightElement": - """Create the component. + ) -> InputRightElement: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/multiselect.py b/reflex_chakra/components/forms/multiselect.py deleted file mode 100644 index 08315fa..0000000 --- a/reflex_chakra/components/forms/multiselect.py +++ /dev/null @@ -1,353 +0,0 @@ -"""Provides a feature-rich Select and some (not all) related components.""" - -from __future__ import annotations - -from typing import Any, Dict, List, Optional, Set, Union - -from reflex.base import Base -from reflex.components.component import Component -from reflex.constants import EventTriggers -from reflex.vars import Var - - -class Option(Base): - """An option component for the chakra-react-select Select.""" - - # What is displayed to the user - label: str - - # The value of the option, must be serializable - value: Any - - # the variant of the option tag - variant: Optional[str] = None - - # [not working yet] - # Whether the option is disabled - # is_disabled: Optional[bool] = None - - # [not working yet] - # 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: Optional[str] = None - - # [not working yet] - # The icon of the option tag - # icon: Optional[str] = None - - -class Select(Component): - """The default chakra-react-select Select component. - Not every available prop is listed here, - for a complete overview check the react-select/chakra-react-select docs. - Props added by chakra-react-select are marked with "[chakra]". - """ - - library = "chakra-react-select@4.7.5" - tag = "Select" - alias = "MultiSelect" - - # Focus the control when it is mounted - auto_focus: Var[bool] - - # Remove the currently focused option when the user presses backspace - # when Select isClearable or isMulti - backspace_removes_value: Var[bool] - - # 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] - - # When the user reaches the top/bottom of the menu, - # prevent scroll on the scroll-parent - capture_menu_scroll: Var[bool] - - # [chakra] - # To use the chakraStyles prop, first, - # check the documentation for the original styles prop from the react-select docs. - # This package offers an identical API for the chakraStyles prop, however, - # the provided and output style objects use Chakra's sx prop - # instead of the default emotion styles the original package offers. - # This allows you to both use the shorthand styling props you'd normally use - # to style Chakra components, as well as tokens from your theme such as named colors. - # All of the style keys offered in the original package can be used in the chakraStyles prop - # except for menuPortal. Along with some other caveats, this is explained below. - # Most of the components rendered by this package use the basic Chakra component with a few exceptions. - # Here are the style keys offered and the corresponding Chakra component that is rendered: - # - clearIndicator - Box (uses theme styles for Chakra's CloseButton) - # - container - Box - # - control - Box (uses theme styles for Chakra's Input) - # - dropdownIndicator - Box (uses theme styles for Chrakra's InputRightAddon) - # - downChevron - Icon - # - crossIcon - Icon - # - group - Box - # - groupHeading - Box (uses theme styles for Chakra's Menu group title) - # - indicatorsContainer - Box - # - indicatorSeparator - Divider - # - input - chakra.input (wrapped in a Box) - # - inputContainer - Box - # - loadingIndicator - Spinner - # - loadingMessage - Box - # - menu - Box - # - menuList - Box (uses theme styles for Chakra's Menu) - # - multiValue - chakra.span (uses theme styles for Chakra's Tag) - # - multiValueLabel - chakra.span (uses theme styles for Chakra's TagLabel) - # - multiValueRemove - Box (uses theme styles for Chakra's TagCloseButton) - # - noOptionsMessage - Box - # - option - Box (uses theme styles for Chakra's MenuItem) - # - placeholder - Box - # - singleValue - Box - # - valueContainer - Box - chakra_styles: Var[str] - - # Close the select menu when the user selects an option - close_menu_on_select: Var[bool] - - # If true, close the select menu when the user scrolls the document/body. - close_menu_on_scroll: Var[bool] - - # [chakra] - # 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[str] - - # 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]] - - # Whether the value of the select, e.g. SingleValue, - # should be displayed in the control. - control_should_render_value: Var[bool] - - # Delimiter used to join multiple values into a single HTML Input value - delimiter: Var[str] - - # [chakra] - # Colors the component border with the given chakra color string on error state - # default: "red.500" - error_border_color: Var[str] - - # Clear all values when the user presses escape AND the menu is closed - escape_clears_value: Var[bool] - - # [chakra] - # Colors the component border with the given chakra color string on focus - # default: "blue.500" - focus_border_color: Var[str] - - # Sets the form attribute on the input - form: Var[str] - - # Hide the selected option from the menu - hide_selected_options: Var[bool] - - # The id to set on the SelectContainer component. - # id: Var[str] - - # The value of the search input - input_value: Var[str] - - # The id of the search input - input_id: Var[str] - - # Is the select value clearable - is_clearable: Var[bool] - - # Is the select disabled - is_disabled: Var[bool] - - # [chakra] - # Style component in the chakra invalid style - # default: False - is_invalid: Var[bool] - - # Support multiple selected options - is_multi: Var[bool] - - # [chakra] - # Style component as disabled (chakra style) - # default: False - is_read_only: Var[bool] - - # Is the select direction right-to-left - is_rtl: Var[bool] - - # Whether to enable search functionality - is_searchable: Var[bool] - - # Minimum height of the menu before flipping - min_menu_height: Var[int] - - # Maximum height of the menu before scrolling - max_menu_height: Var[int] - - # 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] - - # The CSS position value of the menu, - # when "fixed" extra layout management is required - # options: "absolute" | "fixed" - menu_position: Var[str] - - # Whether to block scroll events when the menu is open - menu_should_block_scroll: Var[bool] - - # Whether the menu should be scrolled into view when it opens - menu_should_scroll_into_view: Var[bool] - - # Name of the HTML Input (optional - without this, no input will be rendered) - name: Var[str] - - # Allows control of whether the menu is opened when the Select is focused - open_menu_on_focus: Var[bool] - - # Allows control of whether the menu is opened when the Select is clicked - open_menu_on_click: Var[bool] - - # Array of options that populate the select menu - options: Var[List[Dict]] - - # Number of options to jump in menu when page{up|down} keys are used - page_size: Var[int] - - # Placeholder for the select value - placeholder: Var[Optional[str]] - - # Marks the value-holding input as required for form validation - required: Var[bool] - - # [chakra] - # If you choose to stick with the default selectedOptionStyle="color", - # you have one additional styling option. - # If you do not like the default of blue for the highlight color, - # you can pass the selectedOptionColorScheme prop to change it. - # This prop will accept any named color from your theme's color palette, - # and it will use the 500 value in light mode or the 300 value in dark mode. - # This prop can only be used for named colors from your theme, not arbitrary hex/rgb colors. - # 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] - - # [chakra] - # The default option "color" will style a selected option - # similar to how react-select does it, - # by highlighting the selected option in the color blue. - # Alternatively, if you pass "check" for the value, - # the selected option will be styled like the Chakra UI Menu component - # and include a check icon next to the selected option(s). - # If is_multi and selected_option_style="check" are passed, - # space will only be added for the check marks - # if hide_selected_options=False is also passed. - # options: "color" | "check" - # default: "color" - selected_option_style: Var[str] - - # [chakra] - # The size of the component. - # options: "sm" | "md" | "lg" - # default: "md" - size: Var[str] - - # Sets the tabIndex attribute on the input - tab_index: Var[int] - - # Select the currently focused option when the user presses tab - tab_selects_value: Var[bool] - - # [chakra] - # Variant of multi-select tags - # options: "subtle" | "solid" | "outline" - # default: "subtle" - tag_variant: Var[str] - - # Remove all non-essential styles - unstyled: Var[bool] - - # [chakra] - # If this prop is passed, - # the dropdown indicator at the right of the component will be styled - # in the same way the original Chakra Select component is styled, - # instead of being styled as an InputRightAddon. - # The original purpose of styling it as an addon - # was to create a visual separation between the dropdown indicator - # and the button for clearing the selected options. - # 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] - - # [chakra] - # The variant of the Select. If no variant is passed, - # it will default to defaultProps.variant from the theme for Chakra's Input component. - # If your component theme for Input is not modified, it will be outline. - # options: "outline" | "filled" | "flushed" | "unstyled" - # default: "outline" - variant: Var[str] - - # How the options should be displayed in the menu. - menu_position: Var[str] = "fixed" # type: ignore - - def get_event_triggers(self) -> dict[str, Union[Var, Any]]: - """Get the event triggers that pass the component's value to the handler. - - Returns: - A dict mapping the event trigger to the var that is passed to the handler. - """ - return { - **super().get_event_triggers(), - EventTriggers.ON_CHANGE: ( - lambda e0: [Var.create(f"{e0}.map(e => e.value)", _var_is_string=False)] - if self.is_multi.equals(Var.create(True)) - else lambda e0: [e0] - ), - } - - @classmethod - def get_initial_props(cls) -> Set[str]: - """Get the initial props to set for the component. - - Returns: - The initial props to set. - """ - return super().get_initial_props() | {"is_multi"} - - @classmethod - def create( - cls, options: List[Union[Option, str, int, float, bool]], **props - ) -> Component: - """Takes a list of options and additional properties, checks if each option is an - instance of Option, and returns a Select component with the given options and - properties. No children allowed. - - Args: - options (List[Option | str | int | float | bool]): A list of values. - **props: Additional properties to be passed to the Select component. - - Returns: - The `create` method is returning an instance of the `Select` class. - """ - converted_options: List[Option] = [] - if not isinstance(options, Var): - for option in options: - if not isinstance(option, Option): - converted_options.append(Option(label=str(option), value=option)) - else: - converted_options.append(option) - props["options"] = [o.dict() for o in converted_options] - else: - props["options"] = options - return super().create(*[], **props) diff --git a/reflex_chakra/components/forms/multiselect.pyi b/reflex_chakra/components/forms/multiselect.pyi deleted file mode 100644 index a108865..0000000 --- a/reflex_chakra/components/forms/multiselect.pyi +++ /dev/null @@ -1,199 +0,0 @@ -"""Stub file for reflex/components/chakra/forms/multiselect.py""" -# ------------------- DO NOT EDIT ---------------------- -# This file was generated by `scripts/pyi_generator.py`! -# ------------------------------------------------------ - -from typing import Any, Dict, Literal, Optional, Union, overload -from reflex.vars import Var, BaseVar, ComputedVar -from reflex.event import EventChain, EventHandler, EventSpec -from reflex.style import Style -from typing import Any, Dict, List, Optional, Set, Union -from reflex.base import Base -from reflex.components.component import Component -from reflex.constants import EventTriggers -from reflex.vars import Var - -class Option(Base): - label: str - value: Any - variant: Optional[str] - -class Select(Component): - def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ... - @classmethod - def get_initial_props(cls) -> Set[str]: ... - @overload - @classmethod - def create( # type: ignore - cls, - *children, - auto_focus: Optional[Union[Var[bool], bool]] = None, - backspace_removes_value: Optional[Union[Var[bool], bool]] = None, - blur_input_on_select: Optional[Union[Var[bool], bool]] = None, - capture_menu_scroll: Optional[Union[Var[bool], bool]] = None, - chakra_styles: Optional[Union[Var[str], str]] = None, - close_menu_on_select: Optional[Union[Var[bool], bool]] = None, - close_menu_on_scroll: Optional[Union[Var[bool], bool]] = None, - color_scheme: Optional[Union[Var[str], str]] = None, - components: Optional[ - Union[Var[Dict[str, Component]], Dict[str, Component]] - ] = None, - control_should_render_value: Optional[Union[Var[bool], bool]] = None, - delimiter: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - escape_clears_value: Optional[Union[Var[bool], bool]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - form: Optional[Union[Var[str], str]] = None, - hide_selected_options: Optional[Union[Var[bool], bool]] = None, - input_value: Optional[Union[Var[str], str]] = None, - input_id: Optional[Union[Var[str], str]] = None, - is_clearable: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_multi: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_rtl: Optional[Union[Var[bool], bool]] = None, - is_searchable: Optional[Union[Var[bool], bool]] = None, - min_menu_height: Optional[Union[Var[int], int]] = None, - max_menu_height: Optional[Union[Var[int], int]] = None, - menu_placement: Optional[Union[Var[str], str]] = None, - menu_position: Optional[Union[Var[str], str]] = None, - menu_should_block_scroll: Optional[Union[Var[bool], bool]] = None, - menu_should_scroll_into_view: Optional[Union[Var[bool], bool]] = None, - name: Optional[Union[Var[str], str]] = None, - open_menu_on_focus: Optional[Union[Var[bool], bool]] = None, - open_menu_on_click: Optional[Union[Var[bool], bool]] = None, - options: Optional[Union[Var[List[Dict]], List[Dict]]] = None, - page_size: Optional[Union[Var[int], int]] = None, - placeholder: Optional[Union[Var[Optional[str]], Optional[str]]] = None, - required: Optional[Union[Var[bool], bool]] = None, - selected_option_color_scheme: Optional[Union[Var[str], str]] = None, - selected_option_style: Optional[Union[Var[str], str]] = None, - size: Optional[Union[Var[str], str]] = None, - tab_index: Optional[Union[Var[int], int]] = None, - tab_selects_value: Optional[Union[Var[bool], bool]] = None, - tag_variant: Optional[Union[Var[str], str]] = None, - unstyled: Optional[Union[Var[bool], bool]] = None, - use_basic_style: Optional[Union[Var[bool], bool]] = None, - variant: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_change: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_click: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_focus: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mount: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_scroll: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, function, BaseVar] - ] = None, - **props, - ) -> "Select": - """Takes a list of options and additional properties, checks if each option is an - instance of Option, and returns a Select component with the given options and - properties. No children allowed. - - Args: - options (List[Option | str | int | float | bool]): A list of values. - auto_focus: Focus the control when it is mounted - backspace_removes_value: Remove the currently focused option when the user presses backspace when Select isClearable or isMulti - blur_input_on_select: Remove focus from the input when the user selects an option (handy for dismissing the keyboard on touch devices) - capture_menu_scroll: When the user reaches the top/bottom of the menu, prevent scroll on the scroll-parent - chakra_styles: [chakra] To use the chakraStyles prop, first, check the documentation for the original styles prop from the react-select docs. This package offers an identical API for the chakraStyles prop, however, the provided and output style objects use Chakra's sx prop instead of the default emotion styles the original package offers. This allows you to both use the shorthand styling props you'd normally use to style Chakra components, as well as tokens from your theme such as named colors. All of the style keys offered in the original package can be used in the chakraStyles prop except for menuPortal. Along with some other caveats, this is explained below. Most of the components rendered by this package use the basic Chakra component with a few exceptions. Here are the style keys offered and the corresponding Chakra component that is rendered: - clearIndicator - Box (uses theme styles for Chakra's CloseButton) - container - Box - control - Box (uses theme styles for Chakra's Input) - dropdownIndicator - Box (uses theme styles for Chrakra's InputRightAddon) - downChevron - Icon - crossIcon - Icon - group - Box - groupHeading - Box (uses theme styles for Chakra's Menu group title) - indicatorsContainer - Box - indicatorSeparator - Divider - input - chakra.input (wrapped in a Box) - inputContainer - Box - loadingIndicator - Spinner - loadingMessage - Box - menu - Box - menuList - Box (uses theme styles for Chakra's Menu) - multiValue - chakra.span (uses theme styles for Chakra's Tag) - multiValueLabel - chakra.span (uses theme styles for Chakra's TagLabel) - multiValueRemove - Box (uses theme styles for Chakra's TagCloseButton) - noOptionsMessage - Box - option - Box (uses theme styles for Chakra's MenuItem) - placeholder - Box - singleValue - Box - valueContainer - Box - close_menu_on_select: Close the select menu when the user selects an option - close_menu_on_scroll: If true, close the select menu when the user scrolls the document/body. - color_scheme: [chakra] 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" - components: 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. - control_should_render_value: Whether the value of the select, e.g. SingleValue, should be displayed in the control. - delimiter: Delimiter used to join multiple values into a single HTML Input value - error_border_color: [chakra] Colors the component border with the given chakra color string on error state default: "red.500" - escape_clears_value: Clear all values when the user presses escape AND the menu is closed - focus_border_color: [chakra] Colors the component border with the given chakra color string on focus default: "blue.500" - form: Sets the form attribute on the input - hide_selected_options: Hide the selected option from the menu - input_value: The id to set on the SelectContainer component. id: Var[str] The value of the search input - input_id: The id of the search input - is_clearable: Is the select value clearable - is_disabled: Is the select disabled - is_invalid: [chakra] Style component in the chakra invalid style default: False - is_multi: Support multiple selected options - is_read_only: [chakra] Style component as disabled (chakra style) default: False - is_rtl: Is the select direction right-to-left - is_searchable: Whether to enable search functionality - min_menu_height: Minimum height of the menu before flipping - max_menu_height: Maximum height of the menu before scrolling - menu_placement: 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_position: How the options should be displayed in the menu. - menu_should_block_scroll: Whether to block scroll events when the menu is open - menu_should_scroll_into_view: Whether the menu should be scrolled into view when it opens - name: Name of the HTML Input (optional - without this, no input will be rendered) - open_menu_on_focus: Allows control of whether the menu is opened when the Select is focused - open_menu_on_click: Allows control of whether the menu is opened when the Select is clicked - options: Array of options that populate the select menu - page_size: Number of options to jump in menu when page{up|down} keys are used - placeholder: Placeholder for the select value - required: Marks the value-holding input as required for form validation - selected_option_color_scheme: [chakra] If you choose to stick with the default selectedOptionStyle="color", you have one additional styling option. If you do not like the default of blue for the highlight color, you can pass the selectedOptionColorScheme prop to change it. This prop will accept any named color from your theme's color palette, and it will use the 500 value in light mode or the 300 value in dark mode. This prop can only be used for named colors from your theme, not arbitrary hex/rgb colors. 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_style: [chakra] The default option "color" will style a selected option similar to how react-select does it, by highlighting the selected option in the color blue. Alternatively, if you pass "check" for the value, the selected option will be styled like the Chakra UI Menu component and include a check icon next to the selected option(s). If is_multi and selected_option_style="check" are passed, space will only be added for the check marks if hide_selected_options=False is also passed. options: "color" | "check" default: "color" - size: [chakra] The size of the component. options: "sm" | "md" | "lg" default: "md" - tab_index: Sets the tabIndex attribute on the input - tab_selects_value: Select the currently focused option when the user presses tab - tag_variant: [chakra] Variant of multi-select tags options: "subtle" | "solid" | "outline" default: "subtle" - unstyled: Remove all non-essential styles - use_basic_style: [chakra] If this prop is passed, the dropdown indicator at the right of the component will be styled in the same way the original Chakra Select component is styled, instead of being styled as an InputRightAddon. The original purpose of styling it as an addon was to create a visual separation between the dropdown indicator and the button for clearing the selected options. However, as this button only appears when isMulti is passed, using this style could make more sense for a single select. default: False - variant: [chakra] The variant of the Select. If no variant is passed, it will default to defaultProps.variant from the theme for Chakra's Input component. If your component theme for Input is not modified, it will be outline. options: "outline" | "filled" | "flushed" | "unstyled" default: "outline" - style: The style of the component. - key: A unique key for the component. - id: The id for the component. - class_name: The class name for the component. - autofocus: Whether the component should take the focus once the page is loaded - custom_attrs: custom attribute - **props: Additional properties to be passed to the Select component. - - Returns: - The `create` method is returning an instance of the `Select` class. - """ - ... diff --git a/reflex_chakra/components/forms/numberinput.py b/reflex_chakra/components/forms/numberinput.py index b29d967..621cb6c 100644 --- a/reflex_chakra/components/forms/numberinput.py +++ b/reflex_chakra/components/forms/numberinput.py @@ -2,14 +2,15 @@ from numbers import Number +from reflex.components.component import Component +from reflex.event import EventHandler +from reflex.vars.base import Var + from reflex_chakra.components import ( ChakraComponent, LiteralButtonSize, LiteralInputVariant, ) -from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.vars import Var class NumberInput(ChakraComponent): diff --git a/reflex_chakra/components/forms/numberinput.pyi b/reflex_chakra/components/forms/numberinput.pyi index 2456851..9df6fff 100644 --- a/reflex_chakra/components/forms/numberinput.pyi +++ b/reflex_chakra/components/forms/numberinput.pyi @@ -1,93 +1,83 @@ -"""Stub file for reflex/components/chakra/forms/numberinput.py""" +"""Stub file for reflex_chakra/components/forms/numberinput.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ +from collections.abc import Mapping, Sequence from numbers import Number -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class NumberInput(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[Number], Number]] = None, - allow_mouse_wheel: Optional[Union[Var[bool], bool]] = None, - clamped_value_on_blur: Optional[Union[Var[bool], bool]] = None, - default_value: Optional[Union[Var[Number], Number]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - focus_input_on_change: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - is_valid_character: Optional[Union[Var[str], str]] = None, - keep_within_range: Optional[Union[Var[bool], bool]] = None, - max_: Optional[Union[Var[Number], Number]] = None, - min_: Optional[Union[Var[Number], Number]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Number | Var[Number] | None = None, + allow_mouse_wheel: Var[bool] | bool | None = None, + clamped_value_on_blur: Var[bool] | bool | None = None, + default_value: Number | Var[Number] | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + focus_input_on_change: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + is_valid_character: Var[str] | str | None = None, + keep_within_range: Var[bool] | bool | None = None, + max_: Number | Var[Number] | None = None, + min_: Number | Var[Number] | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "NumberInput": + ) -> NumberInput: """Create a number input component. If no children are provided, a default stepper will be used. @@ -101,7 +91,7 @@ class NumberInput(ChakraComponent): error_border_color: The border color when the input is invalid. focus_border_color: The border color when the input is focused. focus_input_on_change: If true, the input will be focused as you increment or decrement the value with the stepper - is_disabled: 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] Whether the input should be disabled. + is_disabled: Whether the input should be disabled. is_invalid: If true, the input will have `aria-invalid` set to true is_read_only: If true, the input will be in readonly mode is_required: Whether the input is required @@ -112,9 +102,11 @@ class NumberInput(ChakraComponent): variant: "outline" | "filled" | "flushed" | "unstyled" size: "lg" | "md" | "sm" | "xs" name: The name of the form field + on_change: Fired when the input value changes. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -123,268 +115,207 @@ class NumberInput(ChakraComponent): Returns: The component. """ - ... class NumberInputField(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "NumberInputField": - """Create the component. + ) -> NumberInputField: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class NumberInputStepper(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "NumberInputStepper": - """Create the component. + ) -> NumberInputStepper: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class NumberIncrementStepper(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "NumberIncrementStepper": - """Create the component. + ) -> NumberIncrementStepper: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class NumberDecrementStepper(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "NumberDecrementStepper": - """Create the component. + ) -> NumberDecrementStepper: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/password.py b/reflex_chakra/components/forms/password.py index 5ddbc52..7e81332 100644 --- a/reflex_chakra/components/forms/password.py +++ b/reflex_chakra/components/forms/password.py @@ -1,11 +1,12 @@ """A password input component.""" +from reflex.vars.base import Var + from reflex_chakra.components.forms.input import Input -from reflex.vars import Var class Password(Input): """A password input component.""" # The type of input. - type_: Var[str] = "password" # type: ignore + type_: Var[str] = Var.create("password") diff --git a/reflex_chakra/components/forms/password.pyi b/reflex_chakra/components/forms/password.pyi index cfe48ce..604678e 100644 --- a/reflex_chakra/components/forms/password.pyi +++ b/reflex_chakra/components/forms/password.pyi @@ -1,89 +1,77 @@ -"""Stub file for reflex/components/chakra/forms/password.py""" +"""Stub file for reflex_chakra/components/forms/password.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components.forms.input import Input -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Password(Input): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type_: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type_: Var[str] | str | None = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[Any] | None = None, + on_key_down: EventType[Any] | None = None, + on_key_up: EventType[Any] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Password": + ) -> Password: """Create an Input component. Args: @@ -101,9 +89,15 @@ class Password(Input): variant: "outline" | "filled" | "flushed" | "unstyled" size: "lg" | "md" | "sm" | "xs" name: The name of the form field + on_change: Fired when the input value changes. + on_focus: Fired when the input is focused. + on_blur: Fired when the input lose focus. + on_key_down: Fired when a key is pressed down. + on_key_up: Fired when a key is released. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -112,4 +106,3 @@ class Password(Input): Returns: The component. """ - ... diff --git a/reflex_chakra/components/forms/pininput.py b/reflex_chakra/components/forms/pininput.py index fcf95d4..8d9621c 100644 --- a/reflex_chakra/components/forms/pininput.py +++ b/reflex_chakra/components/forms/pininput.py @@ -2,16 +2,15 @@ from __future__ import annotations -from typing import Optional - import reflex as rx -from reflex_chakra.components import ChakraComponent, LiteralInputVariant from reflex.components.component import Component from reflex.components.tags.tag import Tag from reflex.event import EventHandler from reflex.utils import format -from reflex.utils.imports import ImportDict, merge_imports -from reflex.vars import Var +from reflex.utils.imports import ParsedImportDict, merge_imports +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent, LiteralInputVariant class PinInput(ChakraComponent): @@ -70,7 +69,7 @@ class PinInput(ChakraComponent): # Fired when the pin input is completed. on_complete: EventHandler[lambda e0: [e0]] - def _get_imports(self) -> ImportDict: + def _get_imports(self) -> ParsedImportDict: """Include PinInputField explicitly because it may not be a child component at compile time. Returns: @@ -79,7 +78,7 @@ def _get_imports(self) -> ImportDict: range_var = Var.range(0) return merge_imports( super()._get_imports(), - PinInputField._unsafe_create(children=[])._get_all_imports(), # type: ignore + PinInputField._unsafe_create(children=[])._get_all_imports(), range_var._var_data.imports if range_var._var_data is not None else {}, ) @@ -102,7 +101,7 @@ def get_ref(self) -> str | None: return format.format_array_ref(self.id, idx=self.length) return super().get_ref() - def _get_ref_hook(self) -> Optional[str]: + def _get_ref_hook(self): """Override the base _get_ref_hook to handle array refs. Returns: @@ -110,16 +109,16 @@ def _get_ref_hook(self) -> Optional[str]: """ if self.id: ref = format.format_array_ref(self.id, None) - refs_declaration = Var.create( - f"{str(Var.range(self.length))}.map(() => useRef(null))", - _var_is_string=False, + refs_declaration = Var.range(self.length.to(int)).foreach( + lambda _: Var("useRef(null)") ) if ref: - return ( - f"const {ref} = {str(refs_declaration)}; " - f"{str(Var.create(ref, _var_is_string=False).as_ref())} = {ref}" + return Var( + f"const {ref} = {refs_declaration!s}; " + f"{Var(ref)._as_ref()!s} = {ref}" ) return super()._get_ref_hook() + return None def _render(self) -> Tag: """Override the base _render to remove the fake get_ref. @@ -170,7 +169,7 @@ class PinInputField(ChakraComponent): name: Var[str] @classmethod - def for_length(cls, length: Var | int, **props) -> Var: + def for_length(cls, length: Var[int] | int, **props): """Create a PinInputField for a PinInput with a given length. Args: @@ -187,12 +186,12 @@ def _create(i): props["name"] = f"{name}-{i}" return PinInputField.create(**props, index=i, key=i) - return rx.foreach( # type: ignore - Var.range(length), # type: ignore + return rx.foreach( + Var.range(Var.create(length).to(int)), _create, ) - def _get_ref_hook(self) -> Optional[str]: + def _get_ref_hook(self) -> None: return None def get_ref(self): @@ -203,3 +202,4 @@ def get_ref(self): """ if self.id: return format.format_array_ref(self.id, self.index) + return None diff --git a/reflex_chakra/components/forms/pininput.pyi b/reflex_chakra/components/forms/pininput.pyi index 99f0e85..3f58251 100644 --- a/reflex_chakra/components/forms/pininput.pyi +++ b/reflex_chakra/components/forms/pininput.pyi @@ -1,89 +1,77 @@ -"""Stub file for reflex/components/chakra/forms/pininput.py""" +"""Stub file for reflex_chakra/components/forms/pininput.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class PinInput(ChakraComponent): def get_ref(self) -> str | None: ... - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[str], str]] = None, - auto_focus: Optional[Union[Var[bool], bool]] = None, - default_value: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - id_: Optional[Union[Var[str], str]] = None, - length: Optional[Union[Var[int], int]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - manage_focus: Optional[Union[Var[bool], bool]] = None, - mask: Optional[Union[Var[bool], bool]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - type_: Optional[Union[Var[str], str]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_complete: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Var[str] | str | None = None, + auto_focus: Var[bool] | bool | None = None, + default_value: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + id_: Var[str] | str | None = None, + length: Var[int] | int | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + manage_focus: Var[bool] | bool | None = None, + mask: Var[bool] | bool | None = None, + placeholder: Var[str] | str | None = None, + type_: Var[str] | str | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_complete: EventType[Any] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PinInput": + ) -> PinInput: """Create a pin input component. If no children are passed in, the component will create a default pin input @@ -106,9 +94,12 @@ class PinInput(ChakraComponent): type_: The type of values the pin-input should allow ("number" | "alphanumeric"). variant: "outline" | "flushed" | "filled" | "unstyled" name: The name of the form field + on_change: Fired when the pin input is changed. + on_complete: Fired when the pin input is completed. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -117,63 +108,47 @@ class PinInput(ChakraComponent): Returns: The pin input component. """ - ... class PinInputField(ChakraComponent): @classmethod - def for_length(cls, length: Var | int, **props) -> Var: ... + def for_length(cls, length: Var[int] | int, **props): ... def get_ref(self): ... - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - index: Optional[Union[Var[int], int]] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + index: Var[int | None] | int | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PinInputField": - """Create the component. + ) -> PinInputField: + """Create a new Chakra component. Args: *children: The children of the component. @@ -182,12 +157,12 @@ class PinInputField(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/radio.py b/reflex_chakra/components/forms/radio.py index f5ec24b..e29241d 100644 --- a/reflex_chakra/components/forms/radio.py +++ b/reflex_chakra/components/forms/radio.py @@ -1,14 +1,15 @@ """A radio component.""" -from typing import Any, List +from typing import Any -from reflex_chakra.components import ChakraComponent -from reflex_chakra.components.typography.text import Text from reflex.components.component import Component from reflex.components.core.foreach import Foreach from reflex.event import EventHandler from reflex.utils.types import _issubclass -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent +from reflex_chakra.components.typography.text import Text class RadioGroup(ChakraComponent): @@ -44,7 +45,7 @@ def create(cls, *children, **props) -> Component: if ( len(children) == 1 and isinstance(children[0], Var) - and _issubclass(children[0]._var_type, List) + and _issubclass(children[0]._var_type, list) ): children = [Foreach.create(children[0], lambda item: Radio.create(item))] return super().create(*children, **props) @@ -96,6 +97,8 @@ def create(cls, *children, **props) -> Component: The radio component. """ if "value" not in props: - assert len(children) == 1 + if len(children) != 1: + msg = "Radio must have exactly one child or a value prop." + raise ValueError(msg) props["value"] = children[0] return super().create(*children, **props) diff --git a/reflex_chakra/components/forms/radio.pyi b/reflex_chakra/components/forms/radio.pyi index 6e07a97..a2d6832 100644 --- a/reflex_chakra/components/forms/radio.pyi +++ b/reflex_chakra/components/forms/radio.pyi @@ -1,69 +1,61 @@ -"""Stub file for reflex/components/chakra/forms/radio.py""" +"""Stub file for reflex_chakra/components/forms/radio.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent from reflex_chakra.components.typography.text import Text -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class RadioGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[Any], Any]] = None, - default_value: Optional[Union[Var[Any], Any]] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Any | Var[Any] | None = None, + default_value: Any | Var[Any] | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "RadioGroup": + ) -> RadioGroup: """Create a radio group component. Args: @@ -71,9 +63,11 @@ class RadioGroup(ChakraComponent): value: State var to bind the input. default_value: The default value. name: The name of the form field + on_change: Fired when the radio group value changes. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -82,68 +76,52 @@ class RadioGroup(ChakraComponent): Returns: The component. """ - ... class Radio(Text): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[Any], Any]] = None, - default_value: Optional[Union[Var[Any], Any]] = None, - color_scheme: Optional[Union[Var[str], str]] = None, - default_checked: Optional[Union[Var[bool], bool]] = None, - is_checked: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - as_: Optional[Union[Var[str], str]] = None, - no_of_lines: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Any | Var[Any] | None = None, + default_value: Any | Var[Any] | None = None, + color_scheme: Var[str] | str | None = None, + default_checked: Var[bool] | bool | None = None, + is_checked: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + as_: Var[str] | str | None = None, + no_of_lines: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Radio": + ) -> Radio: """Create a radio component. By default, the value is bound to the first child. @@ -164,6 +142,7 @@ class Radio(Text): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -172,4 +151,3 @@ class Radio(Text): Returns: The radio component. """ - ... diff --git a/reflex_chakra/components/forms/rangeslider.py b/reflex_chakra/components/forms/rangeslider.py index 7144fe6..3edb728 100644 --- a/reflex_chakra/components/forms/rangeslider.py +++ b/reflex_chakra/components/forms/rangeslider.py @@ -2,13 +2,12 @@ from __future__ import annotations -from typing import List, Optional - -from reflex_chakra.components import ChakraComponent, LiteralChakraDirection from reflex.components.component import Component from reflex.event import EventHandler from reflex.utils import format -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent, LiteralChakraDirection class RangeSlider(ChakraComponent): @@ -17,10 +16,10 @@ class RangeSlider(ChakraComponent): tag = "RangeSlider" # State var to bind the input. - value: Var[List[int]] + value: Var[list[int]] # The default values. - default_value: Var[List[int]] + default_value: Var[list[int]] # The writing mode ("ltr" | "rtl") direction: Var[LiteralChakraDirection] @@ -64,9 +63,9 @@ def get_ref(self): Returns: The ref of the component. """ - return None + return - def _get_ref_hook(self) -> Optional[str]: + def _get_ref_hook(self): """Override the base _get_ref_hook to handle array refs. Returns: @@ -75,11 +74,12 @@ def _get_ref_hook(self) -> Optional[str]: if self.id: ref = format.format_array_ref(self.id, None) if ref: - return ( + return Var( f"const {ref} = Array.from({{length:2}}, () => useRef(null)); " - f"{str(Var.create(ref, _var_is_string=False).as_ref())} = {ref}" + f"{Var(_js_expr=ref)._as_ref()!s} = {ref}", ) return super()._get_ref_hook() + return None @classmethod def create(cls, *children, **props) -> Component: @@ -95,7 +95,7 @@ def create(cls, *children, **props) -> Component: The RangeSlider component. """ if len(children) == 0: - _id = props.get("id", None) + _id = props.get("id") if _id: children = [ RangeSliderTrack.create( @@ -135,7 +135,7 @@ class RangeSliderThumb(ChakraComponent): # The position of the thumb. index: Var[int] - def _get_ref_hook(self) -> Optional[str]: + def _get_ref_hook(self) -> None: # hook is None because RangeSlider is handling it. return None @@ -147,3 +147,4 @@ def get_ref(self): """ if self.id: return format.format_array_ref(self.id, self.index) + return None diff --git a/reflex_chakra/components/forms/rangeslider.pyi b/reflex_chakra/components/forms/rangeslider.pyi index d451d1e..93cfd61 100644 --- a/reflex_chakra/components/forms/rangeslider.pyi +++ b/reflex_chakra/components/forms/rangeslider.pyi @@ -1,85 +1,72 @@ -"""Stub file for reflex/components/chakra/forms/rangeslider.py""" +"""Stub file for reflex_chakra/components/forms/rangeslider.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class RangeSlider(ChakraComponent): def get_ref(self): ... - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[List[int]], List[int]]] = None, - default_value: Optional[Union[Var[List[int]], List[int]]] = None, - direction: Optional[ - Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]] - ] = None, - focus_thumb_on_change: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_reversed: Optional[Union[Var[bool], bool]] = None, - min_: Optional[Union[Var[int], int]] = None, - max_: Optional[Union[Var[int], int]] = None, - min_steps_between_thumbs: Optional[Union[Var[int], int]] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_change_start: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Var[list[int]] | list[int] | None = None, + default_value: Var[list[int]] | list[int] | None = None, + direction: Literal["ltr", "rtl"] | Var[Literal["ltr", "rtl"]] | None = None, + focus_thumb_on_change: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_reversed: Var[bool] | bool | None = None, + min_: Var[int] | int | None = None, + max_: Var[int] | int | None = None, + min_steps_between_thumbs: Var[int] | int | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_change_end: EventType[Any] | None = None, + on_change_start: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "RangeSlider": + ) -> RangeSlider: """Create a RangeSlider component. If no children are provided, a default RangeSlider will be created. @@ -97,9 +84,13 @@ class RangeSlider(ChakraComponent): max_: The maximum value of the slider. min_steps_between_thumbs: The minimum distance between slider thumbs. Useful for preventing the thumbs from being too close together. name: The name of the form field + on_change: Fired when the value changes. + on_change_start: Fired when the value starts changing. + on_change_end: Fired when the value stops changing. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -108,192 +99,146 @@ class RangeSlider(ChakraComponent): Returns: The RangeSlider component. """ - ... class RangeSliderTrack(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "RangeSliderTrack": - """Create the component. + ) -> RangeSliderTrack: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class RangeSliderFilledTrack(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "RangeSliderFilledTrack": - """Create the component. + ) -> RangeSliderFilledTrack: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class RangeSliderThumb(ChakraComponent): def get_ref(self): ... - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - index: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + index: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "RangeSliderThumb": - """Create the component. + ) -> RangeSliderThumb: + """Create a new Chakra component. Args: *children: The children of the component. @@ -301,12 +246,12 @@ class RangeSliderThumb(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/select.py b/reflex_chakra/components/forms/select.py index 623e162..2c85378 100644 --- a/reflex_chakra/components/forms/select.py +++ b/reflex_chakra/components/forms/select.py @@ -1,12 +1,13 @@ """A select component.""" -from reflex_chakra.components import ChakraComponent, LiteralInputVariant from reflex.components.component import Component from reflex.components.core.foreach import Foreach +from reflex.components.el import Option from reflex.event import EventHandler from reflex.utils.types import _issubclass -from reflex.vars import Var -from reflex.components.el import Option as Option +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent, LiteralInputVariant class Select(ChakraComponent): diff --git a/reflex_chakra/components/forms/select.pyi b/reflex_chakra/components/forms/select.pyi index 9ecd6f7..081db33 100644 --- a/reflex_chakra/components/forms/select.pyi +++ b/reflex_chakra/components/forms/select.pyi @@ -1,82 +1,71 @@ -"""Stub file for reflex/components/chakra/forms/select.py""" +"""Stub file for reflex_chakra/components/forms/select.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex_chakra.components.typography.text import Text -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Select(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - size: Optional[Union[Var[str], str]] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Var[str] | str | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Select": + ) -> Select: """Create a select component. If a list is provided as the first children, a default component @@ -95,9 +84,11 @@ class Select(ChakraComponent): variant: "outline" | "filled" | "flushed" | "unstyled" size: The size of the select. name: The name of the form field + on_change: Fired when the value changes. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -106,77 +97,3 @@ class Select(ChakraComponent): Returns: The component. """ - ... - -class Option(Text): - @overload - @classmethod - def create( # type: ignore - cls, - *children, - value: Optional[Union[Var[Any], Any]] = None, - as_: Optional[Union[Var[str], str]] = None, - no_of_lines: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - **props, - ) -> "Option": - """Create a select option component. - - By default, the value of the option is the text of the option. - - Args: - *children: The children of the component. - as_: Override the tag. The default tag is `

`. - no_of_lines: 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. - style: The style of the component. - key: A unique key for the component. - id: The id for the component. - class_name: The class name for the component. - autofocus: Whether the component should take the focus once the page is loaded - custom_attrs: custom attribute - **props: The props of the component. - - Returns: - The component. - """ - ... diff --git a/reflex_chakra/components/forms/slider.py b/reflex_chakra/components/forms/slider.py index ac010e3..387b233 100644 --- a/reflex_chakra/components/forms/slider.py +++ b/reflex_chakra/components/forms/slider.py @@ -4,10 +4,11 @@ from typing import Literal -from reflex_chakra.components import ChakraComponent, LiteralChakraDirection from reflex.components.component import Component from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent, LiteralChakraDirection LiteralLayout = Literal["horizontal", "vertical"] diff --git a/reflex_chakra/components/forms/slider.pyi b/reflex_chakra/components/forms/slider.pyi index 3ec03e0..13200b8 100644 --- a/reflex_chakra/components/forms/slider.pyi +++ b/reflex_chakra/components/forms/slider.pyi @@ -1,98 +1,83 @@ -"""Stub file for reflex/components/chakra/forms/slider.py""" +"""Stub file for reflex_chakra/components/forms/slider.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, + TypeAlias, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var -LiteralLayout = Literal["horizontal", "vertical"] +LiteralLayout: TypeAlias = Literal["horizontal", "vertical"] class Slider(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[int], int]] = None, - color_scheme: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[int], int]] = None, - direction: Optional[ - Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]] - ] = None, - focus_thumb_on_change: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_reversed: Optional[Union[Var[bool], bool]] = None, - min_: Optional[Union[Var[int], int]] = None, - max_: Optional[Union[Var[int], int]] = None, - step: Optional[Union[Var[int], int]] = None, - min_steps_between_thumbs: Optional[Union[Var[int], int]] = None, - orientation: Optional[ - Union[ - Var[Literal["horizontal", "vertical"]], - Literal["horizontal", "vertical"], - ] - ] = None, - min_h: Optional[Union[Var[str], str]] = None, - min_w: Optional[Union[Var[str], str]] = None, - max_h: Optional[Union[Var[str], str]] = None, - max_w: Optional[Union[Var[str], str]] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change_end: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_change_start: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Var[int] | int | None = None, + color_scheme: Var[str] | str | None = None, + default_value: Var[int] | int | None = None, + direction: Literal["ltr", "rtl"] | Var[Literal["ltr", "rtl"]] | None = None, + focus_thumb_on_change: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_reversed: Var[bool] | bool | None = None, + min_: Var[int] | int | None = None, + max_: Var[int] | int | None = None, + step: Var[int] | int | None = None, + min_steps_between_thumbs: Var[int] | int | None = None, + orientation: Literal["horizontal", "vertical"] + | Var[Literal["horizontal", "vertical"]] + | None = None, + min_h: Var[str] | str | None = None, + min_w: Var[str] | str | None = None, + max_h: Var[str] | str | None = None, + max_w: Var[str] | str | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_change_end: EventType[Any] | None = None, + on_change_start: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Slider": + ) -> Slider: """Create a slider component. If no children are provided, a default slider will be created. @@ -117,9 +102,13 @@ class Slider(ChakraComponent): max_h: Maximum height of the slider. max_w: Maximum width of the slider. name: The name of the form field + on_change: Fired when the value changes. + on_change_start: Fired when the value starts changing. + on_change_end: Fired when the value stops changing. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -128,191 +117,145 @@ class Slider(ChakraComponent): Returns: The slider component. """ - ... class SliderTrack(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "SliderTrack": - """Create the component. + ) -> SliderTrack: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class SliderFilledTrack(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "SliderFilledTrack": - """Create the component. + ) -> SliderFilledTrack: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class SliderThumb(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - box_size: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + box_size: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "SliderThumb": - """Create the component. + ) -> SliderThumb: + """Create a new Chakra component. Args: *children: The children of the component. @@ -320,78 +263,63 @@ class SliderThumb(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class SliderMark(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "SliderMark": - """Create the component. + ) -> SliderMark: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/switch.py b/reflex_chakra/components/forms/switch.py index a4e333f..ce5fdea 100644 --- a/reflex_chakra/components/forms/switch.py +++ b/reflex_chakra/components/forms/switch.py @@ -2,9 +2,10 @@ from __future__ import annotations -from reflex_chakra.components import ChakraComponent, LiteralColorScheme from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent, LiteralColorScheme class Switch(ChakraComponent): diff --git a/reflex_chakra/components/forms/switch.pyi b/reflex_chakra/components/forms/switch.pyi index 21cf08b..6a95004 100644 --- a/reflex_chakra/components/forms/switch.pyi +++ b/reflex_chakra/components/forms/switch.pyi @@ -1,124 +1,114 @@ -"""Stub file for reflex/components/chakra/forms/switch.py""" +"""Stub file for reflex_chakra/components/forms/switch.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Switch(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_checked: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_focusable: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - name: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - spacing: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], + is_checked: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_focusable: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + name: Var[str] | str | None = None, + value: Var[str] | str | None = None, + spacing: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Switch": - """Create the component. + ) -> Switch: + """Create a new Chakra component. Args: *children: The children of the component. @@ -133,15 +123,16 @@ class Switch(ChakraComponent): spacing: The spacing between the switch and its label text (0.5rem) placeholder: The placeholder text. color_scheme: The color scheme of the switch (e.g. "blue", "green", "red", etc.) + on_change: Fired when the switch value changes style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/forms/textarea.py b/reflex_chakra/components/forms/textarea.py index 421c1b6..b453edc 100644 --- a/reflex_chakra/components/forms/textarea.py +++ b/reflex_chakra/components/forms/textarea.py @@ -2,11 +2,12 @@ from __future__ import annotations -from reflex_chakra.components import ChakraComponent, LiteralInputVariant from reflex.components.component import Component from reflex.components.core.debounce import DebounceInput from reflex.event import EventHandler -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent, LiteralInputVariant class TextArea(ChakraComponent): diff --git a/reflex_chakra/components/forms/textarea.pyi b/reflex_chakra/components/forms/textarea.pyi index 3b5fab0..7d09fb2 100644 --- a/reflex_chakra/components/forms/textarea.pyi +++ b/reflex_chakra/components/forms/textarea.pyi @@ -1,85 +1,73 @@ -"""Stub file for reflex/components/chakra/forms/textarea.py""" +"""Stub file for reflex_chakra/components/forms/textarea.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class TextArea(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[Any] | None = None, + on_key_down: EventType[Any] | None = None, + on_key_up: EventType[Any] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TextArea": + ) -> TextArea: """Create an Input component. Args: @@ -95,9 +83,15 @@ class TextArea(ChakraComponent): is_required: If true, the form control will be required. variant: "outline" | "filled" | "flushed" | "unstyled" name: The name of the form field + on_change: Fired when the value changes. + on_focus: Fired when the textarea gets focus. + on_blur: Fired when the textarea loses focus. + on_key_down: Fired when a key is pressed down. + on_key_up: Fired when a key is released. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -106,4 +100,3 @@ class TextArea(ChakraComponent): Returns: The component. """ - ... diff --git a/reflex_chakra/components/forms/time_picker.py b/reflex_chakra/components/forms/time_picker.py index 3028b12..f5fda2e 100644 --- a/reflex_chakra/components/forms/time_picker.py +++ b/reflex_chakra/components/forms/time_picker.py @@ -1,11 +1,12 @@ """A time input component.""" +from reflex.vars.base import Var + from reflex_chakra.components.forms.input import Input -from reflex.vars import Var class TimePicker(Input): """A time input component.""" # The type of input. - type_: Var[str] = "time" # type: ignore + type_: Var[str] = Var.create("time") diff --git a/reflex_chakra/components/forms/time_picker.pyi b/reflex_chakra/components/forms/time_picker.pyi index 7278eb9..1da9ebd 100644 --- a/reflex_chakra/components/forms/time_picker.pyi +++ b/reflex_chakra/components/forms/time_picker.pyi @@ -1,89 +1,77 @@ -"""Stub file for reflex/components/chakra/forms/time_picker.py""" +"""Stub file for reflex_chakra/components/forms/time_picker.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components.forms.input import Input -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class TimePicker(Input): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type_: Optional[Union[Var[str], str]] = None, - value: Optional[Union[Var[str], str]] = None, - default_value: Optional[Union[Var[str], str]] = None, - placeholder: Optional[Union[Var[str], str]] = None, - error_border_color: Optional[Union[Var[str], str]] = None, - focus_border_color: Optional[Union[Var[str], str]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_invalid: Optional[Union[Var[bool], bool]] = None, - is_read_only: Optional[Union[Var[bool], bool]] = None, - is_required: Optional[Union[Var[bool], bool]] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "flushed", "unstyled"]], - Literal["outline", "filled", "flushed", "unstyled"], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg", "xs"]], Literal["sm", "md", "lg", "xs"]] - ] = None, - name: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_key_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_key_up: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type_: Var[str] | str | None = None, + value: Var[str] | str | None = None, + default_value: Var[str] | str | None = None, + placeholder: Var[str] | str | None = None, + error_border_color: Var[str] | str | None = None, + focus_border_color: Var[str] | str | None = None, + is_disabled: Var[bool] | bool | None = None, + is_invalid: Var[bool] | bool | None = None, + is_read_only: Var[bool] | bool | None = None, + is_required: Var[bool] | bool | None = None, + variant: Literal["filled", "flushed", "outline", "unstyled"] + | Var[Literal["filled", "flushed", "outline", "unstyled"]] + | None = None, + size: Literal["lg", "md", "sm", "xs"] + | Var[Literal["lg", "md", "sm", "xs"]] + | None = None, + name: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[Any] | None = None, + on_change: EventType[Any] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[Any] | None = None, + on_key_down: EventType[Any] | None = None, + on_key_up: EventType[Any] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "TimePicker": + ) -> TimePicker: """Create an Input component. Args: @@ -101,9 +89,15 @@ class TimePicker(Input): variant: "outline" | "filled" | "flushed" | "unstyled" size: "lg" | "md" | "sm" | "xs" name: The name of the form field + on_change: Fired when the input value changes. + on_focus: Fired when the input is focused. + on_blur: Fired when the input lose focus. + on_key_down: Fired when a key is pressed down. + on_key_up: Fired when a key is released. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -112,4 +106,3 @@ class TimePicker(Input): Returns: The component. """ - ... diff --git a/reflex_chakra/components/layout/__init__.py b/reflex_chakra/components/layout/__init__.py index 13c28fd..409e71b 100644 --- a/reflex_chakra/components/layout/__init__.py +++ b/reflex_chakra/components/layout/__init__.py @@ -11,4 +11,25 @@ from .stack import Hstack, Stack, Vstack from .wrap import Wrap, WrapItem -__all__ = [f for f in dir() if f[0].isupper()] # type: ignore +__all__ = [ + "AspectRatio", + "Box", + "Card", + "CardBody", + "CardFooter", + "CardHeader", + "Center", + "Circle", + "Container", + "Flex", + "Grid", + "GridItem", + "Hstack", + "ResponsiveGrid", + "Spacer", + "Square", + "Stack", + "Vstack", + "Wrap", + "WrapItem", +] diff --git a/reflex_chakra/components/layout/aspect_ratio.py b/reflex_chakra/components/layout/aspect_ratio.py index 4dc0422..c694404 100644 --- a/reflex_chakra/components/layout/aspect_ratio.py +++ b/reflex_chakra/components/layout/aspect_ratio.py @@ -1,7 +1,8 @@ """A AspectRatio component.""" +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class AspectRatio(ChakraComponent): diff --git a/reflex_chakra/components/layout/aspect_ratio.pyi b/reflex_chakra/components/layout/aspect_ratio.pyi index 8b72701..9a7167a 100644 --- a/reflex_chakra/components/layout/aspect_ratio.pyi +++ b/reflex_chakra/components/layout/aspect_ratio.pyi @@ -1,66 +1,58 @@ -"""Stub file for reflex/components/chakra/layout/aspect_ratio.py""" +"""Stub file for reflex_chakra/components/layout/aspect_ratio.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class AspectRatio(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - ratio: Optional[Union[Var[float], float]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ratio: Var[float] | float | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AspectRatio": - """Create the component. + ) -> AspectRatio: + """Create a new Chakra component. Args: *children: The children of the component. @@ -68,12 +60,12 @@ class AspectRatio(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/box.py b/reflex_chakra/components/layout/box.py index ab9860e..178c611 100644 --- a/reflex_chakra/components/layout/box.py +++ b/reflex_chakra/components/layout/box.py @@ -1,8 +1,9 @@ """A box component that can contain other components.""" +from reflex.components.tags.tag import Tag +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent -from reflex.components.tags import Tag -from reflex.vars import Var class Box(ChakraComponent): diff --git a/reflex_chakra/components/layout/box.pyi b/reflex_chakra/components/layout/box.pyi index b401e48..a7e520e 100644 --- a/reflex_chakra/components/layout/box.pyi +++ b/reflex_chakra/components/layout/box.pyi @@ -1,68 +1,60 @@ -"""Stub file for reflex/components/chakra/layout/box.py""" +"""Stub file for reflex_chakra/components/layout/box.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Box(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - element: Optional[Union[Var[str], str]] = None, - src: Optional[Union[Var[str], str]] = None, - alt: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + element: Var[str] | str | None = None, + src: Var[str] | str | None = None, + alt: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Box": - """Create the component. + ) -> Box: + """Create a new Chakra component. Args: *children: The children of the component. @@ -72,12 +64,12 @@ class Box(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/card.py b/reflex_chakra/components/layout/card.py index 81990e1..8d564c7 100644 --- a/reflex_chakra/components/layout/card.py +++ b/reflex_chakra/components/layout/card.py @@ -1,6 +1,7 @@ """Chakra Card component.""" -from typing import Optional +from reflex.components.component import Component +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, @@ -8,8 +9,6 @@ LiteralColorScheme, LiteralTagSize, ) -from reflex.components.component import Component -from reflex.vars import Var class CardHeader(ChakraComponent): @@ -66,11 +65,12 @@ def create( cls, body: Component, *, - header: Optional[Component] = None, - footer: Optional[Component] = None, + header: Component | None = None, + footer: Component | None = None, **props, ) -> Component: """Creates a Chakra Card with a body and optionally header and/or footer, and returns it. + If header, body or footer are not already instances of Chead, Cbody or Cfoot respectively, they will be wrapped as such for layout purposes. If you want to modify their props, e.g. padding_left, you should wrap them yourself. diff --git a/reflex_chakra/components/layout/card.pyi b/reflex_chakra/components/layout/card.pyi index 12f5d78..54d7a59 100644 --- a/reflex_chakra/components/layout/card.pyi +++ b/reflex_chakra/components/layout/card.pyi @@ -1,328 +1,269 @@ -"""Stub file for reflex/components/chakra/layout/card.py""" +"""Stub file for reflex_chakra/components/layout/card.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.component import Component +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class CardHeader(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "CardHeader": - """Create the component. + ) -> CardHeader: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class CardBody(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "CardBody": - """Create the component. + ) -> CardBody: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class CardFooter(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "CardFooter": - """Create the component. + ) -> CardFooter: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Card(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - header: Optional[Component] = None, - footer: Optional[Component] = None, - align: Optional[Union[Var[str], str]] = None, - direction: Optional[Union[Var[str], str]] = None, - justify: Optional[Union[Var[str], str]] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], - ] - ] = None, - size: Optional[ - Union[Var[Literal["sm", "md", "lg"]], Literal["sm", "md", "lg"]] - ] = None, - variant: Optional[ - Union[ - Var[Literal["outline", "filled", "elevated", "unstyled"]], - Literal["outline", "filled", "elevated", "unstyled"], + header: Component | None = None, + footer: Component | None = None, + align: Var[str] | str | None = None, + direction: Var[str] | str | None = None, + justify: Var[str] | str | None = None, + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + size: Literal["lg", "md", "sm"] | Var[Literal["lg", "md", "sm"]] | None = None, + variant: Literal["elevated", "filled", "outline", "unstyled"] + | Var[Literal["elevated", "filled", "outline", "unstyled"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Card": + ) -> Card: """Creates a Chakra Card with a body and optionally header and/or footer, and returns it. + If header, body or footer are not already instances of Chead, Cbody or Cfoot respectively, they will be wrapped as such for layout purposes. If you want to modify their props, e.g. padding_left, you should wrap them yourself. @@ -336,4 +277,3 @@ class Card(ChakraComponent): Returns: The `create()` method returns a Card object. """ - ... diff --git a/reflex_chakra/components/layout/center.pyi b/reflex_chakra/components/layout/center.pyi index 40fce3d..a57c12d 100644 --- a/reflex_chakra/components/layout/center.pyi +++ b/reflex_chakra/components/layout/center.pyi @@ -1,209 +1,171 @@ -"""Stub file for reflex/components/chakra/layout/center.py""" +"""Stub file for reflex_chakra/components/layout/center.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Center(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Center": - """Create the component. + ) -> Center: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Square(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Square": - """Create the component. + ) -> Square: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Circle(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Circle": - """Create the component. + ) -> Circle: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/container.py b/reflex_chakra/components/layout/container.py index 1abd94d..bbcdc5f 100644 --- a/reflex_chakra/components/layout/container.py +++ b/reflex_chakra/components/layout/container.py @@ -1,7 +1,8 @@ """A flexbox container.""" +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Container(ChakraComponent): diff --git a/reflex_chakra/components/layout/container.pyi b/reflex_chakra/components/layout/container.pyi index 52256a9..3095f1c 100644 --- a/reflex_chakra/components/layout/container.pyi +++ b/reflex_chakra/components/layout/container.pyi @@ -1,66 +1,58 @@ -"""Stub file for reflex/components/chakra/layout/container.py""" +"""Stub file for reflex_chakra/components/layout/container.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Container(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - center_content: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + center_content: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Container": - """Create the component. + ) -> Container: + """Create a new Chakra component. Args: *children: The children of the component. @@ -68,12 +60,12 @@ class Container(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/flex.py b/reflex_chakra/components/layout/flex.py index 33b2a0f..4247ec1 100644 --- a/reflex_chakra/components/layout/flex.py +++ b/reflex_chakra/components/layout/flex.py @@ -1,9 +1,8 @@ """A reflexive container component.""" -from typing import List, Union +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Flex(ChakraComponent): @@ -18,7 +17,7 @@ class Flex(ChakraComponent): basis: Var[str] # Shorthand for flexDirection style prop - direction: Var[Union[str, List[str]]] + direction: Var[str | list[str]] # Shorthand for flexGrow style prop grow: Var[str] @@ -27,7 +26,7 @@ class Flex(ChakraComponent): justify: Var[str] # Shorthand for flexWrap style prop - wrap: Var[Union[str, List[str]]] + wrap: Var[str | list[str]] # Shorthand for flexShrink style prop shrink: Var[str] diff --git a/reflex_chakra/components/layout/flex.pyi b/reflex_chakra/components/layout/flex.pyi index bab1339..f3f64dd 100644 --- a/reflex_chakra/components/layout/flex.pyi +++ b/reflex_chakra/components/layout/flex.pyi @@ -1,72 +1,64 @@ -"""Stub file for reflex/components/chakra/layout/flex.py""" +"""Stub file for reflex_chakra/components/layout/flex.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Flex(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - align: Optional[Union[Var[str], str]] = None, - basis: Optional[Union[Var[str], str]] = None, - direction: Optional[Union[Var[Union[List[str], str]], str, List[str]]] = None, - grow: Optional[Union[Var[str], str]] = None, - justify: Optional[Union[Var[str], str]] = None, - wrap: Optional[Union[Var[Union[List[str], str]], str, List[str]]] = None, - shrink: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + align: Var[str] | str | None = None, + basis: Var[str] | str | None = None, + direction: Var[list[str] | str] | list[str] | str | None = None, + grow: Var[str] | str | None = None, + justify: Var[str] | str | None = None, + wrap: Var[list[str] | str] | list[str] | str | None = None, + shrink: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Flex": - """Create the component. + ) -> Flex: + """Create a new Chakra component. Args: *children: The children of the component. @@ -80,12 +72,12 @@ class Flex(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/grid.py b/reflex_chakra/components/layout/grid.py index 9c5f284..6551c64 100644 --- a/reflex_chakra/components/layout/grid.py +++ b/reflex_chakra/components/layout/grid.py @@ -1,9 +1,8 @@ """Container to stack elements with spacing.""" -from typing import List +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Grid(ChakraComponent): @@ -98,7 +97,7 @@ class ResponsiveGrid(ChakraComponent): row: Var[str] # A list that defines the number of columns for each breakpoint. - columns: Var[List[int]] + columns: Var[list[int]] # 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] diff --git a/reflex_chakra/components/layout/grid.pyi b/reflex_chakra/components/layout/grid.pyi index 09e7560..2670ece 100644 --- a/reflex_chakra/components/layout/grid.pyi +++ b/reflex_chakra/components/layout/grid.pyi @@ -1,72 +1,64 @@ -"""Stub file for reflex/components/chakra/layout/grid.py""" +"""Stub file for reflex_chakra/components/layout/grid.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Grid(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - auto_columns: Optional[Union[Var[str], str]] = None, - auto_flow: Optional[Union[Var[str], str]] = None, - auto_rows: Optional[Union[Var[str], str]] = None, - column: Optional[Union[Var[str], str]] = None, - row: Optional[Union[Var[str], str]] = None, - template_columns: Optional[Union[Var[str], str]] = None, - template_rows: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + auto_columns: Var[str] | str | None = None, + auto_flow: Var[str] | str | None = None, + auto_rows: Var[str] | str | None = None, + column: Var[str] | str | None = None, + row: Var[str] | str | None = None, + template_columns: Var[str] | str | None = None, + template_rows: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Grid": - """Create the component. + ) -> Grid: + """Create a new Chakra component. Args: *children: The children of the component. @@ -80,73 +72,58 @@ class Grid(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class GridItem(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - area: Optional[Union[Var[str], str]] = None, - col_end: Optional[Union[Var[str], str]] = None, - col_start: Optional[Union[Var[int], int]] = None, - col_span: Optional[Union[Var[int], int]] = None, - row_end: Optional[Union[Var[str], str]] = None, - row_start: Optional[Union[Var[int], int]] = None, - row_span: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + area: Var[str] | str | None = None, + col_end: Var[str] | str | None = None, + col_start: Var[int] | int | None = None, + col_span: Var[int] | int | None = None, + row_end: Var[str] | str | None = None, + row_start: Var[int] | int | None = None, + row_span: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "GridItem": - """Create the component. + ) -> GridItem: + """Create a new Chakra component. Args: *children: The children of the component. @@ -160,79 +137,64 @@ class GridItem(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ResponsiveGrid(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - auto_columns: Optional[Union[Var[str], str]] = None, - auto_flow: Optional[Union[Var[str], str]] = None, - auto_rows: Optional[Union[Var[str], str]] = None, - column: Optional[Union[Var[str], str]] = None, - row: Optional[Union[Var[str], str]] = None, - columns: Optional[Union[Var[List[int]], List[int]]] = None, - min_child_width: Optional[Union[Var[str], str]] = None, - spacing: Optional[Union[Var[str], str]] = None, - spacing_x: Optional[Union[Var[str], str]] = None, - spacing_y: Optional[Union[Var[str], str]] = None, - template_areas: Optional[Union[Var[str], str]] = None, - template_columns: Optional[Union[Var[str], str]] = None, - template_rows: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + auto_columns: Var[str] | str | None = None, + auto_flow: Var[str] | str | None = None, + auto_rows: Var[str] | str | None = None, + column: Var[str] | str | None = None, + row: Var[str] | str | None = None, + columns: Var[list[int]] | list[int] | None = None, + min_child_width: Var[str] | str | None = None, + spacing: Var[str] | str | None = None, + spacing_x: Var[str] | str | None = None, + spacing_y: Var[str] | str | None = None, + template_areas: Var[str] | str | None = None, + template_columns: Var[str] | str | None = None, + template_rows: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ResponsiveGrid": - """Create the component. + ) -> ResponsiveGrid: + """Create a new Chakra component. Args: *children: The children of the component. @@ -252,12 +214,12 @@ class ResponsiveGrid(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/spacer.pyi b/reflex_chakra/components/layout/spacer.pyi index 6d125ab..99613c9 100644 --- a/reflex_chakra/components/layout/spacer.pyi +++ b/reflex_chakra/components/layout/spacer.pyi @@ -1,77 +1,69 @@ -"""Stub file for reflex/components/chakra/layout/spacer.py""" +"""Stub file for reflex_chakra/components/layout/spacer.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Spacer(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Spacer": - """Create the component. + ) -> Spacer: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/stack.py b/reflex_chakra/components/layout/stack.py index f8ed96b..ace877a 100644 --- a/reflex_chakra/components/layout/stack.py +++ b/reflex_chakra/components/layout/stack.py @@ -1,9 +1,8 @@ """Container to stack elements with spacing.""" -from typing import List, Union +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent, LiteralStackDirection -from reflex.vars import Var class Stack(ChakraComponent): @@ -15,7 +14,7 @@ class Stack(ChakraComponent): align_items: Var[str] # The direction to stack the items. - direction: Var[Union[LiteralStackDirection, List[str]]] + direction: Var[LiteralStackDirection | list[str]] # If true the items will be stacked horizontally. is_inline: Var[bool] diff --git a/reflex_chakra/components/layout/stack.pyi b/reflex_chakra/components/layout/stack.pyi index 37cff85..562ad46 100644 --- a/reflex_chakra/components/layout/stack.pyi +++ b/reflex_chakra/components/layout/stack.pyi @@ -1,79 +1,69 @@ -"""Stub file for reflex/components/chakra/layout/stack.py""" +"""Stub file for reflex_chakra/components/layout/stack.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Stack(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - align_items: Optional[Union[Var[str], str]] = None, - direction: Optional[ - Union[ - Var[Union[List[str], Literal["row", "column"]]], - Literal["row", "column"], - List[str], - ] - ] = None, - is_inline: Optional[Union[Var[bool], bool]] = None, - justify_content: Optional[Union[Var[str], str]] = None, - should_wrap_children: Optional[Union[Var[bool], bool]] = None, - spacing: Optional[Union[Var[str], str]] = None, - wrap: Optional[Union[Var[str], str]] = None, - justify: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + align_items: Var[str] | str | None = None, + direction: Literal["column", "row"] + | Var[Literal["column", "row"] | list[str]] + | list[str] + | None = None, + is_inline: Var[bool] | bool | None = None, + justify_content: Var[str] | str | None = None, + should_wrap_children: Var[bool] | bool | None = None, + spacing: Var[str] | str | None = None, + wrap: Var[str] | str | None = None, + justify: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Stack": - """Create the component. + ) -> Stack: + """Create a new Chakra component. Args: *children: The children of the component. @@ -88,80 +78,62 @@ class Stack(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Hstack(Stack): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - align_items: Optional[Union[Var[str], str]] = None, - direction: Optional[ - Union[ - Var[Union[List[str], Literal["row", "column"]]], - Literal["row", "column"], - List[str], - ] - ] = None, - is_inline: Optional[Union[Var[bool], bool]] = None, - justify_content: Optional[Union[Var[str], str]] = None, - should_wrap_children: Optional[Union[Var[bool], bool]] = None, - spacing: Optional[Union[Var[str], str]] = None, - wrap: Optional[Union[Var[str], str]] = None, - justify: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + align_items: Var[str] | str | None = None, + direction: Literal["column", "row"] + | Var[Literal["column", "row"] | list[str]] + | list[str] + | None = None, + is_inline: Var[bool] | bool | None = None, + justify_content: Var[str] | str | None = None, + should_wrap_children: Var[bool] | bool | None = None, + spacing: Var[str] | str | None = None, + wrap: Var[str] | str | None = None, + justify: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Hstack": - """Create the component. + ) -> Hstack: + """Create a new Chakra component. Args: *children: The children of the component. @@ -176,80 +148,62 @@ class Hstack(Stack): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Vstack(Stack): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - align_items: Optional[Union[Var[str], str]] = None, - direction: Optional[ - Union[ - Var[Union[List[str], Literal["row", "column"]]], - Literal["row", "column"], - List[str], - ] - ] = None, - is_inline: Optional[Union[Var[bool], bool]] = None, - justify_content: Optional[Union[Var[str], str]] = None, - should_wrap_children: Optional[Union[Var[bool], bool]] = None, - spacing: Optional[Union[Var[str], str]] = None, - wrap: Optional[Union[Var[str], str]] = None, - justify: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + align_items: Var[str] | str | None = None, + direction: Literal["column", "row"] + | Var[Literal["column", "row"] | list[str]] + | list[str] + | None = None, + is_inline: Var[bool] | bool | None = None, + justify_content: Var[str] | str | None = None, + should_wrap_children: Var[bool] | bool | None = None, + spacing: Var[str] | str | None = None, + wrap: Var[str] | str | None = None, + justify: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Vstack": - """Create the component. + ) -> Vstack: + """Create a new Chakra component. Args: *children: The children of the component. @@ -264,12 +218,12 @@ class Vstack(Stack): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/layout/wrap.py b/reflex_chakra/components/layout/wrap.py index c6a4694..58865fa 100644 --- a/reflex_chakra/components/layout/wrap.py +++ b/reflex_chakra/components/layout/wrap.py @@ -1,8 +1,9 @@ """Container to stack elements with spacing.""" -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class Wrap(ChakraComponent): diff --git a/reflex_chakra/components/layout/wrap.pyi b/reflex_chakra/components/layout/wrap.pyi index 0b64330..8227ee0 100644 --- a/reflex_chakra/components/layout/wrap.pyi +++ b/reflex_chakra/components/layout/wrap.pyi @@ -1,72 +1,64 @@ -"""Stub file for reflex/components/chakra/layout/wrap.py""" +"""Stub file for reflex_chakra/components/layout/wrap.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Wrap(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, items=None, - align: Optional[Union[Var[str], str]] = None, - direction: Optional[Union[Var[str], str]] = None, - justify: Optional[Union[Var[str], str]] = None, - should_wrap_children: Optional[Union[Var[bool], bool]] = None, - spacing: Optional[Union[Var[str], str]] = None, - spacing_x: Optional[Union[Var[str], str]] = None, - spacing_y: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + align: Var[str] | str | None = None, + direction: Var[str] | str | None = None, + justify: Var[str] | str | None = None, + should_wrap_children: Var[bool] | bool | None = None, + spacing: Var[str] | str | None = None, + spacing_x: Var[str] | str | None = None, + spacing_y: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Wrap": + ) -> Wrap: """Return a wrap component. Args: @@ -82,6 +74,7 @@ class Wrap(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -90,70 +83,54 @@ class Wrap(ChakraComponent): Returns: The wrap component. """ - ... class WrapItem(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "WrapItem": - """Create the component. + ) -> WrapItem: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/media/__init__.py b/reflex_chakra/components/media/__init__.py index 8346a37..80442c0 100644 --- a/reflex_chakra/components/media/__init__.py +++ b/reflex_chakra/components/media/__init__.py @@ -4,4 +4,10 @@ from .icon import Icon from .image import Image -__all__ = [f for f in dir() if f[0].isupper()] # type: ignore +__all__ = [ + "Avatar", + "AvatarBadge", + "AvatarGroup", + "Icon", + "Image", +] diff --git a/reflex_chakra/components/media/avatar.py b/reflex_chakra/components/media/avatar.py index 8f688fa..c768b66 100644 --- a/reflex_chakra/components/media/avatar.py +++ b/reflex_chakra/components/media/avatar.py @@ -2,9 +2,10 @@ from __future__ import annotations +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var + from reflex_chakra.components.base import ChakraComponent, LiteralAvatarSize -from reflex.event import EventHandler -from reflex.vars import Var class Avatar(ChakraComponent): @@ -37,7 +38,7 @@ class Avatar(ChakraComponent): size: Var[LiteralAvatarSize] # Fired when the image fails to load. - on_error: EventHandler[lambda: []] + on_error: EventHandler[no_args_event_spec] class AvatarBadge(ChakraComponent): diff --git a/reflex_chakra/components/media/avatar.pyi b/reflex_chakra/components/media/avatar.pyi index 83cba88..39f33d1 100644 --- a/reflex_chakra/components/media/avatar.pyi +++ b/reflex_chakra/components/media/avatar.pyi @@ -1,79 +1,69 @@ -"""Stub file for reflex/components/chakra/media/avatar.py""" +"""Stub file for reflex_chakra/components/media/avatar.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components.base import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Avatar(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - icon: Optional[Union[Var[str], str]] = None, - icon_label: Optional[Union[Var[str], str]] = None, - ignore_fallback: Optional[Union[Var[bool], bool]] = None, - name: Optional[Union[Var[str], str]] = None, - show_border: Optional[Union[Var[bool], bool]] = None, - src: Optional[Union[Var[str], str]] = None, - src_set: Optional[Union[Var[str], str]] = None, - size: Optional[ - Union[ - Var[Literal["sm", "md", "lg", "xl", "xs", "2xl", "full", "2xs"]], - Literal["sm", "md", "lg", "xl", "xs", "2xl", "full", "2xs"], - ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + icon: Var[str] | str | None = None, + icon_label: Var[str] | str | None = None, + ignore_fallback: Var[bool] | bool | None = None, + name: Var[str] | str | None = None, + show_border: Var[bool] | bool | None = None, + src: Var[str] | str | None = None, + src_set: Var[str] | str | None = None, + size: Literal["2xl", "2xs", "full", "lg", "md", "sm", "xl", "xs"] + | Var[Literal["2xl", "2xs", "full", "lg", "md", "sm", "xl", "xs"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_error: EventType[()] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Avatar": - """Create the component. + ) -> Avatar: + """Create a new Chakra component. Args: *children: The children of the component. @@ -85,137 +75,108 @@ class Avatar(ChakraComponent): src: The image url of the Avatar. src_set: List of sources to use for different screen resolutions. size: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full" + on_error: Fired when the image fails to load. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AvatarBadge(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AvatarBadge": - """Create the component. + ) -> AvatarBadge: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AvatarGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - max_: Optional[Union[Var[int], int]] = None, - spacing: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + max_: Var[int] | int | None = None, + spacing: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AvatarGroup": - """Create the component. + ) -> AvatarGroup: + """Create a new Chakra component. Args: *children: The children of the component. @@ -224,12 +185,12 @@ class AvatarGroup(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/media/icon.py b/reflex_chakra/components/media/icon.py index a76dd0f..f8c78cd 100644 --- a/reflex_chakra/components/media/icon.py +++ b/reflex_chakra/components/media/icon.py @@ -1,9 +1,8 @@ """An icon component.""" -from typing import List +from reflex.utils import format from reflex_chakra.components.base import ChakraComponent -from reflex.utils import format class ChakraIconComponent(ChakraComponent): @@ -35,21 +34,20 @@ def create(cls, *children, **props): The created component. """ if children: - raise AttributeError( - f"Passing children to Icon component is not allowed: remove positional arguments {children} to fix" - ) + msg = f"Passing children to Icon component is not allowed: remove positional arguments {children} to fix" + raise AttributeError(msg) if "tag" not in props: - raise AttributeError("Missing 'tag' keyword-argument for Icon") + msg = "Missing 'tag' keyword-argument for Icon" + raise AttributeError(msg) if not isinstance(props["tag"], str) or props["tag"].lower() not in ICON_LIST: - raise ValueError( - f"Invalid icon tag: {props['tag']}. Please use one of the following: {sorted(ICON_LIST)}" - ) + msg = f"Invalid icon tag: {props['tag']}. Please use one of the following: {sorted(ICON_LIST)}" + raise ValueError(msg) props["tag"] = format.to_title_case(props["tag"]) + "Icon" return super().create(*children, **props) # List of all icons. -ICON_LIST: List[str] = [ +ICON_LIST: list[str] = [ "add", "arrow_back", "arrow_down", diff --git a/reflex_chakra/components/media/icon.pyi b/reflex_chakra/components/media/icon.pyi index c737b08..75c0b98 100644 --- a/reflex_chakra/components/media/icon.pyi +++ b/reflex_chakra/components/media/icon.pyi @@ -1,130 +1,107 @@ -"""Stub file for reflex/components/chakra/media/icon.py""" +"""Stub file for reflex_chakra/components/media/icon.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) -from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var + +from reflex_chakra.components.base import ChakraComponent class ChakraIconComponent(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ChakraIconComponent": - """Create the component. + ) -> ChakraIconComponent: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class Icon(ChakraIconComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Icon": + ) -> Icon: """Initialize the Icon component. Run some additional checks on Icon component. @@ -134,6 +111,7 @@ class Icon(ChakraIconComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -146,6 +124,5 @@ class Icon(ChakraIconComponent): Returns: The created component. """ - ... -ICON_LIST: List[str] +ICON_LIST: list[str] diff --git a/reflex_chakra/components/media/image.py b/reflex_chakra/components/media/image.py index 6b899a4..810efae 100644 --- a/reflex_chakra/components/media/image.py +++ b/reflex_chakra/components/media/image.py @@ -2,12 +2,13 @@ from __future__ import annotations -from typing import Any, Optional +from typing import Any -from reflex_chakra.components.base import ChakraComponent, LiteralImageLoading from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.vars import Var +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var + +from reflex_chakra.components.base import ChakraComponent, LiteralImageLoading class Image(ChakraComponent): @@ -19,7 +20,7 @@ class Image(ChakraComponent): align: Var[str] # Fallback Reflex component to show if image is loading or image fails. - fallback: Optional[Component] = None + fallback: Var[Component] # Fallback image src to show if image is loading or image fails. fallback_src: Var[str] @@ -52,20 +53,7 @@ class Image(ChakraComponent): src_set: Var[str] # Fired when the image fails to load. - on_error: EventHandler[lambda: []] + on_error: EventHandler[no_args_event_spec] # Fired when the image is loaded. - on_load: EventHandler[lambda: []] - - @classmethod - def create(cls, *children, **props) -> Component: - """Create an Image component. - - Args: - *children: The children of the image. - **props: The props of the image. - - Returns: - The Image component. - """ - return super().create(*children, **props) + on_load: EventHandler[no_args_event_spec] diff --git a/reflex_chakra/components/media/image.pyi b/reflex_chakra/components/media/image.pyi index dee9790..9310ff1 100644 --- a/reflex_chakra/components/media/image.pyi +++ b/reflex_chakra/components/media/image.pyi @@ -1,84 +1,75 @@ -"""Stub file for reflex/components/chakra/media/image.py""" +"""Stub file for reflex_chakra/components/media/image.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var + +from reflex_chakra.components.base import ChakraComponent class Image(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - align: Optional[Union[Var[str], str]] = None, - fallback: Optional[Component] = None, - fallback_src: Optional[Union[Var[str], str]] = None, - fit: Optional[Union[Var[str], str]] = None, - html_height: Optional[Union[Var[str], str]] = None, - html_width: Optional[Union[Var[str], str]] = None, - ignore_fallback: Optional[Union[Var[bool], bool]] = None, - loading: Optional[ - Union[Var[Literal["eager", "lazy"]], Literal["eager", "lazy"]] - ] = None, - src: Optional[Union[Var[Any], Any]] = None, - alt: Optional[Union[Var[str], str]] = None, - src_set: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_error: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_load: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + align: Var[str] | str | None = None, + fallback: Component | Var[Component] | None = None, + fallback_src: Var[str] | str | None = None, + fit: Var[str] | str | None = None, + html_height: Var[str] | str | None = None, + html_width: Var[str] | str | None = None, + ignore_fallback: Var[bool] | bool | None = None, + loading: Literal["eager", "lazy"] | Var[Literal["eager", "lazy"]] | None = None, + src: Any | Var[Any] | None = None, + alt: Var[str] | str | None = None, + src_set: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_error: EventType[()] | None = None, + on_focus: EventType[()] | None = None, + on_load: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Image": - """Create an Image component. + ) -> Image: + """Create a new Chakra component. Args: - *children: The children of the image. + *children: The children of the component. align: How to align the image within its bounds. It maps to css `object-position` property. fallback: Fallback Reflex component to show if image is loading or image fails. fallback_src: Fallback image src to show if image is loading or image fails. @@ -90,15 +81,17 @@ class Image(ChakraComponent): src: The path/url to the image or PIL image object. alt: The alt text of the image. src_set: 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)_ + on_error: Fired when the image fails to load. + on_load: Fired when the image is loaded. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the image. + **props: The properties of the component. Returns: - The Image component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/navigation/__init__.py b/reflex_chakra/components/navigation/__init__.py index 4b61ad8..6ff2525 100644 --- a/reflex_chakra/components/navigation/__init__.py +++ b/reflex_chakra/components/navigation/__init__.py @@ -15,4 +15,21 @@ StepTitle, ) -__all__ = [f for f in dir() if f[0].isupper()] # type: ignore +__all__ = [ + "Breadcrumb", + "BreadcrumbItem", + "BreadcrumbLink", + "BreadcrumbSeparator", + "Link", + "LinkBox", + "LinkOverlay", + "Step", + "StepDescription", + "StepIcon", + "StepIndicator", + "StepNumber", + "StepSeparator", + "StepStatus", + "StepTitle", + "Stepper", +] diff --git a/reflex_chakra/components/navigation/breadcrumb.py b/reflex_chakra/components/navigation/breadcrumb.py index 1144d01..31548ec 100644 --- a/reflex_chakra/components/navigation/breadcrumb.py +++ b/reflex_chakra/components/navigation/breadcrumb.py @@ -1,10 +1,11 @@ """Breadcrumb components.""" -from reflex_chakra.components import ChakraComponent -from reflex_chakra.components.navigation.link import Link from reflex.components.component import Component from reflex.components.core.foreach import Foreach -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent +from reflex_chakra.components.navigation.link import Link class Breadcrumb(ChakraComponent): @@ -79,7 +80,7 @@ def create(cls, *children, label=None, href=None, **props): The BreadcrumbItem component """ if len(children) == 0: - children = [BreadcrumbLink.create(label or "", href=href or "")] # type: ignore + children = [BreadcrumbLink.create(label or "", href=href or "")] return super().create(*children, **props) diff --git a/reflex_chakra/components/navigation/breadcrumb.pyi b/reflex_chakra/components/navigation/breadcrumb.pyi index f992584..2fc4dd7 100644 --- a/reflex_chakra/components/navigation/breadcrumb.pyi +++ b/reflex_chakra/components/navigation/breadcrumb.pyi @@ -1,69 +1,61 @@ -"""Stub file for reflex/components/chakra/navigation/breadcrumb.py""" +"""Stub file for reflex_chakra/components/navigation/breadcrumb.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.component import Component +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent from reflex_chakra.components.navigation.link import Link -from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Breadcrumb(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, items=None, - separator: Optional[Union[Var[str], str]] = None, - separator_margin: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + separator: Var[str] | str | None = None, + separator_margin: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Breadcrumb": + ) -> Breadcrumb: """Create a breadcrumb component. If the kw-args `items` is provided and is a list, they will be added as children. @@ -76,6 +68,7 @@ class Breadcrumb(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -84,63 +77,47 @@ class Breadcrumb(ChakraComponent): Returns: The breadcrumb component. """ - ... class BreadcrumbItem(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, label=None, href=None, - is_current_page: Optional[Union[Var[bool], bool]] = None, - is_last_child: Optional[Union[Var[bool], bool]] = None, - separator: Optional[Union[Var[str], str]] = None, - spacing: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_current_page: Var[bool] | bool | None = None, + is_last_child: Var[bool] | bool | None = None, + separator: Var[str] | str | None = None, + spacing: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "BreadcrumbItem": + ) -> BreadcrumbItem: """Create a Breadcrumb Item component. Args: @@ -154,6 +131,7 @@ class BreadcrumbItem(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -162,129 +140,98 @@ class BreadcrumbItem(ChakraComponent): Returns: The BreadcrumbItem component """ - ... class BreadcrumbSeparator(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "BreadcrumbSeparator": - """Create the component. + ) -> BreadcrumbSeparator: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class BreadcrumbLink(Link): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_current_page: Optional[Union[Var[bool], bool]] = None, - rel: Optional[Union[Var[str], str]] = None, - href: Optional[Union[Var[str], str]] = None, - text: Optional[Union[Var[str], str]] = None, - as_: Optional[Union[Var[Component], Component]] = None, - is_external: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_current_page: Var[bool] | bool | None = None, + rel: Var[str] | str | None = None, + href: Var[str] | str | None = None, + text: Var[str] | str | None = None, + as_: Component | Var[Component] | None = None, + is_external: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "BreadcrumbLink": + ) -> BreadcrumbLink: """Create a Link component. Args: @@ -298,6 +245,7 @@ class BreadcrumbLink(Link): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -309,4 +257,3 @@ class BreadcrumbLink(Link): Returns: Component: The link component """ - ... diff --git a/reflex_chakra/components/navigation/link.py b/reflex_chakra/components/navigation/link.py index 847e4e8..b8ac2c4 100644 --- a/reflex_chakra/components/navigation/link.py +++ b/reflex_chakra/components/navigation/link.py @@ -1,10 +1,11 @@ """A link component.""" from reflex import ImportVar -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent class Link(ChakraComponent): @@ -52,8 +53,9 @@ def create(cls, *children, **props): Component: The link component """ if props.get("href") is not None: - if not len(children): - raise ValueError("Link without a child will not display") + if not children: + msg = "Link without a child will not display" + raise ValueError(msg) else: # Don't use a NextLink if there is no href. props["as_"] = "" diff --git a/reflex_chakra/components/navigation/link.pyi b/reflex_chakra/components/navigation/link.pyi index c81ecd9..641aa16 100644 --- a/reflex_chakra/components/navigation/link.pyi +++ b/reflex_chakra/components/navigation/link.pyi @@ -1,75 +1,64 @@ -"""Stub file for reflex/components/chakra/navigation/link.py""" +"""Stub file for reflex_chakra/components/navigation/link.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component -from reflex.components.next.link import NextLink -from reflex.event import EventHandler, EventSpec -from reflex.style import Style +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) from reflex.utils.imports import ImportDict -from reflex.vars import Var +from reflex.vars.base import Var -next_link = NextLink.create() +from reflex_chakra.components import ChakraComponent class Link(ChakraComponent): def add_imports(self) -> ImportDict: ... - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - rel: Optional[Union[Var[str], str]] = None, - href: Optional[Union[Var[str], str]] = None, - text: Optional[Union[Var[str], str]] = None, - as_: Optional[Union[Var[Component], Component]] = None, - is_external: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + rel: Var[str] | str | None = None, + href: Var[str] | str | None = None, + text: Var[str] | str | None = None, + as_: Component | Var[Component] | None = None, + is_external: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Link": + ) -> Link: """Create a Link component. Args: @@ -82,6 +71,7 @@ class Link(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -93,4 +83,3 @@ class Link(ChakraComponent): Returns: Component: The link component """ - ... diff --git a/reflex_chakra/components/navigation/linkoverlay.py b/reflex_chakra/components/navigation/linkoverlay.py index d0ab726..acad961 100644 --- a/reflex_chakra/components/navigation/linkoverlay.py +++ b/reflex_chakra/components/navigation/linkoverlay.py @@ -1,7 +1,8 @@ """Link overlay components.""" +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class LinkOverlay(ChakraComponent): diff --git a/reflex_chakra/components/navigation/linkoverlay.pyi b/reflex_chakra/components/navigation/linkoverlay.pyi index 53c163a..5759c59 100644 --- a/reflex_chakra/components/navigation/linkoverlay.pyi +++ b/reflex_chakra/components/navigation/linkoverlay.pyi @@ -1,67 +1,59 @@ -"""Stub file for reflex/components/chakra/navigation/linkoverlay.py""" +"""Stub file for reflex_chakra/components/navigation/linkoverlay.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class LinkOverlay(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - is_external: Optional[Union[Var[bool], bool]] = None, - href: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_external: Var[bool] | bool | None = None, + href: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "LinkOverlay": - """Create the component. + ) -> LinkOverlay: + """Create a new Chakra component. Args: *children: The children of the component. @@ -70,78 +62,63 @@ class LinkOverlay(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class LinkBox(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "LinkBox": - """Create the component. + ) -> LinkBox: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/navigation/stepper.py b/reflex_chakra/components/navigation/stepper.py index f85a777..91ef299 100644 --- a/reflex_chakra/components/navigation/stepper.py +++ b/reflex_chakra/components/navigation/stepper.py @@ -1,10 +1,11 @@ """A component to indicate progress through a multi-step process.""" -from typing import List, Literal, Optional, Tuple +from typing import Literal -from reflex_chakra.components import ChakraComponent, LiteralColorScheme from reflex.components.component import Component -from reflex.vars import Var +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent, LiteralColorScheme class Stepper(ChakraComponent): @@ -16,7 +17,7 @@ class Stepper(ChakraComponent): orientation: Var[Literal["vertical", "horizontal"]] # The color scheme to use for the stepper; default is blue. - colorScheme: Var[LiteralColorScheme] + colorScheme: Var[LiteralColorScheme] # noqa: N815 # Chakra provides a useSteps hook to control the stepper. # Instead, use an integer state value to set progress in the stepper. @@ -28,9 +29,7 @@ class Stepper(ChakraComponent): size: Var[str] @classmethod - def create( - cls, *children, items: Optional[List[Tuple]] = None, **props - ) -> Component: + def create(cls, *children, items: list[tuple] | None = None, **props) -> Component: """Create a Stepper component. If the kw-args `items` is provided and is a list, they will be added as children. @@ -107,7 +106,6 @@ class StepStatus(ChakraComponent): incomplete: Var[str] - class StepTitle(ChakraComponent): """The title text for a step component.""" diff --git a/reflex_chakra/components/navigation/stepper.pyi b/reflex_chakra/components/navigation/stepper.pyi index 82fa389..6ebf85d 100644 --- a/reflex_chakra/components/navigation/stepper.pyi +++ b/reflex_chakra/components/navigation/stepper.pyi @@ -1,121 +1,108 @@ -"""Stub file for reflex/components/chakra/navigation/stepper.py""" +"""Stub file for reflex_chakra/components/navigation/stepper.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Stepper(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - items: Optional[List[Tuple]] = None, - orientation: Optional[ - Union[ - Var[Literal["vertical", "horizontal"]], - Literal["vertical", "horizontal"], - ] - ] = None, - colorScheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], + items: list[tuple] | None = None, + orientation: Literal["horizontal", "vertical"] + | Var[Literal["horizontal", "vertical"]] + | None = None, + colorScheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - index: Optional[Union[Var[int], int]] = None, - size: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + index: Var[int] | int | None = None, + size: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Stepper": + ) -> Stepper: """Create a Stepper component. If the kw-args `items` is provided and is a list, they will be added as children. @@ -123,12 +110,14 @@ class Stepper(ChakraComponent): Args: *children: The children of the component. items (list): The child components for each step. + orientation: The orientation of Stepper: 'vertical' | 'horizontal'. Default: 'horizontal' colorScheme: The color scheme to use for the stepper; default is blue. - index: 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: The index of the current step. size: The size of the steps in the stepper. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -137,536 +126,417 @@ class Stepper(ChakraComponent): Returns: The stepper component. """ - ... class Step(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Step": - """Create the component. + ) -> Step: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StepDescription(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StepDescription": - """Create the component. + ) -> StepDescription: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StepIcon(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StepIcon": - """Create the component. + ) -> StepIcon: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StepIndicator(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StepIndicator": - """Create the component. + ) -> StepIndicator: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StepNumber(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StepNumber": - """Create the component. + ) -> StepNumber: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StepSeparator(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StepSeparator": - """Create the component. + ) -> StepSeparator: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StepStatus(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - active: Optional[Union[Var[str], str]] = None, - complete: Optional[Union[Var[str], str]] = None, - incomplete: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + active: Var[str] | str | None = None, + complete: Var[str] | str | None = None, + incomplete: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StepStatus": - """Create the component. + ) -> StepStatus: + """Create a new Chakra component. Args: *children: The children of the component. - active: [not working yet] active, complete, and incomplete should also be able to accept StepIcon or StepNumber components currently, these props only support strings + active: The CSS class name to apply when a step is the currently active step. + complete: The CSS class name to apply when a step is completed. + incomplete: The CSS class name to apply when a step is incomplete. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class StepTitle(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "StepTitle": - """Create the component. + ) -> StepTitle: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/overlay/__init__.py b/reflex_chakra/components/overlay/__init__.py index 322d093..f708bc1 100644 --- a/reflex_chakra/components/overlay/__init__.py +++ b/reflex_chakra/components/overlay/__init__.py @@ -48,3 +48,44 @@ PopoverTrigger, ) from .tooltip import Tooltip + +__all__ = [ + "AlertDialog", + "AlertDialogBody", + "AlertDialogContent", + "AlertDialogFooter", + "AlertDialogHeader", + "AlertDialogOverlay", + "Drawer", + "DrawerBody", + "DrawerCloseButton", + "DrawerContent", + "DrawerFooter", + "DrawerHeader", + "DrawerOverlay", + "Menu", + "MenuButton", + "MenuDivider", + "MenuGroup", + "MenuItem", + "MenuItemOption", + "MenuList", + "MenuOptionGroup", + "Modal", + "ModalBody", + "ModalCloseButton", + "ModalContent", + "ModalFooter", + "ModalHeader", + "ModalOverlay", + "Popover", + "PopoverAnchor", + "PopoverArrow", + "PopoverBody", + "PopoverCloseButton", + "PopoverContent", + "PopoverFooter", + "PopoverHeader", + "PopoverTrigger", + "Tooltip", +] diff --git a/reflex_chakra/components/overlay/alertdialog.py b/reflex_chakra/components/overlay/alertdialog.py index a237db4..76e5fe4 100644 --- a/reflex_chakra/components/overlay/alertdialog.py +++ b/reflex_chakra/components/overlay/alertdialog.py @@ -2,11 +2,12 @@ from __future__ import annotations +from reflex.components.component import Component +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent, LiteralAlertDialogSize from reflex_chakra.components.media.icon import Icon -from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.vars import Var class AlertDialog(ChakraComponent): @@ -54,16 +55,16 @@ class AlertDialog(ChakraComponent): use_inert: Var[bool] # Fired when the modal is closing. - on_close: EventHandler[lambda: []] + on_close: EventHandler[no_args_event_spec] # Fired when the modal is closed and the exit animation is complete. - on_close_complete: EventHandler[lambda: []] + on_close_complete: EventHandler[no_args_event_spec] # Fired when the Esc key is pressed. - on_esc: EventHandler[lambda: []] + on_esc: EventHandler[no_args_event_spec] # Fired when the overlay is clicked. - on_overlay_click: EventHandler[lambda: []] + on_overlay_click: EventHandler[no_args_event_spec] @classmethod def create( @@ -104,9 +105,8 @@ def create( close_button = Icon.create(tag="close") contents.append(AlertDialogCloseButton.create(close_button)) elif close_button: - raise AttributeError( - "Close button can not be used if on_close event handler is not defined" - ) + msg = "Close button can not be used if on_close event handler is not defined" + raise AttributeError(msg) children = [ AlertDialogOverlay.create( diff --git a/reflex_chakra/components/overlay/alertdialog.pyi b/reflex_chakra/components/overlay/alertdialog.pyi index f1646b8..52617fc 100644 --- a/reflex_chakra/components/overlay/alertdialog.pyi +++ b/reflex_chakra/components/overlay/alertdialog.pyi @@ -1,109 +1,82 @@ -"""Stub file for reflex/components/chakra/overlay/alertdialog.py""" +"""Stub file for reflex_chakra/components/overlay/alertdialog.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class AlertDialog(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, header=None, body=None, footer=None, close_button=None, - is_open: Optional[Union[Var[bool], bool]] = None, - least_destructive_ref: Optional[Union[Var[str], str]] = None, - allow_pinch_zoom: Optional[Union[Var[bool], bool]] = None, - auto_focus: Optional[Union[Var[bool], bool]] = None, - block_scroll_on_mount: Optional[Union[Var[bool], bool]] = None, - close_on_esc: Optional[Union[Var[bool], bool]] = None, - close_on_overlay_click: Optional[Union[Var[bool], bool]] = None, - is_centered: Optional[Union[Var[bool], bool]] = None, - lock_focus_across_frames: Optional[Union[Var[bool], bool]] = None, - preserve_scroll_bar_gap: Optional[Union[Var[bool], bool]] = None, - return_focus_on_close: Optional[Union[Var[bool], bool]] = None, - size: Optional[ - Union[ - Var[ - Literal[ - "sm", - "md", - "lg", - "xs", - "2xl", - "full", - "3xl", - "4xl", - "5xl", - "6xl", - ] - ], - Literal[ - "sm", "md", "lg", "xs", "2xl", "full", "3xl", "4xl", "5xl", "6xl" - ], - ] - ] = None, - use_inert: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_complete: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_esc: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_overlay_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + is_open: Var[bool] | bool | None = None, + least_destructive_ref: Var[str] | str | None = None, + allow_pinch_zoom: Var[bool] | bool | None = None, + auto_focus: Var[bool] | bool | None = None, + block_scroll_on_mount: Var[bool] | bool | None = None, + close_on_esc: Var[bool] | bool | None = None, + close_on_overlay_click: Var[bool] | bool | None = None, + is_centered: Var[bool] | bool | None = None, + lock_focus_across_frames: Var[bool] | bool | None = None, + preserve_scroll_bar_gap: Var[bool] | bool | None = None, + return_focus_on_close: Var[bool] | bool | None = None, + size: Literal["2xl", "3xl", "4xl", "5xl", "6xl", "full", "lg", "md", "sm", "xs"] + | Var[ + Literal["2xl", "3xl", "4xl", "5xl", "6xl", "full", "lg", "md", "sm", "xs"] + ] + | None = None, + use_inert: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_close: EventType[()] | None = None, + on_close_complete: EventType[()] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_esc: EventType[()] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_overlay_click: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDialog": + ) -> AlertDialog: """Create an alert dialog component. Args: @@ -125,9 +98,14 @@ class AlertDialog(ChakraComponent): return_focus_on_close: If true, the modal will return focus to the element that triggered it when it closes. size: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "full" use_inert: 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** + on_close: Fired when the modal is closing. + on_close_complete: Fired when the modal is closed and the exit animation is complete. + on_esc: Fired when the Esc key is pressed. + on_overlay_click: Fired when the overlay is clicked. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -139,400 +117,309 @@ class AlertDialog(ChakraComponent): Returns: The alert dialog component. """ - ... class AlertDialogBody(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDialogBody": - """Create the component. + ) -> AlertDialogBody: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AlertDialogHeader(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDialogHeader": - """Create the component. + ) -> AlertDialogHeader: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AlertDialogFooter(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDialogFooter": - """Create the component. + ) -> AlertDialogFooter: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AlertDialogContent(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDialogContent": - """Create the component. + ) -> AlertDialogContent: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AlertDialogOverlay(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDialogOverlay": - """Create the component. + ) -> AlertDialogOverlay: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class AlertDialogCloseButton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "AlertDialogCloseButton": - """Create the component. + ) -> AlertDialogCloseButton: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/overlay/drawer.py b/reflex_chakra/components/overlay/drawer.py index c4ddb2e..903f1e9 100644 --- a/reflex_chakra/components/overlay/drawer.py +++ b/reflex_chakra/components/overlay/drawer.py @@ -2,15 +2,16 @@ from __future__ import annotations +from reflex.components.component import Component +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var + from reflex_chakra.components import ( ChakraComponent, LiteralColorScheme, LiteralDrawerSize, ) from reflex_chakra.components.media.icon import Icon -from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.vars import Var class Drawer(ChakraComponent): @@ -70,16 +71,16 @@ class Drawer(ChakraComponent): color_scheme: Var[LiteralColorScheme] # Fired when the modal is closing. - on_close: EventHandler[lambda: []] + on_close: EventHandler[no_args_event_spec] # Fired when the modal is closed and the exit animation is complete. - on_close_complete: EventHandler[lambda: []] + on_close_complete: EventHandler[no_args_event_spec] # Fired when the Esc key is pressed. - on_esc: EventHandler[lambda: []] + on_esc: EventHandler[no_args_event_spec] # Fired when the overlay is clicked. - on_overlay_click: EventHandler[lambda: []] + on_overlay_click: EventHandler[no_args_event_spec] @classmethod def create( @@ -119,9 +120,8 @@ def create( close_button = Icon.create(tag="close") contents.append(DrawerCloseButton.create(close_button)) elif close_button: - raise AttributeError( - "Close button can not be used if on_close event handler is not defined" - ) + msg = "Close button can not be used if on_close event handler is not defined" + raise AttributeError(msg) children = [ DrawerOverlay.create( diff --git a/reflex_chakra/components/overlay/drawer.pyi b/reflex_chakra/components/overlay/drawer.pyi index 20b70e3..080914c 100644 --- a/reflex_chakra/components/overlay/drawer.pyi +++ b/reflex_chakra/components/overlay/drawer.pyi @@ -1,146 +1,129 @@ -"""Stub file for reflex/components/chakra/overlay/drawer.py""" +"""Stub file for reflex_chakra/components/overlay/drawer.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Drawer(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, header=None, body=None, footer=None, close_button=None, - is_open: Optional[Union[Var[bool], bool]] = None, - allow_pinch_zoom: Optional[Union[Var[bool], bool]] = None, - auto_focus: Optional[Union[Var[bool], bool]] = None, - block_scroll_on_mount: Optional[Union[Var[bool], bool]] = None, - close_on_esc: Optional[Union[Var[bool], bool]] = None, - close_on_overlay_click: Optional[Union[Var[bool], bool]] = None, - is_centered: Optional[Union[Var[bool], bool]] = None, - is_full_height: Optional[Union[Var[bool], bool]] = None, - lock_focus_across_frames: Optional[Union[Var[bool], bool]] = None, - placement: Optional[Union[Var[str], str]] = None, - preserve_scroll_bar_gap: Optional[Union[Var[bool], bool]] = None, - return_focus_on_close: Optional[Union[Var[bool], bool]] = None, - size: Optional[ - Union[ - Var[Literal["sm", "md", "lg", "xs", "xl", "full"]], - Literal["sm", "md", "lg", "xs", "xl", "full"], - ] - ] = None, - use_inert: Optional[Union[Var[bool], bool]] = None, - variant: Optional[Union[Var[str], str]] = None, - color_scheme: Optional[ - Union[ - Var[ - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ] - ], - Literal[ - "none", - "gray", - "red", - "orange", - "yellow", - "green", - "teal", - "blue", - "cyan", - "purple", - "pink", - "whiteAlpha", - "blackAlpha", - "linkedin", - "facebook", - "messenger", - "whatsapp", - "twitter", - "telegram", - ], + is_open: Var[bool] | bool | None = None, + allow_pinch_zoom: Var[bool] | bool | None = None, + auto_focus: Var[bool] | bool | None = None, + block_scroll_on_mount: Var[bool] | bool | None = None, + close_on_esc: Var[bool] | bool | None = None, + close_on_overlay_click: Var[bool] | bool | None = None, + is_centered: Var[bool] | bool | None = None, + is_full_height: Var[bool] | bool | None = None, + lock_focus_across_frames: Var[bool] | bool | None = None, + placement: Var[str] | str | None = None, + preserve_scroll_bar_gap: Var[bool] | bool | None = None, + return_focus_on_close: Var[bool] | bool | None = None, + size: Literal["full", "lg", "md", "sm", "xl", "xs"] + | Var[Literal["full", "lg", "md", "sm", "xl", "xs"]] + | None = None, + use_inert: Var[bool] | bool | None = None, + variant: Var[str] | str | None = None, + color_scheme: Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", + ] + | Var[ + Literal[ + "blackAlpha", + "blue", + "cyan", + "facebook", + "gray", + "green", + "linkedin", + "messenger", + "none", + "orange", + "pink", + "purple", + "red", + "teal", + "telegram", + "twitter", + "whatsapp", + "whiteAlpha", + "yellow", ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_complete: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_esc: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_overlay_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + ] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_close: EventType[()] | None = None, + on_close_complete: EventType[()] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_esc: EventType[()] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_overlay_click: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Drawer": + ) -> Drawer: """Create a drawer component. Args: @@ -165,9 +148,14 @@ class Drawer(ChakraComponent): use_inert: 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** variant: Variant of drawer color_scheme: Color scheme of the Drawer Options: "whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram" + on_close: Fired when the modal is closing. + on_close_complete: Fired when the modal is closed and the exit animation is complete. + on_esc: Fired when the Esc key is pressed. + on_overlay_click: Fired when the overlay is clicked. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -179,400 +167,309 @@ class Drawer(ChakraComponent): Returns: The drawer component. """ - ... class DrawerBody(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DrawerBody": - """Create the component. + ) -> DrawerBody: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class DrawerHeader(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DrawerHeader": - """Create the component. + ) -> DrawerHeader: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class DrawerFooter(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DrawerFooter": - """Create the component. + ) -> DrawerFooter: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class DrawerOverlay(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DrawerOverlay": - """Create the component. + ) -> DrawerOverlay: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class DrawerContent(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DrawerContent": - """Create the component. + ) -> DrawerContent: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class DrawerCloseButton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "DrawerCloseButton": - """Create the component. + ) -> DrawerCloseButton: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/overlay/menu.py b/reflex_chakra/components/overlay/menu.py index 5c85b1e..791f88b 100644 --- a/reflex_chakra/components/overlay/menu.py +++ b/reflex_chakra/components/overlay/menu.py @@ -2,7 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import ClassVar + +from reflex.components.component import Component +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, @@ -11,9 +15,6 @@ LiteralMenuStrategy, ) from reflex_chakra.components.forms.button import Button -from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.vars import Var class Menu(ChakraComponent): @@ -70,17 +71,17 @@ class Menu(ChakraComponent): strategy: Var[LiteralMenuStrategy] # Fired when the menu is closed. - on_close: EventHandler[lambda: []] + on_close: EventHandler[no_args_event_spec] # Fired when the menu is opened. - on_open: EventHandler[lambda: []] + on_open: EventHandler[no_args_event_spec] @classmethod def create( cls, *children, - button: Optional[Component] = None, - items: Optional[List] = None, + button: Component | None = None, + items: list | None = None, **props, ) -> Component: """Create a menu component. @@ -117,7 +118,7 @@ class MenuButton(ChakraComponent): variant: Var[str] # Components that are not allowed as children. - _invalid_children: List[str] = ["Button", "MenuButton"] + _invalid_children: ClassVar[list[str]] = ["Button", "MenuButton"] # The tag to use for the menu button. as_: Var[str] @@ -129,7 +130,7 @@ class MenuList(ChakraComponent): tag = "MenuList" @classmethod - def create(cls, *children, items: Optional[list] = None, **props) -> Component: + def create(cls, *children, items: list | None = None, **props) -> Component: """Create a MenuList component, and automatically wrap in MenuItem if not already one. Args: diff --git a/reflex_chakra/components/overlay/menu.pyi b/reflex_chakra/components/overlay/menu.pyi index 7fe0dbb..43c6dac 100644 --- a/reflex_chakra/components/overlay/menu.pyi +++ b/reflex_chakra/components/overlay/menu.pyi @@ -1,91 +1,82 @@ -"""Stub file for reflex/components/chakra/overlay/menu.py""" +"""Stub file for reflex_chakra/components/overlay/menu.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.component import Component +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Menu(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - button: Optional[Component] = None, - items: Optional[List] = None, - arrow_padding: Optional[Union[Var[int], int]] = None, - auto_select: Optional[Union[Var[bool], bool]] = None, - boundary: Optional[Union[Var[str], str]] = None, - close_on_blur: Optional[Union[Var[bool], bool]] = None, - close_on_select: Optional[Union[Var[bool], bool]] = None, - default_is_open: Optional[Union[Var[bool], bool]] = None, - direction: Optional[ - Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]] - ] = None, - flip: Optional[Union[Var[bool], bool]] = None, - gutter: Optional[Union[Var[int], int]] = None, - is_lazy: Optional[Union[Var[bool], bool]] = None, - lazy_behavior: Optional[Union[Var[str], str]] = None, - is_open: Optional[Union[Var[bool], bool]] = None, - match_width: Optional[Union[Var[bool], bool]] = None, - placement: Optional[Union[Var[str], str]] = None, - prevent_overflow: Optional[Union[Var[bool], bool]] = None, - strategy: Optional[ - Union[Var[Literal["fixed", "absolute"]], Literal["fixed", "absolute"]] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + button: Component | None = None, + items: list | None = None, + arrow_padding: Var[int] | int | None = None, + auto_select: Var[bool] | bool | None = None, + boundary: Var[str] | str | None = None, + close_on_blur: Var[bool] | bool | None = None, + close_on_select: Var[bool] | bool | None = None, + default_is_open: Var[bool] | bool | None = None, + direction: Literal["ltr", "rtl"] | Var[Literal["ltr", "rtl"]] | None = None, + flip: Var[bool] | bool | None = None, + gutter: Var[int] | int | None = None, + is_lazy: Var[bool] | bool | None = None, + lazy_behavior: Var[str] | str | None = None, + is_open: Var[bool] | bool | None = None, + match_width: Var[bool] | bool | None = None, + placement: Var[str] | str | None = None, + prevent_overflow: Var[bool] | bool | None = None, + strategy: Literal["absolute", "fixed"] + | Var[Literal["absolute", "fixed"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_close: EventType[()] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_open: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Menu": + ) -> Menu: """Create a menu component. Args: @@ -108,9 +99,12 @@ class Menu(ChakraComponent): placement: The placement of the popper relative to its reference. prevent_overflow: If true, will prevent the popper from being cut off and ensure it's visible within the boundary area. strategy: The CSS positioning strategy to use. ("fixed" | "absolute") + on_close: Fired when the menu is closed. + on_open: Fired when the menu is opened. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -119,60 +113,44 @@ class Menu(ChakraComponent): Returns: The menu component. """ - ... class MenuButton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - variant: Optional[Union[Var[str], str]] = None, - as_: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + variant: Var[str] | str | None = None, + as_: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "MenuButton": - """Create the component. + ) -> MenuButton: + """Create a new Chakra component. Args: *children: The children of the component. @@ -181,66 +159,51 @@ class MenuButton(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class MenuList(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - items: Optional[list] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + items: list | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "MenuList": + ) -> MenuList: """Create a MenuList component, and automatically wrap in MenuItem if not already one. Args: @@ -249,6 +212,7 @@ class MenuList(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -257,63 +221,47 @@ class MenuList(ChakraComponent): Returns: The MenuList component. """ - ... class MenuItem(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - close_on_select: Optional[Union[Var[bool], bool]] = None, - command: Optional[Union[Var[str], str]] = None, - command_spacing: Optional[Union[Var[int], int]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_focusable: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + close_on_select: Var[bool] | bool | None = None, + command: Var[str] | str | None = None, + command_spacing: Var[int] | int | None = None, + is_disabled: Var[bool] | bool | None = None, + is_focusable: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "MenuItem": - """Create the component. + ) -> MenuItem: + """Create a new Chakra component. Args: *children: The children of the component. @@ -325,76 +273,61 @@ class MenuItem(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class MenuItemOption(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - close_on_select: Optional[Union[Var[bool], bool]] = None, - command: Optional[Union[Var[str], str]] = None, - command_spacing: Optional[Union[Var[int], int]] = None, - is_checked: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_focusable: Optional[Union[Var[bool], bool]] = None, - type_: Optional[ - Union[Var[Literal["checkbox", "radio"]], Literal["checkbox", "radio"]] - ] = None, - value: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + close_on_select: Var[bool] | bool | None = None, + command: Var[str] | str | None = None, + command_spacing: Var[int] | int | None = None, + is_checked: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_focusable: Var[bool] | bool | None = None, + type_: Literal["checkbox", "radio"] + | Var[Literal["checkbox", "radio"]] + | None = None, + value: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "MenuItemOption": - """Create the component. + ) -> MenuItemOption: + """Create a new Chakra component. Args: *children: The children of the component. @@ -409,136 +342,106 @@ class MenuItemOption(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class MenuGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "MenuGroup": - """Create the component. + ) -> MenuGroup: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class MenuOptionGroup(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - type_: Optional[ - Union[Var[Literal["checkbox", "radio"]], Literal["checkbox", "radio"]] - ] = None, - value: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + type_: Literal["checkbox", "radio"] + | Var[Literal["checkbox", "radio"]] + | None = None, + value: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "MenuOptionGroup": - """Create the component. + ) -> MenuOptionGroup: + """Create a new Chakra component. Args: *children: The children of the component. @@ -547,78 +450,63 @@ class MenuOptionGroup(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class MenuDivider(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "MenuDivider": - """Create the component. + ) -> MenuDivider: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/overlay/modal.py b/reflex_chakra/components/overlay/modal.py index eba0b3b..26694a6 100644 --- a/reflex_chakra/components/overlay/modal.py +++ b/reflex_chakra/components/overlay/modal.py @@ -2,13 +2,14 @@ from __future__ import annotations -from typing import Literal, Optional, Union +from typing import Literal + +from reflex.components.component import Component +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent from reflex_chakra.components.media import Icon -from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.vars import Var ModalSizes = Literal["xs", "sm", "md", "lg", "xl", "full"] @@ -58,25 +59,25 @@ class Modal(ChakraComponent): use_inert: Var[bool] # Fired when the modal is closing. - on_close: EventHandler[lambda: []] + on_close: EventHandler[no_args_event_spec] # Fired when the modal is closed and the exit animation is complete. - on_close_complete: EventHandler[lambda: []] + on_close_complete: EventHandler[no_args_event_spec] # Fired when the Esc key is pressed. - on_esc: EventHandler[lambda: []] + on_esc: EventHandler[no_args_event_spec] # Fired when the overlay is clicked. - on_overlay_click: EventHandler[lambda: []] + on_overlay_click: EventHandler[no_args_event_spec] @classmethod def create( cls, *children, - header: Optional[Union[Component, str]] = None, - body: Optional[Union[Component, str]] = None, - footer: Optional[Union[Component, str]] = None, - close_button: Optional[Component] = None, + header: Component | str | None = None, + body: Component | str | None = None, + footer: Component | str | None = None, + close_button: Component | None = None, **props, ) -> Component: """Create a modal component. @@ -117,9 +118,8 @@ def create( close_button = Icon.create(tag="close") contents.append(ModalCloseButton.create(close_button)) elif close_button: - raise AttributeError( - "Close button can not be used if on_close event handler is not defined" - ) + msg = "Close button can not be used if on_close event handler is not defined" + raise AttributeError(msg) children = [ ModalOverlay.create( diff --git a/reflex_chakra/components/overlay/modal.pyi b/reflex_chakra/components/overlay/modal.pyi index 0b2cb26..f7b6676 100644 --- a/reflex_chakra/components/overlay/modal.pyi +++ b/reflex_chakra/components/overlay/modal.pyi @@ -1,97 +1,84 @@ -"""Stub file for reflex/components/chakra/overlay/modal.py""" +"""Stub file for reflex_chakra/components/overlay/modal.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, + TypeAlias, +) -from reflex_chakra.components import ChakraComponent from reflex.components.component import Component -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var + +from reflex_chakra.components import ChakraComponent -ModalSizes = Literal["xs", "sm", "md", "lg", "xl", "full"] +ModalSizes: TypeAlias = Literal["xs", "sm", "md", "lg", "xl", "full"] class Modal(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - header: Optional[Union[Component, str]] = None, - body: Optional[Union[Component, str]] = None, - footer: Optional[Union[Component, str]] = None, - close_button: Optional[Component] = None, - is_open: Optional[Union[Var[bool], bool]] = None, - allow_pinch_zoom: Optional[Union[Var[bool], bool]] = None, - auto_focus: Optional[Union[Var[bool], bool]] = None, - block_scroll_on_mount: Optional[Union[Var[bool], bool]] = None, - close_on_esc: Optional[Union[Var[bool], bool]] = None, - close_on_overlay_click: Optional[Union[Var[bool], bool]] = None, - is_centered: Optional[Union[Var[bool], bool]] = None, - lock_focus_across_frames: Optional[Union[Var[bool], bool]] = None, - motion_preset: Optional[Union[Var[str], str]] = None, - preserve_scroll_bar_gap: Optional[Union[Var[bool], bool]] = None, - return_focus_on_close: Optional[Union[Var[bool], bool]] = None, - size: Optional[ - Union[ - Var[Literal["xs", "sm", "md", "lg", "xl", "full"]], - Literal["xs", "sm", "md", "lg", "xl", "full"], - ] - ] = None, - use_inert: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close_complete: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_esc: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_overlay_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + header: Component | str | None = None, + body: Component | str | None = None, + footer: Component | str | None = None, + close_button: Component | None = None, + is_open: Var[bool] | bool | None = None, + allow_pinch_zoom: Var[bool] | bool | None = None, + auto_focus: Var[bool] | bool | None = None, + block_scroll_on_mount: Var[bool] | bool | None = None, + close_on_esc: Var[bool] | bool | None = None, + close_on_overlay_click: Var[bool] | bool | None = None, + is_centered: Var[bool] | bool | None = None, + lock_focus_across_frames: Var[bool] | bool | None = None, + motion_preset: Var[str] | str | None = None, + preserve_scroll_bar_gap: Var[bool] | bool | None = None, + return_focus_on_close: Var[bool] | bool | None = None, + size: Literal["full", "lg", "md", "sm", "xl", "xs"] + | Var[Literal["full", "lg", "md", "sm", "xl", "xs"]] + | None = None, + use_inert: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_close: EventType[()] | None = None, + on_close_complete: EventType[()] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_esc: EventType[()] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_overlay_click: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Modal": + ) -> Modal: """Create a modal component. Args: @@ -113,9 +100,14 @@ class Modal(ChakraComponent): return_focus_on_close: If true, the modal will return focus to the element that triggered it when it closes. size: "xs" | "sm" | "md" | "lg" | "xl" | "full" use_inert: 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** + on_close: Fired when the modal is closing. + on_close_complete: Fired when the modal is closed and the exit animation is complete. + on_esc: Fired when the Esc key is pressed. + on_overlay_click: Fired when the overlay is clicked. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -127,400 +119,309 @@ class Modal(ChakraComponent): Returns: The modal component. """ - ... class ModalOverlay(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ModalOverlay": - """Create the component. + ) -> ModalOverlay: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ModalHeader(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ModalHeader": - """Create the component. + ) -> ModalHeader: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ModalFooter(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ModalFooter": - """Create the component. + ) -> ModalFooter: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ModalContent(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ModalContent": - """Create the component. + ) -> ModalContent: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ModalBody(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ModalBody": - """Create the component. + ) -> ModalBody: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class ModalCloseButton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "ModalCloseButton": - """Create the component. + ) -> ModalCloseButton: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/overlay/popover.py b/reflex_chakra/components/overlay/popover.py index 535e475..2c823b2 100644 --- a/reflex_chakra/components/overlay/popover.py +++ b/reflex_chakra/components/overlay/popover.py @@ -2,15 +2,16 @@ from __future__ import annotations +from reflex.components.component import Component +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var + from reflex_chakra.components import ( ChakraComponent, LiteralChakraDirection, LiteralMenuStrategy, LiteralPopOverTrigger, ) -from reflex.components.component import Component -from reflex.event import EventHandler -from reflex.vars import Var class Popover(ChakraComponent): @@ -82,10 +83,10 @@ class Popover(ChakraComponent): trigger: Var[LiteralPopOverTrigger] # Fired when the popover is closed. - on_close: EventHandler[lambda: []] + on_close: EventHandler[no_args_event_spec] # Fired when the popover is opened. - on_open: EventHandler[lambda: []] + on_open: EventHandler[no_args_event_spec] @classmethod def create( diff --git a/reflex_chakra/components/overlay/popover.pyi b/reflex_chakra/components/overlay/popover.pyi index f842800..befa3f9 100644 --- a/reflex_chakra/components/overlay/popover.pyi +++ b/reflex_chakra/components/overlay/popover.pyi @@ -1,21 +1,28 @@ -"""Stub file for reflex/components/chakra/overlay/popover.py""" +"""Stub file for reflex_chakra/components/overlay/popover.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ( ChakraComponent, ) -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Popover(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, trigger=None, @@ -23,75 +30,59 @@ class Popover(ChakraComponent): body=None, footer=None, use_close_button=False, - arrow_padding: Optional[Union[Var[int], int]] = None, - arrow_shadow_color: Optional[Union[Var[str], str]] = None, - arrow_size: Optional[Union[Var[int], int]] = None, - auto_focus: Optional[Union[Var[bool], bool]] = None, - boundary: Optional[Union[Var[str], str]] = None, - close_on_blur: Optional[Union[Var[bool], bool]] = None, - close_on_esc: Optional[Union[Var[bool], bool]] = None, - default_is_open: Optional[Union[Var[bool], bool]] = None, - direction: Optional[ - Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]] - ] = None, - flip: Optional[Union[Var[bool], bool]] = None, - gutter: Optional[Union[Var[int], int]] = None, - id_: Optional[Union[Var[str], str]] = None, - is_lazy: Optional[Union[Var[bool], bool]] = None, - lazy_behavior: Optional[Union[Var[str], str]] = None, - is_open: Optional[Union[Var[bool], bool]] = None, - match_width: Optional[Union[Var[bool], bool]] = None, - placement: Optional[Union[Var[str], str]] = None, - prevent_overflow: Optional[Union[Var[bool], bool]] = None, - return_focus_on_close: Optional[Union[Var[bool], bool]] = None, - strategy: Optional[ - Union[Var[Literal["fixed", "absolute"]], Literal["fixed", "absolute"]] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + arrow_padding: Var[int] | int | None = None, + arrow_shadow_color: Var[str] | str | None = None, + arrow_size: Var[int] | int | None = None, + auto_focus: Var[bool] | bool | None = None, + boundary: Var[str] | str | None = None, + close_on_blur: Var[bool] | bool | None = None, + close_on_esc: Var[bool] | bool | None = None, + default_is_open: Var[bool] | bool | None = None, + direction: Literal["ltr", "rtl"] | Var[Literal["ltr", "rtl"]] | None = None, + flip: Var[bool] | bool | None = None, + gutter: Var[int] | int | None = None, + id_: Var[str] | str | None = None, + is_lazy: Var[bool] | bool | None = None, + lazy_behavior: Var[str] | str | None = None, + is_open: Var[bool] | bool | None = None, + match_width: Var[bool] | bool | None = None, + placement: Var[str] | str | None = None, + prevent_overflow: Var[bool] | bool | None = None, + return_focus_on_close: Var[bool] | bool | None = None, + strategy: Literal["absolute", "fixed"] + | Var[Literal["absolute", "fixed"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_close: EventType[()] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_open: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Popover": + ) -> Popover: """Create a popover component. Args: @@ -121,9 +112,12 @@ class Popover(ChakraComponent): prevent_overflow: If true, will prevent the popper from being cut off and ensure it's visible within the boundary area. return_focus_on_close: If true, focus will be returned to the element that triggers the popover when it closes strategy: The CSS positioning strategy to use. ("fixed" | "absolute") + on_close: Fired when the popover is closed. + on_open: Fired when the popover is opened. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute @@ -132,532 +126,411 @@ class Popover(ChakraComponent): Returns: The popover component. """ - ... class PopoverContent(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverContent": - """Create the component. + ) -> PopoverContent: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class PopoverHeader(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverHeader": - """Create the component. + ) -> PopoverHeader: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class PopoverFooter(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverFooter": - """Create the component. + ) -> PopoverFooter: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class PopoverBody(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverBody": - """Create the component. + ) -> PopoverBody: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class PopoverArrow(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverArrow": - """Create the component. + ) -> PopoverArrow: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class PopoverCloseButton(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverCloseButton": - """Create the component. + ) -> PopoverCloseButton: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class PopoverAnchor(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverAnchor": - """Create the component. + ) -> PopoverAnchor: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... class PopoverTrigger(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "PopoverTrigger": - """Create the component. + ) -> PopoverTrigger: + """Create a new Chakra component. Args: *children: The children of the component. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/overlay/tooltip.py b/reflex_chakra/components/overlay/tooltip.py index a4368fc..6130a5c 100644 --- a/reflex_chakra/components/overlay/tooltip.py +++ b/reflex_chakra/components/overlay/tooltip.py @@ -2,9 +2,10 @@ from __future__ import annotations +from reflex.event import EventHandler, no_args_event_spec +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent, LiteralChakraDirection -from reflex.event import EventHandler -from reflex.vars import Var class Tooltip(ChakraComponent): @@ -64,7 +65,7 @@ class Tooltip(ChakraComponent): should_wrap_children: Var[bool] # Fired when the tooltip is closing. - on_close: EventHandler[lambda: []] + on_close: EventHandler[no_args_event_spec] # Fired when the tooltip is opened. - on_open: EventHandler[lambda: []] + on_open: EventHandler[no_args_event_spec] diff --git a/reflex_chakra/components/overlay/tooltip.pyi b/reflex_chakra/components/overlay/tooltip.pyi index b60c5b4..6696e82 100644 --- a/reflex_chakra/components/overlay/tooltip.pyi +++ b/reflex_chakra/components/overlay/tooltip.pyi @@ -1,86 +1,77 @@ -"""Stub file for reflex/components/chakra/overlay/tooltip.py""" +"""Stub file for reflex_chakra/components/overlay/tooltip.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Tooltip(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - arrow_padding: Optional[Union[Var[int], int]] = None, - arrow_shadow_color: Optional[Union[Var[str], str]] = None, - arrow_size: Optional[Union[Var[int], int]] = None, - delay: Optional[Union[Var[int], int]] = None, - close_on_click: Optional[Union[Var[bool], bool]] = None, - close_on_esc: Optional[Union[Var[bool], bool]] = None, - close_on_mouse_down: Optional[Union[Var[bool], bool]] = None, - default_is_open: Optional[Union[Var[bool], bool]] = None, - direction: Optional[ - Union[Var[Literal["ltr", "rtl"]], Literal["ltr", "rtl"]] - ] = None, - gutter: Optional[Union[Var[int], int]] = None, - has_arrow: Optional[Union[Var[bool], bool]] = None, - is_disabled: Optional[Union[Var[bool], bool]] = None, - is_open: Optional[Union[Var[bool], bool]] = None, - label: Optional[Union[Var[str], str]] = None, - open_delay: Optional[Union[Var[int], int]] = None, - placement: Optional[Union[Var[str], str]] = None, - should_wrap_children: Optional[Union[Var[bool], bool]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_close: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_open: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + arrow_padding: Var[int] | int | None = None, + arrow_shadow_color: Var[str] | str | None = None, + arrow_size: Var[int] | int | None = None, + delay: Var[int] | int | None = None, + close_on_click: Var[bool] | bool | None = None, + close_on_esc: Var[bool] | bool | None = None, + close_on_mouse_down: Var[bool] | bool | None = None, + default_is_open: Var[bool] | bool | None = None, + direction: Literal["ltr", "rtl"] | Var[Literal["ltr", "rtl"]] | None = None, + gutter: Var[int] | int | None = None, + has_arrow: Var[bool] | bool | None = None, + is_disabled: Var[bool] | bool | None = None, + is_open: Var[bool] | bool | None = None, + label: Var[str] | str | None = None, + open_delay: Var[int] | int | None = None, + placement: Var[str] | str | None = None, + should_wrap_children: Var[bool] | bool | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_close: EventType[()] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_open: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Tooltip": - """Create the component. + ) -> Tooltip: + """Create a new Chakra component. Args: *children: The children of the component. @@ -101,15 +92,17 @@ class Tooltip(ChakraComponent): open_delay: Delay (in ms) before showing the tooltip placement: The placement of the popper relative to its reference. should_wrap_children: If true, the tooltip will wrap its children in a `` with `tabIndex=0` + on_close: Fired when the tooltip is closing. + on_open: Fired when the tooltip is opened. style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/typography/__init__.py b/reflex_chakra/components/typography/__init__.py index be06b13..64022d3 100644 --- a/reflex_chakra/components/typography/__init__.py +++ b/reflex_chakra/components/typography/__init__.py @@ -1,10 +1,8 @@ """Typography components.""" -from reflex.components.component import Component - from .heading import Heading from .highlight import Highlight from .span import Span from .text import Text -__all__ = [f for f in dir() if f[0].isupper() or f in ("span",)] # type: ignore +__all__ = ["Heading", "Highlight", "Span", "Text"] diff --git a/reflex_chakra/components/typography/heading.py b/reflex_chakra/components/typography/heading.py index f1ce0d3..688e5ee 100644 --- a/reflex_chakra/components/typography/heading.py +++ b/reflex_chakra/components/typography/heading.py @@ -1,7 +1,8 @@ """A heading component.""" +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent, LiteralHeadingSize -from reflex.vars import Var class Heading(ChakraComponent): diff --git a/reflex_chakra/components/typography/heading.pyi b/reflex_chakra/components/typography/heading.pyi index 01eea6b..c97fa6d 100644 --- a/reflex_chakra/components/typography/heading.pyi +++ b/reflex_chakra/components/typography/heading.pyi @@ -1,72 +1,62 @@ -"""Stub file for reflex/components/chakra/typography/heading.py""" +"""Stub file for reflex_chakra/components/typography/heading.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Literal, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, + Literal, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Heading(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - as_: Optional[Union[Var[str], str]] = None, - size: Optional[ - Union[ - Var[Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"]], - Literal["lg", "md", "sm", "xs", "xl", "2xl", "3xl", "4xl"], - ] - ] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + as_: Var[str] | str | None = None, + size: Literal["2xl", "3xl", "4xl", "lg", "md", "sm", "xl", "xs"] + | Var[Literal["2xl", "3xl", "4xl", "lg", "md", "sm", "xl", "xs"]] + | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Heading": - """Create the component. + ) -> Heading: + """Create a new Chakra component. Args: *children: The children of the component. @@ -75,12 +65,12 @@ class Heading(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/typography/highlight.py b/reflex_chakra/components/typography/highlight.py index 55c1a8f..a01adc2 100644 --- a/reflex_chakra/components/typography/highlight.py +++ b/reflex_chakra/components/typography/highlight.py @@ -1,10 +1,9 @@ """A highlight component.""" -from typing import Dict, List +from reflex.components.tags.tag import Tag +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.components.tags import Tag -from reflex.vars import Var class Highlight(ChakraComponent): @@ -13,11 +12,13 @@ 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: Var[list[str]] # The style of the content. # Note: styles and style are different prop. - styles: Var[Dict] = {"px": "2", "py": "1", "rounded": "full", "bg": "teal.100"} # type: ignore + styles: Var[dict] = Var.create( + {"px": "2", "py": "1", "rounded": "full", "bg": "teal.100"} + ) def _render(self) -> Tag: return super()._render().add_props(styles=self.style) diff --git a/reflex_chakra/components/typography/highlight.pyi b/reflex_chakra/components/typography/highlight.pyi index 9f2f637..f8dee7f 100644 --- a/reflex_chakra/components/typography/highlight.pyi +++ b/reflex_chakra/components/typography/highlight.pyi @@ -1,67 +1,59 @@ -"""Stub file for reflex/components/chakra/typography/highlight.py""" +"""Stub file for reflex_chakra/components/typography/highlight.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, List, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Highlight(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - query: Optional[Union[Var[List[str]], List[str]]] = None, - styles: Optional[Union[Var[Dict], Dict]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + query: Var[list[str]] | list[str] | None = None, + styles: Var[dict] | dict | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Highlight": - """Create the component. + ) -> Highlight: + """Create a new Chakra component. Args: *children: The children of the component. @@ -70,12 +62,12 @@ class Highlight(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/typography/span.py b/reflex_chakra/components/typography/span.py index 4ca3832..21b299e 100644 --- a/reflex_chakra/components/typography/span.py +++ b/reflex_chakra/components/typography/span.py @@ -2,8 +2,9 @@ from __future__ import annotations +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Span(ChakraComponent): @@ -12,4 +13,4 @@ class Span(ChakraComponent): tag = "Text" # Override the tag. The default tag is ``. - as_: Var[str] = "span" # type: ignore + as_: Var[str] = Var.create("span") diff --git a/reflex_chakra/components/typography/span.pyi b/reflex_chakra/components/typography/span.pyi index 7c9272a..8c8325d 100644 --- a/reflex_chakra/components/typography/span.pyi +++ b/reflex_chakra/components/typography/span.pyi @@ -1,66 +1,58 @@ -"""Stub file for reflex/components/chakra/typography/span.py""" +"""Stub file for reflex_chakra/components/typography/span.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Span(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - as_: Optional[Union[Var[str], str]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + as_: Var[str] | str | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Span": - """Create the component. + ) -> Span: + """Create a new Chakra component. Args: *children: The children of the component. @@ -68,12 +60,12 @@ class Span(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/components/typography/text.py b/reflex_chakra/components/typography/text.py index 2923f0c..069db59 100644 --- a/reflex_chakra/components/typography/text.py +++ b/reflex_chakra/components/typography/text.py @@ -2,8 +2,9 @@ from __future__ import annotations +from reflex.vars.base import Var + from reflex_chakra.components import ChakraComponent -from reflex.vars import Var class Text(ChakraComponent): diff --git a/reflex_chakra/components/typography/text.pyi b/reflex_chakra/components/typography/text.pyi index 11a6328..881a610 100644 --- a/reflex_chakra/components/typography/text.pyi +++ b/reflex_chakra/components/typography/text.pyi @@ -1,67 +1,59 @@ -"""Stub file for reflex/components/chakra/typography/text.py""" +"""Stub file for reflex_chakra/components/typography/text.py""" # ------------------- DO NOT EDIT ---------------------- # This file was generated by `reflex/utils/pyi_generator.py`! # ------------------------------------------------------ -from typing import Any, Callable, Dict, Optional, Union, overload +from collections.abc import Mapping, Sequence +from typing import ( + Any, +) + +from reflex.components.core.breakpoints import Breakpoints +from reflex.event import ( + EventType, + PointerEventInfo, +) +from reflex.vars.base import Var from reflex_chakra.components import ChakraComponent -from reflex.event import EventHandler, EventSpec -from reflex.style import Style -from reflex.vars import Var class Text(ChakraComponent): - @overload @classmethod - def create( # type: ignore + def create( cls, *children, - as_: Optional[Union[Var[str], str]] = None, - no_of_lines: Optional[Union[Var[int], int]] = None, - style: Optional[Style] = None, - key: Optional[Any] = None, - id: Optional[Any] = None, - class_name: Optional[Any] = None, - autofocus: Optional[bool] = None, - custom_attrs: Optional[Dict[str, Union[Var, str]]] = None, - on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_context_menu: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, + as_: Var[str] | str | None = None, + no_of_lines: Var[int] | int | None = None, + style: Sequence[Mapping[str, Any]] + | Mapping[str, Any] + | Var[Mapping[str, Any]] + | Breakpoints + | None = None, + key: Any | None = None, + id: Any | None = None, + ref: Var | None = None, + class_name: Any | None = None, + autofocus: bool | None = None, + custom_attrs: dict[str, Var | Any] | None = None, + on_blur: EventType[()] | None = None, + on_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None, + on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None, + on_focus: EventType[()] | None = None, + on_mount: EventType[()] | None = None, + on_mouse_down: EventType[()] | None = None, + on_mouse_enter: EventType[()] | None = None, + on_mouse_leave: EventType[()] | None = None, + on_mouse_move: EventType[()] | None = None, + on_mouse_out: EventType[()] | None = None, + on_mouse_over: EventType[()] | None = None, + on_mouse_up: EventType[()] | None = None, + on_scroll: EventType[()] | None = None, + on_scroll_end: EventType[()] | None = None, + on_unmount: EventType[()] | None = None, **props, - ) -> "Text": - """Create the component. + ) -> Text: + """Create a new Chakra component. Args: *children: The children of the component. @@ -70,12 +62,12 @@ class Text(ChakraComponent): style: The style of the component. key: A unique key for the component. id: The id for the component. + ref: The Var to pass as the ref to the component. class_name: The class name for the component. autofocus: Whether the component should take the focus once the page is loaded custom_attrs: custom attribute - **props: The props of the component. + **props: The properties of the component. Returns: - The component. + A new Chakra component. """ - ... diff --git a/reflex_chakra/constants.py b/reflex_chakra/constants.py index a63de53..e442ce9 100644 --- a/reflex_chakra/constants.py +++ b/reflex_chakra/constants.py @@ -1,3 +1,5 @@ +"""Constants for the Reflex Chakra package.""" + from pathlib import Path ASSETS_DIR_NAME = "assets" diff --git a/regenerate_pyi.py b/regenerate_pyi.py new file mode 100644 index 0000000..f07de06 --- /dev/null +++ b/regenerate_pyi.py @@ -0,0 +1,5 @@ +"""Generate .pyi files for type hinting in Reflex Chakra components.""" + +from reflex.utils.pyi_generator import PyiGenerator + +PyiGenerator().scan_all(["reflex_chakra"]) diff --git a/uv.lock b/uv.lock index 6886df7..15a6b71 100644 --- a/uv.lock +++ b/uv.lock @@ -103,16 +103,16 @@ wheels = [ [[package]] name = "fastapi" -version = "0.115.12" +version = "0.115.13" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, { name = "starlette" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f4/55/ae499352d82338331ca1e28c7f4a63bfd09479b16395dce38cf50a39e2c2/fastapi-0.115.12.tar.gz", hash = "sha256:1e2c2a2646905f9e83d32f04a3f86aff4a286669c6c950ca95b5fd68c2602681", size = 295236, upload-time = "2025-03-23T22:55:43.822Z" } +sdist = { url = "https://files.pythonhosted.org/packages/20/64/ec0788201b5554e2a87c49af26b77a4d132f807a0fa9675257ac92c6aa0e/fastapi-0.115.13.tar.gz", hash = "sha256:55d1d25c2e1e0a0a50aceb1c8705cd932def273c102bff0b1c1da88b3c6eb307", size = 295680, upload-time = "2025-06-17T11:49:45.575Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/50/b3/b51f09c2ba432a576fe63758bddc81f78f0c6309d9e5c10d194313bf021e/fastapi-0.115.12-py3-none-any.whl", hash = "sha256:e94613d6c05e27be7ffebdd6ea5f388112e5e430c8f7d6494a9d1d88d43e814d", size = 95164, upload-time = "2025-03-23T22:55:42.101Z" }, + { url = "https://files.pythonhosted.org/packages/59/4a/e17764385382062b0edbb35a26b7cf76d71e27e456546277a42ba6545c6e/fastapi-0.115.13-py3-none-any.whl", hash = "sha256:0a0cab59afa7bab22f5eb347f8c9864b681558c278395e94035a741fc10cd865", size = 95315, upload-time = "2025-06-17T11:49:44.106Z" }, ] [[package]] @@ -395,6 +395,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, ] +[[package]] +name = "nodeenv" +version = "1.9.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/43/16/fc88b08840de0e0a72a2f9d8c6bae36be573e475a6326ae854bcc549fc45/nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f", size = 47437, upload-time = "2024-06-04T18:44:11.171Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d2/1d/1b658dbd2b9fa9c4c9f32accbfc0205d532c8c6194dc0f2a4c0428e7128a/nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9", size = 22314, upload-time = "2024-06-04T18:44:08.352Z" }, +] + [[package]] name = "packaging" version = "25.0" @@ -532,11 +541,24 @@ wheels = [ [[package]] name = "pygments" -version = "2.19.1" +version = "2.19.2" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/7c/2d/c3338d48ea6cc0feb8446d8e6937e1408088a72a39937982cc6111d17f84/pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f", size = 4968581, upload-time = "2025-01-06T17:26:30.443Z" } +sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631, upload-time = "2025-06-21T13:39:12.283Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" }, +] + +[[package]] +name = "pyright" +version = "1.1.402" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nodeenv" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/aa/04/ce0c132d00e20f2d2fb3b3e7c125264ca8b909e693841210534b1ea1752f/pyright-1.1.402.tar.gz", hash = "sha256:85a33c2d40cd4439c66aa946fd4ce71ab2f3f5b8c22ce36a623f59ac22937683", size = 3888207, upload-time = "2025-06-11T08:48:35.759Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/8a/0b/9fcc47d19c48b59121088dd6da2488a49d5f72dacf8262e2790a1d2c7d15/pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c", size = 1225293, upload-time = "2025-01-06T17:26:25.553Z" }, + { url = "https://files.pythonhosted.org/packages/fe/37/1a1c62d955e82adae588be8e374c7f77b165b6cb4203f7d581269959abbc/pyright-1.1.402-py3-none-any.whl", hash = "sha256:2c721f11869baac1884e846232800fe021c33f1b4acb3929cff321f7ea4e2982", size = 5624004, upload-time = "2025-06-11T08:48:33.998Z" }, ] [[package]] @@ -631,7 +653,7 @@ wheels = [ [[package]] name = "reflex" -version = "0.8.0a1" +version = "0.8.0a5" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "alembic" }, @@ -653,21 +675,33 @@ dependencies = [ { name = "typing-extensions" }, { name = "wrapt" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a5/17/54b428a81216f066d7f80593b75988f669a787f4eccc2d671edcc744e771/reflex-0.8.0a1.tar.gz", hash = "sha256:01916bc8dd3ef8ebf3c736e81744da7ecde23149c4de2bd81bb2014a858de927", size = 576937, upload-time = "2025-06-16T05:12:57.091Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4a/b6/89d4fa4bd314c4323150eefe1ef22d0573738a78229fc37ab6509a5e93ad/reflex-0.8.0a5.tar.gz", hash = "sha256:fd5549bf5cddc6bbc929753e9d7f784977882080ec236435c370bcfce26d7c26", size = 581218, upload-time = "2025-06-25T16:51:55.411Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/38/e1/94abaa957935c0a4a624e2592fa746aafca64f49344fb755626e1eb4f252/reflex-0.8.0a1-py3-none-any.whl", hash = "sha256:02da84fd4951dad8cc0ae40db5806d396c6d4a400c09dc7c63ff6b173decc1cd", size = 870655, upload-time = "2025-06-16T05:12:54.235Z" }, + { url = "https://files.pythonhosted.org/packages/e3/01/bbf818c5af0535b0c5202bff9a870be26437815867d3bc2d10aa18226e6d/reflex-0.8.0a5-py3-none-any.whl", hash = "sha256:4835d7e6677deab1bf9ab5e333991085add0c19e7e4456f446a3ee3113386a2d", size = 875402, upload-time = "2025-06-25T16:51:53.507Z" }, ] [[package]] name = "reflex-chakra" -version = "0.7.1" +version = "0.8.1" source = { editable = "." } dependencies = [ { name = "reflex" }, ] +[package.dev-dependencies] +dev = [ + { name = "pyright" }, + { name = "ruff" }, +] + [package.metadata] -requires-dist = [{ name = "reflex", specifier = ">=0.8.0a0" }] +requires-dist = [{ name = "reflex", specifier = ">=0.8.0.dev0" }] + +[package.metadata.requires-dev] +dev = [ + { name = "pyright" }, + { name = "ruff" }, +] [[package]] name = "reflex-hosting-cli" @@ -701,6 +735,31 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl", hash = "sha256:1c9491e1951aac09caffd42f448ee3d04e58923ffe14993f6e83068dc395d7e0", size = 243229, upload-time = "2025-03-30T14:15:12.283Z" }, ] +[[package]] +name = "ruff" +version = "0.12.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/24/90/5255432602c0b196a0da6720f6f76b93eb50baef46d3c9b0025e2f9acbf3/ruff-0.12.0.tar.gz", hash = "sha256:4d047db3662418d4a848a3fdbfaf17488b34b62f527ed6f10cb8afd78135bc5c", size = 4376101, upload-time = "2025-06-17T15:19:26.217Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e6/fd/b46bb20e14b11ff49dbc74c61de352e0dc07fb650189513631f6fb5fc69f/ruff-0.12.0-py3-none-linux_armv6l.whl", hash = "sha256:5652a9ecdb308a1754d96a68827755f28d5dfb416b06f60fd9e13f26191a8848", size = 10311554, upload-time = "2025-06-17T15:18:45.792Z" }, + { url = "https://files.pythonhosted.org/packages/e7/d3/021dde5a988fa3e25d2468d1dadeea0ae89dc4bc67d0140c6e68818a12a1/ruff-0.12.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:05ed0c914fabc602fc1f3b42c53aa219e5736cb030cdd85640c32dbc73da74a6", size = 11118435, upload-time = "2025-06-17T15:18:49.064Z" }, + { url = "https://files.pythonhosted.org/packages/07/a2/01a5acf495265c667686ec418f19fd5c32bcc326d4c79ac28824aecd6a32/ruff-0.12.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:07a7aa9b69ac3fcfda3c507916d5d1bca10821fe3797d46bad10f2c6de1edda0", size = 10466010, upload-time = "2025-06-17T15:18:51.341Z" }, + { url = "https://files.pythonhosted.org/packages/4c/57/7caf31dd947d72e7aa06c60ecb19c135cad871a0a8a251723088132ce801/ruff-0.12.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e7731c3eec50af71597243bace7ec6104616ca56dda2b99c89935fe926bdcd48", size = 10661366, upload-time = "2025-06-17T15:18:53.29Z" }, + { url = "https://files.pythonhosted.org/packages/e9/ba/aa393b972a782b4bc9ea121e0e358a18981980856190d7d2b6187f63e03a/ruff-0.12.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:952d0630eae628250ab1c70a7fffb641b03e6b4a2d3f3ec6c1d19b4ab6c6c807", size = 10173492, upload-time = "2025-06-17T15:18:55.262Z" }, + { url = "https://files.pythonhosted.org/packages/d7/50/9349ee777614bc3062fc6b038503a59b2034d09dd259daf8192f56c06720/ruff-0.12.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c021f04ea06966b02614d442e94071781c424ab8e02ec7af2f037b4c1e01cc82", size = 11761739, upload-time = "2025-06-17T15:18:58.906Z" }, + { url = "https://files.pythonhosted.org/packages/04/8f/ad459de67c70ec112e2ba7206841c8f4eb340a03ee6a5cabc159fe558b8e/ruff-0.12.0-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:7d235618283718ee2fe14db07f954f9b2423700919dc688eacf3f8797a11315c", size = 12537098, upload-time = "2025-06-17T15:19:01.316Z" }, + { url = "https://files.pythonhosted.org/packages/ed/50/15ad9c80ebd3c4819f5bd8883e57329f538704ed57bac680d95cb6627527/ruff-0.12.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0c0758038f81beec8cc52ca22de9685b8ae7f7cc18c013ec2050012862cc9165", size = 12154122, upload-time = "2025-06-17T15:19:03.727Z" }, + { url = "https://files.pythonhosted.org/packages/76/e6/79b91e41bc8cc3e78ee95c87093c6cacfa275c786e53c9b11b9358026b3d/ruff-0.12.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:139b3d28027987b78fc8d6cfb61165447bdf3740e650b7c480744873688808c2", size = 11363374, upload-time = "2025-06-17T15:19:05.875Z" }, + { url = "https://files.pythonhosted.org/packages/db/c3/82b292ff8a561850934549aa9dc39e2c4e783ab3c21debe55a495ddf7827/ruff-0.12.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68853e8517b17bba004152aebd9dd77d5213e503a5f2789395b25f26acac0da4", size = 11587647, upload-time = "2025-06-17T15:19:08.246Z" }, + { url = "https://files.pythonhosted.org/packages/2b/42/d5760d742669f285909de1bbf50289baccb647b53e99b8a3b4f7ce1b2001/ruff-0.12.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3a9512af224b9ac4757f7010843771da6b2b0935a9e5e76bb407caa901a1a514", size = 10527284, upload-time = "2025-06-17T15:19:10.37Z" }, + { url = "https://files.pythonhosted.org/packages/19/f6/fcee9935f25a8a8bba4adbae62495c39ef281256693962c2159e8b284c5f/ruff-0.12.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b08df3d96db798e5beb488d4df03011874aff919a97dcc2dd8539bb2be5d6a88", size = 10158609, upload-time = "2025-06-17T15:19:12.286Z" }, + { url = "https://files.pythonhosted.org/packages/37/fb/057febf0eea07b9384787bfe197e8b3384aa05faa0d6bd844b94ceb29945/ruff-0.12.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6a315992297a7435a66259073681bb0d8647a826b7a6de45c6934b2ca3a9ed51", size = 11141462, upload-time = "2025-06-17T15:19:15.195Z" }, + { url = "https://files.pythonhosted.org/packages/10/7c/1be8571011585914b9d23c95b15d07eec2d2303e94a03df58294bc9274d4/ruff-0.12.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:1e55e44e770e061f55a7dbc6e9aed47feea07731d809a3710feda2262d2d4d8a", size = 11641616, upload-time = "2025-06-17T15:19:17.6Z" }, + { url = "https://files.pythonhosted.org/packages/6a/ef/b960ab4818f90ff59e571d03c3f992828d4683561095e80f9ef31f3d58b7/ruff-0.12.0-py3-none-win32.whl", hash = "sha256:7162a4c816f8d1555eb195c46ae0bd819834d2a3f18f98cc63819a7b46f474fb", size = 10525289, upload-time = "2025-06-17T15:19:19.688Z" }, + { url = "https://files.pythonhosted.org/packages/34/93/8b16034d493ef958a500f17cda3496c63a537ce9d5a6479feec9558f1695/ruff-0.12.0-py3-none-win_amd64.whl", hash = "sha256:d00b7a157b8fb6d3827b49d3324da34a1e3f93492c1f97b08e222ad7e9b291e0", size = 11598311, upload-time = "2025-06-17T15:19:21.785Z" }, + { url = "https://files.pythonhosted.org/packages/d0/33/4d3e79e4a84533d6cd526bfb42c020a23256ae5e4265d858bd1287831f7d/ruff-0.12.0-py3-none-win_arm64.whl", hash = "sha256:8cd24580405ad8c1cc64d61725bca091d6b6da7eb3d36f72cc605467069d7e8b", size = 10724946, upload-time = "2025-06-17T15:19:23.952Z" }, +] + [[package]] name = "simple-websocket" version = "1.1.0"