diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 000000000..05cc10ff7
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1 @@
+@reflex-dev/reflex-team
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 4ba472338..b3966b5d0 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -2,7 +2,6 @@
name: Bug report
about: Create a report to help us improve
title: ''
-labels: bug
assignees: ''
---
diff --git a/.github/workflows/check_node_latest.yml b/.github/workflows/check_node_latest.yml
index 5910fa9ed..1cf9f6fdf 100644
--- a/.github/workflows/check_node_latest.yml
+++ b/.github/workflows/check_node_latest.yml
@@ -18,7 +18,10 @@ jobs:
strategy:
matrix:
python-version: ['3.12']
+ split_index: [1, 2]
node-version: ['node']
+ fail-fast: false
+
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup_build_env
@@ -30,11 +33,11 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: |
- poetry run uv pip install pyvirtualdisplay pillow
+ poetry run uv pip install pyvirtualdisplay pillow pytest-split
poetry run playwright install --with-deps
- run: |
poetry run pytest tests/test_node_version.py
- poetry run pytest tests/integration
+ poetry run pytest tests/integration --splits 2 --group ${{matrix.split_index}}
diff --git a/.github/workflows/check_outdated_dependencies.yml b/.github/workflows/check_outdated_dependencies.yml
index fb28bb318..fe8c42608 100644
--- a/.github/workflows/check_outdated_dependencies.yml
+++ b/.github/workflows/check_outdated_dependencies.yml
@@ -74,7 +74,7 @@ jobs:
echo "$outdated"
# Ignore 3rd party dependencies that are not updated.
- filtered_outdated=$(echo "$outdated" | grep -vE 'Package|@chakra-ui|lucide-react|@splinetool/runtime|ag-grid-react|framer-motion|react-markdown|remark-math|remark-gfm|rehype-katex|rehype-raw' || true)
+ filtered_outdated=$(echo "$outdated" | grep -vE 'Package|@chakra-ui|lucide-react|@splinetool/runtime|ag-grid-react|framer-motion|react-markdown|remark-math|remark-gfm|rehype-katex|rehype-raw|remark-unwrap-images' || true)
no_extra=$(echo "$filtered_outdated" | grep -vE '\|\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-' || true)
diff --git a/.github/workflows/integration_app_harness.yml b/.github/workflows/integration_app_harness.yml
index 9644e0a19..6ac5fe6ab 100644
--- a/.github/workflows/integration_app_harness.yml
+++ b/.github/workflows/integration_app_harness.yml
@@ -6,13 +6,13 @@ concurrency:
on:
push:
- branches: ['main']
+ branches: ["main"]
paths-ignore:
- - '**/*.md'
+ - "**/*.md"
pull_request:
- branches: ['main']
+ branches: ["main"]
paths-ignore:
- - '**/*.md'
+ - "**/*.md"
permissions:
contents: read
@@ -22,8 +22,10 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
- state_manager: ['redis', 'memory']
- python-version: ['3.11.5', '3.12.0']
+ state_manager: ["redis", "memory"]
+ split_index: [1, 2]
+ python-version: ["3.11.5", "3.12.0"]
+ fail-fast: false
runs-on: ubuntu-22.04
services:
# Label used to access the service container
@@ -45,13 +47,14 @@ jobs:
python-version: ${{ matrix.python-version }}
run-poetry-install: true
create-venv-at-path: .venv
- - run: poetry run uv pip install pyvirtualdisplay pillow
+ - run: poetry run uv pip install pyvirtualdisplay pillow pytest-split
- name: Run app harness tests
env:
- SCREENSHOT_DIR: /tmp/screenshots
+ SCREENSHOT_DIR: /tmp/screenshots/${{ matrix.state_manager }}/${{ matrix.python-version }}/${{ matrix.split_index }}
REDIS_URL: ${{ matrix.state_manager == 'redis' && 'redis://localhost:6379' || '' }}
run: |
- poetry run pytest tests/integration
+ poetry run playwright install --with-deps
+ poetry run pytest tests/integration --splits 2 --group ${{matrix.split_index}}
- uses: actions/upload-artifact@v4
name: Upload failed test screenshots
if: always()
diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml
index 106ac1383..3e22234b8 100644
--- a/.github/workflows/integration_tests.yml
+++ b/.github/workflows/integration_tests.yml
@@ -122,7 +122,7 @@ jobs:
fail-fast: false
matrix:
# Show OS combos first in GUI
- os: [ubuntu-latest, windows-latest]
+ os: [ubuntu-latest]
python-version: ['3.10.11', '3.11.4']
env:
@@ -145,7 +145,7 @@ jobs:
- name: Install Requirements for reflex-web
working-directory: ./reflex-web
- run: poetry run uv pip install -r requirements.txt
+ run: poetry run uv pip install $(grep -ivE "reflex " requirements.txt)
- name: Install additional dependencies for DB access
run: poetry run uv pip install psycopg2-binary
- name: Init Website for reflex-web
@@ -162,7 +162,36 @@ jobs:
--python-version "${{ matrix.python-version }}" --commit-sha "${{ github.sha }}"
--pr-id "${{ github.event.pull_request.id }}" --branch-name "${{ github.head_ref || github.ref_name }}"
--app-name "reflex-web" --path ./reflex-web/.web
+
+ rx-shout-from-template:
+ strategy:
+ fail-fast: false
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/setup_build_env
+ with:
+ python-version: '3.11.4'
+ run-poetry-install: true
+ create-venv-at-path: .venv
+ - name: Create app directory
+ run: mkdir rx-shout-from-template
+ - name: Init reflex-web from template
+ run: poetry run reflex init --template https://github.com/masenf/rx_shout
+ working-directory: ./rx-shout-from-template
+ - name: ignore reflex pin in requirements
+ run: sed -i -e '/reflex==/d' requirements.txt
+ working-directory: ./rx-shout-from-template
+ - name: Install additional dependencies
+ run: poetry run uv pip install -r requirements.txt
+ working-directory: ./rx-shout-from-template
+ - name: Run Website and Check for errors
+ run: |
+ # Check that npm is home
+ npm -v
+ poetry run bash scripts/integration.sh ./rx-shout-from-template prod
+
reflex-web-macos:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
strategy:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4d2e76b31..4046bad2d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,7 +3,7 @@ fail_fast: true
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
- rev: v0.6.9
+ rev: v0.7.4
hooks:
- id: ruff-format
args: [reflex, tests]
diff --git a/README.md b/README.md
index 9c965b00f..527cca980 100644
--- a/README.md
+++ b/README.md
@@ -228,7 +228,7 @@ You can create a multi-page app by adding more pages.
-📑 [Docs](https://reflex.dev/docs/getting-started/introduction) | 🗞️ [Blog](https://reflex.dev/blog) | 📱 [Component Library](https://reflex.dev/docs/library) | 🖼️ [Gallery](https://reflex.dev/docs/gallery) | 🛸 [Deployment](https://reflex.dev/docs/hosting/deploy-quick-start)
+📑 [Docs](https://reflex.dev/docs/getting-started/introduction) | 🗞️ [Blog](https://reflex.dev/blog) | 📱 [Component Library](https://reflex.dev/docs/library) | 🖼️ [Templates](https://reflex.dev/templates/) | 🛸 [Deployment](https://reflex.dev/docs/hosting/deploy-quick-start)
diff --git a/benchmarks/benchmark_lighthouse.py b/benchmarks/benchmark_lighthouse.py
index 25d5eaac4..d428c16e6 100644
--- a/benchmarks/benchmark_lighthouse.py
+++ b/benchmarks/benchmark_lighthouse.py
@@ -42,8 +42,7 @@ def get_lighthouse_scores(directory_path: str | Path) -> dict:
try:
for filename in directory_path.iterdir():
if filename.suffix == ".json" and filename.stem != "manifest":
- file_path = directory_path / filename
- data = json.loads(file_path.read_text())
+ data = json.loads(filename.read_text())
# Extract scores and add them to the dictionary with the filename as key
scores[data["finalUrl"].replace("http://localhost:3000/", "/")] = {
"performance_score": data["categories"]["performance"]["score"],
diff --git a/benchmarks/test_benchmark_compile_pages.py b/benchmarks/test_benchmark_compile_pages.py
index 4448bca45..292882b74 100644
--- a/benchmarks/test_benchmark_compile_pages.py
+++ b/benchmarks/test_benchmark_compile_pages.py
@@ -210,9 +210,9 @@ def app_with_one_page(
Yields:
an AppHarness instance
"""
- root = tmp_path_factory.mktemp(f"app1")
+ root = tmp_path_factory.mktemp("app1")
- yield AppHarness.create(root=root, app_source=AppWithOnePage) # type: ignore
+ yield AppHarness.create(root=root, app_source=AppWithOnePage)
@pytest.fixture(scope="session")
@@ -227,7 +227,7 @@ def app_with_ten_pages(
Yields:
an AppHarness instance
"""
- root = tmp_path_factory.mktemp(f"app10")
+ root = tmp_path_factory.mktemp("app10")
yield AppHarness.create(
root=root,
app_source=functools.partial(
@@ -249,7 +249,7 @@ def app_with_hundred_pages(
Yields:
an AppHarness instance
"""
- root = tmp_path_factory.mktemp(f"app100")
+ root = tmp_path_factory.mktemp("app100")
yield AppHarness.create(
root=root,
@@ -272,11 +272,11 @@ def app_with_thousand_pages(
Yields:
an AppHarness instance
"""
- root = tmp_path_factory.mktemp(f"app1000")
+ root = tmp_path_factory.mktemp("app1000")
yield AppHarness.create(
root=root,
- app_source=functools.partial( # type: ignore
+ app_source=functools.partial(
AppWithThousandPages,
render_comp=render_multiple_pages, # type: ignore
),
@@ -295,7 +295,7 @@ def app_with_ten_thousand_pages(
Yields:
running AppHarness instance
"""
- root = tmp_path_factory.mktemp(f"app10000")
+ root = tmp_path_factory.mktemp("app10000")
yield AppHarness.create(
root=root,
diff --git a/docker-example/production-app-platform/Dockerfile b/docker-example/production-app-platform/Dockerfile
index b0f6c69fc..3dd9f1fed 100644
--- a/docker-example/production-app-platform/Dockerfile
+++ b/docker-example/production-app-platform/Dockerfile
@@ -25,7 +25,7 @@
# Stage 1: init
FROM python:3.11 as init
-ARG uv=/root/.cargo/bin/uv
+ARG uv=/root/.local/bin/uv
# Install `uv` for faster package boostrapping
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
diff --git a/docker-example/production-compose/Dockerfile b/docker-example/production-compose/Dockerfile
index f73473df7..42345af40 100644
--- a/docker-example/production-compose/Dockerfile
+++ b/docker-example/production-compose/Dockerfile
@@ -4,7 +4,7 @@
# Stage 1: init
FROM python:3.11 as init
-ARG uv=/root/.cargo/bin/uv
+ARG uv=/root/.local/bin/uv
# Install `uv` for faster package boostrapping
ADD --chmod=755 https://astral.sh/uv/install.sh /install.sh
diff --git a/poetry.lock b/poetry.lock
index 144547342..7d46e4199 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -2,13 +2,13 @@
[[package]]
name = "alembic"
-version = "1.13.3"
+version = "1.14.0"
description = "A database migration tool for SQLAlchemy."
optional = false
python-versions = ">=3.8"
files = [
- {file = "alembic-1.13.3-py3-none-any.whl", hash = "sha256:908e905976d15235fae59c9ac42c4c5b75cfcefe3d27c0fbf7ae15a37715d80e"},
- {file = "alembic-1.13.3.tar.gz", hash = "sha256:203503117415561e203aa14541740643a611f641517f0209fcae63e9fa09f1a2"},
+ {file = "alembic-1.14.0-py3-none-any.whl", hash = "sha256:99bd884ca390466db5e27ffccff1d179ec5c05c965cfefc0607e69f9e411cb25"},
+ {file = "alembic-1.14.0.tar.gz", hash = "sha256:b00892b53b3642d0b8dbedba234dbf1924b69be83a9a769d5a624b01094e304b"},
]
[package.dependencies]
@@ -32,13 +32,13 @@ files = [
[[package]]
name = "anyio"
-version = "4.6.0"
+version = "4.6.2.post1"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
optional = false
python-versions = ">=3.9"
files = [
- {file = "anyio-4.6.0-py3-none-any.whl", hash = "sha256:c7d2e9d63e31599eeb636c8c5c03a7e108d73b345f064f1c19fdc87b79036a9a"},
- {file = "anyio-4.6.0.tar.gz", hash = "sha256:137b4559cbb034c477165047febb6ff83f390fc3b20bf181c1fc0a728cb8beeb"},
+ {file = "anyio-4.6.2.post1-py3-none-any.whl", hash = "sha256:6d170c36fba3bdd840c73d3868c1e777e33676a69c3a72cf0a0d5d6d8009b61d"},
+ {file = "anyio-4.6.2.post1.tar.gz", hash = "sha256:4c8bc31ccdb51c7f7bd251f51c609e038d63e34219b44aa86e47576389880b4c"},
]
[package.dependencies]
@@ -49,18 +49,18 @@ typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""}
[package.extras]
doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"]
-test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.21.0b1)"]
+test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"]
trio = ["trio (>=0.26.1)"]
[[package]]
name = "async-timeout"
-version = "4.0.3"
+version = "5.0.1"
description = "Timeout context manager for asyncio programs"
optional = false
-python-versions = ">=3.7"
+python-versions = ">=3.8"
files = [
- {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"},
- {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"},
+ {file = "async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c"},
+ {file = "async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3"},
]
[[package]]
@@ -247,101 +247,116 @@ files = [
[[package]]
name = "charset-normalizer"
-version = "3.3.2"
+version = "3.4.0"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
optional = false
python-versions = ">=3.7.0"
files = [
- {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-win32.whl", hash = "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73"},
- {file = "charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"},
- {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"},
- {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-win32.whl", hash = "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4"},
- {file = "charset_normalizer-3.3.2-cp37-cp37m-win_amd64.whl", hash = "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-win32.whl", hash = "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25"},
- {file = "charset_normalizer-3.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-win32.whl", hash = "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f"},
- {file = "charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d"},
- {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5ed2e36c3e9b4f21dd9422f6893dec0abf2cca553af509b10cd630f878d3eb99"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40d3ff7fc90b98c637bda91c89d51264a3dcf210cade3a2c6f838c7268d7a4ca"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1110e22af8ca26b90bd6364fe4c763329b0ebf1ee213ba32b68c73de5752323d"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:86f4e8cca779080f66ff4f191a685ced73d2f72d50216f7112185dc02b90b9b7"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f683ddc7eedd742e2889d2bfb96d69573fde1d92fcb811979cdb7165bb9c7d3"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:27623ba66c183eca01bf9ff833875b459cad267aeeb044477fedac35e19ba907"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f606a1881d2663630ea5b8ce2efe2111740df4b687bd78b34a8131baa007f79b"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0b309d1747110feb25d7ed6b01afdec269c647d382c857ef4663bbe6ad95a912"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:136815f06a3ae311fae551c3df1f998a1ebd01ddd424aa5603a4336997629e95"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:14215b71a762336254351b00ec720a8e85cada43b987da5a042e4ce3e82bd68e"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:79983512b108e4a164b9c8d34de3992f76d48cadc9554c9e60b43f308988aabe"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-win32.whl", hash = "sha256:c94057af19bc953643a33581844649a7fdab902624d2eb739738a30e2b3e60fc"},
+ {file = "charset_normalizer-3.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:55f56e2ebd4e3bc50442fbc0888c9d8c94e4e06a933804e2af3e89e2f9c1c749"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-win32.whl", hash = "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99"},
+ {file = "charset_normalizer-3.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-win32.whl", hash = "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7"},
+ {file = "charset_normalizer-3.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-win32.whl", hash = "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67"},
+ {file = "charset_normalizer-3.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dbe03226baf438ac4fda9e2d0715022fd579cb641c4cf639fa40d53b2fe6f3e2"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd9a8bd8900e65504a305bf8ae6fa9fbc66de94178c420791d0293702fce2df7"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8831399554b92b72af5932cdbbd4ddc55c55f631bb13ff8fe4e6536a06c5c51"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a14969b8691f7998e74663b77b4c36c0337cb1df552da83d5c9004a93afdb574"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcaf7c1524c0542ee2fc82cc8ec337f7a9f7edee2532421ab200d2b920fc97cf"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:425c5f215d0eecee9a56cdb703203dda90423247421bf0d67125add85d0c4455"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:d5b054862739d276e09928de37c79ddeec42a6e1bfc55863be96a36ba22926f6"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:f3e73a4255342d4eb26ef6df01e3962e73aa29baa3124a8e824c5d3364a65748"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:2f6c34da58ea9c1a9515621f4d9ac379871a8f21168ba1b5e09d74250de5ad62"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:f09cb5a7bbe1ecae6e87901a2eb23e0256bb524a79ccc53eb0b7629fbe7677c4"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-win32.whl", hash = "sha256:9c98230f5042f4945f957d006edccc2af1e03ed5e37ce7c373f00a5a4daa6149"},
+ {file = "charset_normalizer-3.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:62f60aebecfc7f4b82e3f639a7d1433a20ec32824db2199a11ad4f5e146ef5ee"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:af73657b7a68211996527dbfeffbb0864e043d270580c5aef06dc4b659a4b578"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cab5d0b79d987c67f3b9e9c53f54a61360422a5a0bc075f43cab5621d530c3b6"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9289fd5dddcf57bab41d044f1756550f9e7cf0c8e373b8cdf0ce8773dc4bd417"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b493a043635eb376e50eedf7818f2f322eabbaa974e948bd8bdd29eb7ef2a51"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fa2566ca27d67c86569e8c85297aaf413ffab85a8960500f12ea34ff98e4c41"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8e538f46104c815be19c975572d74afb53f29650ea2025bbfaef359d2de2f7f"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fd30dc99682dc2c603c2b315bded2799019cea829f8bf57dc6b61efde6611c8"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2006769bd1640bdf4d5641c69a3d63b71b81445473cac5ded39740a226fa88ab"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:dc15e99b2d8a656f8e666854404f1ba54765871104e50c8e9813af8a7db07f12"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:ab2e5bef076f5a235c3774b4f4028a680432cded7cad37bba0fd90d64b187d19"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:4ec9dd88a5b71abfc74e9df5ebe7921c35cbb3b641181a531ca65cdb5e8e4dea"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:43193c5cda5d612f247172016c4bb71251c784d7a4d9314677186a838ad34858"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:aa693779a8b50cd97570e5a0f343538a8dbd3e496fa5dcb87e29406ad0299654"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-win32.whl", hash = "sha256:7706f5850360ac01d80c89bcef1640683cc12ed87f42579dab6c5d3ed6888613"},
+ {file = "charset_normalizer-3.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:c3e446d253bd88f6377260d07c895816ebf33ffffd56c1c792b13bff9c3e1ade"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:980b4f289d1d90ca5efcf07958d3eb38ed9c0b7676bf2831a54d4f66f9c27dfa"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f28f891ccd15c514a0981f3b9db9aa23d62fe1a99997512b0491d2ed323d229a"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8aacce6e2e1edcb6ac625fb0f8c3a9570ccc7bfba1f63419b3769ccf6a00ed0"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd7af3717683bea4c87acd8c0d3d5b44d56120b26fd3f8a692bdd2d5260c620a"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5ff2ed8194587faf56555927b3aa10e6fb69d931e33953943bc4f837dfee2242"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e91f541a85298cf35433bf66f3fab2a4a2cff05c127eeca4af174f6d497f0d4b"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:309a7de0a0ff3040acaebb35ec45d18db4b28232f21998851cfa709eeff49d62"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:285e96d9d53422efc0d7a17c60e59f37fbf3dfa942073f666db4ac71e8d726d0"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:5d447056e2ca60382d460a604b6302d8db69476fd2015c81e7c35417cfabe4cd"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:20587d20f557fe189b7947d8e7ec5afa110ccf72a3128d61a2a387c3313f46be"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:130272c698667a982a5d0e626851ceff662565379baf0ff2cc58067b81d4f11d"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ab22fbd9765e6954bc0bcff24c25ff71dcbfdb185fcdaca49e81bac68fe724d3"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7782afc9b6b42200f7362858f9e73b1f8316afb276d316336c0ec3bd73312742"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-win32.whl", hash = "sha256:2de62e8801ddfff069cd5c504ce3bc9672b23266597d4e4f50eda28846c322f2"},
+ {file = "charset_normalizer-3.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:95c3c157765b031331dd4db3c775e58deaee050a3042fcad72cbc4189d7c8dca"},
+ {file = "charset_normalizer-3.4.0-py3-none-any.whl", hash = "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079"},
+ {file = "charset_normalizer-3.4.0.tar.gz", hash = "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"},
]
[[package]]
@@ -371,83 +386,73 @@ files = [
[[package]]
name = "coverage"
-version = "7.6.1"
+version = "7.6.7"
description = "Code coverage measurement for Python"
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.9"
files = [
- {file = "coverage-7.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b06079abebbc0e89e6163b8e8f0e16270124c154dc6e4a47b413dd538859af16"},
- {file = "coverage-7.6.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cf4b19715bccd7ee27b6b120e7e9dd56037b9c0681dcc1adc9ba9db3d417fa36"},
- {file = "coverage-7.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61c0abb4c85b095a784ef23fdd4aede7a2628478e7baba7c5e3deba61070a02"},
- {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd21f6ae3f08b41004dfb433fa895d858f3f5979e7762d052b12aef444e29afc"},
- {file = "coverage-7.6.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f59d57baca39b32db42b83b2a7ba6f47ad9c394ec2076b084c3f029b7afca23"},
- {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:a1ac0ae2b8bd743b88ed0502544847c3053d7171a3cff9228af618a068ed9c34"},
- {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e6a08c0be454c3b3beb105c0596ebdc2371fab6bb90c0c0297f4e58fd7e1012c"},
- {file = "coverage-7.6.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f5796e664fe802da4f57a168c85359a8fbf3eab5e55cd4e4569fbacecc903959"},
- {file = "coverage-7.6.1-cp310-cp310-win32.whl", hash = "sha256:7bb65125fcbef8d989fa1dd0e8a060999497629ca5b0efbca209588a73356232"},
- {file = "coverage-7.6.1-cp310-cp310-win_amd64.whl", hash = "sha256:3115a95daa9bdba70aea750db7b96b37259a81a709223c8448fa97727d546fe0"},
- {file = "coverage-7.6.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7dea0889685db8550f839fa202744652e87c60015029ce3f60e006f8c4462c93"},
- {file = "coverage-7.6.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ed37bd3c3b063412f7620464a9ac1314d33100329f39799255fb8d3027da50d3"},
- {file = "coverage-7.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d85f5e9a5f8b73e2350097c3756ef7e785f55bd71205defa0bfdaf96c31616ff"},
- {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bc572be474cafb617672c43fe989d6e48d3c83af02ce8de73fff1c6bb3c198d"},
- {file = "coverage-7.6.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c0420b573964c760df9e9e86d1a9a622d0d27f417e1a949a8a66dd7bcee7bc6"},
- {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1f4aa8219db826ce6be7099d559f8ec311549bfc4046f7f9fe9b5cea5c581c56"},
- {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:fc5a77d0c516700ebad189b587de289a20a78324bc54baee03dd486f0855d234"},
- {file = "coverage-7.6.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b48f312cca9621272ae49008c7f613337c53fadca647d6384cc129d2996d1133"},
- {file = "coverage-7.6.1-cp311-cp311-win32.whl", hash = "sha256:1125ca0e5fd475cbbba3bb67ae20bd2c23a98fac4e32412883f9bcbaa81c314c"},
- {file = "coverage-7.6.1-cp311-cp311-win_amd64.whl", hash = "sha256:8ae539519c4c040c5ffd0632784e21b2f03fc1340752af711f33e5be83a9d6c6"},
- {file = "coverage-7.6.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:95cae0efeb032af8458fc27d191f85d1717b1d4e49f7cb226cf526ff28179778"},
- {file = "coverage-7.6.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5621a9175cf9d0b0c84c2ef2b12e9f5f5071357c4d2ea6ca1cf01814f45d2391"},
- {file = "coverage-7.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:260933720fdcd75340e7dbe9060655aff3af1f0c5d20f46b57f262ab6c86a5e8"},
- {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07e2ca0ad381b91350c0ed49d52699b625aab2b44b65e1b4e02fa9df0e92ad2d"},
- {file = "coverage-7.6.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c44fee9975f04b33331cb8eb272827111efc8930cfd582e0320613263ca849ca"},
- {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:877abb17e6339d96bf08e7a622d05095e72b71f8afd8a9fefc82cf30ed944163"},
- {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:3e0cadcf6733c09154b461f1ca72d5416635e5e4ec4e536192180d34ec160f8a"},
- {file = "coverage-7.6.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c3c02d12f837d9683e5ab2f3d9844dc57655b92c74e286c262e0fc54213c216d"},
- {file = "coverage-7.6.1-cp312-cp312-win32.whl", hash = "sha256:e05882b70b87a18d937ca6768ff33cc3f72847cbc4de4491c8e73880766718e5"},
- {file = "coverage-7.6.1-cp312-cp312-win_amd64.whl", hash = "sha256:b5d7b556859dd85f3a541db6a4e0167b86e7273e1cdc973e5b175166bb634fdb"},
- {file = "coverage-7.6.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a4acd025ecc06185ba2b801f2de85546e0b8ac787cf9d3b06e7e2a69f925b106"},
- {file = "coverage-7.6.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a6d3adcf24b624a7b778533480e32434a39ad8fa30c315208f6d3e5542aeb6e9"},
- {file = "coverage-7.6.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0c212c49b6c10e6951362f7c6df3329f04c2b1c28499563d4035d964ab8e08c"},
- {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e81d7a3e58882450ec4186ca59a3f20a5d4440f25b1cff6f0902ad890e6748a"},
- {file = "coverage-7.6.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78b260de9790fd81e69401c2dc8b17da47c8038176a79092a89cb2b7d945d060"},
- {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a78d169acd38300060b28d600344a803628c3fd585c912cacc9ea8790fe96862"},
- {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:2c09f4ce52cb99dd7505cd0fc8e0e37c77b87f46bc9c1eb03fe3bc9991085388"},
- {file = "coverage-7.6.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6878ef48d4227aace338d88c48738a4258213cd7b74fd9a3d4d7582bb1d8a155"},
- {file = "coverage-7.6.1-cp313-cp313-win32.whl", hash = "sha256:44df346d5215a8c0e360307d46ffaabe0f5d3502c8a1cefd700b34baf31d411a"},
- {file = "coverage-7.6.1-cp313-cp313-win_amd64.whl", hash = "sha256:8284cf8c0dd272a247bc154eb6c95548722dce90d098c17a883ed36e67cdb129"},
- {file = "coverage-7.6.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:d3296782ca4eab572a1a4eca686d8bfb00226300dcefdf43faa25b5242ab8a3e"},
- {file = "coverage-7.6.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:502753043567491d3ff6d08629270127e0c31d4184c4c8d98f92c26f65019962"},
- {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6a89ecca80709d4076b95f89f308544ec8f7b4727e8a547913a35f16717856cb"},
- {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a318d68e92e80af8b00fa99609796fdbcdfef3629c77c6283566c6f02c6d6704"},
- {file = "coverage-7.6.1-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13b0a73a0896988f053e4fbb7de6d93388e6dd292b0d87ee51d106f2c11b465b"},
- {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:4421712dbfc5562150f7554f13dde997a2e932a6b5f352edcce948a815efee6f"},
- {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:166811d20dfea725e2e4baa71fffd6c968a958577848d2131f39b60043400223"},
- {file = "coverage-7.6.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:225667980479a17db1048cb2bf8bfb39b8e5be8f164b8f6628b64f78a72cf9d3"},
- {file = "coverage-7.6.1-cp313-cp313t-win32.whl", hash = "sha256:170d444ab405852903b7d04ea9ae9b98f98ab6d7e63e1115e82620807519797f"},
- {file = "coverage-7.6.1-cp313-cp313t-win_amd64.whl", hash = "sha256:b9f222de8cded79c49bf184bdbc06630d4c58eec9459b939b4a690c82ed05657"},
- {file = "coverage-7.6.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6db04803b6c7291985a761004e9060b2bca08da6d04f26a7f2294b8623a0c1a0"},
- {file = "coverage-7.6.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f1adfc8ac319e1a348af294106bc6a8458a0f1633cc62a1446aebc30c5fa186a"},
- {file = "coverage-7.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a95324a9de9650a729239daea117df21f4b9868ce32e63f8b650ebe6cef5595b"},
- {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b43c03669dc4618ec25270b06ecd3ee4fa94c7f9b3c14bae6571ca00ef98b0d3"},
- {file = "coverage-7.6.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8929543a7192c13d177b770008bc4e8119f2e1f881d563fc6b6305d2d0ebe9de"},
- {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:a09ece4a69cf399510c8ab25e0950d9cf2b42f7b3cb0374f95d2e2ff594478a6"},
- {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9054a0754de38d9dbd01a46621636689124d666bad1936d76c0341f7d71bf569"},
- {file = "coverage-7.6.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:0dbde0f4aa9a16fa4d754356a8f2e36296ff4d83994b2c9d8398aa32f222f989"},
- {file = "coverage-7.6.1-cp38-cp38-win32.whl", hash = "sha256:da511e6ad4f7323ee5702e6633085fb76c2f893aaf8ce4c51a0ba4fc07580ea7"},
- {file = "coverage-7.6.1-cp38-cp38-win_amd64.whl", hash = "sha256:3f1156e3e8f2872197af3840d8ad307a9dd18e615dc64d9ee41696f287c57ad8"},
- {file = "coverage-7.6.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:abd5fd0db5f4dc9289408aaf34908072f805ff7792632250dcb36dc591d24255"},
- {file = "coverage-7.6.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:547f45fa1a93154bd82050a7f3cddbc1a7a4dd2a9bf5cb7d06f4ae29fe94eaf8"},
- {file = "coverage-7.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645786266c8f18a931b65bfcefdbf6952dd0dea98feee39bd188607a9d307ed2"},
- {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9e0b2df163b8ed01d515807af24f63de04bebcecbd6c3bfeff88385789fdf75a"},
- {file = "coverage-7.6.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:609b06f178fe8e9f89ef676532760ec0b4deea15e9969bf754b37f7c40326dbc"},
- {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:702855feff378050ae4f741045e19a32d57d19f3e0676d589df0575008ea5004"},
- {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:2bdb062ea438f22d99cba0d7829c2ef0af1d768d1e4a4f528087224c90b132cb"},
- {file = "coverage-7.6.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9c56863d44bd1c4fe2abb8a4d6f5371d197f1ac0ebdee542f07f35895fc07f36"},
- {file = "coverage-7.6.1-cp39-cp39-win32.whl", hash = "sha256:6e2cd258d7d927d09493c8df1ce9174ad01b381d4729a9d8d4e38670ca24774c"},
- {file = "coverage-7.6.1-cp39-cp39-win_amd64.whl", hash = "sha256:06a737c882bd26d0d6ee7269b20b12f14a8704807a01056c80bb881a4b2ce6ca"},
- {file = "coverage-7.6.1-pp38.pp39.pp310-none-any.whl", hash = "sha256:e9a6e0eb86070e8ccaedfbd9d38fec54864f3125ab95419970575b42af7541df"},
- {file = "coverage-7.6.1.tar.gz", hash = "sha256:953510dfb7b12ab69d20135a0662397f077c59b1e6379a768e97c59d852ee51d"},
+ {file = "coverage-7.6.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:108bb458827765d538abcbf8288599fee07d2743357bdd9b9dad456c287e121e"},
+ {file = "coverage-7.6.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c973b2fe4dc445cb865ab369df7521df9c27bf40715c837a113edaa2aa9faf45"},
+ {file = "coverage-7.6.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c6b24007c4bcd0b19fac25763a7cac5035c735ae017e9a349b927cfc88f31c1"},
+ {file = "coverage-7.6.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:acbb8af78f8f91b3b51f58f288c0994ba63c646bc1a8a22ad072e4e7e0a49f1c"},
+ {file = "coverage-7.6.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad32a981bcdedb8d2ace03b05e4fd8dace8901eec64a532b00b15217d3677dd2"},
+ {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:34d23e28ccb26236718a3a78ba72744212aa383141961dd6825f6595005c8b06"},
+ {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e25bacb53a8c7325e34d45dddd2f2fbae0dbc230d0e2642e264a64e17322a777"},
+ {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:af05bbba896c4472a29408455fe31b3797b4d8648ed0a2ccac03e074a77e2314"},
+ {file = "coverage-7.6.7-cp310-cp310-win32.whl", hash = "sha256:796c9b107d11d2d69e1849b2dfe41730134b526a49d3acb98ca02f4985eeff7a"},
+ {file = "coverage-7.6.7-cp310-cp310-win_amd64.whl", hash = "sha256:987a8e3da7da4eed10a20491cf790589a8e5e07656b6dc22d3814c4d88faf163"},
+ {file = "coverage-7.6.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7e61b0e77ff4dddebb35a0e8bb5a68bf0f8b872407d8d9f0c726b65dfabe2469"},
+ {file = "coverage-7.6.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1a5407a75ca4abc20d6252efeb238377a71ce7bda849c26c7a9bece8680a5d99"},
+ {file = "coverage-7.6.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df002e59f2d29e889c37abd0b9ee0d0e6e38c24f5f55d71ff0e09e3412a340ec"},
+ {file = "coverage-7.6.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:673184b3156cba06154825f25af33baa2671ddae6343f23175764e65a8c4c30b"},
+ {file = "coverage-7.6.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e69ad502f1a2243f739f5bd60565d14a278be58be4c137d90799f2c263e7049a"},
+ {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:60dcf7605c50ea72a14490d0756daffef77a5be15ed1b9fea468b1c7bda1bc3b"},
+ {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:9c2eb378bebb2c8f65befcb5147877fc1c9fbc640fc0aad3add759b5df79d55d"},
+ {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3c0317288f032221d35fa4cbc35d9f4923ff0dfd176c79c9b356e8ef8ef2dff4"},
+ {file = "coverage-7.6.7-cp311-cp311-win32.whl", hash = "sha256:951aade8297358f3618a6e0660dc74f6b52233c42089d28525749fc8267dccd2"},
+ {file = "coverage-7.6.7-cp311-cp311-win_amd64.whl", hash = "sha256:5e444b8e88339a2a67ce07d41faabb1d60d1004820cee5a2c2b54e2d8e429a0f"},
+ {file = "coverage-7.6.7-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f07ff574986bc3edb80e2c36391678a271d555f91fd1d332a1e0f4b5ea4b6ea9"},
+ {file = "coverage-7.6.7-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:49ed5ee4109258973630c1f9d099c7e72c5c36605029f3a91fe9982c6076c82b"},
+ {file = "coverage-7.6.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f3e8796434a8106b3ac025fd15417315d7a58ee3e600ad4dbcfddc3f4b14342c"},
+ {file = "coverage-7.6.7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a3b925300484a3294d1c70f6b2b810d6526f2929de954e5b6be2bf8caa1f12c1"},
+ {file = "coverage-7.6.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c42ec2c522e3ddd683dec5cdce8e62817afb648caedad9da725001fa530d354"},
+ {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0266b62cbea568bd5e93a4da364d05de422110cbed5056d69339bd5af5685433"},
+ {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e5f2a0f161d126ccc7038f1f3029184dbdf8f018230af17ef6fd6a707a5b881f"},
+ {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c132b5a22821f9b143f87446805e13580b67c670a548b96da945a8f6b4f2efbb"},
+ {file = "coverage-7.6.7-cp312-cp312-win32.whl", hash = "sha256:7c07de0d2a110f02af30883cd7dddbe704887617d5c27cf373362667445a4c76"},
+ {file = "coverage-7.6.7-cp312-cp312-win_amd64.whl", hash = "sha256:fd49c01e5057a451c30c9b892948976f5d38f2cbd04dc556a82743ba8e27ed8c"},
+ {file = "coverage-7.6.7-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:46f21663e358beae6b368429ffadf14ed0a329996248a847a4322fb2e35d64d3"},
+ {file = "coverage-7.6.7-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:40cca284c7c310d622a1677f105e8507441d1bb7c226f41978ba7c86979609ab"},
+ {file = "coverage-7.6.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77256ad2345c29fe59ae861aa11cfc74579c88d4e8dbf121cbe46b8e32aec808"},
+ {file = "coverage-7.6.7-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87ea64b9fa52bf395272e54020537990a28078478167ade6c61da7ac04dc14bc"},
+ {file = "coverage-7.6.7-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d608a7808793e3615e54e9267519351c3ae204a6d85764d8337bd95993581a8"},
+ {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdd94501d65adc5c24f8a1a0eda110452ba62b3f4aeaba01e021c1ed9cb8f34a"},
+ {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:82c809a62e953867cf57e0548c2b8464207f5f3a6ff0e1e961683e79b89f2c55"},
+ {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:bb684694e99d0b791a43e9fc0fa58efc15ec357ac48d25b619f207c41f2fd384"},
+ {file = "coverage-7.6.7-cp313-cp313-win32.whl", hash = "sha256:963e4a08cbb0af6623e61492c0ec4c0ec5c5cf74db5f6564f98248d27ee57d30"},
+ {file = "coverage-7.6.7-cp313-cp313-win_amd64.whl", hash = "sha256:14045b8bfd5909196a90da145a37f9d335a5d988a83db34e80f41e965fb7cb42"},
+ {file = "coverage-7.6.7-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:f2c7a045eef561e9544359a0bf5784b44e55cefc7261a20e730baa9220c83413"},
+ {file = "coverage-7.6.7-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5dd4e4a49d9c72a38d18d641135d2fb0bdf7b726ca60a103836b3d00a1182acd"},
+ {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c95e0fa3d1547cb6f021ab72f5c23402da2358beec0a8e6d19a368bd7b0fb37"},
+ {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f63e21ed474edd23f7501f89b53280014436e383a14b9bd77a648366c81dce7b"},
+ {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ead9b9605c54d15be228687552916c89c9683c215370c4a44f1f217d2adcc34d"},
+ {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:0573f5cbf39114270842d01872952d301027d2d6e2d84013f30966313cadb529"},
+ {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:e2c8e3384c12dfa19fa9a52f23eb091a8fad93b5b81a41b14c17c78e23dd1d8b"},
+ {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:70a56a2ec1869e6e9fa69ef6b76b1a8a7ef709972b9cc473f9ce9d26b5997ce3"},
+ {file = "coverage-7.6.7-cp313-cp313t-win32.whl", hash = "sha256:dbba8210f5067398b2c4d96b4e64d8fb943644d5eb70be0d989067c8ca40c0f8"},
+ {file = "coverage-7.6.7-cp313-cp313t-win_amd64.whl", hash = "sha256:dfd14bcae0c94004baba5184d1c935ae0d1231b8409eb6c103a5fd75e8ecdc56"},
+ {file = "coverage-7.6.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37a15573f988b67f7348916077c6d8ad43adb75e478d0910957394df397d2874"},
+ {file = "coverage-7.6.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b6cce5c76985f81da3769c52203ee94722cd5d5889731cd70d31fee939b74bf0"},
+ {file = "coverage-7.6.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1ab9763d291a17b527ac6fd11d1a9a9c358280adb320e9c2672a97af346ac2c"},
+ {file = "coverage-7.6.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6cf96ceaa275f071f1bea3067f8fd43bec184a25a962c754024c973af871e1b7"},
+ {file = "coverage-7.6.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aee9cf6b0134d6f932d219ce253ef0e624f4fa588ee64830fcba193269e4daa3"},
+ {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2bc3e45c16564cc72de09e37413262b9f99167803e5e48c6156bccdfb22c8327"},
+ {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:623e6965dcf4e28a3debaa6fcf4b99ee06d27218f46d43befe4db1c70841551c"},
+ {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:850cfd2d6fc26f8346f422920ac204e1d28814e32e3a58c19c91980fa74d8289"},
+ {file = "coverage-7.6.7-cp39-cp39-win32.whl", hash = "sha256:c296263093f099da4f51b3dff1eff5d4959b527d4f2f419e16508c5da9e15e8c"},
+ {file = "coverage-7.6.7-cp39-cp39-win_amd64.whl", hash = "sha256:90746521206c88bdb305a4bf3342b1b7316ab80f804d40c536fc7d329301ee13"},
+ {file = "coverage-7.6.7-pp39.pp310-none-any.whl", hash = "sha256:0ddcb70b3a3a57581b450571b31cb774f23eb9519c2aaa6176d3a84c9fc57671"},
+ {file = "coverage-7.6.7.tar.gz", hash = "sha256:d79d4826e41441c9a118ff045e4bccb9fdbdcb1d02413e7ea6eb5c87b5439d24"},
]
[package.dependencies]
@@ -458,38 +463,38 @@ toml = ["tomli"]
[[package]]
name = "cryptography"
-version = "43.0.1"
+version = "43.0.3"
description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."
optional = false
python-versions = ">=3.7"
files = [
- {file = "cryptography-43.0.1-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:8385d98f6a3bf8bb2d65a73e17ed87a3ba84f6991c155691c51112075f9ffc5d"},
- {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:27e613d7077ac613e399270253259d9d53872aaf657471473ebfc9a52935c062"},
- {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68aaecc4178e90719e95298515979814bda0cbada1256a4485414860bd7ab962"},
- {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:de41fd81a41e53267cb020bb3a7212861da53a7d39f863585d13ea11049cf277"},
- {file = "cryptography-43.0.1-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f98bf604c82c416bc829e490c700ca1553eafdf2912a91e23a79d97d9801372a"},
- {file = "cryptography-43.0.1-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:61ec41068b7b74268fa86e3e9e12b9f0c21fcf65434571dbb13d954bceb08042"},
- {file = "cryptography-43.0.1-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:014f58110f53237ace6a408b5beb6c427b64e084eb451ef25a28308270086494"},
- {file = "cryptography-43.0.1-cp37-abi3-win32.whl", hash = "sha256:2bd51274dcd59f09dd952afb696bf9c61a7a49dfc764c04dd33ef7a6b502a1e2"},
- {file = "cryptography-43.0.1-cp37-abi3-win_amd64.whl", hash = "sha256:666ae11966643886c2987b3b721899d250855718d6d9ce41b521252a17985f4d"},
- {file = "cryptography-43.0.1-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:ac119bb76b9faa00f48128b7f5679e1d8d437365c5d26f1c2c3f0da4ce1b553d"},
- {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1bbcce1a551e262dfbafb6e6252f1ae36a248e615ca44ba302df077a846a8806"},
- {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58d4e9129985185a06d849aa6df265bdd5a74ca6e1b736a77959b498e0505b85"},
- {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d03a475165f3134f773d1388aeb19c2d25ba88b6a9733c5c590b9ff7bbfa2e0c"},
- {file = "cryptography-43.0.1-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:511f4273808ab590912a93ddb4e3914dfd8a388fed883361b02dea3791f292e1"},
- {file = "cryptography-43.0.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:80eda8b3e173f0f247f711eef62be51b599b5d425c429b5d4ca6a05e9e856baa"},
- {file = "cryptography-43.0.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:38926c50cff6f533f8a2dae3d7f19541432610d114a70808f0926d5aaa7121e4"},
- {file = "cryptography-43.0.1-cp39-abi3-win32.whl", hash = "sha256:a575913fb06e05e6b4b814d7f7468c2c660e8bb16d8d5a1faf9b33ccc569dd47"},
- {file = "cryptography-43.0.1-cp39-abi3-win_amd64.whl", hash = "sha256:d75601ad10b059ec832e78823b348bfa1a59f6b8d545db3a24fd44362a1564cb"},
- {file = "cryptography-43.0.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:ea25acb556320250756e53f9e20a4177515f012c9eaea17eb7587a8c4d8ae034"},
- {file = "cryptography-43.0.1-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:c1332724be35d23a854994ff0b66530119500b6053d0bd3363265f7e5e77288d"},
- {file = "cryptography-43.0.1-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:fba1007b3ef89946dbbb515aeeb41e30203b004f0b4b00e5e16078b518563289"},
- {file = "cryptography-43.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:5b43d1ea6b378b54a1dc99dd8a2b5be47658fe9a7ce0a58ff0b55f4b43ef2b84"},
- {file = "cryptography-43.0.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:88cce104c36870d70c49c7c8fd22885875d950d9ee6ab54df2745f83ba0dc365"},
- {file = "cryptography-43.0.1-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:9d3cdb25fa98afdd3d0892d132b8d7139e2c087da1712041f6b762e4f807cc96"},
- {file = "cryptography-43.0.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e710bf40870f4db63c3d7d929aa9e09e4e7ee219e703f949ec4073b4294f6172"},
- {file = "cryptography-43.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7c05650fe8023c5ed0d46793d4b7d7e6cd9c04e68eabe5b0aeea836e37bdcec2"},
- {file = "cryptography-43.0.1.tar.gz", hash = "sha256:203e92a75716d8cfb491dc47c79e17d0d9207ccffcbcb35f598fbe463ae3444d"},
+ {file = "cryptography-43.0.3-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:bf7a1932ac4176486eab36a19ed4c0492da5d97123f1406cf15e41b05e787d2e"},
+ {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63efa177ff54aec6e1c0aefaa1a241232dcd37413835a9b674b6e3f0ae2bfd3e"},
+ {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e1ce50266f4f70bf41a2c6dc4358afadae90e2a1e5342d3c08883df1675374f"},
+ {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:443c4a81bb10daed9a8f334365fe52542771f25aedaf889fd323a853ce7377d6"},
+ {file = "cryptography-43.0.3-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:74f57f24754fe349223792466a709f8e0c093205ff0dca557af51072ff47ab18"},
+ {file = "cryptography-43.0.3-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:9762ea51a8fc2a88b70cf2995e5675b38d93bf36bd67d91721c309df184f49bd"},
+ {file = "cryptography-43.0.3-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:81ef806b1fef6b06dcebad789f988d3b37ccaee225695cf3e07648eee0fc6b73"},
+ {file = "cryptography-43.0.3-cp37-abi3-win32.whl", hash = "sha256:cbeb489927bd7af4aa98d4b261af9a5bc025bd87f0e3547e11584be9e9427be2"},
+ {file = "cryptography-43.0.3-cp37-abi3-win_amd64.whl", hash = "sha256:f46304d6f0c6ab8e52770addfa2fc41e6629495548862279641972b6215451cd"},
+ {file = "cryptography-43.0.3-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:8ac43ae87929a5982f5948ceda07001ee5e83227fd69cf55b109144938d96984"},
+ {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:846da004a5804145a5f441b8530b4bf35afbf7da70f82409f151695b127213d5"},
+ {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f996e7268af62598f2fc1204afa98a3b5712313a55c4c9d434aef49cadc91d4"},
+ {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f7b178f11ed3664fd0e995a47ed2b5ff0a12d893e41dd0494f406d1cf555cab7"},
+ {file = "cryptography-43.0.3-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:c2e6fc39c4ab499049df3bdf567f768a723a5e8464816e8f009f121a5a9f4405"},
+ {file = "cryptography-43.0.3-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:e1be4655c7ef6e1bbe6b5d0403526601323420bcf414598955968c9ef3eb7d16"},
+ {file = "cryptography-43.0.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:df6b6c6d742395dd77a23ea3728ab62f98379eff8fb61be2744d4679ab678f73"},
+ {file = "cryptography-43.0.3-cp39-abi3-win32.whl", hash = "sha256:d56e96520b1020449bbace2b78b603442e7e378a9b3bd68de65c782db1507995"},
+ {file = "cryptography-43.0.3-cp39-abi3-win_amd64.whl", hash = "sha256:0c580952eef9bf68c4747774cde7ec1d85a6e61de97281f2dba83c7d2c806362"},
+ {file = "cryptography-43.0.3-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:d03b5621a135bffecad2c73e9f4deb1a0f977b9a8ffe6f8e002bf6c9d07b918c"},
+ {file = "cryptography-43.0.3-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:a2a431ee15799d6db9fe80c82b055bae5a752bef645bba795e8e52687c69efe3"},
+ {file = "cryptography-43.0.3-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:281c945d0e28c92ca5e5930664c1cefd85efe80e5c0d2bc58dd63383fda29f83"},
+ {file = "cryptography-43.0.3-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:f18c716be16bc1fea8e95def49edf46b82fccaa88587a45f8dc0ff6ab5d8e0a7"},
+ {file = "cryptography-43.0.3-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:4a02ded6cd4f0a5562a8887df8b3bd14e822a90f97ac5e544c162899bc467664"},
+ {file = "cryptography-43.0.3-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:53a583b6637ab4c4e3591a15bc9db855b8d9dee9a669b550f311480acab6eb08"},
+ {file = "cryptography-43.0.3-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:1ec0bcf7e17c0c5669d881b1cd38c4972fade441b27bda1051665faaa89bdcaa"},
+ {file = "cryptography-43.0.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2ce6fae5bdad59577b44e4dfed356944fbf1d925269114c28be377692643b4ff"},
+ {file = "cryptography-43.0.3.tar.gz", hash = "sha256:315b9001266a492a6ff443b61238f956b214dbec9910a081ba5b6646a055a805"},
]
[package.dependencies]
@@ -502,7 +507,7 @@ nox = ["nox"]
pep8test = ["check-sdist", "click", "mypy", "ruff"]
sdist = ["build"]
ssh = ["bcrypt (>=3.1.5)"]
-test = ["certifi", "cryptography-vectors (==43.0.1)", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"]
+test = ["certifi", "cryptography-vectors (==43.0.3)", "pretend", "pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-xdist"]
test-randomorder = ["pytest-randomly"]
[[package]]
@@ -516,15 +521,30 @@ files = [
{file = "darglint-1.8.1.tar.gz", hash = "sha256:080d5106df149b199822e7ee7deb9c012b49891538f14a11be681044f0bb20da"},
]
+[[package]]
+name = "dill"
+version = "0.3.9"
+description = "serialize all of Python"
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "dill-0.3.9-py3-none-any.whl", hash = "sha256:468dff3b89520b474c0397703366b7b95eebe6303f108adf9b19da1f702be87a"},
+ {file = "dill-0.3.9.tar.gz", hash = "sha256:81aa267dddf68cbfe8029c42ca9ec6a4ab3b22371d1c450abc54422577b4512c"},
+]
+
+[package.extras]
+graph = ["objgraph (>=1.7.2)"]
+profile = ["gprof2dot (>=2022.7.29)"]
+
[[package]]
name = "distlib"
-version = "0.3.8"
+version = "0.3.9"
description = "Distribution utilities"
optional = false
python-versions = "*"
files = [
- {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"},
- {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"},
+ {file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"},
+ {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"},
]
[[package]]
@@ -565,18 +585,18 @@ test = ["pytest (>=6)"]
[[package]]
name = "fastapi"
-version = "0.115.0"
+version = "0.115.5"
description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production"
optional = false
python-versions = ">=3.8"
files = [
- {file = "fastapi-0.115.0-py3-none-any.whl", hash = "sha256:17ea427674467486e997206a5ab25760f6b09e069f099b96f5b55a32fb6f1631"},
- {file = "fastapi-0.115.0.tar.gz", hash = "sha256:f93b4ca3529a8ebc6fc3fcf710e5efa8de3df9b41570958abf1d97d843138004"},
+ {file = "fastapi-0.115.5-py3-none-any.whl", hash = "sha256:596b95adbe1474da47049e802f9a65ab2ffa9c2b07e7efee70eb8a66c9f2f796"},
+ {file = "fastapi-0.115.5.tar.gz", hash = "sha256:0e7a4d0dc0d01c68df21887cce0945e72d3c48b9f4f79dfe7a7d53aa08fbb289"},
]
[package.dependencies]
pydantic = ">=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0 || >2.0.0,<2.0.1 || >2.0.1,<2.1.0 || >2.1.0,<3.0.0"
-starlette = ">=0.37.2,<0.39.0"
+starlette = ">=0.40.0,<0.42.0"
typing-extensions = ">=4.8.0"
[package.extras]
@@ -601,69 +621,84 @@ typing = ["typing-extensions (>=4.12.2)"]
[[package]]
name = "greenlet"
-version = "3.0.3"
+version = "3.1.1"
description = "Lightweight in-process concurrent programming"
optional = false
python-versions = ">=3.7"
files = [
- {file = "greenlet-3.0.3-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:9da2bd29ed9e4f15955dd1595ad7bc9320308a3b766ef7f837e23ad4b4aac31a"},
- {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d353cadd6083fdb056bb46ed07e4340b0869c305c8ca54ef9da3421acbdf6881"},
- {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dca1e2f3ca00b84a396bc1bce13dd21f680f035314d2379c4160c98153b2059b"},
- {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ed7fb269f15dc662787f4119ec300ad0702fa1b19d2135a37c2c4de6fadfd4a"},
- {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd4f49ae60e10adbc94b45c0b5e6a179acc1736cf7a90160b404076ee283cf83"},
- {file = "greenlet-3.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:73a411ef564e0e097dbe7e866bb2dda0f027e072b04da387282b02c308807405"},
- {file = "greenlet-3.0.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:7f362975f2d179f9e26928c5b517524e89dd48530a0202570d55ad6ca5d8a56f"},
- {file = "greenlet-3.0.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:649dde7de1a5eceb258f9cb00bdf50e978c9db1b996964cd80703614c86495eb"},
- {file = "greenlet-3.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:68834da854554926fbedd38c76e60c4a2e3198c6fbed520b106a8986445caaf9"},
- {file = "greenlet-3.0.3-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:b1b5667cced97081bf57b8fa1d6bfca67814b0afd38208d52538316e9422fc61"},
- {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:52f59dd9c96ad2fc0d5724107444f76eb20aaccb675bf825df6435acb7703559"},
- {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:afaff6cf5200befd5cec055b07d1c0a5a06c040fe5ad148abcd11ba6ab9b114e"},
- {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fe754d231288e1e64323cfad462fcee8f0288654c10bdf4f603a39ed923bef33"},
- {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2797aa5aedac23af156bbb5a6aa2cd3427ada2972c828244eb7d1b9255846379"},
- {file = "greenlet-3.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b7f009caad047246ed379e1c4dbcb8b020f0a390667ea74d2387be2998f58a22"},
- {file = "greenlet-3.0.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:c5e1536de2aad7bf62e27baf79225d0d64360d4168cf2e6becb91baf1ed074f3"},
- {file = "greenlet-3.0.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:894393ce10ceac937e56ec00bb71c4c2f8209ad516e96033e4b3b1de270e200d"},
- {file = "greenlet-3.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:1ea188d4f49089fc6fb283845ab18a2518d279c7cd9da1065d7a84e991748728"},
- {file = "greenlet-3.0.3-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:70fb482fdf2c707765ab5f0b6655e9cfcf3780d8d87355a063547b41177599be"},
- {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d4d1ac74f5c0c0524e4a24335350edad7e5f03b9532da7ea4d3c54d527784f2e"},
- {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:149e94a2dd82d19838fe4b2259f1b6b9957d5ba1b25640d2380bea9c5df37676"},
- {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:15d79dd26056573940fcb8c7413d84118086f2ec1a8acdfa854631084393efcc"},
- {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:881b7db1ebff4ba09aaaeae6aa491daeb226c8150fc20e836ad00041bcb11230"},
- {file = "greenlet-3.0.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fcd2469d6a2cf298f198f0487e0a5b1a47a42ca0fa4dfd1b6862c999f018ebbf"},
- {file = "greenlet-3.0.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:1f672519db1796ca0d8753f9e78ec02355e862d0998193038c7073045899f305"},
- {file = "greenlet-3.0.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:2516a9957eed41dd8f1ec0c604f1cdc86758b587d964668b5b196a9db5bfcde6"},
- {file = "greenlet-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:bba5387a6975598857d86de9eac14210a49d554a77eb8261cc68b7d082f78ce2"},
- {file = "greenlet-3.0.3-cp37-cp37m-macosx_11_0_universal2.whl", hash = "sha256:5b51e85cb5ceda94e79d019ed36b35386e8c37d22f07d6a751cb659b180d5274"},
- {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:daf3cb43b7cf2ba96d614252ce1684c1bccee6b2183a01328c98d36fcd7d5cb0"},
- {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99bf650dc5d69546e076f413a87481ee1d2d09aaaaaca058c9251b6d8c14783f"},
- {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2dd6e660effd852586b6a8478a1d244b8dc90ab5b1321751d2ea15deb49ed414"},
- {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e3391d1e16e2a5a1507d83e4a8b100f4ee626e8eca43cf2cadb543de69827c4c"},
- {file = "greenlet-3.0.3-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1f145462f1fa6e4a4ae3c0f782e580ce44d57c8f2c7aae1b6fa88c0b2efdb41"},
- {file = "greenlet-3.0.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1a7191e42732df52cb5f39d3527217e7ab73cae2cb3694d241e18f53d84ea9a7"},
- {file = "greenlet-3.0.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0448abc479fab28b00cb472d278828b3ccca164531daab4e970a0458786055d6"},
- {file = "greenlet-3.0.3-cp37-cp37m-win32.whl", hash = "sha256:b542be2440edc2d48547b5923c408cbe0fc94afb9f18741faa6ae970dbcb9b6d"},
- {file = "greenlet-3.0.3-cp37-cp37m-win_amd64.whl", hash = "sha256:01bc7ea167cf943b4c802068e178bbf70ae2e8c080467070d01bfa02f337ee67"},
- {file = "greenlet-3.0.3-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:1996cb9306c8595335bb157d133daf5cf9f693ef413e7673cb07e3e5871379ca"},
- {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3ddc0f794e6ad661e321caa8d2f0a55ce01213c74722587256fb6566049a8b04"},
- {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c9db1c18f0eaad2f804728c67d6c610778456e3e1cc4ab4bbd5eeb8e6053c6fc"},
- {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7170375bcc99f1a2fbd9c306f5be8764eaf3ac6b5cb968862cad4c7057756506"},
- {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b66c9c1e7ccabad3a7d037b2bcb740122a7b17a53734b7d72a344ce39882a1b"},
- {file = "greenlet-3.0.3-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:098d86f528c855ead3479afe84b49242e174ed262456c342d70fc7f972bc13c4"},
- {file = "greenlet-3.0.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:81bb9c6d52e8321f09c3d165b2a78c680506d9af285bfccbad9fb7ad5a5da3e5"},
- {file = "greenlet-3.0.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fd096eb7ffef17c456cfa587523c5f92321ae02427ff955bebe9e3c63bc9f0da"},
- {file = "greenlet-3.0.3-cp38-cp38-win32.whl", hash = "sha256:d46677c85c5ba00a9cb6f7a00b2bfa6f812192d2c9f7d9c4f6a55b60216712f3"},
- {file = "greenlet-3.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:419b386f84949bf0e7c73e6032e3457b82a787c1ab4a0e43732898a761cc9dbf"},
- {file = "greenlet-3.0.3-cp39-cp39-macosx_11_0_universal2.whl", hash = "sha256:da70d4d51c8b306bb7a031d5cff6cc25ad253affe89b70352af5f1cb68e74b53"},
- {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:086152f8fbc5955df88382e8a75984e2bb1c892ad2e3c80a2508954e52295257"},
- {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d73a9fe764d77f87f8ec26a0c85144d6a951a6c438dfe50487df5595c6373eac"},
- {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b7dcbe92cc99f08c8dd11f930de4d99ef756c3591a5377d1d9cd7dd5e896da71"},
- {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1551a8195c0d4a68fac7a4325efac0d541b48def35feb49d803674ac32582f61"},
- {file = "greenlet-3.0.3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:64d7675ad83578e3fc149b617a444fab8efdafc9385471f868eb5ff83e446b8b"},
- {file = "greenlet-3.0.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b37eef18ea55f2ffd8f00ff8fe7c8d3818abd3e25fb73fae2ca3b672e333a7a6"},
- {file = "greenlet-3.0.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:77457465d89b8263bca14759d7c1684df840b6811b2499838cc5b040a8b5b113"},
- {file = "greenlet-3.0.3-cp39-cp39-win32.whl", hash = "sha256:57e8974f23e47dac22b83436bdcf23080ade568ce77df33159e019d161ce1d1e"},
- {file = "greenlet-3.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:c5ee858cfe08f34712f548c3c363e807e7186f03ad7a5039ebadb29e8c6be067"},
- {file = "greenlet-3.0.3.tar.gz", hash = "sha256:43374442353259554ce33599da8b692d5aa96f8976d567d4badf263371fbe491"},
+ {file = "greenlet-3.1.1-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:0bbae94a29c9e5c7e4a2b7f0aae5c17e8e90acbfd3bf6270eeba60c39fce3563"},
+ {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fde093fb93f35ca72a556cf72c92ea3ebfda3d79fc35bb19fbe685853869a83"},
+ {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:36b89d13c49216cadb828db8dfa6ce86bbbc476a82d3a6c397f0efae0525bdd0"},
+ {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94b6150a85e1b33b40b1464a3f9988dcc5251d6ed06842abff82e42632fac120"},
+ {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93147c513fac16385d1036b7e5b102c7fbbdb163d556b791f0f11eada7ba65dc"},
+ {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:da7a9bff22ce038e19bf62c4dd1ec8391062878710ded0a845bcf47cc0200617"},
+ {file = "greenlet-3.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b2795058c23988728eec1f36a4e5e4ebad22f8320c85f3587b539b9ac84128d7"},
+ {file = "greenlet-3.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ed10eac5830befbdd0c32f83e8aa6288361597550ba669b04c48f0f9a2c843c6"},
+ {file = "greenlet-3.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:77c386de38a60d1dfb8e55b8c1101d68c79dfdd25c7095d51fec2dd800892b80"},
+ {file = "greenlet-3.1.1-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:e4d333e558953648ca09d64f13e6d8f0523fa705f51cae3f03b5983489958c70"},
+ {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:09fc016b73c94e98e29af67ab7b9a879c307c6731a2c9da0db5a7d9b7edd1159"},
+ {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d5e975ca70269d66d17dd995dafc06f1b06e8cb1ec1e9ed54c1d1e4a7c4cf26e"},
+ {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3b2813dc3de8c1ee3f924e4d4227999285fd335d1bcc0d2be6dc3f1f6a318ec1"},
+ {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e347b3bfcf985a05e8c0b7d462ba6f15b1ee1c909e2dcad795e49e91b152c383"},
+ {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9e8f8c9cb53cdac7ba9793c276acd90168f416b9ce36799b9b885790f8ad6c0a"},
+ {file = "greenlet-3.1.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:62ee94988d6b4722ce0028644418d93a52429e977d742ca2ccbe1c4f4a792511"},
+ {file = "greenlet-3.1.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1776fd7f989fc6b8d8c8cb8da1f6b82c5814957264d1f6cf818d475ec2bf6395"},
+ {file = "greenlet-3.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:48ca08c771c268a768087b408658e216133aecd835c0ded47ce955381105ba39"},
+ {file = "greenlet-3.1.1-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:4afe7ea89de619adc868e087b4d2359282058479d7cfb94970adf4b55284574d"},
+ {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f406b22b7c9a9b4f8aa9d2ab13d6ae0ac3e85c9a809bd590ad53fed2bf70dc79"},
+ {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c3a701fe5a9695b238503ce5bbe8218e03c3bcccf7e204e455e7462d770268aa"},
+ {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2846930c65b47d70b9d178e89c7e1a69c95c1f68ea5aa0a58646b7a96df12441"},
+ {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99cfaa2110534e2cf3ba31a7abcac9d328d1d9f1b95beede58294a60348fba36"},
+ {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1443279c19fca463fc33e65ef2a935a5b09bb90f978beab37729e1c3c6c25fe9"},
+ {file = "greenlet-3.1.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b7cede291382a78f7bb5f04a529cb18e068dd29e0fb27376074b6d0317bf4dd0"},
+ {file = "greenlet-3.1.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:23f20bb60ae298d7d8656c6ec6db134bca379ecefadb0b19ce6f19d1f232a942"},
+ {file = "greenlet-3.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:7124e16b4c55d417577c2077be379514321916d5790fa287c9ed6f23bd2ffd01"},
+ {file = "greenlet-3.1.1-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:05175c27cb459dcfc05d026c4232f9de8913ed006d42713cb8a5137bd49375f1"},
+ {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:935e943ec47c4afab8965954bf49bfa639c05d4ccf9ef6e924188f762145c0ff"},
+ {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:667a9706c970cb552ede35aee17339a18e8f2a87a51fba2ed39ceeeb1004798a"},
+ {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b8a678974d1f3aa55f6cc34dc480169d58f2e6d8958895d68845fa4ab566509e"},
+ {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efc0f674aa41b92da8c49e0346318c6075d734994c3c4e4430b1c3f853e498e4"},
+ {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0153404a4bb921f0ff1abeb5ce8a5131da56b953eda6e14b88dc6bbc04d2049e"},
+ {file = "greenlet-3.1.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:275f72decf9932639c1c6dd1013a1bc266438eb32710016a1c742df5da6e60a1"},
+ {file = "greenlet-3.1.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:c4aab7f6381f38a4b42f269057aee279ab0fc7bf2e929e3d4abfae97b682a12c"},
+ {file = "greenlet-3.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:b42703b1cf69f2aa1df7d1030b9d77d3e584a70755674d60e710f0af570f3761"},
+ {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1695e76146579f8c06c1509c7ce4dfe0706f49c6831a817ac04eebb2fd02011"},
+ {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7876452af029456b3f3549b696bb36a06db7c90747740c5302f74a9e9fa14b13"},
+ {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4ead44c85f8ab905852d3de8d86f6f8baf77109f9da589cb4fa142bd3b57b475"},
+ {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8320f64b777d00dd7ccdade271eaf0cad6636343293a25074cc5566160e4de7b"},
+ {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6510bf84a6b643dabba74d3049ead221257603a253d0a9873f55f6a59a65f822"},
+ {file = "greenlet-3.1.1-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:04b013dc07c96f83134b1e99888e7a79979f1a247e2a9f59697fa14b5862ed01"},
+ {file = "greenlet-3.1.1-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:411f015496fec93c1c8cd4e5238da364e1da7a124bcb293f085bf2860c32c6f6"},
+ {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:47da355d8687fd65240c364c90a31569a133b7b60de111c255ef5b606f2ae291"},
+ {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:98884ecf2ffb7d7fe6bd517e8eb99d31ff7855a840fa6d0d63cd07c037f6a981"},
+ {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f1d4aeb8891338e60d1ab6127af1fe45def5259def8094b9c7e34690c8858803"},
+ {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db32b5348615a04b82240cc67983cb315309e88d444a288934ee6ceaebcad6cc"},
+ {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dcc62f31eae24de7f8dce72134c8651c58000d3b1868e01392baea7c32c247de"},
+ {file = "greenlet-3.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1d3755bcb2e02de341c55b4fca7a745a24a9e7212ac953f6b3a48d117d7257aa"},
+ {file = "greenlet-3.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:b8da394b34370874b4572676f36acabac172602abf054cbc4ac910219f3340af"},
+ {file = "greenlet-3.1.1-cp37-cp37m-win32.whl", hash = "sha256:a0dfc6c143b519113354e780a50381508139b07d2177cb6ad6a08278ec655798"},
+ {file = "greenlet-3.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:54558ea205654b50c438029505def3834e80f0869a70fb15b871c29b4575ddef"},
+ {file = "greenlet-3.1.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:346bed03fe47414091be4ad44786d1bd8bef0c3fcad6ed3dee074a032ab408a9"},
+ {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfc59d69fc48664bc693842bd57acfdd490acafda1ab52c7836e3fc75c90a111"},
+ {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d21e10da6ec19b457b82636209cbe2331ff4306b54d06fa04b7c138ba18c8a81"},
+ {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:37b9de5a96111fc15418819ab4c4432e4f3c2ede61e660b1e33971eba26ef9ba"},
+ {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ef9ea3f137e5711f0dbe5f9263e8c009b7069d8a1acea822bd5e9dae0ae49c8"},
+ {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:85f3ff71e2e60bd4b4932a043fbbe0f499e263c628390b285cb599154a3b03b1"},
+ {file = "greenlet-3.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:95ffcf719966dd7c453f908e208e14cde192e09fde6c7186c8f1896ef778d8cd"},
+ {file = "greenlet-3.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:03a088b9de532cbfe2ba2034b2b85e82df37874681e8c470d6fb2f8c04d7e4b7"},
+ {file = "greenlet-3.1.1-cp38-cp38-win32.whl", hash = "sha256:8b8b36671f10ba80e159378df9c4f15c14098c4fd73a36b9ad715f057272fbef"},
+ {file = "greenlet-3.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:7017b2be767b9d43cc31416aba48aab0d2309ee31b4dbf10a1d38fb7972bdf9d"},
+ {file = "greenlet-3.1.1-cp39-cp39-macosx_11_0_universal2.whl", hash = "sha256:396979749bd95f018296af156201d6211240e7a23090f50a8d5d18c370084dc3"},
+ {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca9d0ff5ad43e785350894d97e13633a66e2b50000e8a183a50a88d834752d42"},
+ {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f6ff3b14f2df4c41660a7dec01045a045653998784bf8cfcb5a525bdffffbc8f"},
+ {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94ebba31df2aa506d7b14866fed00ac141a867e63143fe5bca82a8e503b36437"},
+ {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:73aaad12ac0ff500f62cebed98d8789198ea0e6f233421059fa68a5aa7220145"},
+ {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:63e4844797b975b9af3a3fb8f7866ff08775f5426925e1e0bbcfe7932059a12c"},
+ {file = "greenlet-3.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:7939aa3ca7d2a1593596e7ac6d59391ff30281ef280d8632fa03d81f7c5f955e"},
+ {file = "greenlet-3.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d0028e725ee18175c6e422797c407874da24381ce0690d6b9396c204c7f7276e"},
+ {file = "greenlet-3.1.1-cp39-cp39-win32.whl", hash = "sha256:5e06afd14cbaf9e00899fae69b24a32f2196c19de08fcb9f4779dd4f004e5e7c"},
+ {file = "greenlet-3.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:3319aa75e0e0639bc15ff54ca327e8dc7a6fe404003496e3c6925cd3142e0e22"},
+ {file = "greenlet-3.1.1.tar.gz", hash = "sha256:4ce3ac6cdb6adf7946475d7ef31777c26d94bccc377e070a7986bd2d5c515467"},
]
[package.extras]
@@ -704,13 +739,13 @@ files = [
[[package]]
name = "httpcore"
-version = "1.0.6"
+version = "1.0.7"
description = "A minimal low-level HTTP client."
optional = false
python-versions = ">=3.8"
files = [
- {file = "httpcore-1.0.6-py3-none-any.whl", hash = "sha256:27b59625743b85577a8c0e10e55b50b5368a4f2cfe8cc7bcfa9cf00829c2682f"},
- {file = "httpcore-1.0.6.tar.gz", hash = "sha256:73f6dbd6eb8c21bbf7ef8efad555481853f5f6acdeaff1edb0694289269ee17f"},
+ {file = "httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd"},
+ {file = "httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c"},
]
[package.dependencies]
@@ -750,13 +785,13 @@ zstd = ["zstandard (>=0.18.0)"]
[[package]]
name = "identify"
-version = "2.6.1"
+version = "2.6.2"
description = "File identification library for Python"
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.9"
files = [
- {file = "identify-2.6.1-py2.py3-none-any.whl", hash = "sha256:53863bcac7caf8d2ed85bd20312ea5dcfc22226800f6d6881f232d861db5a8f0"},
- {file = "identify-2.6.1.tar.gz", hash = "sha256:91478c5fb7c3aac5ff7bf9b4344f803843dc586832d5f110d672b19aa1984c98"},
+ {file = "identify-2.6.2-py2.py3-none-any.whl", hash = "sha256:c097384259f49e372f4ea00a19719d95ae27dd5ff0fd77ad630aa891306b82f3"},
+ {file = "identify-2.6.2.tar.gz", hash = "sha256:fab5c716c24d7a789775228823797296a2994b075fb6080ac83a102772a98cbd"},
]
[package.extras]
@@ -902,13 +937,13 @@ i18n = ["Babel (>=2.7)"]
[[package]]
name = "keyring"
-version = "25.4.1"
+version = "25.5.0"
description = "Store and access your passwords safely."
optional = false
python-versions = ">=3.8"
files = [
- {file = "keyring-25.4.1-py3-none-any.whl", hash = "sha256:5426f817cf7f6f007ba5ec722b1bcad95a75b27d780343772ad76b17cb47b0bf"},
- {file = "keyring-25.4.1.tar.gz", hash = "sha256:b07ebc55f3e8ed86ac81dd31ef14e81ace9dd9c3d4b5d77a6e9a2016d0d71a1b"},
+ {file = "keyring-25.5.0-py3-none-any.whl", hash = "sha256:e67f8ac32b04be4714b42fe84ce7dad9c40985b9ca827c592cc303e7c26d9741"},
+ {file = "keyring-25.5.0.tar.gz", hash = "sha256:4c753b3ec91717fe713c4edd522d625889d8973a349b0e582622f49766de58e6"},
]
[package.dependencies]
@@ -950,13 +985,13 @@ test = ["pytest (>=7.4)", "pytest-cov (>=4.1)"]
[[package]]
name = "mako"
-version = "1.3.5"
+version = "1.3.6"
description = "A super-fast templating language that borrows the best ideas from the existing templating languages."
optional = false
python-versions = ">=3.8"
files = [
- {file = "Mako-1.3.5-py3-none-any.whl", hash = "sha256:260f1dbc3a519453a9c856dedfe4beb4e50bd5a26d96386cb6c80856556bb91a"},
- {file = "Mako-1.3.5.tar.gz", hash = "sha256:48dbc20568c1d276a2698b36d968fa76161bf127194907ea6fc594fa81f943bc"},
+ {file = "Mako-1.3.6-py3-none-any.whl", hash = "sha256:a91198468092a2f1a0de86ca92690fb0cfc43ca90ee17e15d93662b4c04b241a"},
+ {file = "mako-1.3.6.tar.gz", hash = "sha256:9ec3a1583713479fae654f83ed9fa8c9a4c16b7bb0daba0e6bbebff50c0d983d"},
]
[package.dependencies]
@@ -993,71 +1028,72 @@ testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"]
[[package]]
name = "markupsafe"
-version = "2.1.5"
+version = "3.0.2"
description = "Safely add untrusted strings to HTML/XML markup."
optional = false
-python-versions = ">=3.7"
+python-versions = ">=3.9"
files = [
- {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-win32.whl", hash = "sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4"},
- {file = "MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl", hash = "sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-win32.whl", hash = "sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906"},
- {file = "MarkupSafe-2.1.5-cp311-cp311-win_amd64.whl", hash = "sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-win32.whl", hash = "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad"},
- {file = "MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-win32.whl", hash = "sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371"},
- {file = "MarkupSafe-2.1.5-cp37-cp37m-win_amd64.whl", hash = "sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-win32.whl", hash = "sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff"},
- {file = "MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl", hash = "sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-win32.whl", hash = "sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf"},
- {file = "MarkupSafe-2.1.5-cp39-cp39-win_amd64.whl", hash = "sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5"},
- {file = "MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-win32.whl", hash = "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50"},
+ {file = "MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-win32.whl", hash = "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d"},
+ {file = "MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-win32.whl", hash = "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30"},
+ {file = "MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6"},
+ {file = "MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-win32.whl", hash = "sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f"},
+ {file = "MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a"},
+ {file = "markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"},
]
[[package]]
@@ -1174,64 +1210,66 @@ files = [
[[package]]
name = "numpy"
-version = "2.1.2"
+version = "2.1.3"
description = "Fundamental package for array computing in Python"
optional = false
python-versions = ">=3.10"
files = [
- {file = "numpy-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30d53720b726ec36a7f88dc873f0eec8447fbc93d93a8f079dfac2629598d6ee"},
- {file = "numpy-2.1.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e8d3ca0a72dd8846eb6f7dfe8f19088060fcb76931ed592d29128e0219652884"},
- {file = "numpy-2.1.2-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:fc44e3c68ff00fd991b59092a54350e6e4911152682b4782f68070985aa9e648"},
- {file = "numpy-2.1.2-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:7c1c60328bd964b53f8b835df69ae8198659e2b9302ff9ebb7de4e5a5994db3d"},
- {file = "numpy-2.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6cdb606a7478f9ad91c6283e238544451e3a95f30fb5467fbf715964341a8a86"},
- {file = "numpy-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d666cb72687559689e9906197e3bec7b736764df6a2e58ee265e360663e9baf7"},
- {file = "numpy-2.1.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c6eef7a2dbd0abfb0d9eaf78b73017dbfd0b54051102ff4e6a7b2980d5ac1a03"},
- {file = "numpy-2.1.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:12edb90831ff481f7ef5f6bc6431a9d74dc0e5ff401559a71e5e4611d4f2d466"},
- {file = "numpy-2.1.2-cp310-cp310-win32.whl", hash = "sha256:a65acfdb9c6ebb8368490dbafe83c03c7e277b37e6857f0caeadbbc56e12f4fb"},
- {file = "numpy-2.1.2-cp310-cp310-win_amd64.whl", hash = "sha256:860ec6e63e2c5c2ee5e9121808145c7bf86c96cca9ad396c0bd3e0f2798ccbe2"},
- {file = "numpy-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b42a1a511c81cc78cbc4539675713bbcf9d9c3913386243ceff0e9429ca892fe"},
- {file = "numpy-2.1.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:faa88bc527d0f097abdc2c663cddf37c05a1c2f113716601555249805cf573f1"},
- {file = "numpy-2.1.2-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:c82af4b2ddd2ee72d1fc0c6695048d457e00b3582ccde72d8a1c991b808bb20f"},
- {file = "numpy-2.1.2-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:13602b3174432a35b16c4cfb5de9a12d229727c3dd47a6ce35111f2ebdf66ff4"},
- {file = "numpy-2.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ebec5fd716c5a5b3d8dfcc439be82a8407b7b24b230d0ad28a81b61c2f4659a"},
- {file = "numpy-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2b49c3c0804e8ecb05d59af8386ec2f74877f7ca8fd9c1e00be2672e4d399b1"},
- {file = "numpy-2.1.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2cbba4b30bf31ddbe97f1c7205ef976909a93a66bb1583e983adbd155ba72ac2"},
- {file = "numpy-2.1.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8e00ea6fc82e8a804433d3e9cedaa1051a1422cb6e443011590c14d2dea59146"},
- {file = "numpy-2.1.2-cp311-cp311-win32.whl", hash = "sha256:5006b13a06e0b38d561fab5ccc37581f23c9511879be7693bd33c7cd15ca227c"},
- {file = "numpy-2.1.2-cp311-cp311-win_amd64.whl", hash = "sha256:f1eb068ead09f4994dec71c24b2844f1e4e4e013b9629f812f292f04bd1510d9"},
- {file = "numpy-2.1.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7bf0a4f9f15b32b5ba53147369e94296f5fffb783db5aacc1be15b4bf72f43b"},
- {file = "numpy-2.1.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b1d0fcae4f0949f215d4632be684a539859b295e2d0cb14f78ec231915d644db"},
- {file = "numpy-2.1.2-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:f751ed0a2f250541e19dfca9f1eafa31a392c71c832b6bb9e113b10d050cb0f1"},
- {file = "numpy-2.1.2-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:bd33f82e95ba7ad632bc57837ee99dba3d7e006536200c4e9124089e1bf42426"},
- {file = "numpy-2.1.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b8cde4f11f0a975d1fd59373b32e2f5a562ade7cde4f85b7137f3de8fbb29a0"},
- {file = "numpy-2.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d95f286b8244b3649b477ac066c6906fbb2905f8ac19b170e2175d3d799f4df"},
- {file = "numpy-2.1.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:ab4754d432e3ac42d33a269c8567413bdb541689b02d93788af4131018cbf366"},
- {file = "numpy-2.1.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e585c8ae871fd38ac50598f4763d73ec5497b0de9a0ab4ef5b69f01c6a046142"},
- {file = "numpy-2.1.2-cp312-cp312-win32.whl", hash = "sha256:9c6c754df29ce6a89ed23afb25550d1c2d5fdb9901d9c67a16e0b16eaf7e2550"},
- {file = "numpy-2.1.2-cp312-cp312-win_amd64.whl", hash = "sha256:456e3b11cb79ac9946c822a56346ec80275eaf2950314b249b512896c0d2505e"},
- {file = "numpy-2.1.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a84498e0d0a1174f2b3ed769b67b656aa5460c92c9554039e11f20a05650f00d"},
- {file = "numpy-2.1.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4d6ec0d4222e8ffdab1744da2560f07856421b367928026fb540e1945f2eeeaf"},
- {file = "numpy-2.1.2-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:259ec80d54999cc34cd1eb8ded513cb053c3bf4829152a2e00de2371bd406f5e"},
- {file = "numpy-2.1.2-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:675c741d4739af2dc20cd6c6a5c4b7355c728167845e3c6b0e824e4e5d36a6c3"},
- {file = "numpy-2.1.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:05b2d4e667895cc55e3ff2b56077e4c8a5604361fc21a042845ea3ad67465aa8"},
- {file = "numpy-2.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:43cca367bf94a14aca50b89e9bc2061683116cfe864e56740e083392f533ce7a"},
- {file = "numpy-2.1.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:76322dcdb16fccf2ac56f99048af32259dcc488d9b7e25b51e5eca5147a3fb98"},
- {file = "numpy-2.1.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:32e16a03138cabe0cb28e1007ee82264296ac0983714094380b408097a418cfe"},
- {file = "numpy-2.1.2-cp313-cp313-win32.whl", hash = "sha256:242b39d00e4944431a3cd2db2f5377e15b5785920421993770cddb89992c3f3a"},
- {file = "numpy-2.1.2-cp313-cp313-win_amd64.whl", hash = "sha256:f2ded8d9b6f68cc26f8425eda5d3877b47343e68ca23d0d0846f4d312ecaa445"},
- {file = "numpy-2.1.2-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:2ffef621c14ebb0188a8633348504a35c13680d6da93ab5cb86f4e54b7e922b5"},
- {file = "numpy-2.1.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:ad369ed238b1959dfbade9018a740fb9392c5ac4f9b5173f420bd4f37ba1f7a0"},
- {file = "numpy-2.1.2-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:d82075752f40c0ddf57e6e02673a17f6cb0f8eb3f587f63ca1eaab5594da5b17"},
- {file = "numpy-2.1.2-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:1600068c262af1ca9580a527d43dc9d959b0b1d8e56f8a05d830eea39b7c8af6"},
- {file = "numpy-2.1.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a26ae94658d3ba3781d5e103ac07a876b3e9b29db53f68ed7df432fd033358a8"},
- {file = "numpy-2.1.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13311c2db4c5f7609b462bc0f43d3c465424d25c626d95040f073e30f7570e35"},
- {file = "numpy-2.1.2-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:2abbf905a0b568706391ec6fa15161fad0fb5d8b68d73c461b3c1bab6064dd62"},
- {file = "numpy-2.1.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:ef444c57d664d35cac4e18c298c47d7b504c66b17c2ea91312e979fcfbdfb08a"},
- {file = "numpy-2.1.2-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:bdd407c40483463898b84490770199d5714dcc9dd9b792f6c6caccc523c00952"},
- {file = "numpy-2.1.2-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:da65fb46d4cbb75cb417cddf6ba5e7582eb7bb0b47db4b99c9fe5787ce5d91f5"},
- {file = "numpy-2.1.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c193d0b0238638e6fc5f10f1b074a6993cb13b0b431f64079a509d63d3aa8b7"},
- {file = "numpy-2.1.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a7d80b2e904faa63068ead63107189164ca443b42dd1930299e0d1cb041cec2e"},
- {file = "numpy-2.1.2.tar.gz", hash = "sha256:13532a088217fa624c99b843eeb54640de23b3414b14aa66d023805eb731066c"},
+ {file = "numpy-2.1.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c894b4305373b9c5576d7a12b473702afdf48ce5369c074ba304cc5ad8730dff"},
+ {file = "numpy-2.1.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b47fbb433d3260adcd51eb54f92a2ffbc90a4595f8970ee00e064c644ac788f5"},
+ {file = "numpy-2.1.3-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:825656d0743699c529c5943554d223c021ff0494ff1442152ce887ef4f7561a1"},
+ {file = "numpy-2.1.3-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:6a4825252fcc430a182ac4dee5a505053d262c807f8a924603d411f6718b88fd"},
+ {file = "numpy-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e711e02f49e176a01d0349d82cb5f05ba4db7d5e7e0defd026328e5cfb3226d3"},
+ {file = "numpy-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78574ac2d1a4a02421f25da9559850d59457bac82f2b8d7a44fe83a64f770098"},
+ {file = "numpy-2.1.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c7662f0e3673fe4e832fe07b65c50342ea27d989f92c80355658c7f888fcc83c"},
+ {file = "numpy-2.1.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:fa2d1337dc61c8dc417fbccf20f6d1e139896a30721b7f1e832b2bb6ef4eb6c4"},
+ {file = "numpy-2.1.3-cp310-cp310-win32.whl", hash = "sha256:72dcc4a35a8515d83e76b58fdf8113a5c969ccd505c8a946759b24e3182d1f23"},
+ {file = "numpy-2.1.3-cp310-cp310-win_amd64.whl", hash = "sha256:ecc76a9ba2911d8d37ac01de72834d8849e55473457558e12995f4cd53e778e0"},
+ {file = "numpy-2.1.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4d1167c53b93f1f5d8a139a742b3c6f4d429b54e74e6b57d0eff40045187b15d"},
+ {file = "numpy-2.1.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c80e4a09b3d95b4e1cac08643f1152fa71a0a821a2d4277334c88d54b2219a41"},
+ {file = "numpy-2.1.3-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:576a1c1d25e9e02ed7fa5477f30a127fe56debd53b8d2c89d5578f9857d03ca9"},
+ {file = "numpy-2.1.3-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:973faafebaae4c0aaa1a1ca1ce02434554d67e628b8d805e61f874b84e136b09"},
+ {file = "numpy-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:762479be47a4863e261a840e8e01608d124ee1361e48b96916f38b119cfda04a"},
+ {file = "numpy-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc6f24b3d1ecc1eebfbf5d6051faa49af40b03be1aaa781ebdadcbc090b4539b"},
+ {file = "numpy-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:17ee83a1f4fef3c94d16dc1802b998668b5419362c8a4f4e8a491de1b41cc3ee"},
+ {file = "numpy-2.1.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:15cb89f39fa6d0bdfb600ea24b250e5f1a3df23f901f51c8debaa6a5d122b2f0"},
+ {file = "numpy-2.1.3-cp311-cp311-win32.whl", hash = "sha256:d9beb777a78c331580705326d2367488d5bc473b49a9bc3036c154832520aca9"},
+ {file = "numpy-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:d89dd2b6da69c4fff5e39c28a382199ddedc3a5be5390115608345dec660b9e2"},
+ {file = "numpy-2.1.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f55ba01150f52b1027829b50d70ef1dafd9821ea82905b63936668403c3b471e"},
+ {file = "numpy-2.1.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:13138eadd4f4da03074851a698ffa7e405f41a0845a6b1ad135b81596e4e9958"},
+ {file = "numpy-2.1.3-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:a6b46587b14b888e95e4a24d7b13ae91fa22386c199ee7b418f449032b2fa3b8"},
+ {file = "numpy-2.1.3-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:0fa14563cc46422e99daef53d725d0c326e99e468a9320a240affffe87852564"},
+ {file = "numpy-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8637dcd2caa676e475503d1f8fdb327bc495554e10838019651b76d17b98e512"},
+ {file = "numpy-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2312b2aa89e1f43ecea6da6ea9a810d06aae08321609d8dc0d0eda6d946a541b"},
+ {file = "numpy-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a38c19106902bb19351b83802531fea19dee18e5b37b36454f27f11ff956f7fc"},
+ {file = "numpy-2.1.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:02135ade8b8a84011cbb67dc44e07c58f28575cf9ecf8ab304e51c05528c19f0"},
+ {file = "numpy-2.1.3-cp312-cp312-win32.whl", hash = "sha256:e6988e90fcf617da2b5c78902fe8e668361b43b4fe26dbf2d7b0f8034d4cafb9"},
+ {file = "numpy-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:0d30c543f02e84e92c4b1f415b7c6b5326cbe45ee7882b6b77db7195fb971e3a"},
+ {file = "numpy-2.1.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:96fe52fcdb9345b7cd82ecd34547fca4321f7656d500eca497eb7ea5a926692f"},
+ {file = "numpy-2.1.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f653490b33e9c3a4c1c01d41bc2aef08f9475af51146e4a7710c450cf9761598"},
+ {file = "numpy-2.1.3-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:dc258a761a16daa791081d026f0ed4399b582712e6fc887a95af09df10c5ca57"},
+ {file = "numpy-2.1.3-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:016d0f6f5e77b0f0d45d77387ffa4bb89816b57c835580c3ce8e099ef830befe"},
+ {file = "numpy-2.1.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c181ba05ce8299c7aa3125c27b9c2167bca4a4445b7ce73d5febc411ca692e43"},
+ {file = "numpy-2.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5641516794ca9e5f8a4d17bb45446998c6554704d888f86df9b200e66bdcce56"},
+ {file = "numpy-2.1.3-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ea4dedd6e394a9c180b33c2c872b92f7ce0f8e7ad93e9585312b0c5a04777a4a"},
+ {file = "numpy-2.1.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b0df3635b9c8ef48bd3be5f862cf71b0a4716fa0e702155c45067c6b711ddcef"},
+ {file = "numpy-2.1.3-cp313-cp313-win32.whl", hash = "sha256:50ca6aba6e163363f132b5c101ba078b8cbd3fa92c7865fd7d4d62d9779ac29f"},
+ {file = "numpy-2.1.3-cp313-cp313-win_amd64.whl", hash = "sha256:747641635d3d44bcb380d950679462fae44f54b131be347d5ec2bce47d3df9ed"},
+ {file = "numpy-2.1.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:996bb9399059c5b82f76b53ff8bb686069c05acc94656bb259b1d63d04a9506f"},
+ {file = "numpy-2.1.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:45966d859916ad02b779706bb43b954281db43e185015df6eb3323120188f9e4"},
+ {file = "numpy-2.1.3-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:baed7e8d7481bfe0874b566850cb0b85243e982388b7b23348c6db2ee2b2ae8e"},
+ {file = "numpy-2.1.3-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:a9f7f672a3388133335589cfca93ed468509cb7b93ba3105fce780d04a6576a0"},
+ {file = "numpy-2.1.3-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7aac50327da5d208db2eec22eb11e491e3fe13d22653dce51b0f4109101b408"},
+ {file = "numpy-2.1.3-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4394bc0dbd074b7f9b52024832d16e019decebf86caf909d94f6b3f77a8ee3b6"},
+ {file = "numpy-2.1.3-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:50d18c4358a0a8a53f12a8ba9d772ab2d460321e6a93d6064fc22443d189853f"},
+ {file = "numpy-2.1.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:14e253bd43fc6b37af4921b10f6add6925878a42a0c5fe83daee390bca80bc17"},
+ {file = "numpy-2.1.3-cp313-cp313t-win32.whl", hash = "sha256:08788d27a5fd867a663f6fc753fd7c3ad7e92747efc73c53bca2f19f8bc06f48"},
+ {file = "numpy-2.1.3-cp313-cp313t-win_amd64.whl", hash = "sha256:2564fbdf2b99b3f815f2107c1bbc93e2de8ee655a69c261363a1172a79a257d4"},
+ {file = "numpy-2.1.3-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:4f2015dfe437dfebbfce7c85c7b53d81ba49e71ba7eadbf1df40c915af75979f"},
+ {file = "numpy-2.1.3-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:3522b0dfe983a575e6a9ab3a4a4dfe156c3e428468ff08ce582b9bb6bd1d71d4"},
+ {file = "numpy-2.1.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c006b607a865b07cd981ccb218a04fc86b600411d83d6fc261357f1c0966755d"},
+ {file = "numpy-2.1.3-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:e14e26956e6f1696070788252dcdff11b4aca4c3e8bd166e0df1bb8f315a67cb"},
+ {file = "numpy-2.1.3.tar.gz", hash = "sha256:aa08e04e08aaf974d4458def539dece0d28146d866a39da5639596f4921fd761"},
]
[[package]]
@@ -1250,13 +1288,13 @@ attrs = ">=19.2.0"
[[package]]
name = "packaging"
-version = "24.1"
+version = "24.2"
description = "Core utilities for Python packages"
optional = false
python-versions = ">=3.8"
files = [
- {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"},
- {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"},
+ {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
+ {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
]
[[package]]
@@ -1312,8 +1350,8 @@ files = [
[package.dependencies]
numpy = [
- {version = ">=1.26.0", markers = "python_version >= \"3.12\""},
{version = ">=1.23.2", markers = "python_version == \"3.11\""},
+ {version = ">=1.26.0", markers = "python_version >= \"3.12\""},
{version = ">=1.22.4", markers = "python_version < \"3.11\""},
]
python-dateutil = ">=2.8.2"
@@ -1347,95 +1385,90 @@ xml = ["lxml (>=4.9.2)"]
[[package]]
name = "pillow"
-version = "10.4.0"
+version = "11.0.0"
description = "Python Imaging Library (Fork)"
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.9"
files = [
- {file = "pillow-10.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:4d9667937cfa347525b319ae34375c37b9ee6b525440f3ef48542fcf66f2731e"},
- {file = "pillow-10.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:543f3dc61c18dafb755773efc89aae60d06b6596a63914107f75459cf984164d"},
- {file = "pillow-10.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7928ecbf1ece13956b95d9cbcfc77137652b02763ba384d9ab508099a2eca856"},
- {file = "pillow-10.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4d49b85c4348ea0b31ea63bc75a9f3857869174e2bf17e7aba02945cd218e6f"},
- {file = "pillow-10.4.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:6c762a5b0997f5659a5ef2266abc1d8851ad7749ad9a6a5506eb23d314e4f46b"},
- {file = "pillow-10.4.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:a985e028fc183bf12a77a8bbf36318db4238a3ded7fa9df1b9a133f1cb79f8fc"},
- {file = "pillow-10.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:812f7342b0eee081eaec84d91423d1b4650bb9828eb53d8511bcef8ce5aecf1e"},
- {file = "pillow-10.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ac1452d2fbe4978c2eec89fb5a23b8387aba707ac72810d9490118817d9c0b46"},
- {file = "pillow-10.4.0-cp310-cp310-win32.whl", hash = "sha256:bcd5e41a859bf2e84fdc42f4edb7d9aba0a13d29a2abadccafad99de3feff984"},
- {file = "pillow-10.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:ecd85a8d3e79cd7158dec1c9e5808e821feea088e2f69a974db5edf84dc53141"},
- {file = "pillow-10.4.0-cp310-cp310-win_arm64.whl", hash = "sha256:ff337c552345e95702c5fde3158acb0625111017d0e5f24bf3acdb9cc16b90d1"},
- {file = "pillow-10.4.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:0a9ec697746f268507404647e531e92889890a087e03681a3606d9b920fbee3c"},
- {file = "pillow-10.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dfe91cb65544a1321e631e696759491ae04a2ea11d36715eca01ce07284738be"},
- {file = "pillow-10.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5dc6761a6efc781e6a1544206f22c80c3af4c8cf461206d46a1e6006e4429ff3"},
- {file = "pillow-10.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e84b6cc6a4a3d76c153a6b19270b3526a5a8ed6b09501d3af891daa2a9de7d6"},
- {file = "pillow-10.4.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:bbc527b519bd3aa9d7f429d152fea69f9ad37c95f0b02aebddff592688998abe"},
- {file = "pillow-10.4.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:76a911dfe51a36041f2e756b00f96ed84677cdeb75d25c767f296c1c1eda1319"},
- {file = "pillow-10.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:59291fb29317122398786c2d44427bbd1a6d7ff54017075b22be9d21aa59bd8d"},
- {file = "pillow-10.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:416d3a5d0e8cfe4f27f574362435bc9bae57f679a7158e0096ad2beb427b8696"},
- {file = "pillow-10.4.0-cp311-cp311-win32.whl", hash = "sha256:7086cc1d5eebb91ad24ded9f58bec6c688e9f0ed7eb3dbbf1e4800280a896496"},
- {file = "pillow-10.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cbed61494057c0f83b83eb3a310f0bf774b09513307c434d4366ed64f4128a91"},
- {file = "pillow-10.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:f5f0c3e969c8f12dd2bb7e0b15d5c468b51e5017e01e2e867335c81903046a22"},
- {file = "pillow-10.4.0-cp312-cp312-macosx_10_10_x86_64.whl", hash = "sha256:673655af3eadf4df6b5457033f086e90299fdd7a47983a13827acf7459c15d94"},
- {file = "pillow-10.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:866b6942a92f56300012f5fbac71f2d610312ee65e22f1aa2609e491284e5597"},
- {file = "pillow-10.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29dbdc4207642ea6aad70fbde1a9338753d33fb23ed6956e706936706f52dd80"},
- {file = "pillow-10.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf2342ac639c4cf38799a44950bbc2dfcb685f052b9e262f446482afaf4bffca"},
- {file = "pillow-10.4.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:f5b92f4d70791b4a67157321c4e8225d60b119c5cc9aee8ecf153aace4aad4ef"},
- {file = "pillow-10.4.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a"},
- {file = "pillow-10.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:780c072c2e11c9b2c7ca37f9a2ee8ba66f44367ac3e5c7832afcfe5104fd6d1b"},
- {file = "pillow-10.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:37fb69d905be665f68f28a8bba3c6d3223c8efe1edf14cc4cfa06c241f8c81d9"},
- {file = "pillow-10.4.0-cp312-cp312-win32.whl", hash = "sha256:7dfecdbad5c301d7b5bde160150b4db4c659cee2b69589705b6f8a0c509d9f42"},
- {file = "pillow-10.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:1d846aea995ad352d4bdcc847535bd56e0fd88d36829d2c90be880ef1ee4668a"},
- {file = "pillow-10.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:e553cad5179a66ba15bb18b353a19020e73a7921296a7979c4a2b7f6a5cd57f9"},
- {file = "pillow-10.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8bc1a764ed8c957a2e9cacf97c8b2b053b70307cf2996aafd70e91a082e70df3"},
- {file = "pillow-10.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6209bb41dc692ddfee4942517c19ee81b86c864b626dbfca272ec0f7cff5d9fb"},
- {file = "pillow-10.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bee197b30783295d2eb680b311af15a20a8b24024a19c3a26431ff83eb8d1f70"},
- {file = "pillow-10.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ef61f5dd14c300786318482456481463b9d6b91ebe5ef12f405afbba77ed0be"},
- {file = "pillow-10.4.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:297e388da6e248c98bc4a02e018966af0c5f92dfacf5a5ca22fa01cb3179bca0"},
- {file = "pillow-10.4.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:e4db64794ccdf6cb83a59d73405f63adbe2a1887012e308828596100a0b2f6cc"},
- {file = "pillow-10.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:bd2880a07482090a3bcb01f4265f1936a903d70bc740bfcb1fd4e8a2ffe5cf5a"},
- {file = "pillow-10.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4b35b21b819ac1dbd1233317adeecd63495f6babf21b7b2512d244ff6c6ce309"},
- {file = "pillow-10.4.0-cp313-cp313-win32.whl", hash = "sha256:551d3fd6e9dc15e4c1eb6fc4ba2b39c0c7933fa113b220057a34f4bb3268a060"},
- {file = "pillow-10.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:030abdbe43ee02e0de642aee345efa443740aa4d828bfe8e2eb11922ea6a21ea"},
- {file = "pillow-10.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:5b001114dd152cfd6b23befeb28d7aee43553e2402c9f159807bf55f33af8a8d"},
- {file = "pillow-10.4.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:8d4d5063501b6dd4024b8ac2f04962d661222d120381272deea52e3fc52d3736"},
- {file = "pillow-10.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7c1ee6f42250df403c5f103cbd2768a28fe1a0ea1f0f03fe151c8741e1469c8b"},
- {file = "pillow-10.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b15e02e9bb4c21e39876698abf233c8c579127986f8207200bc8a8f6bb27acf2"},
- {file = "pillow-10.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a8d4bade9952ea9a77d0c3e49cbd8b2890a399422258a77f357b9cc9be8d680"},
- {file = "pillow-10.4.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:43efea75eb06b95d1631cb784aa40156177bf9dd5b4b03ff38979e048258bc6b"},
- {file = "pillow-10.4.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:950be4d8ba92aca4b2bb0741285a46bfae3ca699ef913ec8416c1b78eadd64cd"},
- {file = "pillow-10.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d7480af14364494365e89d6fddc510a13e5a2c3584cb19ef65415ca57252fb84"},
- {file = "pillow-10.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:73664fe514b34c8f02452ffb73b7a92c6774e39a647087f83d67f010eb9a0cf0"},
- {file = "pillow-10.4.0-cp38-cp38-win32.whl", hash = "sha256:e88d5e6ad0d026fba7bdab8c3f225a69f063f116462c49892b0149e21b6c0a0e"},
- {file = "pillow-10.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:5161eef006d335e46895297f642341111945e2c1c899eb406882a6c61a4357ab"},
- {file = "pillow-10.4.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0ae24a547e8b711ccaaf99c9ae3cd975470e1a30caa80a6aaee9a2f19c05701d"},
- {file = "pillow-10.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:298478fe4f77a4408895605f3482b6cc6222c018b2ce565c2b6b9c354ac3229b"},
- {file = "pillow-10.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:134ace6dc392116566980ee7436477d844520a26a4b1bd4053f6f47d096997fd"},
- {file = "pillow-10.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:930044bb7679ab003b14023138b50181899da3f25de50e9dbee23b61b4de2126"},
- {file = "pillow-10.4.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:c76e5786951e72ed3686e122d14c5d7012f16c8303a674d18cdcd6d89557fc5b"},
- {file = "pillow-10.4.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:b2724fdb354a868ddf9a880cb84d102da914e99119211ef7ecbdc613b8c96b3c"},
- {file = "pillow-10.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:dbc6ae66518ab3c5847659e9988c3b60dc94ffb48ef9168656e0019a93dbf8a1"},
- {file = "pillow-10.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:06b2f7898047ae93fad74467ec3d28fe84f7831370e3c258afa533f81ef7f3df"},
- {file = "pillow-10.4.0-cp39-cp39-win32.whl", hash = "sha256:7970285ab628a3779aecc35823296a7869f889b8329c16ad5a71e4901a3dc4ef"},
- {file = "pillow-10.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:961a7293b2457b405967af9c77dcaa43cc1a8cd50d23c532e62d48ab6cdd56f5"},
- {file = "pillow-10.4.0-cp39-cp39-win_arm64.whl", hash = "sha256:32cda9e3d601a52baccb2856b8ea1fc213c90b340c542dcef77140dfa3278a9e"},
- {file = "pillow-10.4.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:5b4815f2e65b30f5fbae9dfffa8636d992d49705723fe86a3661806e069352d4"},
- {file = "pillow-10.4.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:8f0aef4ef59694b12cadee839e2ba6afeab89c0f39a3adc02ed51d109117b8da"},
- {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9f4727572e2918acaa9077c919cbbeb73bd2b3ebcfe033b72f858fc9fbef0026"},
- {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ff25afb18123cea58a591ea0244b92eb1e61a1fd497bf6d6384f09bc3262ec3e"},
- {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:dc3e2db6ba09ffd7d02ae9141cfa0ae23393ee7687248d46a7507b75d610f4f5"},
- {file = "pillow-10.4.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:02a2be69f9c9b8c1e97cf2713e789d4e398c751ecfd9967c18d0ce304efbf885"},
- {file = "pillow-10.4.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:0755ffd4a0c6f267cccbae2e9903d95477ca2f77c4fcf3a3a09570001856c8a5"},
- {file = "pillow-10.4.0-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:a02364621fe369e06200d4a16558e056fe2805d3468350df3aef21e00d26214b"},
- {file = "pillow-10.4.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:1b5dea9831a90e9d0721ec417a80d4cbd7022093ac38a568db2dd78363b00908"},
- {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9b885f89040bb8c4a1573566bbb2f44f5c505ef6e74cec7ab9068c900047f04b"},
- {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87dd88ded2e6d74d31e1e0a99a726a6765cda32d00ba72dc37f0651f306daaa8"},
- {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:2db98790afc70118bd0255c2eeb465e9767ecf1f3c25f9a1abb8ffc8cfd1fe0a"},
- {file = "pillow-10.4.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:f7baece4ce06bade126fb84b8af1c33439a76d8a6fd818970215e0560ca28c27"},
- {file = "pillow-10.4.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:cfdd747216947628af7b259d274771d84db2268ca062dd5faf373639d00113a3"},
- {file = "pillow-10.4.0.tar.gz", hash = "sha256:166c1cd4d24309b30d61f79f4a9114b7b2313d7450912277855ff5dfd7cd4a06"},
+ {file = "pillow-11.0.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:6619654954dc4936fcff82db8eb6401d3159ec6be81e33c6000dfd76ae189947"},
+ {file = "pillow-11.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b3c5ac4bed7519088103d9450a1107f76308ecf91d6dabc8a33a2fcfb18d0fba"},
+ {file = "pillow-11.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a65149d8ada1055029fcb665452b2814fe7d7082fcb0c5bed6db851cb69b2086"},
+ {file = "pillow-11.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88a58d8ac0cc0e7f3a014509f0455248a76629ca9b604eca7dc5927cc593c5e9"},
+ {file = "pillow-11.0.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:c26845094b1af3c91852745ae78e3ea47abf3dbcd1cf962f16b9a5fbe3ee8488"},
+ {file = "pillow-11.0.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:1a61b54f87ab5786b8479f81c4b11f4d61702830354520837f8cc791ebba0f5f"},
+ {file = "pillow-11.0.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:674629ff60030d144b7bca2b8330225a9b11c482ed408813924619c6f302fdbb"},
+ {file = "pillow-11.0.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:598b4e238f13276e0008299bd2482003f48158e2b11826862b1eb2ad7c768b97"},
+ {file = "pillow-11.0.0-cp310-cp310-win32.whl", hash = "sha256:9a0f748eaa434a41fccf8e1ee7a3eed68af1b690e75328fd7a60af123c193b50"},
+ {file = "pillow-11.0.0-cp310-cp310-win_amd64.whl", hash = "sha256:a5629742881bcbc1f42e840af185fd4d83a5edeb96475a575f4da50d6ede337c"},
+ {file = "pillow-11.0.0-cp310-cp310-win_arm64.whl", hash = "sha256:ee217c198f2e41f184f3869f3e485557296d505b5195c513b2bfe0062dc537f1"},
+ {file = "pillow-11.0.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:1c1d72714f429a521d8d2d018badc42414c3077eb187a59579f28e4270b4b0fc"},
+ {file = "pillow-11.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:499c3a1b0d6fc8213519e193796eb1a86a1be4b1877d678b30f83fd979811d1a"},
+ {file = "pillow-11.0.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c8b2351c85d855293a299038e1f89db92a2f35e8d2f783489c6f0b2b5f3fe8a3"},
+ {file = "pillow-11.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6f4dba50cfa56f910241eb7f883c20f1e7b1d8f7d91c750cd0b318bad443f4d5"},
+ {file = "pillow-11.0.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:5ddbfd761ee00c12ee1be86c9c0683ecf5bb14c9772ddbd782085779a63dd55b"},
+ {file = "pillow-11.0.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:45c566eb10b8967d71bf1ab8e4a525e5a93519e29ea071459ce517f6b903d7fa"},
+ {file = "pillow-11.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:b4fd7bd29610a83a8c9b564d457cf5bd92b4e11e79a4ee4716a63c959699b306"},
+ {file = "pillow-11.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:cb929ca942d0ec4fac404cbf520ee6cac37bf35be479b970c4ffadf2b6a1cad9"},
+ {file = "pillow-11.0.0-cp311-cp311-win32.whl", hash = "sha256:006bcdd307cc47ba43e924099a038cbf9591062e6c50e570819743f5607404f5"},
+ {file = "pillow-11.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:52a2d8323a465f84faaba5236567d212c3668f2ab53e1c74c15583cf507a0291"},
+ {file = "pillow-11.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:16095692a253047fe3ec028e951fa4221a1f3ed3d80c397e83541a3037ff67c9"},
+ {file = "pillow-11.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d2c0a187a92a1cb5ef2c8ed5412dd8d4334272617f532d4ad4de31e0495bd923"},
+ {file = "pillow-11.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:084a07ef0821cfe4858fe86652fffac8e187b6ae677e9906e192aafcc1b69903"},
+ {file = "pillow-11.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8069c5179902dcdce0be9bfc8235347fdbac249d23bd90514b7a47a72d9fecf4"},
+ {file = "pillow-11.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f02541ef64077f22bf4924f225c0fd1248c168f86e4b7abdedd87d6ebaceab0f"},
+ {file = "pillow-11.0.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:fcb4621042ac4b7865c179bb972ed0da0218a076dc1820ffc48b1d74c1e37fe9"},
+ {file = "pillow-11.0.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:00177a63030d612148e659b55ba99527803288cea7c75fb05766ab7981a8c1b7"},
+ {file = "pillow-11.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8853a3bf12afddfdf15f57c4b02d7ded92c7a75a5d7331d19f4f9572a89c17e6"},
+ {file = "pillow-11.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3107c66e43bda25359d5ef446f59c497de2b5ed4c7fdba0894f8d6cf3822dafc"},
+ {file = "pillow-11.0.0-cp312-cp312-win32.whl", hash = "sha256:86510e3f5eca0ab87429dd77fafc04693195eec7fd6a137c389c3eeb4cfb77c6"},
+ {file = "pillow-11.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:8ec4a89295cd6cd4d1058a5e6aec6bf51e0eaaf9714774e1bfac7cfc9051db47"},
+ {file = "pillow-11.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:27a7860107500d813fcd203b4ea19b04babe79448268403172782754870dac25"},
+ {file = "pillow-11.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bcd1fb5bb7b07f64c15618c89efcc2cfa3e95f0e3bcdbaf4642509de1942a699"},
+ {file = "pillow-11.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0e038b0745997c7dcaae350d35859c9715c71e92ffb7e0f4a8e8a16732150f38"},
+ {file = "pillow-11.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ae08bd8ffc41aebf578c2af2f9d8749d91f448b3bfd41d7d9ff573d74f2a6b2"},
+ {file = "pillow-11.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d69bfd8ec3219ae71bcde1f942b728903cad25fafe3100ba2258b973bd2bc1b2"},
+ {file = "pillow-11.0.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:61b887f9ddba63ddf62fd02a3ba7add935d053b6dd7d58998c630e6dbade8527"},
+ {file = "pillow-11.0.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:c6a660307ca9d4867caa8d9ca2c2658ab685de83792d1876274991adec7b93fa"},
+ {file = "pillow-11.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:73e3a0200cdda995c7e43dd47436c1548f87a30bb27fb871f352a22ab8dcf45f"},
+ {file = "pillow-11.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fba162b8872d30fea8c52b258a542c5dfd7b235fb5cb352240c8d63b414013eb"},
+ {file = "pillow-11.0.0-cp313-cp313-win32.whl", hash = "sha256:f1b82c27e89fffc6da125d5eb0ca6e68017faf5efc078128cfaa42cf5cb38798"},
+ {file = "pillow-11.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:8ba470552b48e5835f1d23ecb936bb7f71d206f9dfeee64245f30c3270b994de"},
+ {file = "pillow-11.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:846e193e103b41e984ac921b335df59195356ce3f71dcfd155aa79c603873b84"},
+ {file = "pillow-11.0.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:4ad70c4214f67d7466bea6a08061eba35c01b1b89eaa098040a35272a8efb22b"},
+ {file = "pillow-11.0.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:6ec0d5af64f2e3d64a165f490d96368bb5dea8b8f9ad04487f9ab60dc4bb6003"},
+ {file = "pillow-11.0.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c809a70e43c7977c4a42aefd62f0131823ebf7dd73556fa5d5950f5b354087e2"},
+ {file = "pillow-11.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:4b60c9520f7207aaf2e1d94de026682fc227806c6e1f55bba7606d1c94dd623a"},
+ {file = "pillow-11.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:1e2688958a840c822279fda0086fec1fdab2f95bf2b717b66871c4ad9859d7e8"},
+ {file = "pillow-11.0.0-cp313-cp313t-win32.whl", hash = "sha256:607bbe123c74e272e381a8d1957083a9463401f7bd01287f50521ecb05a313f8"},
+ {file = "pillow-11.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:5c39ed17edea3bc69c743a8dd3e9853b7509625c2462532e62baa0732163a904"},
+ {file = "pillow-11.0.0-cp313-cp313t-win_arm64.whl", hash = "sha256:75acbbeb05b86bc53cbe7b7e6fe00fbcf82ad7c684b3ad82e3d711da9ba287d3"},
+ {file = "pillow-11.0.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:2e46773dc9f35a1dd28bd6981332fd7f27bec001a918a72a79b4133cf5291dba"},
+ {file = "pillow-11.0.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2679d2258b7f1192b378e2893a8a0a0ca472234d4c2c0e6bdd3380e8dfa21b6a"},
+ {file = "pillow-11.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eda2616eb2313cbb3eebbe51f19362eb434b18e3bb599466a1ffa76a033fb916"},
+ {file = "pillow-11.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:20ec184af98a121fb2da42642dea8a29ec80fc3efbaefb86d8fdd2606619045d"},
+ {file = "pillow-11.0.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:8594f42df584e5b4bb9281799698403f7af489fba84c34d53d1c4bfb71b7c4e7"},
+ {file = "pillow-11.0.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:c12b5ae868897c7338519c03049a806af85b9b8c237b7d675b8c5e089e4a618e"},
+ {file = "pillow-11.0.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:70fbbdacd1d271b77b7721fe3cdd2d537bbbd75d29e6300c672ec6bb38d9672f"},
+ {file = "pillow-11.0.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:5178952973e588b3f1360868847334e9e3bf49d19e169bbbdfaf8398002419ae"},
+ {file = "pillow-11.0.0-cp39-cp39-win32.whl", hash = "sha256:8c676b587da5673d3c75bd67dd2a8cdfeb282ca38a30f37950511766b26858c4"},
+ {file = "pillow-11.0.0-cp39-cp39-win_amd64.whl", hash = "sha256:94f3e1780abb45062287b4614a5bc0874519c86a777d4a7ad34978e86428b8dd"},
+ {file = "pillow-11.0.0-cp39-cp39-win_arm64.whl", hash = "sha256:290f2cc809f9da7d6d622550bbf4c1e57518212da51b6a30fe8e0a270a5b78bd"},
+ {file = "pillow-11.0.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:1187739620f2b365de756ce086fdb3604573337cc28a0d3ac4a01ab6b2d2a6d2"},
+ {file = "pillow-11.0.0-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:fbbcb7b57dc9c794843e3d1258c0fbf0f48656d46ffe9e09b63bbd6e8cd5d0a2"},
+ {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d203af30149ae339ad1b4f710d9844ed8796e97fda23ffbc4cc472968a47d0b"},
+ {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21a0d3b115009ebb8ac3d2ebec5c2982cc693da935f4ab7bb5c8ebe2f47d36f2"},
+ {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:73853108f56df97baf2bb8b522f3578221e56f646ba345a372c78326710d3830"},
+ {file = "pillow-11.0.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:e58876c91f97b0952eb766123bfef372792ab3f4e3e1f1a2267834c2ab131734"},
+ {file = "pillow-11.0.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:224aaa38177597bb179f3ec87eeefcce8e4f85e608025e9cfac60de237ba6316"},
+ {file = "pillow-11.0.0-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:5bd2d3bdb846d757055910f0a59792d33b555800813c3b39ada1829c372ccb06"},
+ {file = "pillow-11.0.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:375b8dd15a1f5d2feafff536d47e22f69625c1aa92f12b339ec0b2ca40263273"},
+ {file = "pillow-11.0.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:daffdf51ee5db69a82dd127eabecce20729e21f7a3680cf7cbb23f0829189790"},
+ {file = "pillow-11.0.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7326a1787e3c7b0429659e0a944725e1b03eeaa10edd945a86dead1913383944"},
+ {file = "pillow-11.0.0.tar.gz", hash = "sha256:72bacbaf24ac003fea9bff9837d1eedb6088758d41e100c1552930151f677739"},
]
[package.extras]
-docs = ["furo", "olefile", "sphinx (>=7.3)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"]
+docs = ["furo", "olefile", "sphinx (>=8.1)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinxext-opengraph"]
fpx = ["olefile"]
mic = ["olefile"]
tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"]
@@ -1444,13 +1477,13 @@ xmp = ["defusedxml"]
[[package]]
name = "pip"
-version = "24.2"
+version = "24.3.1"
description = "The PyPA recommended tool for installing Python packages."
optional = false
python-versions = ">=3.8"
files = [
- {file = "pip-24.2-py3-none-any.whl", hash = "sha256:2cd581cf58ab7fcfca4ce8efa6dcacd0de5bf8d0a3eb9ec927e07405f4d9e2a2"},
- {file = "pip-24.2.tar.gz", hash = "sha256:5b5e490b5e9cb275c879595064adce9ebd31b854e3e803740b72f9ccf34a45b8"},
+ {file = "pip-24.3.1-py3-none-any.whl", hash = "sha256:3790624780082365f47549d032f3770eeb2b1e8bd1f7b2e02dace1afa361b4ed"},
+ {file = "pip-24.3.1.tar.gz", hash = "sha256:ebcb60557f2aefabc2e0f918751cd24ea0d56d8ec5445fe1807f1d2109660b99"},
]
[[package]]
@@ -1503,22 +1536,22 @@ type = ["mypy (>=1.11.2)"]
[[package]]
name = "playwright"
-version = "1.47.0"
+version = "1.48.0"
description = "A high-level API to automate web browsers"
optional = false
python-versions = ">=3.8"
files = [
- {file = "playwright-1.47.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:f205df24edb925db1a4ab62f1ab0da06f14bb69e382efecfb0deedc4c7f4b8cd"},
- {file = "playwright-1.47.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7fc820faf6885f69a52ba4ec94124e575d3c4a4003bf29200029b4a4f2b2d0ab"},
- {file = "playwright-1.47.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:8e212dc472ff19c7d46ed7e900191c7a786ce697556ac3f1615986ec3aa00341"},
- {file = "playwright-1.47.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:a1935672531963e4b2a321de5aa59b982fb92463ee6e1032dd7326378e462955"},
- {file = "playwright-1.47.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e0a1b61473d6f7f39c5d77d4800b3cbefecb03344c90b98f3fbcae63294ad249"},
- {file = "playwright-1.47.0-py3-none-win32.whl", hash = "sha256:1b977ed81f6bba5582617684a21adab9bad5676d90a357ebf892db7bdf4a9974"},
- {file = "playwright-1.47.0-py3-none-win_amd64.whl", hash = "sha256:0ec1056042d2e86088795a503347407570bffa32cbe20748e5d4c93dba085280"},
+ {file = "playwright-1.48.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:082bce2739f1078acc7d0734da8cc0e23eb91b7fae553f3316d733276f09a6b1"},
+ {file = "playwright-1.48.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7da2eb51a19c7f3b523e9faa9d98e7af92e52eb983a099979ea79c9668e3cbf7"},
+ {file = "playwright-1.48.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:115b988d1da322358b77bc3bf2d3cc90f8c881e691461538e7df91614c4833c9"},
+ {file = "playwright-1.48.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:8dabb80e62f667fe2640a8b694e26a7b884c0b4803f7514a3954fc849126227b"},
+ {file = "playwright-1.48.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8ff8303409ebed76bed4c3d655340320b768817d900ba208b394fdd7d7939a5c"},
+ {file = "playwright-1.48.0-py3-none-win32.whl", hash = "sha256:85598c360c590076d4f435525be991246d74a905b654ac19d26eab7ed9b98b2d"},
+ {file = "playwright-1.48.0-py3-none-win_amd64.whl", hash = "sha256:e0e87b0c4dc8fce83c725dd851aec37bc4e882bb225ec8a96bd83cf32d4f1623"},
]
[package.dependencies]
-greenlet = "3.0.3"
+greenlet = "3.1.1"
pyee = "12.0.0"
[[package]]
@@ -1553,13 +1586,13 @@ testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "pre-commit"
-version = "4.0.0"
+version = "4.0.1"
description = "A framework for managing and maintaining multi-language pre-commit hooks."
optional = false
python-versions = ">=3.9"
files = [
- {file = "pre_commit-4.0.0-py2.py3-none-any.whl", hash = "sha256:0ca2341cf94ac1865350970951e54b1a50521e57b7b500403307aed4315a1234"},
- {file = "pre_commit-4.0.0.tar.gz", hash = "sha256:5d9807162cc5537940f94f266cbe2d716a75cfad0d78a317a92cac16287cfed6"},
+ {file = "pre_commit-4.0.1-py2.py3-none-any.whl", hash = "sha256:efde913840816312445dc98787724647c65473daefe420785f885e8ed9a06878"},
+ {file = "pre_commit-4.0.1.tar.gz", hash = "sha256:80905ac375958c0444c65e9cebebd948b3cdb518f335a091a670a89d652139d2"},
]
[package.dependencies]
@@ -1571,32 +1604,33 @@ virtualenv = ">=20.10.0"
[[package]]
name = "psutil"
-version = "6.0.0"
+version = "6.1.0"
description = "Cross-platform lib for process and system monitoring in Python."
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7"
files = [
- {file = "psutil-6.0.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:a021da3e881cd935e64a3d0a20983bda0bb4cf80e4f74fa9bfcb1bc5785360c6"},
- {file = "psutil-6.0.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:1287c2b95f1c0a364d23bc6f2ea2365a8d4d9b726a3be7294296ff7ba97c17f0"},
- {file = "psutil-6.0.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:a9a3dbfb4de4f18174528d87cc352d1f788b7496991cca33c6996f40c9e3c92c"},
- {file = "psutil-6.0.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:6ec7588fb3ddaec7344a825afe298db83fe01bfaaab39155fa84cf1c0d6b13c3"},
- {file = "psutil-6.0.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:1e7c870afcb7d91fdea2b37c24aeb08f98b6d67257a5cb0a8bc3ac68d0f1a68c"},
- {file = "psutil-6.0.0-cp27-none-win32.whl", hash = "sha256:02b69001f44cc73c1c5279d02b30a817e339ceb258ad75997325e0e6169d8b35"},
- {file = "psutil-6.0.0-cp27-none-win_amd64.whl", hash = "sha256:21f1fb635deccd510f69f485b87433460a603919b45e2a324ad65b0cc74f8fb1"},
- {file = "psutil-6.0.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:c588a7e9b1173b6e866756dde596fd4cad94f9399daf99ad8c3258b3cb2b47a0"},
- {file = "psutil-6.0.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ed2440ada7ef7d0d608f20ad89a04ec47d2d3ab7190896cd62ca5fc4fe08bf0"},
- {file = "psutil-6.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fd9a97c8e94059b0ef54a7d4baf13b405011176c3b6ff257c247cae0d560ecd"},
- {file = "psutil-6.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e2e8d0054fc88153ca0544f5c4d554d42e33df2e009c4ff42284ac9ebdef4132"},
- {file = "psutil-6.0.0-cp36-cp36m-win32.whl", hash = "sha256:fc8c9510cde0146432bbdb433322861ee8c3efbf8589865c8bf8d21cb30c4d14"},
- {file = "psutil-6.0.0-cp36-cp36m-win_amd64.whl", hash = "sha256:34859b8d8f423b86e4385ff3665d3f4d94be3cdf48221fbe476e883514fdb71c"},
- {file = "psutil-6.0.0-cp37-abi3-win32.whl", hash = "sha256:a495580d6bae27291324fe60cea0b5a7c23fa36a7cd35035a16d93bdcf076b9d"},
- {file = "psutil-6.0.0-cp37-abi3-win_amd64.whl", hash = "sha256:33ea5e1c975250a720b3a6609c490db40dae5d83a4eb315170c4fe0d8b1f34b3"},
- {file = "psutil-6.0.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:ffe7fc9b6b36beadc8c322f84e1caff51e8703b88eee1da46d1e3a6ae11b4fd0"},
- {file = "psutil-6.0.0.tar.gz", hash = "sha256:8faae4f310b6d969fa26ca0545338b21f73c6b15db7c4a8d934a5482faa818f2"},
+ {file = "psutil-6.1.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:ff34df86226c0227c52f38b919213157588a678d049688eded74c76c8ba4a5d0"},
+ {file = "psutil-6.1.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:c0e0c00aa18ca2d3b2b991643b799a15fc8f0563d2ebb6040f64ce8dc027b942"},
+ {file = "psutil-6.1.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:000d1d1ebd634b4efb383f4034437384e44a6d455260aaee2eca1e9c1b55f047"},
+ {file = "psutil-6.1.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:5cd2bcdc75b452ba2e10f0e8ecc0b57b827dd5d7aaffbc6821b2a9a242823a76"},
+ {file = "psutil-6.1.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:045f00a43c737f960d273a83973b2511430d61f283a44c96bf13a6e829ba8fdc"},
+ {file = "psutil-6.1.0-cp27-none-win32.whl", hash = "sha256:9118f27452b70bb1d9ab3198c1f626c2499384935aaf55388211ad982611407e"},
+ {file = "psutil-6.1.0-cp27-none-win_amd64.whl", hash = "sha256:a8506f6119cff7015678e2bce904a4da21025cc70ad283a53b099e7620061d85"},
+ {file = "psutil-6.1.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:6e2dcd475ce8b80522e51d923d10c7871e45f20918e027ab682f94f1c6351688"},
+ {file = "psutil-6.1.0-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:0895b8414afafc526712c498bd9de2b063deaac4021a3b3c34566283464aff8e"},
+ {file = "psutil-6.1.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9dcbfce5d89f1d1f2546a2090f4fcf87c7f669d1d90aacb7d7582addece9fb38"},
+ {file = "psutil-6.1.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:498c6979f9c6637ebc3a73b3f87f9eb1ec24e1ce53a7c5173b8508981614a90b"},
+ {file = "psutil-6.1.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d905186d647b16755a800e7263d43df08b790d709d575105d419f8b6ef65423a"},
+ {file = "psutil-6.1.0-cp36-cp36m-win32.whl", hash = "sha256:6d3fbbc8d23fcdcb500d2c9f94e07b1342df8ed71b948a2649b5cb060a7c94ca"},
+ {file = "psutil-6.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:1209036fbd0421afde505a4879dee3b2fd7b1e14fee81c0069807adcbbcca747"},
+ {file = "psutil-6.1.0-cp37-abi3-win32.whl", hash = "sha256:1ad45a1f5d0b608253b11508f80940985d1d0c8f6111b5cb637533a0e6ddc13e"},
+ {file = "psutil-6.1.0-cp37-abi3-win_amd64.whl", hash = "sha256:a8fb3752b491d246034fa4d279ff076501588ce8cbcdbb62c32fd7a377d996be"},
+ {file = "psutil-6.1.0.tar.gz", hash = "sha256:353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a"},
]
[package.extras]
-test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"]
+dev = ["black", "check-manifest", "coverage", "packaging", "pylint", "pyperf", "pypinfo", "pytest-cov", "requests", "rstcheck", "ruff", "sphinx", "sphinx_rtd_theme", "toml-sort", "twine", "virtualenv", "wheel"]
+test = ["pytest", "pytest-xdist", "setuptools"]
[[package]]
name = "py-cpuinfo"
@@ -1622,22 +1656,19 @@ files = [
[[package]]
name = "pydantic"
-version = "2.9.2"
+version = "2.10.1"
description = "Data validation using Python type hints"
optional = false
python-versions = ">=3.8"
files = [
- {file = "pydantic-2.9.2-py3-none-any.whl", hash = "sha256:f048cec7b26778210e28a0459867920654d48e5e62db0958433636cde4254f12"},
- {file = "pydantic-2.9.2.tar.gz", hash = "sha256:d155cef71265d1e9807ed1c32b4c8deec042a44a50a4188b25ac67ecd81a9c0f"},
+ {file = "pydantic-2.10.1-py3-none-any.whl", hash = "sha256:a8d20db84de64cf4a7d59e899c2caf0fe9d660c7cfc482528e7020d7dd189a7e"},
+ {file = "pydantic-2.10.1.tar.gz", hash = "sha256:a4daca2dc0aa429555e0656d6bf94873a7dc5f54ee42b1f5873d666fb3f35560"},
]
[package.dependencies]
annotated-types = ">=0.6.0"
-pydantic-core = "2.23.4"
-typing-extensions = [
- {version = ">=4.12.2", markers = "python_version >= \"3.13\""},
- {version = ">=4.6.1", markers = "python_version < \"3.13\""},
-]
+pydantic-core = "2.27.1"
+typing-extensions = ">=4.12.2"
[package.extras]
email = ["email-validator (>=2.0.0)"]
@@ -1645,100 +1676,111 @@ timezone = ["tzdata"]
[[package]]
name = "pydantic-core"
-version = "2.23.4"
+version = "2.27.1"
description = "Core functionality for Pydantic validation and serialization"
optional = false
python-versions = ">=3.8"
files = [
- {file = "pydantic_core-2.23.4-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:b10bd51f823d891193d4717448fab065733958bdb6a6b351967bd349d48d5c9b"},
- {file = "pydantic_core-2.23.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4fc714bdbfb534f94034efaa6eadd74e5b93c8fa6315565a222f7b6f42ca1166"},
- {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63e46b3169866bd62849936de036f901a9356e36376079b05efa83caeaa02ceb"},
- {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed1a53de42fbe34853ba90513cea21673481cd81ed1be739f7f2efb931b24916"},
- {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:cfdd16ab5e59fc31b5e906d1a3f666571abc367598e3e02c83403acabc092e07"},
- {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:255a8ef062cbf6674450e668482456abac99a5583bbafb73f9ad469540a3a232"},
- {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a7cd62e831afe623fbb7aabbb4fe583212115b3ef38a9f6b71869ba644624a2"},
- {file = "pydantic_core-2.23.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f09e2ff1f17c2b51f2bc76d1cc33da96298f0a036a137f5440ab3ec5360b624f"},
- {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:e38e63e6f3d1cec5a27e0afe90a085af8b6806ee208b33030e65b6516353f1a3"},
- {file = "pydantic_core-2.23.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0dbd8dbed2085ed23b5c04afa29d8fd2771674223135dc9bc937f3c09284d071"},
- {file = "pydantic_core-2.23.4-cp310-none-win32.whl", hash = "sha256:6531b7ca5f951d663c339002e91aaebda765ec7d61b7d1e3991051906ddde119"},
- {file = "pydantic_core-2.23.4-cp310-none-win_amd64.whl", hash = "sha256:7c9129eb40958b3d4500fa2467e6a83356b3b61bfff1b414c7361d9220f9ae8f"},
- {file = "pydantic_core-2.23.4-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:77733e3892bb0a7fa797826361ce8a9184d25c8dffaec60b7ffe928153680ba8"},
- {file = "pydantic_core-2.23.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1b84d168f6c48fabd1f2027a3d1bdfe62f92cade1fb273a5d68e621da0e44e6d"},
- {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df49e7a0861a8c36d089c1ed57d308623d60416dab2647a4a17fe050ba85de0e"},
- {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ff02b6d461a6de369f07ec15e465a88895f3223eb75073ffea56b84d9331f607"},
- {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:996a38a83508c54c78a5f41456b0103c30508fed9abcad0a59b876d7398f25fd"},
- {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d97683ddee4723ae8c95d1eddac7c192e8c552da0c73a925a89fa8649bf13eea"},
- {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:216f9b2d7713eb98cb83c80b9c794de1f6b7e3145eef40400c62e86cee5f4e1e"},
- {file = "pydantic_core-2.23.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6f783e0ec4803c787bcea93e13e9932edab72068f68ecffdf86a99fd5918878b"},
- {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:d0776dea117cf5272382634bd2a5c1b6eb16767c223c6a5317cd3e2a757c61a0"},
- {file = "pydantic_core-2.23.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d5f7a395a8cf1621939692dba2a6b6a830efa6b3cee787d82c7de1ad2930de64"},
- {file = "pydantic_core-2.23.4-cp311-none-win32.whl", hash = "sha256:74b9127ffea03643e998e0c5ad9bd3811d3dac8c676e47db17b0ee7c3c3bf35f"},
- {file = "pydantic_core-2.23.4-cp311-none-win_amd64.whl", hash = "sha256:98d134c954828488b153d88ba1f34e14259284f256180ce659e8d83e9c05eaa3"},
- {file = "pydantic_core-2.23.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f3e0da4ebaef65158d4dfd7d3678aad692f7666877df0002b8a522cdf088f231"},
- {file = "pydantic_core-2.23.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f69a8e0b033b747bb3e36a44e7732f0c99f7edd5cea723d45bc0d6e95377ffee"},
- {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:723314c1d51722ab28bfcd5240d858512ffd3116449c557a1336cbe3919beb87"},
- {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bb2802e667b7051a1bebbfe93684841cc9351004e2badbd6411bf357ab8d5ac8"},
- {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d18ca8148bebe1b0a382a27a8ee60350091a6ddaf475fa05ef50dc35b5df6327"},
- {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:33e3d65a85a2a4a0dc3b092b938a4062b1a05f3a9abde65ea93b233bca0e03f2"},
- {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:128585782e5bfa515c590ccee4b727fb76925dd04a98864182b22e89a4e6ed36"},
- {file = "pydantic_core-2.23.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:68665f4c17edcceecc112dfed5dbe6f92261fb9d6054b47d01bf6371a6196126"},
- {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:20152074317d9bed6b7a95ade3b7d6054845d70584216160860425f4fbd5ee9e"},
- {file = "pydantic_core-2.23.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:9261d3ce84fa1d38ed649c3638feefeae23d32ba9182963e465d58d62203bd24"},
- {file = "pydantic_core-2.23.4-cp312-none-win32.whl", hash = "sha256:4ba762ed58e8d68657fc1281e9bb72e1c3e79cc5d464be146e260c541ec12d84"},
- {file = "pydantic_core-2.23.4-cp312-none-win_amd64.whl", hash = "sha256:97df63000f4fea395b2824da80e169731088656d1818a11b95f3b173747b6cd9"},
- {file = "pydantic_core-2.23.4-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7530e201d10d7d14abce4fb54cfe5b94a0aefc87da539d0346a484ead376c3cc"},
- {file = "pydantic_core-2.23.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:df933278128ea1cd77772673c73954e53a1c95a4fdf41eef97c2b779271bd0bd"},
- {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cb3da3fd1b6a5d0279a01877713dbda118a2a4fc6f0d821a57da2e464793f05"},
- {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c6dcb030aefb668a2b7009c85b27f90e51e6a3b4d5c9bc4c57631292015b0d"},
- {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:696dd8d674d6ce621ab9d45b205df149399e4bb9aa34102c970b721554828510"},
- {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2971bb5ffe72cc0f555c13e19b23c85b654dd2a8f7ab493c262071377bfce9f6"},
- {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8394d940e5d400d04cad4f75c0598665cbb81aecefaca82ca85bd28264af7f9b"},
- {file = "pydantic_core-2.23.4-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0dff76e0602ca7d4cdaacc1ac4c005e0ce0dcfe095d5b5259163a80d3a10d327"},
- {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7d32706badfe136888bdea71c0def994644e09fff0bfe47441deaed8e96fdbc6"},
- {file = "pydantic_core-2.23.4-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ed541d70698978a20eb63d8c5d72f2cc6d7079d9d90f6b50bad07826f1320f5f"},
- {file = "pydantic_core-2.23.4-cp313-none-win32.whl", hash = "sha256:3d5639516376dce1940ea36edf408c554475369f5da2abd45d44621cb616f769"},
- {file = "pydantic_core-2.23.4-cp313-none-win_amd64.whl", hash = "sha256:5a1504ad17ba4210df3a045132a7baeeba5a200e930f57512ee02909fc5c4cb5"},
- {file = "pydantic_core-2.23.4-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d4488a93b071c04dc20f5cecc3631fc78b9789dd72483ba15d423b5b3689b555"},
- {file = "pydantic_core-2.23.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:81965a16b675b35e1d09dd14df53f190f9129c0202356ed44ab2728b1c905658"},
- {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ffa2ebd4c8530079140dd2d7f794a9d9a73cbb8e9d59ffe24c63436efa8f271"},
- {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:61817945f2fe7d166e75fbfb28004034b48e44878177fc54d81688e7b85a3665"},
- {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:29d2c342c4bc01b88402d60189f3df065fb0dda3654744d5a165a5288a657368"},
- {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5e11661ce0fd30a6790e8bcdf263b9ec5988e95e63cf901972107efc49218b13"},
- {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d18368b137c6295db49ce7218b1a9ba15c5bc254c96d7c9f9e924a9bc7825ad"},
- {file = "pydantic_core-2.23.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ec4e55f79b1c4ffb2eecd8a0cfba9955a2588497d96851f4c8f99aa4a1d39b12"},
- {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:374a5e5049eda9e0a44c696c7ade3ff355f06b1fe0bb945ea3cac2bc336478a2"},
- {file = "pydantic_core-2.23.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5c364564d17da23db1106787675fc7af45f2f7b58b4173bfdd105564e132e6fb"},
- {file = "pydantic_core-2.23.4-cp38-none-win32.whl", hash = "sha256:d7a80d21d613eec45e3d41eb22f8f94ddc758a6c4720842dc74c0581f54993d6"},
- {file = "pydantic_core-2.23.4-cp38-none-win_amd64.whl", hash = "sha256:5f5ff8d839f4566a474a969508fe1c5e59c31c80d9e140566f9a37bba7b8d556"},
- {file = "pydantic_core-2.23.4-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a4fa4fc04dff799089689f4fd502ce7d59de529fc2f40a2c8836886c03e0175a"},
- {file = "pydantic_core-2.23.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0a7df63886be5e270da67e0966cf4afbae86069501d35c8c1b3b6c168f42cb36"},
- {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dcedcd19a557e182628afa1d553c3895a9f825b936415d0dbd3cd0bbcfd29b4b"},
- {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f54b118ce5de9ac21c363d9b3caa6c800341e8c47a508787e5868c6b79c9323"},
- {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86d2f57d3e1379a9525c5ab067b27dbb8a0642fb5d454e17a9ac434f9ce523e3"},
- {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:de6d1d1b9e5101508cb37ab0d972357cac5235f5c6533d1071964c47139257df"},
- {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1278e0d324f6908e872730c9102b0112477a7f7cf88b308e4fc36ce1bdb6d58c"},
- {file = "pydantic_core-2.23.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9a6b5099eeec78827553827f4c6b8615978bb4b6a88e5d9b93eddf8bb6790f55"},
- {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:e55541f756f9b3ee346b840103f32779c695a19826a4c442b7954550a0972040"},
- {file = "pydantic_core-2.23.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a5c7ba8ffb6d6f8f2ab08743be203654bb1aaa8c9dcb09f82ddd34eadb695605"},
- {file = "pydantic_core-2.23.4-cp39-none-win32.whl", hash = "sha256:37b0fe330e4a58d3c58b24d91d1eb102aeec675a3db4c292ec3928ecd892a9a6"},
- {file = "pydantic_core-2.23.4-cp39-none-win_amd64.whl", hash = "sha256:1498bec4c05c9c787bde9125cfdcc63a41004ff167f495063191b863399b1a29"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:f455ee30a9d61d3e1a15abd5068827773d6e4dc513e795f380cdd59932c782d5"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1e90d2e3bd2c3863d48525d297cd143fe541be8bbf6f579504b9712cb6b643ec"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e203fdf807ac7e12ab59ca2bfcabb38c7cf0b33c41efeb00f8e5da1d86af480"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e08277a400de01bc72436a0ccd02bdf596631411f592ad985dcee21445bd0068"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f220b0eea5965dec25480b6333c788fb72ce5f9129e8759ef876a1d805d00801"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d06b0c8da4f16d1d1e352134427cb194a0a6e19ad5db9161bf32b2113409e728"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:ba1a0996f6c2773bd83e63f18914c1de3c9dd26d55f4ac302a7efe93fb8e7433"},
- {file = "pydantic_core-2.23.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:9a5bce9d23aac8f0cf0836ecfc033896aa8443b501c58d0602dbfd5bd5b37753"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:78ddaaa81421a29574a682b3179d4cf9e6d405a09b99d93ddcf7e5239c742e21"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:883a91b5dd7d26492ff2f04f40fbb652de40fcc0afe07e8129e8ae779c2110eb"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:88ad334a15b32a791ea935af224b9de1bf99bcd62fabf745d5f3442199d86d59"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:233710f069d251feb12a56da21e14cca67994eab08362207785cf8c598e74577"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:19442362866a753485ba5e4be408964644dd6a09123d9416c54cd49171f50744"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:624e278a7d29b6445e4e813af92af37820fafb6dcc55c012c834f9e26f9aaaef"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f5ef8f42bec47f21d07668a043f077d507e5bf4e668d5c6dfe6aaba89de1a5b8"},
- {file = "pydantic_core-2.23.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:aea443fffa9fbe3af1a9ba721a87f926fe548d32cab71d188a6ede77d0ff244e"},
- {file = "pydantic_core-2.23.4.tar.gz", hash = "sha256:2584f7cf844ac4d970fba483a717dbe10c1c1c96a969bf65d61ffe94df1b2863"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:71a5e35c75c021aaf400ac048dacc855f000bdfed91614b4a726f7432f1f3d6a"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f82d068a2d6ecfc6e054726080af69a6764a10015467d7d7b9f66d6ed5afa23b"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:121ceb0e822f79163dd4699e4c54f5ad38b157084d97b34de8b232bcaad70278"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4603137322c18eaf2e06a4495f426aa8d8388940f3c457e7548145011bb68e05"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a33cd6ad9017bbeaa9ed78a2e0752c5e250eafb9534f308e7a5f7849b0b1bfb4"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:15cc53a3179ba0fcefe1e3ae50beb2784dede4003ad2dfd24f81bba4b23a454f"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45d9c5eb9273aa50999ad6adc6be5e0ecea7e09dbd0d31bd0c65a55a2592ca08"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8bf7b66ce12a2ac52d16f776b31d16d91033150266eb796967a7e4621707e4f6"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:655d7dd86f26cb15ce8a431036f66ce0318648f8853d709b4167786ec2fa4807"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:5556470f1a2157031e676f776c2bc20acd34c1990ca5f7e56f1ebf938b9ab57c"},
+ {file = "pydantic_core-2.27.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f69ed81ab24d5a3bd93861c8c4436f54afdf8e8cc421562b0c7504cf3be58206"},
+ {file = "pydantic_core-2.27.1-cp310-none-win32.whl", hash = "sha256:f5a823165e6d04ccea61a9f0576f345f8ce40ed533013580e087bd4d7442b52c"},
+ {file = "pydantic_core-2.27.1-cp310-none-win_amd64.whl", hash = "sha256:57866a76e0b3823e0b56692d1a0bf722bffb324839bb5b7226a7dbd6c9a40b17"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:ac3b20653bdbe160febbea8aa6c079d3df19310d50ac314911ed8cc4eb7f8cb8"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a5a8e19d7c707c4cadb8c18f5f60c843052ae83c20fa7d44f41594c644a1d330"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7f7059ca8d64fea7f238994c97d91f75965216bcbe5f695bb44f354893f11d52"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bed0f8a0eeea9fb72937ba118f9db0cb7e90773462af7962d382445f3005e5a4"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a3cb37038123447cf0f3ea4c74751f6a9d7afef0eb71aa07bf5f652b5e6a132c"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:84286494f6c5d05243456e04223d5a9417d7f443c3b76065e75001beb26f88de"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:acc07b2cfc5b835444b44a9956846b578d27beeacd4b52e45489e93276241025"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4fefee876e07a6e9aad7a8c8c9f85b0cdbe7df52b8a9552307b09050f7512c7e"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:258c57abf1188926c774a4c94dd29237e77eda19462e5bb901d88adcab6af919"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:35c14ac45fcfdf7167ca76cc80b2001205a8d5d16d80524e13508371fb8cdd9c"},
+ {file = "pydantic_core-2.27.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d1b26e1dff225c31897696cab7d4f0a315d4c0d9e8666dbffdb28216f3b17fdc"},
+ {file = "pydantic_core-2.27.1-cp311-none-win32.whl", hash = "sha256:2cdf7d86886bc6982354862204ae3b2f7f96f21a3eb0ba5ca0ac42c7b38598b9"},
+ {file = "pydantic_core-2.27.1-cp311-none-win_amd64.whl", hash = "sha256:3af385b0cee8df3746c3f406f38bcbfdc9041b5c2d5ce3e5fc6637256e60bbc5"},
+ {file = "pydantic_core-2.27.1-cp311-none-win_arm64.whl", hash = "sha256:81f2ec23ddc1b476ff96563f2e8d723830b06dceae348ce02914a37cb4e74b89"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9cbd94fc661d2bab2bc702cddd2d3370bbdcc4cd0f8f57488a81bcce90c7a54f"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5f8c4718cd44ec1580e180cb739713ecda2bdee1341084c1467802a417fe0f02"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:15aae984e46de8d376df515f00450d1522077254ef6b7ce189b38ecee7c9677c"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1ba5e3963344ff25fc8c40da90f44b0afca8cfd89d12964feb79ac1411a260ac"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:992cea5f4f3b29d6b4f7f1726ed8ee46c8331c6b4eed6db5b40134c6fe1768bb"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0325336f348dbee6550d129b1627cb8f5351a9dc91aad141ffb96d4937bd9529"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7597c07fbd11515f654d6ece3d0e4e5093edc30a436c63142d9a4b8e22f19c35"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3bbd5d8cc692616d5ef6fbbbd50dbec142c7e6ad9beb66b78a96e9c16729b089"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:dc61505e73298a84a2f317255fcc72b710b72980f3a1f670447a21efc88f8381"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:e1f735dc43da318cad19b4173dd1ffce1d84aafd6c9b782b3abc04a0d5a6f5bb"},
+ {file = "pydantic_core-2.27.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f4e5658dbffe8843a0f12366a4c2d1c316dbe09bb4dfbdc9d2d9cd6031de8aae"},
+ {file = "pydantic_core-2.27.1-cp312-none-win32.whl", hash = "sha256:672ebbe820bb37988c4d136eca2652ee114992d5d41c7e4858cdd90ea94ffe5c"},
+ {file = "pydantic_core-2.27.1-cp312-none-win_amd64.whl", hash = "sha256:66ff044fd0bb1768688aecbe28b6190f6e799349221fb0de0e6f4048eca14c16"},
+ {file = "pydantic_core-2.27.1-cp312-none-win_arm64.whl", hash = "sha256:9a3b0793b1bbfd4146304e23d90045f2a9b5fd5823aa682665fbdaf2a6c28f3e"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f216dbce0e60e4d03e0c4353c7023b202d95cbaeff12e5fd2e82ea0a66905073"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a2e02889071850bbfd36b56fd6bc98945e23670773bc7a76657e90e6b6603c08"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42b0e23f119b2b456d07ca91b307ae167cc3f6c846a7b169fca5326e32fdc6cf"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:764be71193f87d460a03f1f7385a82e226639732214b402f9aa61f0d025f0737"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1c00666a3bd2f84920a4e94434f5974d7bbc57e461318d6bb34ce9cdbbc1f6b2"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ccaa88b24eebc0f849ce0a4d09e8a408ec5a94afff395eb69baf868f5183107"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c65af9088ac534313e1963443d0ec360bb2b9cba6c2909478d22c2e363d98a51"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:206b5cf6f0c513baffaeae7bd817717140770c74528f3e4c3e1cec7871ddd61a"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:062f60e512fc7fff8b8a9d680ff0ddaaef0193dba9fa83e679c0c5f5fbd018bc"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:a0697803ed7d4af5e4c1adf1670af078f8fcab7a86350e969f454daf598c4960"},
+ {file = "pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:58ca98a950171f3151c603aeea9303ef6c235f692fe555e883591103da709b23"},
+ {file = "pydantic_core-2.27.1-cp313-none-win32.whl", hash = "sha256:8065914ff79f7eab1599bd80406681f0ad08f8e47c880f17b416c9f8f7a26d05"},
+ {file = "pydantic_core-2.27.1-cp313-none-win_amd64.whl", hash = "sha256:ba630d5e3db74c79300d9a5bdaaf6200172b107f263c98a0539eeecb857b2337"},
+ {file = "pydantic_core-2.27.1-cp313-none-win_arm64.whl", hash = "sha256:45cf8588c066860b623cd11c4ba687f8d7175d5f7ef65f7129df8a394c502de5"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:5897bec80a09b4084aee23f9b73a9477a46c3304ad1d2d07acca19723fb1de62"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:d0165ab2914379bd56908c02294ed8405c252250668ebcb438a55494c69f44ab"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b9af86e1d8e4cfc82c2022bfaa6f459381a50b94a29e95dcdda8442d6d83864"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f6c8a66741c5f5447e047ab0ba7a1c61d1e95580d64bce852e3df1f895c4067"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a42d6a8156ff78981f8aa56eb6394114e0dedb217cf8b729f438f643608cbcd"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:64c65f40b4cd8b0e049a8edde07e38b476da7e3aaebe63287c899d2cff253fa5"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fdcf339322a3fae5cbd504edcefddd5a50d9ee00d968696846f089b4432cf78"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bf99c8404f008750c846cb4ac4667b798a9f7de673ff719d705d9b2d6de49c5f"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:8f1edcea27918d748c7e5e4d917297b2a0ab80cad10f86631e488b7cddf76a36"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_armv7l.whl", hash = "sha256:159cac0a3d096f79ab6a44d77a961917219707e2a130739c64d4dd46281f5c2a"},
+ {file = "pydantic_core-2.27.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:029d9757eb621cc6e1848fa0b0310310de7301057f623985698ed7ebb014391b"},
+ {file = "pydantic_core-2.27.1-cp38-none-win32.whl", hash = "sha256:a28af0695a45f7060e6f9b7092558a928a28553366519f64083c63a44f70e618"},
+ {file = "pydantic_core-2.27.1-cp38-none-win_amd64.whl", hash = "sha256:2d4567c850905d5eaaed2f7a404e61012a51caf288292e016360aa2b96ff38d4"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:e9386266798d64eeb19dd3677051f5705bf873e98e15897ddb7d76f477131967"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4228b5b646caa73f119b1ae756216b59cc6e2267201c27d3912b592c5e323b60"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0b3dfe500de26c52abe0477dde16192ac39c98f05bf2d80e76102d394bd13854"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:aee66be87825cdf72ac64cb03ad4c15ffef4143dbf5c113f64a5ff4f81477bf9"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3b748c44bb9f53031c8cbc99a8a061bc181c1000c60a30f55393b6e9c45cc5bd"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ca038c7f6a0afd0b2448941b6ef9d5e1949e999f9e5517692eb6da58e9d44be"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e0bd57539da59a3e4671b90a502da9a28c72322a4f17866ba3ac63a82c4498e"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ac6c2c45c847bbf8f91930d88716a0fb924b51e0c6dad329b793d670ec5db792"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b94d4ba43739bbe8b0ce4262bcc3b7b9f31459ad120fb595627eaeb7f9b9ca01"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:00e6424f4b26fe82d44577b4c842d7df97c20be6439e8e685d0d715feceb9fb9"},
+ {file = "pydantic_core-2.27.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:38de0a70160dd97540335b7ad3a74571b24f1dc3ed33f815f0880682e6880131"},
+ {file = "pydantic_core-2.27.1-cp39-none-win32.whl", hash = "sha256:7ccebf51efc61634f6c2344da73e366c75e735960b5654b63d7e6f69a5885fa3"},
+ {file = "pydantic_core-2.27.1-cp39-none-win_amd64.whl", hash = "sha256:a57847b090d7892f123726202b7daa20df6694cbd583b67a592e856bff603d6c"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3fa80ac2bd5856580e242dbc202db873c60a01b20309c8319b5c5986fbe53ce6"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d950caa237bb1954f1b8c9227b5065ba6875ac9771bb8ec790d956a699b78676"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0e4216e64d203e39c62df627aa882f02a2438d18a5f21d7f721621f7a5d3611d"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:02a3d637bd387c41d46b002f0e49c52642281edacd2740e5a42f7017feea3f2c"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:161c27ccce13b6b0c8689418da3885d3220ed2eae2ea5e9b2f7f3d48f1d52c27"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:19910754e4cc9c63bc1c7f6d73aa1cfee82f42007e407c0f413695c2f7ed777f"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:e173486019cc283dc9778315fa29a363579372fe67045e971e89b6365cc035ed"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:af52d26579b308921b73b956153066481f064875140ccd1dfd4e77db89dbb12f"},
+ {file = "pydantic_core-2.27.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:981fb88516bd1ae8b0cbbd2034678a39dedc98752f264ac9bc5839d3923fa04c"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5fde892e6c697ce3e30c61b239330fc5d569a71fefd4eb6512fc6caec9dd9e2f"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:816f5aa087094099fff7edabb5e01cc370eb21aa1a1d44fe2d2aefdfb5599b31"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c10c309e18e443ddb108f0ef64e8729363adbfd92d6d57beec680f6261556f3"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98476c98b02c8e9b2eec76ac4156fd006628b1b2d0ef27e548ffa978393fd154"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c3027001c28434e7ca5a6e1e527487051136aa81803ac812be51802150d880dd"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:7699b1df36a48169cdebda7ab5a2bac265204003f153b4bd17276153d997670a"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:1c39b07d90be6b48968ddc8c19e7585052088fd7ec8d568bb31ff64c70ae3c97"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:46ccfe3032b3915586e469d4972973f893c0a2bb65669194a5bdea9bacc088c2"},
+ {file = "pydantic_core-2.27.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:62ba45e21cf6571d7f716d903b5b7b6d2617e2d5d67c0923dc47b9d41369f840"},
+ {file = "pydantic_core-2.27.1.tar.gz", hash = "sha256:62a763352879b84aa31058fc931884055fd75089cccbd9d58bb6afd01141b235"},
]
[package.dependencies]
@@ -1876,37 +1918,37 @@ test = ["black (>=22.1.0)", "flake8 (>=4.0.1)", "pre-commit (>=2.17.0)", "pytest
[[package]]
name = "pytest-benchmark"
-version = "4.0.0"
+version = "5.1.0"
description = "A ``pytest`` fixture for benchmarking code. It will group the tests into rounds that are calibrated to the chosen timer."
optional = false
-python-versions = ">=3.7"
+python-versions = ">=3.9"
files = [
- {file = "pytest-benchmark-4.0.0.tar.gz", hash = "sha256:fb0785b83efe599a6a956361c0691ae1dbb5318018561af10f3e915caa0048d1"},
- {file = "pytest_benchmark-4.0.0-py3-none-any.whl", hash = "sha256:fdb7db64e31c8b277dff9850d2a2556d8b60bcb0ea6524e36e28ffd7c87f71d6"},
+ {file = "pytest-benchmark-5.1.0.tar.gz", hash = "sha256:9ea661cdc292e8231f7cd4c10b0319e56a2118e2c09d9f50e1b3d150d2aca105"},
+ {file = "pytest_benchmark-5.1.0-py3-none-any.whl", hash = "sha256:922de2dfa3033c227c96da942d1878191afa135a29485fb942e85dff1c592c89"},
]
[package.dependencies]
py-cpuinfo = "*"
-pytest = ">=3.8"
+pytest = ">=8.1"
[package.extras]
aspect = ["aspectlib"]
elasticsearch = ["elasticsearch"]
-histogram = ["pygal", "pygaljs"]
+histogram = ["pygal", "pygaljs", "setuptools"]
[[package]]
name = "pytest-cov"
-version = "5.0.0"
+version = "6.0.0"
description = "Pytest plugin for measuring coverage."
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.9"
files = [
- {file = "pytest-cov-5.0.0.tar.gz", hash = "sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857"},
- {file = "pytest_cov-5.0.0-py3-none-any.whl", hash = "sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652"},
+ {file = "pytest-cov-6.0.0.tar.gz", hash = "sha256:fde0b595ca248bb8e2d76f020b465f3b107c9632e6a1d1705f17834c89dcadc0"},
+ {file = "pytest_cov-6.0.0-py3-none-any.whl", hash = "sha256:eee6f1b9e61008bd34975a4d5bab25801eb31898b032dd55addc93e96fcaaa35"},
]
[package.dependencies]
-coverage = {version = ">=5.2.1", extras = ["toml"]}
+coverage = {version = ">=7.5", extras = ["toml"]}
pytest = ">=4.6"
[package.extras]
@@ -1962,13 +2004,13 @@ six = ">=1.5"
[[package]]
name = "python-engineio"
-version = "4.9.1"
+version = "4.10.1"
description = "Engine.IO server and client for Python"
optional = false
python-versions = ">=3.6"
files = [
- {file = "python_engineio-4.9.1-py3-none-any.whl", hash = "sha256:f995e702b21f6b9ebde4e2000cd2ad0112ba0e5116ec8d22fe3515e76ba9dddd"},
- {file = "python_engineio-4.9.1.tar.gz", hash = "sha256:7631cf5563086076611e494c643b3fa93dd3a854634b5488be0bba0ef9b99709"},
+ {file = "python_engineio-4.10.1-py3-none-any.whl", hash = "sha256:445a94004ec8034960ab99e7ce4209ec619c6e6b6a12aedcb05abeab924025c0"},
+ {file = "python_engineio-4.10.1.tar.gz", hash = "sha256:166cea8dd7429638c5c4e3a4895beae95196e860bc6f29ed0b9fe753d1ef2072"},
]
[package.dependencies]
@@ -1981,13 +2023,13 @@ docs = ["sphinx"]
[[package]]
name = "python-multipart"
-version = "0.0.12"
+version = "0.0.17"
description = "A streaming multipart parser for Python"
optional = false
python-versions = ">=3.8"
files = [
- {file = "python_multipart-0.0.12-py3-none-any.whl", hash = "sha256:43dcf96cf65888a9cd3423544dd0d75ac10f7aa0c3c28a175bbcd00c9ce1aebf"},
- {file = "python_multipart-0.0.12.tar.gz", hash = "sha256:045e1f98d719c1ce085ed7f7e1ef9d8ccc8c02ba02b5566d5f7521410ced58cb"},
+ {file = "python_multipart-0.0.17-py3-none-any.whl", hash = "sha256:15dc4f487e0a9476cc1201261188ee0940165cffc94429b6fc565c4d3045cb5d"},
+ {file = "python_multipart-0.0.17.tar.gz", hash = "sha256:41330d831cae6e2f22902704ead2826ea038d0419530eadff3ea80175aec5538"},
]
[[package]]
@@ -2132,13 +2174,13 @@ md = ["cmarkgfm (>=0.8.0)"]
[[package]]
name = "redis"
-version = "5.1.1"
+version = "5.2.0"
description = "Python client for Redis database and key-value store"
optional = false
python-versions = ">=3.8"
files = [
- {file = "redis-5.1.1-py3-none-any.whl", hash = "sha256:f8ea06b7482a668c6475ae202ed8d9bcaa409f6e87fb77ed1043d912afd62e24"},
- {file = "redis-5.1.1.tar.gz", hash = "sha256:f6c997521fedbae53387307c5d0bf784d9acc28d9f1d058abeac566ec4dbed72"},
+ {file = "redis-5.2.0-py3-none-any.whl", hash = "sha256:ae174f2bb3b1bf2b09d54bf3e51fbc1469cf6c10aa03e21141f51969801a7897"},
+ {file = "redis-5.2.0.tar.gz", hash = "sha256:0b1087665a771b1ff2e003aa5bdd354f15a70c9e25d5a7dbf9c722c16528a7b0"},
]
[package.dependencies]
@@ -2150,13 +2192,13 @@ ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==23.2.1)", "requests (>=2.31.0)"
[[package]]
name = "reflex-chakra"
-version = "0.6.1"
+version = "0.6.2"
description = "reflex using chakra components"
optional = false
-python-versions = "<4.0,>=3.8"
+python-versions = "<4.0,>=3.9"
files = [
- {file = "reflex_chakra-0.6.1-py3-none-any.whl", hash = "sha256:824d461264b6d2c836ba4a2a430e677a890b82e83da149672accfc58786442fa"},
- {file = "reflex_chakra-0.6.1.tar.gz", hash = "sha256:4b9b3c8bada19cbb4d1b8d8bc4ab0460ec008a91f380010c34d416d5b613dc07"},
+ {file = "reflex_chakra-0.6.2-py3-none-any.whl", hash = "sha256:b8aa19f39a02601c560b97f4b17f171c0b5980e13a58069e3a5dd0999e362e4f"},
+ {file = "reflex_chakra-0.6.2.tar.gz", hash = "sha256:81ddb7f182cc454922cc817312755b799d4e1a49a46ef2e81305052dc76ef86d"},
]
[package.dependencies]
@@ -2164,13 +2206,13 @@ reflex = ">=0.6.0a"
[[package]]
name = "reflex-hosting-cli"
-version = "0.1.13"
+version = "0.1.29"
description = "Reflex Hosting CLI"
optional = false
python-versions = "<4.0,>=3.8"
files = [
- {file = "reflex_hosting_cli-0.1.13-py3-none-any.whl", hash = "sha256:5bfec7f3d7ce4bbd703989f086494e586a641ef37c9e60e60fb82bdfb07ff227"},
- {file = "reflex_hosting_cli-0.1.13.tar.gz", hash = "sha256:c5d6afdcfeb74cee046a374ddbd59116ab8ed797dae688fcc744dabae24dc571"},
+ {file = "reflex_hosting_cli-0.1.29-py3-none-any.whl", hash = "sha256:fcbdad829762287f32397cd8a5d46536ab0db396e7fdb8a23c7f9343d7dc8de0"},
+ {file = "reflex_hosting_cli-0.1.29.tar.gz", hash = "sha256:7b421fec6936c26549c8c65c9dda34fc042eaaec79b238dce6b9c020f848563b"},
]
[package.dependencies]
@@ -2182,7 +2224,7 @@ pydantic = ">=1.10.2,<3.0"
python-dateutil = ">=2.8.1"
rich = ">=13.0.0,<14.0"
tabulate = ">=0.9.0,<0.10.0"
-typer = ">=0.4.2,<1"
+typer = ">=0.15.0,<1"
websockets = ">=10.4"
[[package]]
@@ -2236,13 +2278,13 @@ idna2008 = ["idna"]
[[package]]
name = "rich"
-version = "13.9.2"
+version = "13.9.4"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
optional = false
python-versions = ">=3.8.0"
files = [
- {file = "rich-13.9.2-py3-none-any.whl", hash = "sha256:8c82a3d3f8dcfe9e734771313e606b39d8247bb6b826e196f4914b333b743cf1"},
- {file = "rich-13.9.2.tar.gz", hash = "sha256:51a2c62057461aaf7152b4d611168f93a9fc73068f8ded2790f29fe2b5366d0c"},
+ {file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"},
+ {file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"},
]
[package.dependencies]
@@ -2255,29 +2297,29 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"]
[[package]]
name = "ruff"
-version = "0.6.9"
+version = "0.7.4"
description = "An extremely fast Python linter and code formatter, written in Rust."
optional = false
python-versions = ">=3.7"
files = [
- {file = "ruff-0.6.9-py3-none-linux_armv6l.whl", hash = "sha256:064df58d84ccc0ac0fcd63bc3090b251d90e2a372558c0f057c3f75ed73e1ccd"},
- {file = "ruff-0.6.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:140d4b5c9f5fc7a7b074908a78ab8d384dd7f6510402267bc76c37195c02a7ec"},
- {file = "ruff-0.6.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:53fd8ca5e82bdee8da7f506d7b03a261f24cd43d090ea9db9a1dc59d9313914c"},
- {file = "ruff-0.6.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645d7d8761f915e48a00d4ecc3686969761df69fb561dd914a773c1a8266e14e"},
- {file = "ruff-0.6.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eae02b700763e3847595b9d2891488989cac00214da7f845f4bcf2989007d577"},
- {file = "ruff-0.6.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7d5ccc9e58112441de8ad4b29dcb7a86dc25c5f770e3c06a9d57e0e5eba48829"},
- {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:417b81aa1c9b60b2f8edc463c58363075412866ae4e2b9ab0f690dc1e87ac1b5"},
- {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c866b631f5fbce896a74a6e4383407ba7507b815ccc52bcedabb6810fdb3ef7"},
- {file = "ruff-0.6.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7b118afbb3202f5911486ad52da86d1d52305b59e7ef2031cea3425142b97d6f"},
- {file = "ruff-0.6.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a67267654edc23c97335586774790cde402fb6bbdb3c2314f1fc087dee320bfa"},
- {file = "ruff-0.6.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3ef0cc774b00fec123f635ce5c547dac263f6ee9fb9cc83437c5904183b55ceb"},
- {file = "ruff-0.6.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:12edd2af0c60fa61ff31cefb90aef4288ac4d372b4962c2864aeea3a1a2460c0"},
- {file = "ruff-0.6.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:55bb01caeaf3a60b2b2bba07308a02fca6ab56233302406ed5245180a05c5625"},
- {file = "ruff-0.6.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:925d26471fa24b0ce5a6cdfab1bb526fb4159952385f386bdcc643813d472039"},
- {file = "ruff-0.6.9-py3-none-win32.whl", hash = "sha256:eb61ec9bdb2506cffd492e05ac40e5bc6284873aceb605503d8494180d6fc84d"},
- {file = "ruff-0.6.9-py3-none-win_amd64.whl", hash = "sha256:785d31851c1ae91f45b3d8fe23b8ae4b5170089021fbb42402d811135f0b7117"},
- {file = "ruff-0.6.9-py3-none-win_arm64.whl", hash = "sha256:a9641e31476d601f83cd602608739a0840e348bda93fec9f1ee816f8b6798b93"},
- {file = "ruff-0.6.9.tar.gz", hash = "sha256:b076ef717a8e5bc819514ee1d602bbdca5b4420ae13a9cf61a0c0a4f53a2baa2"},
+ {file = "ruff-0.7.4-py3-none-linux_armv6l.whl", hash = "sha256:a4919925e7684a3f18e18243cd6bea7cfb8e968a6eaa8437971f681b7ec51478"},
+ {file = "ruff-0.7.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:cfb365c135b830778dda8c04fb7d4280ed0b984e1aec27f574445231e20d6c63"},
+ {file = "ruff-0.7.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:63a569b36bc66fbadec5beaa539dd81e0527cb258b94e29e0531ce41bacc1f20"},
+ {file = "ruff-0.7.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d06218747d361d06fd2fdac734e7fa92df36df93035db3dc2ad7aa9852cb109"},
+ {file = "ruff-0.7.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e0cea28d0944f74ebc33e9f934238f15c758841f9f5edd180b5315c203293452"},
+ {file = "ruff-0.7.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:80094ecd4793c68b2571b128f91754d60f692d64bc0d7272ec9197fdd09bf9ea"},
+ {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:997512325c6620d1c4c2b15db49ef59543ef9cd0f4aa8065ec2ae5103cedc7e7"},
+ {file = "ruff-0.7.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:00b4cf3a6b5fad6d1a66e7574d78956bbd09abfd6c8a997798f01f5da3d46a05"},
+ {file = "ruff-0.7.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7dbdc7d8274e1422722933d1edddfdc65b4336abf0b16dfcb9dedd6e6a517d06"},
+ {file = "ruff-0.7.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e92dfb5f00eaedb1501b2f906ccabfd67b2355bdf117fea9719fc99ac2145bc"},
+ {file = "ruff-0.7.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3bd726099f277d735dc38900b6a8d6cf070f80828877941983a57bca1cd92172"},
+ {file = "ruff-0.7.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2e32829c429dd081ee5ba39aef436603e5b22335c3d3fff013cd585806a6486a"},
+ {file = "ruff-0.7.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:662a63b4971807623f6f90c1fb664613f67cc182dc4d991471c23c541fee62dd"},
+ {file = "ruff-0.7.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:876f5e09eaae3eb76814c1d3b68879891d6fde4824c015d48e7a7da4cf066a3a"},
+ {file = "ruff-0.7.4-py3-none-win32.whl", hash = "sha256:75c53f54904be42dd52a548728a5b572344b50d9b2873d13a3f8c5e3b91f5cac"},
+ {file = "ruff-0.7.4-py3-none-win_amd64.whl", hash = "sha256:745775c7b39f914238ed1f1b0bebed0b9155a17cd8bc0b08d3c87e4703b990d6"},
+ {file = "ruff-0.7.4-py3-none-win_arm64.whl", hash = "sha256:11bff065102c3ae9d3ea4dc9ecdfe5a5171349cdd0787c1fc64761212fc9cf1f"},
+ {file = "ruff-0.7.4.tar.gz", hash = "sha256:cd12e35031f5af6b9b93715d8c4f40360070b2041f81273d0527683d5708fce2"},
]
[[package]]
@@ -2297,13 +2339,13 @@ jeepney = ">=0.6"
[[package]]
name = "selenium"
-version = "4.25.0"
+version = "4.26.1"
description = "Official Python bindings for Selenium WebDriver"
optional = false
python-versions = ">=3.8"
files = [
- {file = "selenium-4.25.0-py3-none-any.whl", hash = "sha256:3798d2d12b4a570bc5790163ba57fef10b2afee958bf1d80f2a3cf07c4141f33"},
- {file = "selenium-4.25.0.tar.gz", hash = "sha256:95d08d3b82fb353f3c474895154516604c7f0e6a9a565ae6498ef36c9bac6921"},
+ {file = "selenium-4.26.1-py3-none-any.whl", hash = "sha256:1db3f3a0cd5bb07624fa8a3905a6fdde1595a42185a0617077c361dc53d104fb"},
+ {file = "selenium-4.26.1.tar.gz", hash = "sha256:7640f3f08ae7f4e450f895678e8a10a55eb4e4ca18311ed675ecc4684b96b683"},
]
[package.dependencies]
@@ -2316,23 +2358,23 @@ websocket-client = ">=1.8,<2.0"
[[package]]
name = "setuptools"
-version = "75.1.0"
+version = "75.6.0"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.9"
files = [
- {file = "setuptools-75.1.0-py3-none-any.whl", hash = "sha256:35ab7fd3bcd95e6b7fd704e4a1539513edad446c097797f2985e0e4b960772f2"},
- {file = "setuptools-75.1.0.tar.gz", hash = "sha256:d59a21b17a275fb872a9c3dae73963160ae079f1049ed956880cd7c09b120538"},
+ {file = "setuptools-75.6.0-py3-none-any.whl", hash = "sha256:ce74b49e8f7110f9bf04883b730f4765b774ef3ef28f722cce7c273d253aaf7d"},
+ {file = "setuptools-75.6.0.tar.gz", hash = "sha256:8199222558df7c86216af4f84c30e9b34a61d8ba19366cc914424cdbd28252f6"},
]
[package.extras]
-check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.5.2)"]
-core = ["importlib-metadata (>=6)", "importlib-resources (>=5.10.2)", "jaraco.collections", "jaraco.functools", "jaraco.text (>=3.7)", "more-itertools", "more-itertools (>=8.8)", "packaging", "packaging (>=24)", "platformdirs (>=2.6.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"]
+check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.7.0)"]
+core = ["importlib_metadata (>=6)", "jaraco.collections", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"]
cover = ["pytest-cov"]
doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"]
enabler = ["pytest-enabler (>=2.2)"]
-test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test", "packaging (>=23.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"]
-type = ["importlib-metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (==1.11.*)", "pytest-mypy"]
+test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"]
+type = ["importlib_metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (>=1.12,<1.14)", "pytest-mypy"]
[[package]]
name = "shellingham"
@@ -2347,19 +2389,20 @@ files = [
[[package]]
name = "simple-websocket"
-version = "1.0.0"
+version = "1.1.0"
description = "Simple WebSocket server and client for Python"
optional = false
python-versions = ">=3.6"
files = [
- {file = "simple-websocket-1.0.0.tar.gz", hash = "sha256:17d2c72f4a2bd85174a97e3e4c88b01c40c3f81b7b648b0cc3ce1305968928c8"},
- {file = "simple_websocket-1.0.0-py3-none-any.whl", hash = "sha256:1d5bf585e415eaa2083e2bcf02a3ecf91f9712e7b3e6b9fa0b461ad04e0837bc"},
+ {file = "simple_websocket-1.1.0-py3-none-any.whl", hash = "sha256:4af6069630a38ed6c561010f0e11a5bc0d4ca569b36306eb257cd9a192497c8c"},
+ {file = "simple_websocket-1.1.0.tar.gz", hash = "sha256:7939234e7aa067c534abdab3a9ed933ec9ce4691b0713c78acb195560aa52ae4"},
]
[package.dependencies]
wsproto = "*"
[package.extras]
+dev = ["flake8", "pytest", "pytest-cov", "tox"]
docs = ["sphinx"]
[[package]]
@@ -2397,60 +2440,68 @@ files = [
[[package]]
name = "sqlalchemy"
-version = "2.0.35"
+version = "2.0.36"
description = "Database Abstraction Library"
optional = false
python-versions = ">=3.7"
files = [
- {file = "SQLAlchemy-2.0.35-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:67219632be22f14750f0d1c70e62f204ba69d28f62fd6432ba05ab295853de9b"},
- {file = "SQLAlchemy-2.0.35-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4668bd8faf7e5b71c0319407b608f278f279668f358857dbfd10ef1954ac9f90"},
- {file = "SQLAlchemy-2.0.35-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb8bea573863762bbf45d1e13f87c2d2fd32cee2dbd50d050f83f87429c9e1ea"},
- {file = "SQLAlchemy-2.0.35-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f552023710d4b93d8fb29a91fadf97de89c5926c6bd758897875435f2a939f33"},
- {file = "SQLAlchemy-2.0.35-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:016b2e665f778f13d3c438651dd4de244214b527a275e0acf1d44c05bc6026a9"},
- {file = "SQLAlchemy-2.0.35-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:7befc148de64b6060937231cbff8d01ccf0bfd75aa26383ffdf8d82b12ec04ff"},
- {file = "SQLAlchemy-2.0.35-cp310-cp310-win32.whl", hash = "sha256:22b83aed390e3099584b839b93f80a0f4a95ee7f48270c97c90acd40ee646f0b"},
- {file = "SQLAlchemy-2.0.35-cp310-cp310-win_amd64.whl", hash = "sha256:a29762cd3d116585278ffb2e5b8cc311fb095ea278b96feef28d0b423154858e"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e21f66748ab725ade40fa7af8ec8b5019c68ab00b929f6643e1b1af461eddb60"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8a6219108a15fc6d24de499d0d515c7235c617b2540d97116b663dade1a54d62"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:042622a5306c23b972192283f4e22372da3b8ddf5f7aac1cc5d9c9b222ab3ff6"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:627dee0c280eea91aed87b20a1f849e9ae2fe719d52cbf847c0e0ea34464b3f7"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4fdcd72a789c1c31ed242fd8c1bcd9ea186a98ee8e5408a50e610edfef980d71"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:89b64cd8898a3a6f642db4eb7b26d1b28a497d4022eccd7717ca066823e9fb01"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-win32.whl", hash = "sha256:6a93c5a0dfe8d34951e8a6f499a9479ffb9258123551fa007fc708ae2ac2bc5e"},
- {file = "SQLAlchemy-2.0.35-cp311-cp311-win_amd64.whl", hash = "sha256:c68fe3fcde03920c46697585620135b4ecfdfc1ed23e75cc2c2ae9f8502c10b8"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:eb60b026d8ad0c97917cb81d3662d0b39b8ff1335e3fabb24984c6acd0c900a2"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6921ee01caf375363be5e9ae70d08ce7ca9d7e0e8983183080211a062d299468"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8cdf1a0dbe5ced887a9b127da4ffd7354e9c1a3b9bb330dce84df6b70ccb3a8d"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93a71c8601e823236ac0e5d087e4f397874a421017b3318fd92c0b14acf2b6db"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e04b622bb8a88f10e439084486f2f6349bf4d50605ac3e445869c7ea5cf0fa8c"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1b56961e2d31389aaadf4906d453859f35302b4eb818d34a26fab72596076bb8"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-win32.whl", hash = "sha256:0f9f3f9a3763b9c4deb8c5d09c4cc52ffe49f9876af41cc1b2ad0138878453cf"},
- {file = "SQLAlchemy-2.0.35-cp312-cp312-win_amd64.whl", hash = "sha256:25b0f63e7fcc2a6290cb5f7f5b4fc4047843504983a28856ce9b35d8f7de03cc"},
- {file = "SQLAlchemy-2.0.35-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:f021d334f2ca692523aaf7bbf7592ceff70c8594fad853416a81d66b35e3abf9"},
- {file = "SQLAlchemy-2.0.35-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:05c3f58cf91683102f2f0265c0db3bd3892e9eedabe059720492dbaa4f922da1"},
- {file = "SQLAlchemy-2.0.35-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:032d979ce77a6c2432653322ba4cbeabf5a6837f704d16fa38b5a05d8e21fa00"},
- {file = "SQLAlchemy-2.0.35-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:2e795c2f7d7249b75bb5f479b432a51b59041580d20599d4e112b5f2046437a3"},
- {file = "SQLAlchemy-2.0.35-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:cc32b2990fc34380ec2f6195f33a76b6cdaa9eecf09f0c9404b74fc120aef36f"},
- {file = "SQLAlchemy-2.0.35-cp37-cp37m-win32.whl", hash = "sha256:9509c4123491d0e63fb5e16199e09f8e262066e58903e84615c301dde8fa2e87"},
- {file = "SQLAlchemy-2.0.35-cp37-cp37m-win_amd64.whl", hash = "sha256:3655af10ebcc0f1e4e06c5900bb33e080d6a1fa4228f502121f28a3b1753cde5"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:4c31943b61ed8fdd63dfd12ccc919f2bf95eefca133767db6fbbd15da62078ec"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a62dd5d7cc8626a3634208df458c5fe4f21200d96a74d122c83bc2015b333bc1"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0630774b0977804fba4b6bbea6852ab56c14965a2b0c7fc7282c5f7d90a1ae72"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d625eddf7efeba2abfd9c014a22c0f6b3796e0ffb48f5d5ab106568ef01ff5a"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:ada603db10bb865bbe591939de854faf2c60f43c9b763e90f653224138f910d9"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:c41411e192f8d3ea39ea70e0fae48762cd11a2244e03751a98bd3c0ca9a4e936"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-win32.whl", hash = "sha256:d299797d75cd747e7797b1b41817111406b8b10a4f88b6e8fe5b5e59598b43b0"},
- {file = "SQLAlchemy-2.0.35-cp38-cp38-win_amd64.whl", hash = "sha256:0375a141e1c0878103eb3d719eb6d5aa444b490c96f3fedab8471c7f6ffe70ee"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ccae5de2a0140d8be6838c331604f91d6fafd0735dbdcee1ac78fc8fbaba76b4"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2a275a806f73e849e1c309ac11108ea1a14cd7058577aba962cd7190e27c9e3c"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:732e026240cdd1c1b2e3ac515c7a23820430ed94292ce33806a95869c46bd139"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:890da8cd1941fa3dab28c5bac3b9da8502e7e366f895b3b8e500896f12f94d11"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:c0d8326269dbf944b9201911b0d9f3dc524d64779a07518199a58384c3d37a44"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:b76d63495b0508ab9fc23f8152bac63205d2a704cd009a2b0722f4c8e0cba8e0"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-win32.whl", hash = "sha256:69683e02e8a9de37f17985905a5eca18ad651bf592314b4d3d799029797d0eb3"},
- {file = "SQLAlchemy-2.0.35-cp39-cp39-win_amd64.whl", hash = "sha256:aee110e4ef3c528f3abbc3c2018c121e708938adeeff9006428dd7c8555e9b3f"},
- {file = "SQLAlchemy-2.0.35-py3-none-any.whl", hash = "sha256:2ab3f0336c0387662ce6221ad30ab3a5e6499aab01b9790879b6578fd9b8faa1"},
- {file = "sqlalchemy-2.0.35.tar.gz", hash = "sha256:e11d7ea4d24f0a262bccf9a7cd6284c976c5369dac21db237cff59586045ab9f"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:59b8f3adb3971929a3e660337f5dacc5942c2cdb760afcabb2614ffbda9f9f72"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:37350015056a553e442ff672c2d20e6f4b6d0b2495691fa239d8aa18bb3bc908"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8318f4776c85abc3f40ab185e388bee7a6ea99e7fa3a30686580b209eaa35c08"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c245b1fbade9c35e5bd3b64270ab49ce990369018289ecfde3f9c318411aaa07"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:69f93723edbca7342624d09f6704e7126b152eaed3cdbb634cb657a54332a3c5"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f9511d8dd4a6e9271d07d150fb2f81874a3c8c95e11ff9af3a2dfc35fe42ee44"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-win32.whl", hash = "sha256:c3f3631693003d8e585d4200730616b78fafd5a01ef8b698f6967da5c605b3fa"},
+ {file = "SQLAlchemy-2.0.36-cp310-cp310-win_amd64.whl", hash = "sha256:a86bfab2ef46d63300c0f06936bd6e6c0105faa11d509083ba8f2f9d237fb5b5"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:fd3a55deef00f689ce931d4d1b23fa9f04c880a48ee97af488fd215cf24e2a6c"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4f5e9cd989b45b73bd359f693b935364f7e1f79486e29015813c338450aa5a71"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d0ddd9db6e59c44875211bc4c7953a9f6638b937b0a88ae6d09eb46cced54eff"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2519f3a5d0517fc159afab1015e54bb81b4406c278749779be57a569d8d1bb0d"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:59b1ee96617135f6e1d6f275bbe988f419c5178016f3d41d3c0abb0c819f75bb"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:39769a115f730d683b0eb7b694db9789267bcd027326cccc3125e862eb03bfd8"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-win32.whl", hash = "sha256:66bffbad8d6271bb1cc2f9a4ea4f86f80fe5e2e3e501a5ae2a3dc6a76e604e6f"},
+ {file = "SQLAlchemy-2.0.36-cp311-cp311-win_amd64.whl", hash = "sha256:23623166bfefe1487d81b698c423f8678e80df8b54614c2bf4b4cfcd7c711959"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f7b64e6ec3f02c35647be6b4851008b26cff592a95ecb13b6788a54ef80bbdd4"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:46331b00096a6db1fdc052d55b101dbbfc99155a548e20a0e4a8e5e4d1362855"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fdf3386a801ea5aba17c6410dd1dc8d39cf454ca2565541b5ac42a84e1e28f53"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac9dfa18ff2a67b09b372d5db8743c27966abf0e5344c555d86cc7199f7ad83a"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:90812a8933df713fdf748b355527e3af257a11e415b613dd794512461eb8a686"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1bc330d9d29c7f06f003ab10e1eaced295e87940405afe1b110f2eb93a233588"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-win32.whl", hash = "sha256:79d2e78abc26d871875b419e1fd3c0bca31a1cb0043277d0d850014599626c2e"},
+ {file = "SQLAlchemy-2.0.36-cp312-cp312-win_amd64.whl", hash = "sha256:b544ad1935a8541d177cb402948b94e871067656b3a0b9e91dbec136b06a2ff5"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b5cc79df7f4bc3d11e4b542596c03826063092611e481fcf1c9dfee3c94355ef"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3c01117dd36800f2ecaa238c65365b7b16497adc1522bf84906e5710ee9ba0e8"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9bc633f4ee4b4c46e7adcb3a9b5ec083bf1d9a97c1d3854b92749d935de40b9b"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e46ed38affdfc95d2c958de328d037d87801cfcbea6d421000859e9789e61c2"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:b2985c0b06e989c043f1dc09d4fe89e1616aadd35392aea2844f0458a989eacf"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4a121d62ebe7d26fec9155f83f8be5189ef1405f5973ea4874a26fab9f1e262c"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-win32.whl", hash = "sha256:0572f4bd6f94752167adfd7c1bed84f4b240ee6203a95e05d1e208d488d0d436"},
+ {file = "SQLAlchemy-2.0.36-cp313-cp313-win_amd64.whl", hash = "sha256:8c78ac40bde930c60e0f78b3cd184c580f89456dd87fc08f9e3ee3ce8765ce88"},
+ {file = "SQLAlchemy-2.0.36-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:be9812b766cad94a25bc63bec11f88c4ad3629a0cec1cd5d4ba48dc23860486b"},
+ {file = "SQLAlchemy-2.0.36-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50aae840ebbd6cdd41af1c14590e5741665e5272d2fee999306673a1bb1fdb4d"},
+ {file = "SQLAlchemy-2.0.36-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4557e1f11c5f653ebfdd924f3f9d5ebfc718283b0b9beebaa5dd6b77ec290971"},
+ {file = "SQLAlchemy-2.0.36-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:07b441f7d03b9a66299ce7ccf3ef2900abc81c0db434f42a5694a37bd73870f2"},
+ {file = "SQLAlchemy-2.0.36-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:28120ef39c92c2dd60f2721af9328479516844c6b550b077ca450c7d7dc68575"},
+ {file = "SQLAlchemy-2.0.36-cp37-cp37m-win32.whl", hash = "sha256:b81ee3d84803fd42d0b154cb6892ae57ea6b7c55d8359a02379965706c7efe6c"},
+ {file = "SQLAlchemy-2.0.36-cp37-cp37m-win_amd64.whl", hash = "sha256:f942a799516184c855e1a32fbc7b29d7e571b52612647866d4ec1c3242578fcb"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3d6718667da04294d7df1670d70eeddd414f313738d20a6f1d1f379e3139a545"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:72c28b84b174ce8af8504ca28ae9347d317f9dba3999e5981a3cd441f3712e24"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b11d0cfdd2b095e7b0686cf5fabeb9c67fae5b06d265d8180715b8cfa86522e3"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e32092c47011d113dc01ab3e1d3ce9f006a47223b18422c5c0d150af13a00687"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:6a440293d802d3011028e14e4226da1434b373cbaf4a4bbb63f845761a708346"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:c54a1e53a0c308a8e8a7dffb59097bff7facda27c70c286f005327f21b2bd6b1"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-win32.whl", hash = "sha256:1e0d612a17581b6616ff03c8e3d5eff7452f34655c901f75d62bd86449d9750e"},
+ {file = "SQLAlchemy-2.0.36-cp38-cp38-win_amd64.whl", hash = "sha256:8958b10490125124463095bbdadda5aa22ec799f91958e410438ad6c97a7b793"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:dc022184d3e5cacc9579e41805a681187650e170eb2fd70e28b86192a479dcaa"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b817d41d692bf286abc181f8af476c4fbef3fd05e798777492618378448ee689"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a4e46a888b54be23d03a89be510f24a7652fe6ff660787b96cd0e57a4ebcb46d"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4ae3005ed83f5967f961fd091f2f8c5329161f69ce8480aa8168b2d7fe37f06"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:03e08af7a5f9386a43919eda9de33ffda16b44eb11f3b313e6822243770e9763"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3dbb986bad3ed5ceaf090200eba750b5245150bd97d3e67343a3cfed06feecf7"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-win32.whl", hash = "sha256:9fe53b404f24789b5ea9003fc25b9a3988feddebd7e7b369c8fac27ad6f52f28"},
+ {file = "SQLAlchemy-2.0.36-cp39-cp39-win_amd64.whl", hash = "sha256:af148a33ff0349f53512a049c6406923e4e02bf2f26c5fb285f143faf4f0e46a"},
+ {file = "SQLAlchemy-2.0.36-py3-none-any.whl", hash = "sha256:fddbe92b4760c6f5d48162aef14824add991aeda8ddadb3c31d56eb15ca69f8e"},
+ {file = "sqlalchemy-2.0.36.tar.gz", hash = "sha256:7f2767680b6d2398aea7082e45a774b2b0767b5c8d8ffb9c8b683088ea9b29c5"},
]
[package.dependencies]
@@ -2463,7 +2514,7 @@ aioodbc = ["aioodbc", "greenlet (!=0.4.17)"]
aiosqlite = ["aiosqlite", "greenlet (!=0.4.17)", "typing_extensions (!=3.10.0.1)"]
asyncio = ["greenlet (!=0.4.17)"]
asyncmy = ["asyncmy (>=0.2.3,!=0.2.4,!=0.2.6)", "greenlet (!=0.4.17)"]
-mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2,!=1.1.5)"]
+mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2,!=1.1.5,!=1.1.10)"]
mssql = ["pyodbc"]
mssql-pymssql = ["pymssql"]
mssql-pyodbc = ["pyodbc"]
@@ -2499,13 +2550,13 @@ SQLAlchemy = ">=2.0.14,<2.1.0"
[[package]]
name = "starlette"
-version = "0.38.6"
+version = "0.41.3"
description = "The little ASGI library that shines."
optional = false
python-versions = ">=3.8"
files = [
- {file = "starlette-0.38.6-py3-none-any.whl", hash = "sha256:4517a1409e2e73ee4951214ba012052b9e16f60e90d73cfb06192c19203bbb05"},
- {file = "starlette-0.38.6.tar.gz", hash = "sha256:863a1588f5574e70a821dadefb41e4881ea451a47a3cd1b4df359d4ffefe5ead"},
+ {file = "starlette-0.41.3-py3-none-any.whl", hash = "sha256:44cedb2b7c77a9de33a8b74b2b90e9f50d11fcf25d8270ea525ad71a25374ff7"},
+ {file = "starlette-0.41.3.tar.gz", hash = "sha256:0e4ab3d16522a255be6b28260b938eae2482f98ce5cc934cb08dce8dc3ba5835"},
]
[package.dependencies]
@@ -2591,13 +2642,13 @@ files = [
[[package]]
name = "tomli"
-version = "2.0.2"
+version = "2.1.0"
description = "A lil' TOML parser"
optional = false
python-versions = ">=3.8"
files = [
- {file = "tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38"},
- {file = "tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed"},
+ {file = "tomli-2.1.0-py3-none-any.whl", hash = "sha256:a5c57c3d1c56f5ccdf89f6523458f60ef716e210fc47c4cfb188c5ba473e0391"},
+ {file = "tomli-2.1.0.tar.gz", hash = "sha256:3f646cae2aec94e17d04973e4249548320197cfabdf130015d023de4b74d8ab8"},
]
[[package]]
@@ -2613,13 +2664,13 @@ files = [
[[package]]
name = "trio"
-version = "0.26.2"
+version = "0.27.0"
description = "A friendly Python library for async concurrency and I/O"
optional = false
python-versions = ">=3.8"
files = [
- {file = "trio-0.26.2-py3-none-any.whl", hash = "sha256:c5237e8133eb0a1d72f09a971a55c28ebe69e351c783fc64bc37db8db8bbe1d0"},
- {file = "trio-0.26.2.tar.gz", hash = "sha256:0346c3852c15e5c7d40ea15972c4805689ef2cb8b5206f794c9c19450119f3a4"},
+ {file = "trio-0.27.0-py3-none-any.whl", hash = "sha256:68eabbcf8f457d925df62da780eff15ff5dc68fd6b367e2dde59f7aaf2a0b884"},
+ {file = "trio-0.27.0.tar.gz", hash = "sha256:1dcc95ab1726b2da054afea8fd761af74bad79bd52381b84eae408e983c76831"},
]
[package.dependencies]
@@ -2671,13 +2722,13 @@ urllib3 = ">=1.26.0"
[[package]]
name = "typer"
-version = "0.12.5"
+version = "0.15.1"
description = "Typer, build great CLIs. Easy to code. Based on Python type hints."
optional = false
python-versions = ">=3.7"
files = [
- {file = "typer-0.12.5-py3-none-any.whl", hash = "sha256:62fe4e471711b147e3365034133904df3e235698399bc4de2b36c8579298d52b"},
- {file = "typer-0.12.5.tar.gz", hash = "sha256:f592f089bedcc8ec1b974125d64851029c3b1af145f04aca64d69410f0c9b722"},
+ {file = "typer-0.15.1-py3-none-any.whl", hash = "sha256:7994fb7b8155b64d3402518560648446072864beefd44aa2dc36972a5972e847"},
+ {file = "typer-0.15.1.tar.gz", hash = "sha256:a0588c0a7fa68a1978a069818657778f86abe6ff5ea6abf472f940a08bfe4f0a"},
]
[package.dependencies]
@@ -2730,13 +2781,13 @@ zstd = ["zstandard (>=0.18.0)"]
[[package]]
name = "uvicorn"
-version = "0.31.0"
+version = "0.32.1"
description = "The lightning-fast ASGI server."
optional = false
python-versions = ">=3.8"
files = [
- {file = "uvicorn-0.31.0-py3-none-any.whl", hash = "sha256:cac7be4dd4d891c363cd942160a7b02e69150dcbc7a36be04d5f4af4b17c8ced"},
- {file = "uvicorn-0.31.0.tar.gz", hash = "sha256:13bc21373d103859f68fe739608e2eb054a816dea79189bc3ca08ea89a275906"},
+ {file = "uvicorn-0.32.1-py3-none-any.whl", hash = "sha256:82ad92fd58da0d12af7482ecdb5f2470a04c9c9a53ced65b9bbb4a205377602e"},
+ {file = "uvicorn-0.32.1.tar.gz", hash = "sha256:ee9519c246a72b1c084cea8d3b44ed6026e78a4a309cbedae9c37e4cb9fbb175"},
]
[package.dependencies]
@@ -2745,17 +2796,17 @@ h11 = ">=0.8"
typing-extensions = {version = ">=4.0", markers = "python_version < \"3.11\""}
[package.extras]
-standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1)", "watchfiles (>=0.13)", "websockets (>=10.4)"]
+standard = ["colorama (>=0.4)", "httptools (>=0.6.3)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1)", "watchfiles (>=0.13)", "websockets (>=10.4)"]
[[package]]
name = "virtualenv"
-version = "20.26.6"
+version = "20.27.1"
description = "Virtual Python Environment builder"
optional = false
-python-versions = ">=3.7"
+python-versions = ">=3.8"
files = [
- {file = "virtualenv-20.26.6-py3-none-any.whl", hash = "sha256:7345cc5b25405607a624d8418154577459c3e0277f5466dd79c49d5e492995f2"},
- {file = "virtualenv-20.26.6.tar.gz", hash = "sha256:280aede09a2a5c317e409a00102e7077c6432c5a38f0ef938e643805a7ad2c48"},
+ {file = "virtualenv-20.27.1-py3-none-any.whl", hash = "sha256:f11f1b8a29525562925f745563bfd48b189450f61fb34c4f9cc79dd5aa32a1f4"},
+ {file = "virtualenv-20.27.1.tar.gz", hash = "sha256:142c6be10212543b32c6c45d3d3893dff89112cc588b7d0879ae5a1ec03a47ba"},
]
[package.dependencies]
@@ -2785,108 +2836,91 @@ test = ["websockets"]
[[package]]
name = "websockets"
-version = "13.1"
+version = "14.1"
description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)"
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.9"
files = [
- {file = "websockets-13.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f48c749857f8fb598fb890a75f540e3221d0976ed0bf879cf3c7eef34151acee"},
- {file = "websockets-13.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c7e72ce6bda6fb9409cc1e8164dd41d7c91466fb599eb047cfda72fe758a34a7"},
- {file = "websockets-13.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f779498eeec470295a2b1a5d97aa1bc9814ecd25e1eb637bd9d1c73a327387f6"},
- {file = "websockets-13.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4676df3fe46956fbb0437d8800cd5f2b6d41143b6e7e842e60554398432cf29b"},
- {file = "websockets-13.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7affedeb43a70351bb811dadf49493c9cfd1ed94c9c70095fd177e9cc1541fa"},
- {file = "websockets-13.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1971e62d2caa443e57588e1d82d15f663b29ff9dfe7446d9964a4b6f12c1e700"},
- {file = "websockets-13.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5f2e75431f8dc4a47f31565a6e1355fb4f2ecaa99d6b89737527ea917066e26c"},
- {file = "websockets-13.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:58cf7e75dbf7e566088b07e36ea2e3e2bd5676e22216e4cad108d4df4a7402a0"},
- {file = "websockets-13.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c90d6dec6be2c7d03378a574de87af9b1efea77d0c52a8301dd831ece938452f"},
- {file = "websockets-13.1-cp310-cp310-win32.whl", hash = "sha256:730f42125ccb14602f455155084f978bd9e8e57e89b569b4d7f0f0c17a448ffe"},
- {file = "websockets-13.1-cp310-cp310-win_amd64.whl", hash = "sha256:5993260f483d05a9737073be197371940c01b257cc45ae3f1d5d7adb371b266a"},
- {file = "websockets-13.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:61fc0dfcda609cda0fc9fe7977694c0c59cf9d749fbb17f4e9483929e3c48a19"},
- {file = "websockets-13.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ceec59f59d092c5007e815def4ebb80c2de330e9588e101cf8bd94c143ec78a5"},
- {file = "websockets-13.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c1dca61c6db1166c48b95198c0b7d9c990b30c756fc2923cc66f68d17dc558fd"},
- {file = "websockets-13.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:308e20f22c2c77f3f39caca508e765f8725020b84aa963474e18c59accbf4c02"},
- {file = "websockets-13.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62d516c325e6540e8a57b94abefc3459d7dab8ce52ac75c96cad5549e187e3a7"},
- {file = "websockets-13.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87c6e35319b46b99e168eb98472d6c7d8634ee37750d7693656dc766395df096"},
- {file = "websockets-13.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5f9fee94ebafbc3117c30be1844ed01a3b177bb6e39088bc6b2fa1dc15572084"},
- {file = "websockets-13.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:7c1e90228c2f5cdde263253fa5db63e6653f1c00e7ec64108065a0b9713fa1b3"},
- {file = "websockets-13.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6548f29b0e401eea2b967b2fdc1c7c7b5ebb3eeb470ed23a54cd45ef078a0db9"},
- {file = "websockets-13.1-cp311-cp311-win32.whl", hash = "sha256:c11d4d16e133f6df8916cc5b7e3e96ee4c44c936717d684a94f48f82edb7c92f"},
- {file = "websockets-13.1-cp311-cp311-win_amd64.whl", hash = "sha256:d04f13a1d75cb2b8382bdc16ae6fa58c97337253826dfe136195b7f89f661557"},
- {file = "websockets-13.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:9d75baf00138f80b48f1eac72ad1535aac0b6461265a0bcad391fc5aba875cfc"},
- {file = "websockets-13.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9b6f347deb3dcfbfde1c20baa21c2ac0751afaa73e64e5b693bb2b848efeaa49"},
- {file = "websockets-13.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de58647e3f9c42f13f90ac7e5f58900c80a39019848c5547bc691693098ae1bd"},
- {file = "websockets-13.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1b54689e38d1279a51d11e3467dd2f3a50f5f2e879012ce8f2d6943f00e83f0"},
- {file = "websockets-13.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf1781ef73c073e6b0f90af841aaf98501f975d306bbf6221683dd594ccc52b6"},
- {file = "websockets-13.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d23b88b9388ed85c6faf0e74d8dec4f4d3baf3ecf20a65a47b836d56260d4b9"},
- {file = "websockets-13.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3c78383585f47ccb0fcf186dcb8a43f5438bd7d8f47d69e0b56f71bf431a0a68"},
- {file = "websockets-13.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:d6d300f8ec35c24025ceb9b9019ae9040c1ab2f01cddc2bcc0b518af31c75c14"},
- {file = "websockets-13.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a9dcaf8b0cc72a392760bb8755922c03e17a5a54e08cca58e8b74f6902b433cf"},
- {file = "websockets-13.1-cp312-cp312-win32.whl", hash = "sha256:2f85cf4f2a1ba8f602298a853cec8526c2ca42a9a4b947ec236eaedb8f2dc80c"},
- {file = "websockets-13.1-cp312-cp312-win_amd64.whl", hash = "sha256:38377f8b0cdeee97c552d20cf1865695fcd56aba155ad1b4ca8779a5b6ef4ac3"},
- {file = "websockets-13.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a9ab1e71d3d2e54a0aa646ab6d4eebfaa5f416fe78dfe4da2839525dc5d765c6"},
- {file = "websockets-13.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b9d7439d7fab4dce00570bb906875734df13d9faa4b48e261c440a5fec6d9708"},
- {file = "websockets-13.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:327b74e915cf13c5931334c61e1a41040e365d380f812513a255aa804b183418"},
- {file = "websockets-13.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:325b1ccdbf5e5725fdcb1b0e9ad4d2545056479d0eee392c291c1bf76206435a"},
- {file = "websockets-13.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:346bee67a65f189e0e33f520f253d5147ab76ae42493804319b5716e46dddf0f"},
- {file = "websockets-13.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:91a0fa841646320ec0d3accdff5b757b06e2e5c86ba32af2e0815c96c7a603c5"},
- {file = "websockets-13.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:18503d2c5f3943e93819238bf20df71982d193f73dcecd26c94514f417f6b135"},
- {file = "websockets-13.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:a9cd1af7e18e5221d2878378fbc287a14cd527fdd5939ed56a18df8a31136bb2"},
- {file = "websockets-13.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:70c5be9f416aa72aab7a2a76c90ae0a4fe2755c1816c153c1a2bcc3333ce4ce6"},
- {file = "websockets-13.1-cp313-cp313-win32.whl", hash = "sha256:624459daabeb310d3815b276c1adef475b3e6804abaf2d9d2c061c319f7f187d"},
- {file = "websockets-13.1-cp313-cp313-win_amd64.whl", hash = "sha256:c518e84bb59c2baae725accd355c8dc517b4a3ed8db88b4bc93c78dae2974bf2"},
- {file = "websockets-13.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:c7934fd0e920e70468e676fe7f1b7261c1efa0d6c037c6722278ca0228ad9d0d"},
- {file = "websockets-13.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:149e622dc48c10ccc3d2760e5f36753db9cacf3ad7bc7bbbfd7d9c819e286f23"},
- {file = "websockets-13.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a569eb1b05d72f9bce2ebd28a1ce2054311b66677fcd46cf36204ad23acead8c"},
- {file = "websockets-13.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:95df24ca1e1bd93bbca51d94dd049a984609687cb2fb08a7f2c56ac84e9816ea"},
- {file = "websockets-13.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d8dbb1bf0c0a4ae8b40bdc9be7f644e2f3fb4e8a9aca7145bfa510d4a374eeb7"},
- {file = "websockets-13.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:035233b7531fb92a76beefcbf479504db8c72eb3bff41da55aecce3a0f729e54"},
- {file = "websockets-13.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:e4450fc83a3df53dec45922b576e91e94f5578d06436871dce3a6be38e40f5db"},
- {file = "websockets-13.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:463e1c6ec853202dd3657f156123d6b4dad0c546ea2e2e38be2b3f7c5b8e7295"},
- {file = "websockets-13.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:6d6855bbe70119872c05107e38fbc7f96b1d8cb047d95c2c50869a46c65a8e96"},
- {file = "websockets-13.1-cp38-cp38-win32.whl", hash = "sha256:204e5107f43095012b00f1451374693267adbb832d29966a01ecc4ce1db26faf"},
- {file = "websockets-13.1-cp38-cp38-win_amd64.whl", hash = "sha256:485307243237328c022bc908b90e4457d0daa8b5cf4b3723fd3c4a8012fce4c6"},
- {file = "websockets-13.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:9b37c184f8b976f0c0a231a5f3d6efe10807d41ccbe4488df8c74174805eea7d"},
- {file = "websockets-13.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:163e7277e1a0bd9fb3c8842a71661ad19c6aa7bb3d6678dc7f89b17fbcc4aeb7"},
- {file = "websockets-13.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4b889dbd1342820cc210ba44307cf75ae5f2f96226c0038094455a96e64fb07a"},
- {file = "websockets-13.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:586a356928692c1fed0eca68b4d1c2cbbd1ca2acf2ac7e7ebd3b9052582deefa"},
- {file = "websockets-13.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7bd6abf1e070a6b72bfeb71049d6ad286852e285f146682bf30d0296f5fbadfa"},
- {file = "websockets-13.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2aad13a200e5934f5a6767492fb07151e1de1d6079c003ab31e1823733ae79"},
- {file = "websockets-13.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:df01aea34b6e9e33572c35cd16bae5a47785e7d5c8cb2b54b2acdb9678315a17"},
- {file = "websockets-13.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:e54affdeb21026329fb0744ad187cf812f7d3c2aa702a5edb562b325191fcab6"},
- {file = "websockets-13.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9ef8aa8bdbac47f4968a5d66462a2a0935d044bf35c0e5a8af152d58516dbeb5"},
- {file = "websockets-13.1-cp39-cp39-win32.whl", hash = "sha256:deeb929efe52bed518f6eb2ddc00cc496366a14c726005726ad62c2dd9017a3c"},
- {file = "websockets-13.1-cp39-cp39-win_amd64.whl", hash = "sha256:7c65ffa900e7cc958cd088b9a9157a8141c991f8c53d11087e6fb7277a03f81d"},
- {file = "websockets-13.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:5dd6da9bec02735931fccec99d97c29f47cc61f644264eb995ad6c0c27667238"},
- {file = "websockets-13.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:2510c09d8e8df777177ee3d40cd35450dc169a81e747455cc4197e63f7e7bfe5"},
- {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1c3cf67185543730888b20682fb186fc8d0fa6f07ccc3ef4390831ab4b388d9"},
- {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bcc03c8b72267e97b49149e4863d57c2d77f13fae12066622dc78fe322490fe6"},
- {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:004280a140f220c812e65f36944a9ca92d766b6cc4560be652a0a3883a79ed8a"},
- {file = "websockets-13.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:e2620453c075abeb0daa949a292e19f56de518988e079c36478bacf9546ced23"},
- {file = "websockets-13.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:9156c45750b37337f7b0b00e6248991a047be4aa44554c9886fe6bdd605aab3b"},
- {file = "websockets-13.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:80c421e07973a89fbdd93e6f2003c17d20b69010458d3a8e37fb47874bd67d51"},
- {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82d0ba76371769d6a4e56f7e83bb8e81846d17a6190971e38b5de108bde9b0d7"},
- {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e9875a0143f07d74dc5e1ded1c4581f0d9f7ab86c78994e2ed9e95050073c94d"},
- {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a11e38ad8922c7961447f35c7b17bffa15de4d17c70abd07bfbe12d6faa3e027"},
- {file = "websockets-13.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:4059f790b6ae8768471cddb65d3c4fe4792b0ab48e154c9f0a04cefaabcd5978"},
- {file = "websockets-13.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:25c35bf84bf7c7369d247f0b8cfa157f989862c49104c5cf85cb5436a641d93e"},
- {file = "websockets-13.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:83f91d8a9bb404b8c2c41a707ac7f7f75b9442a0a876df295de27251a856ad09"},
- {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a43cfdcddd07f4ca2b1afb459824dd3c6d53a51410636a2c7fc97b9a8cf4842"},
- {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48a2ef1381632a2f0cb4efeff34efa97901c9fbc118e01951ad7cfc10601a9bb"},
- {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:459bf774c754c35dbb487360b12c5727adab887f1622b8aed5755880a21c4a20"},
- {file = "websockets-13.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:95858ca14a9f6fa8413d29e0a585b31b278388aa775b8a81fa24830123874678"},
- {file = "websockets-13.1-py3-none-any.whl", hash = "sha256:a9a396a6ad26130cdae92ae10c36af09d9bfe6cafe69670fd3b6da9b07b4044f"},
- {file = "websockets-13.1.tar.gz", hash = "sha256:a3b3366087c1bc0a2795111edcadddb8b3b59509d5db5d7ea3fdd69f954a8878"},
+ {file = "websockets-14.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a0adf84bc2e7c86e8a202537b4fd50e6f7f0e4a6b6bf64d7ccb96c4cd3330b29"},
+ {file = "websockets-14.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:90b5d9dfbb6d07a84ed3e696012610b6da074d97453bd01e0e30744b472c8179"},
+ {file = "websockets-14.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2177ee3901075167f01c5e335a6685e71b162a54a89a56001f1c3e9e3d2ad250"},
+ {file = "websockets-14.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f14a96a0034a27f9d47fd9788913924c89612225878f8078bb9d55f859272b0"},
+ {file = "websockets-14.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f874ba705deea77bcf64a9da42c1f5fc2466d8f14daf410bc7d4ceae0a9fcb0"},
+ {file = "websockets-14.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9607b9a442392e690a57909c362811184ea429585a71061cd5d3c2b98065c199"},
+ {file = "websockets-14.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:bea45f19b7ca000380fbd4e02552be86343080120d074b87f25593ce1700ad58"},
+ {file = "websockets-14.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:219c8187b3ceeadbf2afcf0f25a4918d02da7b944d703b97d12fb01510869078"},
+ {file = "websockets-14.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ad2ab2547761d79926effe63de21479dfaf29834c50f98c4bf5b5480b5838434"},
+ {file = "websockets-14.1-cp310-cp310-win32.whl", hash = "sha256:1288369a6a84e81b90da5dbed48610cd7e5d60af62df9851ed1d1d23a9069f10"},
+ {file = "websockets-14.1-cp310-cp310-win_amd64.whl", hash = "sha256:e0744623852f1497d825a49a99bfbec9bea4f3f946df6eb9d8a2f0c37a2fec2e"},
+ {file = "websockets-14.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:449d77d636f8d9c17952628cc7e3b8faf6e92a17ec581ec0c0256300717e1512"},
+ {file = "websockets-14.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a35f704be14768cea9790d921c2c1cc4fc52700410b1c10948511039be824aac"},
+ {file = "websockets-14.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b1f3628a0510bd58968c0f60447e7a692933589b791a6b572fcef374053ca280"},
+ {file = "websockets-14.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c3deac3748ec73ef24fc7be0b68220d14d47d6647d2f85b2771cb35ea847aa1"},
+ {file = "websockets-14.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7048eb4415d46368ef29d32133134c513f507fff7d953c18c91104738a68c3b3"},
+ {file = "websockets-14.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6cf0ad281c979306a6a34242b371e90e891bce504509fb6bb5246bbbf31e7b6"},
+ {file = "websockets-14.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:cc1fc87428c1d18b643479caa7b15db7d544652e5bf610513d4a3478dbe823d0"},
+ {file = "websockets-14.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:f95ba34d71e2fa0c5d225bde3b3bdb152e957150100e75c86bc7f3964c450d89"},
+ {file = "websockets-14.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9481a6de29105d73cf4515f2bef8eb71e17ac184c19d0b9918a3701c6c9c4f23"},
+ {file = "websockets-14.1-cp311-cp311-win32.whl", hash = "sha256:368a05465f49c5949e27afd6fbe0a77ce53082185bbb2ac096a3a8afaf4de52e"},
+ {file = "websockets-14.1-cp311-cp311-win_amd64.whl", hash = "sha256:6d24fc337fc055c9e83414c94e1ee0dee902a486d19d2a7f0929e49d7d604b09"},
+ {file = "websockets-14.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:ed907449fe5e021933e46a3e65d651f641975a768d0649fee59f10c2985529ed"},
+ {file = "websockets-14.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:87e31011b5c14a33b29f17eb48932e63e1dcd3fa31d72209848652310d3d1f0d"},
+ {file = "websockets-14.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bc6ccf7d54c02ae47a48ddf9414c54d48af9c01076a2e1023e3b486b6e72c707"},
+ {file = "websockets-14.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9777564c0a72a1d457f0848977a1cbe15cfa75fa2f67ce267441e465717dcf1a"},
+ {file = "websockets-14.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a655bde548ca98f55b43711b0ceefd2a88a71af6350b0c168aa77562104f3f45"},
+ {file = "websockets-14.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a3dfff83ca578cada2d19e665e9c8368e1598d4e787422a460ec70e531dbdd58"},
+ {file = "websockets-14.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6a6c9bcf7cdc0fd41cc7b7944447982e8acfd9f0d560ea6d6845428ed0562058"},
+ {file = "websockets-14.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:4b6caec8576e760f2c7dd878ba817653144d5f369200b6ddf9771d64385b84d4"},
+ {file = "websockets-14.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:eb6d38971c800ff02e4a6afd791bbe3b923a9a57ca9aeab7314c21c84bf9ff05"},
+ {file = "websockets-14.1-cp312-cp312-win32.whl", hash = "sha256:1d045cbe1358d76b24d5e20e7b1878efe578d9897a25c24e6006eef788c0fdf0"},
+ {file = "websockets-14.1-cp312-cp312-win_amd64.whl", hash = "sha256:90f4c7a069c733d95c308380aae314f2cb45bd8a904fb03eb36d1a4983a4993f"},
+ {file = "websockets-14.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:3630b670d5057cd9e08b9c4dab6493670e8e762a24c2c94ef312783870736ab9"},
+ {file = "websockets-14.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:36ebd71db3b89e1f7b1a5deaa341a654852c3518ea7a8ddfdf69cc66acc2db1b"},
+ {file = "websockets-14.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5b918d288958dc3fa1c5a0b9aa3256cb2b2b84c54407f4813c45d52267600cd3"},
+ {file = "websockets-14.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:00fe5da3f037041da1ee0cf8e308374e236883f9842c7c465aa65098b1c9af59"},
+ {file = "websockets-14.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8149a0f5a72ca36720981418eeffeb5c2729ea55fa179091c81a0910a114a5d2"},
+ {file = "websockets-14.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77569d19a13015e840b81550922056acabc25e3f52782625bc6843cfa034e1da"},
+ {file = "websockets-14.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cf5201a04550136ef870aa60ad3d29d2a59e452a7f96b94193bee6d73b8ad9a9"},
+ {file = "websockets-14.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:88cf9163ef674b5be5736a584c999e98daf3aabac6e536e43286eb74c126b9c7"},
+ {file = "websockets-14.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:836bef7ae338a072e9d1863502026f01b14027250a4545672673057997d5c05a"},
+ {file = "websockets-14.1-cp313-cp313-win32.whl", hash = "sha256:0d4290d559d68288da9f444089fd82490c8d2744309113fc26e2da6e48b65da6"},
+ {file = "websockets-14.1-cp313-cp313-win_amd64.whl", hash = "sha256:8621a07991add373c3c5c2cf89e1d277e49dc82ed72c75e3afc74bd0acc446f0"},
+ {file = "websockets-14.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:01bb2d4f0a6d04538d3c5dfd27c0643269656c28045a53439cbf1c004f90897a"},
+ {file = "websockets-14.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:414ffe86f4d6f434a8c3b7913655a1a5383b617f9bf38720e7c0799fac3ab1c6"},
+ {file = "websockets-14.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8fda642151d5affdee8a430bd85496f2e2517be3a2b9d2484d633d5712b15c56"},
+ {file = "websockets-14.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd7c11968bc3860d5c78577f0dbc535257ccec41750675d58d8dc66aa47fe52c"},
+ {file = "websockets-14.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a032855dc7db987dff813583d04f4950d14326665d7e714d584560b140ae6b8b"},
+ {file = "websockets-14.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7e7ea2f782408c32d86b87a0d2c1fd8871b0399dd762364c731d86c86069a78"},
+ {file = "websockets-14.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:39450e6215f7d9f6f7bc2a6da21d79374729f5d052333da4d5825af8a97e6735"},
+ {file = "websockets-14.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:ceada5be22fa5a5a4cdeec74e761c2ee7db287208f54c718f2df4b7e200b8d4a"},
+ {file = "websockets-14.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3fc753451d471cff90b8f467a1fc0ae64031cf2d81b7b34e1811b7e2691bc4bc"},
+ {file = "websockets-14.1-cp39-cp39-win32.whl", hash = "sha256:14839f54786987ccd9d03ed7f334baec0f02272e7ec4f6e9d427ff584aeea8b4"},
+ {file = "websockets-14.1-cp39-cp39-win_amd64.whl", hash = "sha256:d9fd19ecc3a4d5ae82ddbfb30962cf6d874ff943e56e0c81f5169be2fda62979"},
+ {file = "websockets-14.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:e5dc25a9dbd1a7f61eca4b7cb04e74ae4b963d658f9e4f9aad9cd00b688692c8"},
+ {file = "websockets-14.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:04a97aca96ca2acedf0d1f332c861c5a4486fdcba7bcef35873820f940c4231e"},
+ {file = "websockets-14.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df174ece723b228d3e8734a6f2a6febbd413ddec39b3dc592f5a4aa0aff28098"},
+ {file = "websockets-14.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:034feb9f4286476f273b9a245fb15f02c34d9586a5bc936aff108c3ba1b21beb"},
+ {file = "websockets-14.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:660c308dabd2b380807ab64b62985eaccf923a78ebc572bd485375b9ca2b7dc7"},
+ {file = "websockets-14.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:5a42d3ecbb2db5080fc578314439b1d79eef71d323dc661aa616fb492436af5d"},
+ {file = "websockets-14.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:ddaa4a390af911da6f680be8be4ff5aaf31c4c834c1a9147bc21cbcbca2d4370"},
+ {file = "websockets-14.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:a4c805c6034206143fbabd2d259ec5e757f8b29d0a2f0bf3d2fe5d1f60147a4a"},
+ {file = "websockets-14.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:205f672a6c2c671a86d33f6d47c9b35781a998728d2c7c2a3e1cf3333fcb62b7"},
+ {file = "websockets-14.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5ef440054124728cc49b01c33469de06755e5a7a4e83ef61934ad95fc327fbb0"},
+ {file = "websockets-14.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e7591d6f440af7f73c4bd9404f3772bfee064e639d2b6cc8c94076e71b2471c1"},
+ {file = "websockets-14.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:25225cc79cfebc95ba1d24cd3ab86aaa35bcd315d12fa4358939bd55e9bd74a5"},
+ {file = "websockets-14.1-py3-none-any.whl", hash = "sha256:4d4fc827a20abe6d544a119896f6b78ee13fe81cbfef416f3f2ddf09a03f0e2e"},
+ {file = "websockets-14.1.tar.gz", hash = "sha256:398b10c77d471c0aab20a845e7a60076b6390bfdaac7a6d2edb0d2c59d75e8d8"},
]
[[package]]
name = "wheel"
-version = "0.44.0"
+version = "0.45.0"
description = "A built-package format for Python"
optional = false
python-versions = ">=3.8"
files = [
- {file = "wheel-0.44.0-py3-none-any.whl", hash = "sha256:2376a90c98cc337d18623527a97c31797bd02bad0033d41547043a1cbfbe448f"},
- {file = "wheel-0.44.0.tar.gz", hash = "sha256:a29c3f2817e95ab89aa4660681ad547c0e9547f20e75b0562fe7723c9a2a9d49"},
+ {file = "wheel-0.45.0-py3-none-any.whl", hash = "sha256:52f0baa5e6522155090a09c6bd95718cc46956d1b51d537ea5454249edb671c7"},
+ {file = "wheel-0.45.0.tar.gz", hash = "sha256:a57353941a3183b3d5365346b567a260a0602a0f8a635926a7dede41b94c674a"},
]
[package.extras]
@@ -2987,13 +3021,13 @@ h11 = ">=0.9.0,<1"
[[package]]
name = "zipp"
-version = "3.20.2"
+version = "3.21.0"
description = "Backport of pathlib-compatible object wrapper for zip files"
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.9"
files = [
- {file = "zipp-3.20.2-py3-none-any.whl", hash = "sha256:a817ac80d6cf4b23bf7f2828b7cabf326f15a001bea8b1f9b49631780ba28350"},
- {file = "zipp-3.20.2.tar.gz", hash = "sha256:bc9eb26f4506fda01b81bcde0ca78103b6e62f991b381fec825435c836edbc29"},
+ {file = "zipp-3.21.0-py3-none-any.whl", hash = "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931"},
+ {file = "zipp-3.21.0.tar.gz", hash = "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4"},
]
[package.extras]
@@ -3007,4 +3041,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.0"
python-versions = "^3.9"
-content-hash = "796ddba36f031ad2b47cae43ce6c49102e2cb98f92823b265d9779e6684333f6"
+content-hash = "3810e99ff4d09952e62d88b2c26651a0d8e0ffe4007bc3274c2fb83b68243951"
diff --git a/pyproject.toml b/pyproject.toml
index ae636a1c4..b63fad319 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "reflex"
-version = "0.6.4dev1"
+version = "0.6.7dev1"
description = "Web apps in pure Python."
license = "Apache-2.0"
authors = [
@@ -49,7 +49,7 @@ wrapt = [
{version = ">=1.11.0,<2.0", python = "<3.11"},
]
packaging = ">=23.1,<25.0"
-reflex-hosting-cli = ">=0.1.2,<2.0"
+reflex-hosting-cli = ">=0.1.29,<2.0"
charset-normalizer = ">=3.3.2,<4.0"
wheel = ">=0.42.0,<1.0"
build = ">=1.0.3,<2.0"
@@ -59,23 +59,25 @@ twine = ">=4.0.0,<6.0"
tomlkit = ">=0.12.4,<1.0"
lazy_loader = ">=0.4"
reflex-chakra = ">=0.6.0"
+typing_extensions = ">=4.6.0"
[tool.poetry.group.dev.dependencies]
pytest = ">=7.1.2,<9.0"
pytest-mock = ">=3.10.0,<4.0"
pyright = ">=1.1.229,<1.1.335"
darglint = ">=1.8.1,<2.0"
+dill = ">=0.3.8"
toml = ">=0.10.2,<1.0"
pytest-asyncio = ">=0.24.0"
-pytest-cov = ">=4.0.0,<6.0"
-ruff = "^0.6.9"
+pytest-cov = ">=4.0.0,<7.0"
+ruff = "0.7.4"
pandas = ">=2.1.1,<3.0"
-pillow = ">=10.0.0,<11.0"
+pillow = ">=10.0.0,<12.0"
plotly = ">=5.13.0,<6.0"
asynctest = ">=0.13.0,<1.0"
pre-commit = ">=3.2.1"
selenium = ">=4.11.0,<5.0"
-pytest-benchmark = ">=4.0.0,<5.0"
+pytest-benchmark = ">=4.0.0,<6.0"
playwright = ">=1.46.0"
pytest-playwright = ">=0.5.1"
@@ -90,8 +92,9 @@ build-backend = "poetry.core.masonry.api"
[tool.ruff]
target-version = "py39"
+lint.isort.split-on-trailing-comma = false
lint.select = ["B", "D", "E", "F", "I", "SIM", "W"]
-lint.ignore = ["B008", "D203", "D205", "D213", "D401", "D406", "D407", "E501", "F403", "F405", "F541"]
+lint.ignore = ["B008", "D205", "E501", "F403", "SIM115"]
lint.pydocstyle.convention = "google"
[tool.ruff.lint.per-file-ignores]
@@ -103,4 +106,4 @@ lint.pydocstyle.convention = "google"
[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
-asyncio_mode = "auto"
\ No newline at end of file
+asyncio_mode = "auto"
diff --git a/reflex/.templates/jinja/web/pages/_app.js.jinja2 b/reflex/.templates/jinja/web/pages/_app.js.jinja2
index c893e19e2..21cfd921a 100644
--- a/reflex/.templates/jinja/web/pages/_app.js.jinja2
+++ b/reflex/.templates/jinja/web/pages/_app.js.jinja2
@@ -1,11 +1,11 @@
{% extends "web/pages/base_page.js.jinja2" %}
{% block early_imports %}
-import '/styles/styles.css'
+import '$/styles/styles.css'
{% endblock %}
{% block declaration %}
-import { EventLoopProvider, StateProvider, defaultColorMode } from "/utils/context.js";
+import { EventLoopProvider, StateProvider, defaultColorMode } from "$/utils/context.js";
import { ThemeProvider } from 'next-themes'
{% for library_alias, library_path in window_libraries %}
import * as {{library_alias}} from "{{library_path}}";
diff --git a/reflex/.templates/jinja/web/pages/custom_component.js.jinja2 b/reflex/.templates/jinja/web/pages/custom_component.js.jinja2
index 210246992..222524d2d 100644
--- a/reflex/.templates/jinja/web/pages/custom_component.js.jinja2
+++ b/reflex/.templates/jinja/web/pages/custom_component.js.jinja2
@@ -8,20 +8,6 @@
{% endfor %}
export const {{component.name}} = memo(({ {{-component.props|join(", ")-}} }) => {
-{% if component.name == "CodeBlock" and "language" in component.props %}
- if (language) {
- (async () => {
- try {
- const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${language}`);
- SyntaxHighlighter.registerLanguage(language, module.default);
- } catch (error) {
- console.error(`Error importing language module for ${language}:`, error);
- }
- })();
-
-
- }
-{% endif %}
{% for hook in component.hooks %}
{{ hook }}
{% endfor %}
diff --git a/reflex/.templates/jinja/web/pages/utils.js.jinja2 b/reflex/.templates/jinja/web/pages/utils.js.jinja2
index 908482d24..624e3bee8 100644
--- a/reflex/.templates/jinja/web/pages/utils.js.jinja2
+++ b/reflex/.templates/jinja/web/pages/utils.js.jinja2
@@ -36,14 +36,10 @@
{# component: component dictionary #}
{% macro render_tag(component) %}
<{{component.name}} {{- render_props(component.props) }}>
-{%- if component.args is not none -%}
- {{- render_arg_content(component) }}
-{%- else -%}
- {{ component.contents }}
- {% for child in component.children %}
- {{ render(child) }}
- {% endfor %}
-{%- endif -%}
+{{ component.contents }}
+{% for child in component.children %}
+{{ render(child) }}
+{% endfor %}
{{component.name}}>
{%- endmacro %}
diff --git a/reflex/.templates/jinja/web/utils/context.js.jinja2 b/reflex/.templates/jinja/web/utils/context.js.jinja2
index 8faecd9d2..2428cfa9d 100644
--- a/reflex/.templates/jinja/web/utils/context.js.jinja2
+++ b/reflex/.templates/jinja/web/utils/context.js.jinja2
@@ -1,5 +1,5 @@
import { createContext, useContext, useMemo, useReducer, useState } from "react"
-import { applyDelta, Event, hydrateClientStorage, useEventLoop, refs } from "/utils/state.js"
+import { applyDelta, Event, hydrateClientStorage, useEventLoop, refs } from "$/utils/state.js"
{% if initial_state %}
export const initialState = {{ initial_state|json_dumps }}
@@ -59,6 +59,8 @@ export const initialEvents = () => [
{% else %}
export const state_name = undefined
+export const exception_state_name = undefined
+
export const onLoadInternalEvent = () => []
export const initialEvents = () => []
diff --git a/reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js b/reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js
index 04df06059..dd7886c89 100644
--- a/reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js
+++ b/reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js
@@ -4,8 +4,8 @@ import {
ColorModeContext,
defaultColorMode,
isDevMode,
- lastCompiledTimeStamp
-} from "/utils/context.js";
+ lastCompiledTimeStamp,
+} from "$/utils/context.js";
export default function RadixThemesColorModeProvider({ children }) {
const { theme, resolvedTheme, setTheme } = useTheme();
@@ -37,7 +37,7 @@ export default function RadixThemesColorModeProvider({ children }) {
const allowedModes = ["light", "dark", "system"];
if (!allowedModes.includes(mode)) {
console.error(
- `Invalid color mode "${mode}". Defaulting to "${defaultColorMode}".`,
+ `Invalid color mode "${mode}". Defaulting to "${defaultColorMode}".`
);
mode = defaultColorMode;
}
diff --git a/reflex/.templates/web/components/shiki/code.js b/reflex/.templates/web/components/shiki/code.js
new file mode 100644
index 000000000..22b3693b4
--- /dev/null
+++ b/reflex/.templates/web/components/shiki/code.js
@@ -0,0 +1,34 @@
+import { useEffect, useState } from "react"
+import { codeToHtml} from "shiki"
+
+/**
+ * Code component that uses Shiki to convert code to HTML and render it.
+ *
+ * @param code - The code to be highlighted.
+ * @param theme - The theme to be used for highlighting.
+ * @param language - The language of the code.
+ * @param transformers - The transformers to be applied to the code.
+ * @param decorations - The decorations to be applied to the code.
+ * @param divProps - Additional properties to be passed to the div element.
+ * @returns The rendered code block.
+ */
+export function Code ({code, theme, language, transformers, decorations, ...divProps}) {
+ const [codeResult, setCodeResult] = useState("")
+ useEffect(() => {
+ async function fetchCode() {
+ const result = await codeToHtml(code, {
+ lang: language,
+ theme,
+ transformers,
+ decorations
+ });
+ setCodeResult(result);
+ }
+ fetchCode();
+ }, [code, language, theme, transformers, decorations]
+
+ )
+ return (
+
+ )
+}
diff --git a/reflex/.templates/web/jsconfig.json b/reflex/.templates/web/jsconfig.json
index 3c8a3257f..3fcb35ba6 100644
--- a/reflex/.templates/web/jsconfig.json
+++ b/reflex/.templates/web/jsconfig.json
@@ -2,7 +2,8 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
+ "$/*": ["*"],
"@/*": ["public/*"]
}
}
-}
\ No newline at end of file
+}
diff --git a/reflex/.templates/web/utils/state.js b/reflex/.templates/web/utils/state.js
index 0fe0db8c1..622f171ad 100644
--- a/reflex/.templates/web/utils/state.js
+++ b/reflex/.templates/web/utils/state.js
@@ -2,7 +2,7 @@
import axios from "axios";
import io from "socket.io-client";
import JSON5 from "json5";
-import env from "/env.json";
+import env from "$/env.json";
import Cookies from "universal-cookie";
import { useEffect, useRef, useState } from "react";
import Router, { useRouter } from "next/router";
@@ -12,10 +12,9 @@ import {
onLoadInternalEvent,
state_name,
exception_state_name,
-} from "utils/context.js";
-import debounce from "/utils/helpers/debounce";
-import throttle from "/utils/helpers/throttle";
-import * as Babel from "@babel/standalone";
+} from "$/utils/context.js";
+import debounce from "$/utils/helpers/debounce";
+import throttle from "$/utils/helpers/throttle";
// Endpoint URLs.
const EVENTURL = env.EVENT;
@@ -139,8 +138,7 @@ export const evalReactComponent = async (component) => {
if (!window.React && window.__reflex) {
window.React = window.__reflex.react;
}
- const output = Babel.transform(component, { presets: ["react"] }).code;
- const encodedJs = encodeURIComponent(output);
+ const encodedJs = encodeURIComponent(component);
const dataUri = "data:text/javascript;charset=utf-8," + encodedJs;
const module = await eval(`import(dataUri)`);
return module.default;
@@ -180,11 +178,6 @@ export const applyEvent = async (event, socket) => {
return false;
}
- if (event.name == "_console") {
- console.log(event.payload.message);
- return false;
- }
-
if (event.name == "_remove_cookie") {
cookies.remove(event.payload.key, { ...event.payload.options });
queueEventIfSocketExists(initialEvents(), socket);
@@ -215,12 +208,6 @@ export const applyEvent = async (event, socket) => {
return false;
}
- if (event.name == "_set_clipboard") {
- const content = event.payload.content;
- navigator.clipboard.writeText(content);
- return false;
- }
-
if (event.name == "_download") {
const a = document.createElement("a");
a.hidden = true;
@@ -235,11 +222,6 @@ export const applyEvent = async (event, socket) => {
return false;
}
- if (event.name == "_alert") {
- alert(event.payload.message);
- return false;
- }
-
if (event.name == "_set_focus") {
const ref =
event.payload.ref in refs ? refs[event.payload.ref] : event.payload.ref;
@@ -256,9 +238,35 @@ export const applyEvent = async (event, socket) => {
return false;
}
- if (event.name == "_call_script") {
+ if (
+ event.name == "_call_function" &&
+ typeof event.payload.function !== "string"
+ ) {
try {
- const eval_result = eval(event.payload.javascript_code);
+ const eval_result = event.payload.function();
+ if (event.payload.callback) {
+ if (!!eval_result && typeof eval_result.then === "function") {
+ event.payload.callback(await eval_result);
+ } else {
+ event.payload.callback(eval_result);
+ }
+ }
+ } catch (e) {
+ console.log("_call_function", e);
+ if (window && window?.onerror) {
+ window.onerror(e.message, null, null, null, e);
+ }
+ }
+ return false;
+ }
+
+ if (event.name == "_call_script" || event.name == "_call_function") {
+ try {
+ const eval_result =
+ event.name == "_call_script"
+ ? eval(event.payload.javascript_code)
+ : eval(event.payload.function)();
+
if (event.payload.callback) {
if (!!eval_result && typeof eval_result.then === "function") {
eval(event.payload.callback)(await eval_result);
@@ -446,6 +454,10 @@ export const connect = async (
queueEvents(update.events, socket);
}
});
+ socket.current.on("reload", async (event) => {
+ event_processing = false;
+ queueEvents([...initialEvents(), JSON5.parse(event)], socket);
+ });
document.addEventListener("visibilitychange", checkVisibility);
};
@@ -478,23 +490,30 @@ export const uploadFiles = async (
return false;
}
+ // Track how many partial updates have been processed for this upload.
let resp_idx = 0;
const eventHandler = (progressEvent) => {
- // handle any delta / event streamed from the upload event handler
+ const event_callbacks = socket._callbacks.$event;
+ // Whenever called, responseText will contain the entire response so far.
const chunks = progressEvent.event.target.responseText.trim().split("\n");
+ // So only process _new_ chunks beyond resp_idx.
chunks.slice(resp_idx).map((chunk) => {
- try {
- socket._callbacks.$event.map((f) => {
- f(chunk);
- });
- resp_idx += 1;
- } catch (e) {
- if (progressEvent.progress === 1) {
- // Chunk may be incomplete, so only report errors when full response is available.
- console.log("Error parsing chunk", chunk, e);
- }
- return;
- }
+ event_callbacks.map((f, ix) => {
+ f(chunk)
+ .then(() => {
+ if (ix === event_callbacks.length - 1) {
+ // Mark this chunk as processed.
+ resp_idx += 1;
+ }
+ })
+ .catch((e) => {
+ if (progressEvent.progress === 1) {
+ // Chunk may be incomplete, so only report errors when full response is available.
+ console.log("Error parsing chunk", chunk, e);
+ }
+ return;
+ });
+ });
});
};
@@ -697,6 +716,11 @@ export const useEventLoop = (
_e.stopPropagation();
}
const combined_name = events.map((e) => e.name).join("+++");
+ if (event_actions?.temporal) {
+ if (!socket.current || !socket.current.connected) {
+ return; // don't queue when the backend is not connected
+ }
+ }
if (event_actions?.throttle) {
// If throttle returns false, the events are not added to the queue.
if (!throttle(combined_name, event_actions.throttle)) {
@@ -743,6 +767,7 @@ export const useEventLoop = (
addEvents([
Event(`${exception_state_name}.handle_frontend_exception`, {
stack: error.stack,
+ component_stack: "",
}),
]);
return false;
@@ -753,7 +778,8 @@ export const useEventLoop = (
window.onunhandledrejection = function (event) {
addEvents([
Event(`${exception_state_name}.handle_frontend_exception`, {
- stack: event.reason.stack,
+ stack: event.reason?.stack,
+ component_stack: "",
}),
]);
return false;
@@ -827,11 +853,20 @@ export const useEventLoop = (
}
};
const change_complete = () => addEvents(onLoadInternalEvent());
+ const change_error = () => {
+ // Remove cached error state from router for this page, otherwise the
+ // page will never send on_load events again.
+ if (router.components[router.pathname].error) {
+ delete router.components[router.pathname].error;
+ }
+ };
router.events.on("routeChangeStart", change_start);
router.events.on("routeChangeComplete", change_complete);
+ router.events.on("routeChangeError", change_error);
return () => {
router.events.off("routeChangeStart", change_start);
router.events.off("routeChangeComplete", change_complete);
+ router.events.off("routeChangeError", change_error);
};
}, [router]);
diff --git a/reflex/__init__.py b/reflex/__init__.py
index ad51d2cf4..562524416 100644
--- a/reflex/__init__.py
+++ b/reflex/__init__.py
@@ -264,6 +264,7 @@ _MAPPING: dict = {
"experimental": ["_x"],
"admin": ["AdminDash"],
"app": ["App", "UploadFile"],
+ "assets": ["asset"],
"base": ["Base"],
"components.component": [
"Component",
@@ -298,15 +299,19 @@ _MAPPING: dict = {
"components.moment": ["MomentDelta", "moment"],
"config": ["Config", "DBConfig"],
"constants": ["Env"],
+ "constants.colors": ["Color"],
"event": [
"EventChain",
"EventHandler",
"background",
"call_script",
+ "call_function",
+ "run_script",
"clear_local_storage",
"clear_session_storage",
"console_log",
"download",
+ "noop",
"prevent_default",
"redirect",
"remove_cookie",
@@ -320,18 +325,22 @@ _MAPPING: dict = {
"upload_files",
"window_alert",
],
+ "istate.storage": [
+ "Cookie",
+ "LocalStorage",
+ "SessionStorage",
+ ],
"middleware": ["middleware", "Middleware"],
"model": ["session", "Model"],
"state": [
"var",
- "Cookie",
- "LocalStorage",
- "SessionStorage",
"ComponentState",
"State",
+ "dynamic",
],
+ "istate.wrappers": ["get_state"],
"style": ["Style", "toggle_color_mode"],
- "utils.imports": ["ImportVar"],
+ "utils.imports": ["ImportDict", "ImportVar"],
"utils.serializers": ["serializer"],
"vars": ["Var", "field", "Field"],
}
diff --git a/reflex/__init__.pyi b/reflex/__init__.pyi
index d928778d8..6f61435e6 100644
--- a/reflex/__init__.pyi
+++ b/reflex/__init__.pyi
@@ -19,6 +19,7 @@ from . import vars as vars
from .admin import AdminDash as AdminDash
from .app import App as App
from .app import UploadFile as UploadFile
+from .assets import asset as asset
from .base import Base as Base
from .components import el as el
from .components import lucide as lucide
@@ -152,20 +153,24 @@ from .components.suneditor import editor as editor
from .config import Config as Config
from .config import DBConfig as DBConfig
from .constants import Env as Env
+from .constants.colors import Color as Color
from .event import EventChain as EventChain
from .event import EventHandler as EventHandler
from .event import background as background
+from .event import call_function as call_function
from .event import call_script as call_script
from .event import clear_local_storage as clear_local_storage
from .event import clear_session_storage as clear_session_storage
from .event import console_log as console_log
from .event import download as download
from .event import event as event
+from .event import noop as noop
from .event import prevent_default as prevent_default
from .event import redirect as redirect
from .event import remove_cookie as remove_cookie
from .event import remove_local_storage as remove_local_storage
from .event import remove_session_storage as remove_session_storage
+from .event import run_script as run_script
from .event import scroll_to as scroll_to
from .event import set_clipboard as set_clipboard
from .event import set_focus as set_focus
@@ -174,19 +179,22 @@ from .event import stop_propagation as stop_propagation
from .event import upload_files as upload_files
from .event import window_alert as window_alert
from .experimental import _x as _x
+from .istate.storage import Cookie as Cookie
+from .istate.storage import LocalStorage as LocalStorage
+from .istate.storage import SessionStorage as SessionStorage
+from .istate.wrappers import get_state as get_state
from .middleware import Middleware as Middleware
from .middleware import middleware as middleware
from .model import Model as Model
from .model import session as session
from .page import page as page
from .state import ComponentState as ComponentState
-from .state import Cookie as Cookie
-from .state import LocalStorage as LocalStorage
-from .state import SessionStorage as SessionStorage
from .state import State as State
+from .state import dynamic as dynamic
from .state import var as var
from .style import Style as Style
from .style import toggle_color_mode as toggle_color_mode
+from .utils.imports import ImportDict as ImportDict
from .utils.imports import ImportVar as ImportVar
from .utils.serializers import serializer as serializer
from .vars import Field as Field
diff --git a/reflex/app.py b/reflex/app.py
index 584b8a321..cdf21aa35 100644
--- a/reflex/app.py
+++ b/reflex/app.py
@@ -6,23 +6,25 @@ import asyncio
import concurrent.futures
import contextlib
import copy
+import dataclasses
import functools
import inspect
import io
import json
import multiprocessing
-import os
import platform
import sys
import traceback
from datetime import datetime
from pathlib import Path
from typing import (
+ TYPE_CHECKING,
Any,
AsyncIterator,
Callable,
Coroutine,
Dict,
+ Generic,
List,
Optional,
Set,
@@ -44,10 +46,9 @@ from starlette_admin.contrib.sqla.view import ModelView
from reflex import constants
from reflex.admin import AdminDash
from reflex.app_mixins import AppMixin, LifespanMixin, MiddlewareMixin
-from reflex.base import Base
from reflex.compiler import compiler
from reflex.compiler import utils as compiler_utils
-from reflex.compiler.compiler import ExecutorSafeFunctions
+from reflex.compiler.compiler import ExecutorSafeFunctions, compile_theme
from reflex.components.base.app_wrap import AppWrap
from reflex.components.base.error_boundary import ErrorBoundary
from reflex.components.base.fragment import Fragment
@@ -64,12 +65,19 @@ from reflex.components.core.client_side_routing import (
)
from reflex.components.core.upload import Upload, get_upload_dir
from reflex.components.radix import themes
-from reflex.config import get_config
-from reflex.event import Event, EventHandler, EventSpec, window_alert
-from reflex.model import Model, get_db_status
-from reflex.page import (
- DECORATED_PAGES,
+from reflex.config import environment, get_config
+from reflex.event import (
+ BASE_STATE,
+ Event,
+ EventHandler,
+ EventSpec,
+ EventType,
+ IndividualEventType,
+ get_hydrate_event,
+ window_alert,
)
+from reflex.model import Model, get_db_status
+from reflex.page import DECORATED_PAGES
from reflex.route import (
get_route_args,
replace_brackets_with_keywords,
@@ -85,9 +93,12 @@ from reflex.state import (
code_uses_state_contexts,
)
from reflex.utils import codespaces, console, exceptions, format, prerequisites, types
-from reflex.utils.exec import is_prod_mode, is_testing_env, should_skip_compile
+from reflex.utils.exec import is_prod_mode, is_testing_env
from reflex.utils.imports import ImportVar
+if TYPE_CHECKING:
+ from reflex.vars import Var
+
# Define custom types.
ComponentCallable = Callable[[], Component]
Reducer = Callable[[Event], Coroutine[Any, Any, StateUpdate]]
@@ -170,7 +181,23 @@ class OverlayFragment(Fragment):
pass
-class App(MiddlewareMixin, LifespanMixin, Base):
+@dataclasses.dataclass(
+ frozen=True,
+)
+class UnevaluatedPage(Generic[BASE_STATE]):
+ """An uncompiled page."""
+
+ component: Union[Component, ComponentCallable]
+ route: str
+ title: Union[Var, str, None]
+ description: Union[Var, str, None]
+ image: str
+ on_load: Union[EventType[[], BASE_STATE], None]
+ meta: List[Dict[str, str]]
+
+
+@dataclasses.dataclass()
+class App(MiddlewareMixin, LifespanMixin):
"""The main Reflex app that encapsulates the backend and frontend.
Every Reflex app needs an app defined in its main module.
@@ -192,24 +219,26 @@ class App(MiddlewareMixin, LifespanMixin, Base):
"""
# The global [theme](https://reflex.dev/docs/styling/theming/#theme) for the entire app.
- theme: Optional[Component] = themes.theme(accent_color="blue")
+ theme: Optional[Component] = dataclasses.field(
+ default_factory=lambda: themes.theme(accent_color="blue")
+ )
# The [global style](https://reflex.dev/docs/styling/overview/#global-styles}) for the app.
- style: ComponentStyle = {}
+ style: ComponentStyle = dataclasses.field(default_factory=dict)
# A list of URLs to [stylesheets](https://reflex.dev/docs/styling/custom-stylesheets/) to include in the app.
- stylesheets: List[str] = []
+ stylesheets: List[str] = dataclasses.field(default_factory=list)
# A component that is present on every page (defaults to the Connection Error banner).
overlay_component: Optional[Union[Component, ComponentCallable]] = (
- default_overlay_component()
+ dataclasses.field(default_factory=default_overlay_component)
)
# Error boundary component to wrap the app with.
error_boundary: Optional[ComponentCallable] = default_error_boundary
# Components to add to the head of every page.
- head_components: List[Component] = []
+ head_components: List[Component] = dataclasses.field(default_factory=list)
# The Socket.IO AsyncServer instance.
sio: Optional[AsyncServer] = None
@@ -220,8 +249,13 @@ class App(MiddlewareMixin, LifespanMixin, Base):
# Attributes to add to the html root tag of every page.
html_custom_attrs: Optional[Dict[str, str]] = None
+ # A map from a route to an unevaluated page. PRIVATE.
+ unevaluated_pages: Dict[str, UnevaluatedPage] = dataclasses.field(
+ default_factory=dict
+ )
+
# A map from a page route to the component to render. Users should use `add_page`. PRIVATE.
- pages: Dict[str, Component] = {}
+ pages: Dict[str, Component] = dataclasses.field(default_factory=dict)
# The backend API object. PRIVATE.
api: FastAPI = None # type: ignore
@@ -233,7 +267,9 @@ class App(MiddlewareMixin, LifespanMixin, Base):
_state_manager: Optional[StateManager] = None
# Mapping from a route to event handlers to trigger when the page loads. PRIVATE.
- load_events: Dict[str, List[Union[EventHandler, EventSpec]]] = {}
+ load_events: Dict[str, List[IndividualEventType[[], Any]]] = dataclasses.field(
+ default_factory=dict
+ )
# Admin dashboard to view and manage the database. PRIVATE.
admin_dash: Optional[AdminDash] = None
@@ -242,7 +278,7 @@ class App(MiddlewareMixin, LifespanMixin, Base):
event_namespace: Optional[EventNamespace] = None
# Background tasks that are currently running. PRIVATE.
- background_tasks: Set[asyncio.Task] = set()
+ background_tasks: Set[asyncio.Task] = dataclasses.field(default_factory=set)
# Frontend Error Handler Function
frontend_exception_handler: Callable[[Exception], None] = (
@@ -254,23 +290,14 @@ class App(MiddlewareMixin, LifespanMixin, Base):
[Exception], Union[EventSpec, List[EventSpec], None]
] = default_backend_exception_handler
- def __init__(self, **kwargs):
+ def __post_init__(self):
"""Initialize the app.
- Args:
- **kwargs: Kwargs to initialize the app with.
-
Raises:
ValueError: If the event namespace is not provided in the config.
Also, if there are multiple client subclasses of rx.BaseState(Subclasses of rx.BaseState should consist
of the DefaultState and the client app state).
"""
- if "connect_error_component" in kwargs:
- raise ValueError(
- "`connect_error_component` is deprecated, use `overlay_component` instead"
- )
- super().__init__(**kwargs)
-
# Special case to allow test cases have multiple subclasses of rx.BaseState.
if not is_testing_env() and BaseState.__subclasses__() != [State]:
# Only rx.State is allowed as Base State subclass.
@@ -381,8 +408,8 @@ class App(MiddlewareMixin, LifespanMixin, Base):
def _add_optional_endpoints(self):
"""Add optional api endpoints (_upload)."""
- # To upload files.
if Upload.is_used:
+ # To upload files.
self.api.post(str(constants.Endpoint.UPLOAD))(upload(self))
# To access uploaded files.
@@ -442,12 +469,10 @@ class App(MiddlewareMixin, LifespanMixin, Base):
self,
component: Component | ComponentCallable,
route: str | None = None,
- title: str | None = None,
- description: str | None = None,
+ title: str | Var | None = None,
+ description: str | Var | None = None,
image: str = constants.DefaultPage.IMAGE,
- on_load: (
- EventHandler | EventSpec | list[EventHandler | EventSpec] | None
- ) = None,
+ on_load: EventType[[], BASE_STATE] | None = None,
meta: list[dict[str, str]] = constants.DefaultPage.META_LIST,
):
"""Add a page to the app.
@@ -479,13 +504,13 @@ class App(MiddlewareMixin, LifespanMixin, Base):
# Check if the route given is valid
verify_route_validity(route)
- if route in self.pages and os.getenv(constants.RELOAD_CONFIG):
+ if route in self.unevaluated_pages and environment.RELOAD_CONFIG.is_set():
# when the app is reloaded(typically for app harness tests), we should maintain
# the latest render function of a route.This applies typically to decorated pages
# since they are only added when app._compile is called.
- self.pages.pop(route)
+ self.unevaluated_pages.pop(route)
- if route in self.pages:
+ if route in self.unevaluated_pages:
route_name = (
f"`{route}` or `/`"
if route == constants.PageNames.INDEX_ROUTE
@@ -501,59 +526,39 @@ class App(MiddlewareMixin, LifespanMixin, Base):
state = self.state if self.state else State
state.setup_dynamic_args(get_route_args(route))
- # Generate the component if it is a callable.
- component = self._generate_component(component)
+ if on_load:
+ self.load_events[route] = (
+ on_load if isinstance(on_load, list) else [on_load]
+ )
- # unpack components that return tuples in an rx.fragment.
- if isinstance(component, tuple):
- component = Fragment.create(*component)
-
- # Ensure state is enabled if this page uses state.
- if self.state is None:
- if on_load or component._has_stateful_event_triggers():
- self._enable_state()
- else:
- for var in component._get_vars(include_children=True):
- var_data = var._get_all_var_data()
- if not var_data:
- continue
- if not var_data.state:
- continue
- self._enable_state()
- break
-
- component = OverlayFragment.create(component)
-
- meta_args = {
- "title": (
- title
- if title is not None
- else format.make_default_page_title(get_config().app_name, route)
- ),
- "image": image,
- "meta": meta,
- }
-
- if description is not None:
- meta_args["description"] = description
-
- # Add meta information to the component.
- compiler_utils.add_meta(
- component,
- **meta_args,
+ self.unevaluated_pages[route] = UnevaluatedPage(
+ component=component,
+ route=route,
+ title=title,
+ description=description,
+ image=image,
+ on_load=on_load,
+ meta=meta,
)
+ def _compile_page(self, route: str):
+ """Compile a page.
+
+ Args:
+ route: The route of the page to compile.
+ """
+ component, enable_state = compiler.compile_unevaluated_page(
+ route, self.unevaluated_pages[route], self.state, self.style, self.theme
+ )
+
+ if enable_state:
+ self._enable_state()
+
# Add the page.
self._check_routes_conflict(route)
self.pages[route] = component
- # Add the load events.
- if on_load:
- if not isinstance(on_load, list):
- on_load = [on_load]
- self.load_events[route] = on_load
-
- def get_load_events(self, route: str) -> list[EventHandler | EventSpec]:
+ def get_load_events(self, route: str) -> list[IndividualEventType[[], Any]]:
"""Get the load events for a route.
Args:
@@ -612,9 +617,7 @@ class App(MiddlewareMixin, LifespanMixin, Base):
title: str = constants.Page404.TITLE,
image: str = constants.Page404.IMAGE,
description: str = constants.Page404.DESCRIPTION,
- on_load: (
- EventHandler | EventSpec | list[EventHandler | EventSpec] | None
- ) = None,
+ on_load: EventType[[], BASE_STATE] | None = None,
meta: list[dict[str, str]] = constants.DefaultPage.META_LIST,
):
"""Define a custom 404 page for any url having no match.
@@ -679,7 +682,7 @@ class App(MiddlewareMixin, LifespanMixin, Base):
for i, tags in imports.items()
if i not in constants.PackageJson.DEPENDENCIES
and i not in constants.PackageJson.DEV_DEPENDENCIES
- and not any(i.startswith(prefix) for prefix in ["/", ".", "next/"])
+ and not any(i.startswith(prefix) for prefix in ["/", "$/", ".", "next/"])
and i != ""
and any(tag.install for tag in tags)
}
@@ -718,7 +721,7 @@ class App(MiddlewareMixin, LifespanMixin, Base):
Whether the app should be compiled.
"""
# Check the environment variable.
- if should_skip_compile():
+ if environment.REFLEX_SKIP_COMPILE.get():
return False
nocompile = prerequisites.get_web_dir() / constants.NOCOMPILE_FILE
@@ -827,13 +830,32 @@ class App(MiddlewareMixin, LifespanMixin, Base):
"""
from reflex.utils.exceptions import ReflexRuntimeError
+ self.pages = {}
+
def get_compilation_time() -> str:
return str(datetime.now().time()).split(".")[0]
# Render a default 404 page if the user didn't supply one
- if constants.Page404.SLUG not in self.pages:
+ if constants.Page404.SLUG not in self.unevaluated_pages:
self.add_custom_404_page()
+ # Fix up the style.
+ self.style = evaluate_style_namespaces(self.style)
+
+ # Add the app wrappers.
+ app_wrappers: Dict[tuple[int, str], Component] = {
+ # Default app wrap component renders {children}
+ (0, "AppWrap"): AppWrap.create()
+ }
+
+ if self.theme is not None:
+ # If a theme component was provided, wrap the app with it
+ app_wrappers[(20, "Theme")] = self.theme
+
+ for route in self.unevaluated_pages:
+ console.debug(f"Evaluating page: {route}")
+ self._compile_page(route)
+
# Add the optional endpoints (_upload)
self._add_optional_endpoints()
@@ -868,28 +890,15 @@ class App(MiddlewareMixin, LifespanMixin, Base):
# Store the compile results.
compile_results = []
- # Add the app wrappers.
- app_wrappers: Dict[tuple[int, str], Component] = {
- # Default app wrap component renders {children}
- (0, "AppWrap"): AppWrap.create()
- }
- if self.theme is not None:
- # If a theme component was provided, wrap the app with it
- app_wrappers[(20, "Theme")] = self.theme
-
progress.advance(task)
- # Fix up the style.
- self.style = evaluate_style_namespaces(self.style)
-
# Track imports and custom components found.
all_imports = {}
custom_components = set()
- for _route, component in self.pages.items():
- # Merge the component style with the app style.
- component._add_style_recursive(self.style, self.theme)
-
+ # This has to happen before compiling stateful components as that
+ # prevents recursive functions from reaching all components.
+ for component in self.pages.values():
# Add component._get_all_imports() to all_imports.
all_imports.update(component._get_all_imports())
@@ -899,8 +908,6 @@ class App(MiddlewareMixin, LifespanMixin, Base):
# Add the custom components from the page to the set.
custom_components |= component._get_all_custom_components()
- progress.advance(task)
-
# Perform auto-memoization of stateful components.
(
stateful_components_path,
@@ -918,6 +925,8 @@ class App(MiddlewareMixin, LifespanMixin, Base):
)
compile_results.append((stateful_components_path, stateful_components_code))
+ progress.advance(task)
+
# Compile the root document before fork.
compile_results.append(
compiler.compile_document_root(
@@ -927,77 +936,50 @@ class App(MiddlewareMixin, LifespanMixin, Base):
)
)
- # Compile the contexts before fork.
- compile_results.append(
- compiler.compile_contexts(self.state, self.theme),
- )
- # Fix #2992 by removing the top-level appearance prop
- if self.theme is not None:
- self.theme.appearance = None
-
- app_root = self._app_root(app_wrappers=app_wrappers)
-
progress.advance(task)
- # Prepopulate the global ExecutorSafeFunctions class with input data required by the compile functions.
- # This is required for multiprocessing to work, in presence of non-picklable inputs.
- for route, component in zip(self.pages, page_components):
- ExecutorSafeFunctions.COMPILE_PAGE_ARGS_BY_ROUTE[route] = (
- route,
- component,
- self.state,
- )
-
- ExecutorSafeFunctions.COMPILE_APP_APP_ROOT = app_root
- ExecutorSafeFunctions.CUSTOM_COMPONENTS = custom_components
- ExecutorSafeFunctions.STYLE = self.style
-
# Use a forking process pool, if possible. Much faster, especially for large sites.
# Fallback to ThreadPoolExecutor as something that will always work.
executor = None
if (
platform.system() in ("Linux", "Darwin")
- and os.environ.get("REFLEX_COMPILE_PROCESSES") is not None
+ and (number_of_processes := environment.REFLEX_COMPILE_PROCESSES.get())
+ is not None
):
executor = concurrent.futures.ProcessPoolExecutor(
- max_workers=int(os.environ.get("REFLEX_COMPILE_PROCESSES", 0)) or None,
+ max_workers=number_of_processes,
mp_context=multiprocessing.get_context("fork"),
)
else:
executor = concurrent.futures.ThreadPoolExecutor(
- max_workers=int(os.environ.get("REFLEX_COMPILE_THREADS", 0)) or None,
+ max_workers=environment.REFLEX_COMPILE_THREADS.get()
)
+ for route, component in zip(self.pages, page_components):
+ ExecutorSafeFunctions.COMPONENTS[route] = component
+
+ ExecutorSafeFunctions.STATE = self.state
+
with executor:
result_futures = []
- custom_components_future = None
-
- def _mark_complete(_=None):
- progress.advance(task)
def _submit_work(fn, *args, **kwargs):
f = executor.submit(fn, *args, **kwargs)
- f.add_done_callback(_mark_complete)
+ # f = executor.apipe(fn, *args, **kwargs)
result_futures.append(f)
- # Compile all page components.
+ # Compile the pre-compiled pages.
for route in self.pages:
- _submit_work(ExecutorSafeFunctions.compile_page, route)
-
- # Compile the app wrapper.
- _submit_work(ExecutorSafeFunctions.compile_app)
-
- # Compile the custom components.
- custom_components_future = executor.submit(
- ExecutorSafeFunctions.compile_custom_components,
- )
- custom_components_future.add_done_callback(_mark_complete)
+ _submit_work(
+ ExecutorSafeFunctions.compile_page,
+ route,
+ )
# Compile the root stylesheet with base styles.
_submit_work(compiler.compile_root_stylesheet, self.stylesheets)
# Compile the theme.
- _submit_work(ExecutorSafeFunctions.compile_theme)
+ _submit_work(compile_theme, self.style)
# Compile the Tailwind config.
if config.tailwind is not None:
@@ -1011,21 +993,37 @@ class App(MiddlewareMixin, LifespanMixin, Base):
# Wait for all compilation tasks to complete.
for future in concurrent.futures.as_completed(result_futures):
compile_results.append(future.result())
+ progress.advance(task)
- # Special case for custom_components, since we need the compiled imports
- # to install proper frontend packages.
- (
- *custom_components_result,
- custom_components_imports,
- ) = custom_components_future.result()
- compile_results.append(custom_components_result)
- all_imports.update(custom_components_imports)
+ app_root = self._app_root(app_wrappers=app_wrappers)
# Get imports from AppWrap components.
all_imports.update(app_root._get_all_imports())
progress.advance(task)
+ # Compile the contexts.
+ compile_results.append(
+ compiler.compile_contexts(self.state, self.theme),
+ )
+ if self.theme is not None:
+ # Fix #2992 by removing the top-level appearance prop
+ self.theme.appearance = None
+ progress.advance(task)
+
+ # Compile the app root.
+ compile_results.append(
+ compiler.compile_app(app_root),
+ )
+ progress.advance(task)
+
+ # Compile custom components.
+ *custom_components_result, custom_components_imports = (
+ compiler.compile_components(custom_components)
+ )
+ compile_results.append(custom_components_result)
+ all_imports.update(custom_components_imports)
+
progress.advance(task)
progress.stop()
@@ -1262,6 +1260,21 @@ async def process(
)
# Get the state for the session exclusively.
async with app.state_manager.modify_state(event.substate_token) as state:
+ # When this is a brand new instance of the state, signal the
+ # frontend to reload before processing it.
+ if (
+ not state.router_data
+ and event.name != get_hydrate_event(state)
+ and app.event_namespace is not None
+ ):
+ await asyncio.create_task(
+ app.event_namespace.emit(
+ "reload",
+ data=format.json_dumps(event),
+ to=sid,
+ )
+ )
+ return
# re-assign only when the value is different
if state.router_data != router_data:
# assignment will recurse into substates and force recalculation of
@@ -1392,7 +1405,7 @@ def upload(app: App):
if isinstance(func, EventHandler):
if func.is_background:
raise UploadTypeError(
- f"@rx.background is not supported for upload handler `{handler}`.",
+ f"@rx.event(background=True) is not supported for upload handler `{handler}`.",
)
func = func.fn
if isinstance(func, functools.partial):
@@ -1465,10 +1478,10 @@ class EventNamespace(AsyncNamespace):
app: App
# Keep a mapping between socket ID and client token.
- token_to_sid: dict[str, str] = {}
+ token_to_sid: dict[str, str]
# Keep a mapping between client token and socket ID.
- sid_to_token: dict[str, str] = {}
+ sid_to_token: dict[str, str]
def __init__(self, namespace: str, app: App):
"""Initialize the event namespace.
@@ -1478,6 +1491,8 @@ class EventNamespace(AsyncNamespace):
app: The application object.
"""
super().__init__(namespace)
+ self.token_to_sid = {}
+ self.sid_to_token = {}
self.app = app
def on_connect(self, sid, environ):
diff --git a/reflex/app_mixins/lifespan.py b/reflex/app_mixins/lifespan.py
index ef882a2ea..52bf0be1d 100644
--- a/reflex/app_mixins/lifespan.py
+++ b/reflex/app_mixins/lifespan.py
@@ -4,6 +4,7 @@ from __future__ import annotations
import asyncio
import contextlib
+import dataclasses
import functools
import inspect
from typing import Callable, Coroutine, Set, Union
@@ -16,11 +17,14 @@ from reflex.utils.exceptions import InvalidLifespanTaskType
from .mixin import AppMixin
+@dataclasses.dataclass
class LifespanMixin(AppMixin):
"""A Mixin that allow tasks to run during the whole app lifespan."""
# Lifespan tasks that are planned to run.
- lifespan_tasks: Set[Union[asyncio.Task, Callable]] = set()
+ lifespan_tasks: Set[Union[asyncio.Task, Callable]] = dataclasses.field(
+ default_factory=set
+ )
@contextlib.asynccontextmanager
async def _run_lifespan_tasks(self, app: FastAPI):
diff --git a/reflex/app_mixins/middleware.py b/reflex/app_mixins/middleware.py
index 1e42faf18..30593d9ae 100644
--- a/reflex/app_mixins/middleware.py
+++ b/reflex/app_mixins/middleware.py
@@ -3,6 +3,7 @@
from __future__ import annotations
import asyncio
+import dataclasses
from typing import List
from reflex.event import Event
@@ -12,11 +13,12 @@ from reflex.state import BaseState, StateUpdate
from .mixin import AppMixin
+@dataclasses.dataclass
class MiddlewareMixin(AppMixin):
"""Middleware Mixin that allow to add middleware to the app."""
# Middleware to add to the app. Users should use `add_middleware`. PRIVATE.
- middleware: List[Middleware] = []
+ middleware: List[Middleware] = dataclasses.field(default_factory=list)
def _init_mixin(self):
self.middleware.append(HydrateMiddleware())
diff --git a/reflex/app_mixins/mixin.py b/reflex/app_mixins/mixin.py
index ed301c495..23207a462 100644
--- a/reflex/app_mixins/mixin.py
+++ b/reflex/app_mixins/mixin.py
@@ -1,9 +1,10 @@
"""Default mixin for all app mixins."""
-from reflex.base import Base
+import dataclasses
-class AppMixin(Base):
+@dataclasses.dataclass
+class AppMixin:
"""Define the base class for all app mixins."""
def _init_mixin(self):
diff --git a/reflex/assets.py b/reflex/assets.py
new file mode 100644
index 000000000..8a50664b6
--- /dev/null
+++ b/reflex/assets.py
@@ -0,0 +1,95 @@
+"""Helper functions for adding assets to the app."""
+
+import inspect
+from pathlib import Path
+from typing import Optional
+
+from reflex import constants
+from reflex.utils.exec import is_backend_only
+
+
+def asset(
+ path: str,
+ shared: bool = False,
+ subfolder: Optional[str] = None,
+ _stack_level: int = 1,
+) -> str:
+ """Add an asset to the app, either shared as a symlink or local.
+
+ Shared/External/Library assets:
+ Place the file next to your including python file.
+ Links the file to the app's external assets directory.
+
+ Example:
+ ```python
+ # my_custom_javascript.js is a shared asset located next to the including python file.
+ rx.script(src=rx.asset(path="my_custom_javascript.js", shared=True))
+ rx.image(src=rx.asset(path="test_image.png", shared=True, subfolder="subfolder"))
+ ```
+
+ Local/Internal assets:
+ Place the file in the app's assets/ directory.
+
+ Example:
+ ```python
+ # local_image.png is an asset located in the app's assets/ directory. It cannot be shared when developing a library.
+ rx.image(src=rx.asset(path="local_image.png"))
+ ```
+
+ Args:
+ path: The relative path of the asset.
+ subfolder: The directory to place the shared asset in.
+ shared: Whether to expose the asset to other apps.
+ _stack_level: The stack level to determine the calling file, defaults to
+ the immediate caller 1. When using rx.asset via a helper function,
+ increase this number for each helper function in the stack.
+
+ Raises:
+ FileNotFoundError: If the file does not exist.
+ ValueError: If subfolder is provided for local assets.
+
+ Returns:
+ The relative URL to the asset.
+ """
+ assets = constants.Dirs.APP_ASSETS
+ backend_only = is_backend_only()
+
+ # Local asset handling
+ if not shared:
+ cwd = Path.cwd()
+ src_file_local = cwd / assets / path
+ if subfolder is not None:
+ raise ValueError("Subfolder is not supported for local assets.")
+ if not backend_only and not src_file_local.exists():
+ raise FileNotFoundError(f"File not found: {src_file_local}")
+ return f"/{path}"
+
+ # Shared asset handling
+ # Determine the file by which the asset is exposed.
+ frame = inspect.stack()[_stack_level]
+ calling_file = frame.filename
+ module = inspect.getmodule(frame[0])
+ assert module is not None
+
+ external = constants.Dirs.EXTERNAL_APP_ASSETS
+ src_file_shared = Path(calling_file).parent / path
+ if not src_file_shared.exists():
+ raise FileNotFoundError(f"File not found: {src_file_shared}")
+
+ caller_module_path = module.__name__.replace(".", "/")
+ subfolder = f"{caller_module_path}/{subfolder}" if subfolder else caller_module_path
+
+ # Symlink the asset to the app's external assets directory if running frontend.
+ if not backend_only:
+ # Create the asset folder in the currently compiling app.
+ asset_folder = Path.cwd() / assets / external / subfolder
+ asset_folder.mkdir(parents=True, exist_ok=True)
+
+ dst_file = asset_folder / path
+
+ if not dst_file.exists() and (
+ not dst_file.is_symlink() or dst_file.resolve() != src_file_shared.resolve()
+ ):
+ dst_file.symlink_to(src_file_shared)
+
+ return f"/{external}/{subfolder}/{path}"
diff --git a/reflex/base.py b/reflex/base.py
index c334ddf56..692f123a8 100644
--- a/reflex/base.py
+++ b/reflex/base.py
@@ -16,9 +16,6 @@ except ModuleNotFoundError:
from pydantic.fields import ModelField # type: ignore
-from reflex import constants
-
-
def validate_field_name(bases: List[Type["BaseModel"]], field_name: str) -> None:
"""Ensure that the field's name does not shadow an existing attribute of the model.
@@ -31,7 +28,8 @@ def validate_field_name(bases: List[Type["BaseModel"]], field_name: str) -> None
"""
from reflex.utils.exceptions import VarNameError
- reload = os.getenv(constants.RELOAD_CONFIG) == "True"
+ # can't use reflex.config.environment here cause of circular import
+ reload = os.getenv("__RELOAD_CONFIG", "").lower() == "true"
for base in bases:
try:
if not reload and getattr(base, field_name, None):
@@ -132,8 +130,8 @@ class Base(BaseModel): # pyright: ignore [reportUnboundVariable]
Returns:
The value of the field.
"""
- if isinstance(key, str) and key in self.__fields__:
+ if isinstance(key, str):
# Seems like this function signature was wrong all along?
# If the user wants a field that we know of, get it and pass it off to _get_value
- key = getattr(self, key)
+ return getattr(self, key, key)
return key
diff --git a/reflex/compiler/compiler.py b/reflex/compiler/compiler.py
index 0c29f941d..9f81f319d 100644
--- a/reflex/compiler/compiler.py
+++ b/reflex/compiler/compiler.py
@@ -2,13 +2,13 @@
from __future__ import annotations
-import os
from datetime import datetime
from pathlib import Path
-from typing import Dict, Iterable, Optional, Type, Union
+from typing import TYPE_CHECKING, Dict, Iterable, Optional, Tuple, Type, Union
from reflex import constants
from reflex.compiler import templates, utils
+from reflex.components.base.fragment import Fragment
from reflex.components.component import (
BaseComponent,
Component,
@@ -16,7 +16,7 @@ from reflex.components.component import (
CustomComponent,
StatefulComponent,
)
-from reflex.config import get_config
+from reflex.config import environment, get_config
from reflex.state import BaseState
from reflex.style import SYSTEM_COLOR_MODE
from reflex.utils.exec import is_prod_mode
@@ -68,8 +68,8 @@ def _compile_app(app_root: Component) -> str:
window_libraries = [
(_normalize_library_name(name), name) for name in bundled_libraries
] + [
- ("utils_context", f"/{constants.Dirs.UTILS}/context"),
- ("utils_state", f"/{constants.Dirs.UTILS}/state"),
+ ("utils_context", f"$/{constants.Dirs.UTILS}/context"),
+ ("utils_state", f"$/{constants.Dirs.UTILS}/state"),
]
return templates.APP_ROOT.render(
@@ -127,8 +127,8 @@ def _compile_contexts(state: Optional[Type[BaseState]], theme: Component | None)
def _compile_page(
- component: Component,
- state: Type[BaseState],
+ component: BaseComponent,
+ state: Type[BaseState] | None,
) -> str:
"""Compile the component given the app state.
@@ -143,7 +143,7 @@ def _compile_page(
imports = utils.compile_imports(imports)
# Compile the code to render the component.
- kwargs = {"state_name": state.get_name()} if state else {}
+ kwargs = {"state_name": state.get_name()} if state is not None else {}
return templates.PAGE.render(
imports=imports,
@@ -229,7 +229,7 @@ def _compile_components(
"""
imports = {
"react": [ImportVar(tag="memo")],
- f"/{constants.Dirs.STATE_PATH}": [ImportVar(tag="E"), ImportVar(tag="isTrue")],
+ f"$/{constants.Dirs.STATE_PATH}": [ImportVar(tag="E"), ImportVar(tag="isTrue")],
}
component_renders = []
@@ -316,7 +316,7 @@ def _compile_stateful_components(
# Don't import from the file that we're about to create.
all_imports = utils.merge_imports(*all_import_dicts)
all_imports.pop(
- f"/{constants.Dirs.UTILS}/{constants.PageNames.STATEFUL_COMPONENTS}", None
+ f"$/{constants.Dirs.UTILS}/{constants.PageNames.STATEFUL_COMPONENTS}", None
)
return templates.STATEFUL_COMPONENTS.render(
@@ -425,7 +425,7 @@ def compile_contexts(
def compile_page(
- path: str, component: Component, state: Type[BaseState]
+ path: str, component: BaseComponent, state: Type[BaseState] | None
) -> tuple[str, str]:
"""Compile a single page.
@@ -527,7 +527,7 @@ def remove_tailwind_from_postcss() -> tuple[str, str]:
def purge_web_pages_dir():
"""Empty out .web/pages directory."""
- if not is_prod_mode() and os.environ.get("REFLEX_PERSIST_WEB_DIR"):
+ if not is_prod_mode() and environment.REFLEX_PERSIST_WEB_DIR.get():
# Skip purging the web directory in dev mode if REFLEX_PERSIST_WEB_DIR is set.
return
@@ -535,6 +535,81 @@ def purge_web_pages_dir():
utils.empty_dir(get_web_dir() / constants.Dirs.PAGES, keep_files=["_app.js"])
+if TYPE_CHECKING:
+ from reflex.app import UnevaluatedPage
+
+
+def compile_unevaluated_page(
+ route: str,
+ page: UnevaluatedPage,
+ state: Type[BaseState] | None = None,
+ style: ComponentStyle | None = None,
+ theme: Component | None = None,
+) -> Tuple[Component, bool]:
+ """Compiles an uncompiled page into a component and adds meta information.
+
+ Args:
+ route: The route of the page.
+ page: The uncompiled page object.
+ state: The state of the app.
+ style: The style of the page.
+ theme: The theme of the page.
+
+ Returns:
+ The compiled component and whether state should be enabled.
+ """
+ # Generate the component if it is a callable.
+ component = page.component
+ component = component if isinstance(component, Component) else component()
+
+ # unpack components that return tuples in an rx.fragment.
+ if isinstance(component, tuple):
+ component = Fragment.create(*component)
+
+ component._add_style_recursive(style or {}, theme)
+
+ enable_state = False
+ # Ensure state is enabled if this page uses state.
+ if state is None:
+ if page.on_load or component._has_stateful_event_triggers():
+ enable_state = True
+ else:
+ for var in component._get_vars(include_children=True):
+ var_data = var._get_all_var_data()
+ if not var_data:
+ continue
+ if not var_data.state:
+ continue
+ enable_state = True
+ break
+
+ from reflex.app import OverlayFragment
+ from reflex.utils.format import make_default_page_title
+
+ component = OverlayFragment.create(component)
+
+ meta_args = {
+ "title": (
+ page.title
+ if page.title is not None
+ else make_default_page_title(get_config().app_name, route)
+ ),
+ "image": page.image,
+ "meta": page.meta,
+ }
+
+ if page.description is not None:
+ meta_args["description"] = page.description
+
+ # Add meta information to the component.
+ utils.add_meta(
+ component,
+ **meta_args,
+ )
+
+ return component, enable_state
+
+
class ExecutorSafeFunctions:
"""Helper class to allow parallelisation of parts of the compilation process.
@@ -560,13 +635,12 @@ class ExecutorSafeFunctions:
"""
- COMPILE_PAGE_ARGS_BY_ROUTE = {}
- COMPILE_APP_APP_ROOT: Component | None = None
- CUSTOM_COMPONENTS: set[CustomComponent] | None = None
- STYLE: ComponentStyle | None = None
+ COMPONENTS: Dict[str, BaseComponent] = {}
+ UNCOMPILED_PAGES: Dict[str, UnevaluatedPage] = {}
+ STATE: Optional[Type[BaseState]] = None
@classmethod
- def compile_page(cls, route: str):
+ def compile_page(cls, route: str) -> tuple[str, str]:
"""Compile a page.
Args:
@@ -575,46 +649,45 @@ class ExecutorSafeFunctions:
Returns:
The path and code of the compiled page.
"""
- return compile_page(*cls.COMPILE_PAGE_ARGS_BY_ROUTE[route])
+ return compile_page(route, cls.COMPONENTS[route], cls.STATE)
@classmethod
- def compile_app(cls):
- """Compile the app.
+ def compile_unevaluated_page(
+ cls,
+ route: str,
+ style: ComponentStyle,
+ theme: Component | None,
+ ) -> tuple[str, Component, tuple[str, str]]:
+ """Compile an unevaluated page.
+
+ Args:
+ route: The route of the page to compile.
+ style: The style of the page.
+ theme: The theme of the page.
Returns:
- The path and code of the compiled app.
-
- Raises:
- ValueError: If the app root is not set.
+ The route, compiled component, and compiled page.
"""
- if cls.COMPILE_APP_APP_ROOT is None:
- raise ValueError("COMPILE_APP_APP_ROOT should be set")
- return compile_app(cls.COMPILE_APP_APP_ROOT)
+ component, enable_state = compile_unevaluated_page(
+ route, cls.UNCOMPILED_PAGES[route]
+ )
+ component = component if isinstance(component, Component) else component()
+ component._add_style_recursive(style, theme)
+ return route, component, compile_page(route, component, cls.STATE)
@classmethod
- def compile_custom_components(cls):
- """Compile the custom components.
-
- Returns:
- The path and code of the compiled custom components.
-
- Raises:
- ValueError: If the custom components are not set.
- """
- if cls.CUSTOM_COMPONENTS is None:
- raise ValueError("CUSTOM_COMPONENTS should be set")
- return compile_components(cls.CUSTOM_COMPONENTS)
-
- @classmethod
- def compile_theme(cls):
+ def compile_theme(cls, style: ComponentStyle | None) -> tuple[str, str]:
"""Compile the theme.
+ Args:
+ style: The style to compile.
+
Returns:
The path and code of the compiled theme.
Raises:
ValueError: If the style is not set.
"""
- if cls.STYLE is None:
+ if style is None:
raise ValueError("STYLE should be set")
- return compile_theme(cls.STYLE)
+ return compile_theme(style)
diff --git a/reflex/compiler/utils.py b/reflex/compiler/utils.py
index 6f4fa2d1b..29398da87 100644
--- a/reflex/compiler/utils.py
+++ b/reflex/compiler/utils.py
@@ -28,7 +28,8 @@ from reflex.components.base import (
Title,
)
from reflex.components.component import Component, ComponentStyle, CustomComponent
-from reflex.state import BaseState, Cookie, LocalStorage, SessionStorage
+from reflex.istate.storage import Cookie, LocalStorage, SessionStorage
+from reflex.state import BaseState
from reflex.style import Style
from reflex.utils import console, format, imports, path_ops
from reflex.utils.imports import ImportVar, ParsedImportDict
@@ -82,6 +83,12 @@ def validate_imports(import_dict: ParsedImportDict):
f"{_import.tag}/{_import.alias}" if _import.alias else _import.tag
)
if import_name in used_tags:
+ already_imported = used_tags[import_name]
+ if (already_imported[0] == "$" and already_imported[1:] == lib) or (
+ lib[0] == "$" and lib[1:] == already_imported
+ ):
+ used_tags[import_name] = lib if lib[0] == "$" else already_imported
+ continue
raise ValueError(
f"Can not compile, the tag {import_name} is used multiple time from {lib} and {used_tags[import_name]}"
)
diff --git a/reflex/components/base/app_wrap.pyi b/reflex/components/base/app_wrap.pyi
index c4cb45469..962e70c76 100644
--- a/reflex/components/base/app_wrap.pyi
+++ b/reflex/components/base/app_wrap.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.base.fragment import Fragment
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,22 +21,22 @@ class AppWrap(Fragment):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AppWrap":
"""Create a new AppWrap component.
diff --git a/reflex/components/base/bare.py b/reflex/components/base/bare.py
index ada511ef2..c70b4c844 100644
--- a/reflex/components/base/bare.py
+++ b/reflex/components/base/bare.py
@@ -4,10 +4,11 @@ from __future__ import annotations
from typing import Any, Iterator
-from reflex.components.component import Component
+from reflex.components.component import Component, LiteralComponentVar
from reflex.components.tags import Tag
from reflex.components.tags.tagless import Tagless
-from reflex.vars import ArrayVar, BooleanVar, ObjectVar, Var
+from reflex.utils.imports import ParsedImportDict
+from reflex.vars import BooleanVar, ObjectVar, Var
class Bare(Component):
@@ -31,9 +32,77 @@ class Bare(Component):
contents = str(contents) if contents is not None else ""
return cls(contents=contents) # type: ignore
+ def _get_all_hooks_internal(self) -> dict[str, None]:
+ """Include the hooks for the component.
+
+ Returns:
+ The hooks for the component.
+ """
+ hooks = super()._get_all_hooks_internal()
+ if isinstance(self.contents, LiteralComponentVar):
+ hooks |= self.contents._var_value._get_all_hooks_internal()
+ return hooks
+
+ def _get_all_hooks(self) -> dict[str, None]:
+ """Include the hooks for the component.
+
+ Returns:
+ The hooks for the component.
+ """
+ hooks = super()._get_all_hooks()
+ if isinstance(self.contents, LiteralComponentVar):
+ hooks |= self.contents._var_value._get_all_hooks()
+ return hooks
+
+ def _get_all_imports(self) -> ParsedImportDict:
+ """Include the imports for the component.
+
+ Returns:
+ The imports for the component.
+ """
+ imports = super()._get_all_imports()
+ if isinstance(self.contents, LiteralComponentVar):
+ var_data = self.contents._get_all_var_data()
+ if var_data:
+ imports |= {k: list(v) for k, v in var_data.imports}
+ return imports
+
+ def _get_all_dynamic_imports(self) -> set[str]:
+ """Get dynamic imports for the component.
+
+ Returns:
+ The dynamic imports.
+ """
+ dynamic_imports = super()._get_all_dynamic_imports()
+ if isinstance(self.contents, LiteralComponentVar):
+ dynamic_imports |= self.contents._var_value._get_all_dynamic_imports()
+ return dynamic_imports
+
+ def _get_all_custom_code(self) -> set[str]:
+ """Get custom code for the component.
+
+ Returns:
+ The custom code.
+ """
+ custom_code = super()._get_all_custom_code()
+ if isinstance(self.contents, LiteralComponentVar):
+ custom_code |= self.contents._var_value._get_all_custom_code()
+ return custom_code
+
+ def _get_all_refs(self) -> set[str]:
+ """Get the refs for the children of the component.
+
+ Returns:
+ The refs for the children.
+ """
+ refs = super()._get_all_refs()
+ if isinstance(self.contents, LiteralComponentVar):
+ refs |= self.contents._var_value._get_all_refs()
+ return refs
+
def _render(self) -> Tag:
if isinstance(self.contents, Var):
- if isinstance(self.contents, (BooleanVar, ObjectVar, ArrayVar)):
+ if isinstance(self.contents, (BooleanVar, ObjectVar)):
return Tagless(contents=f"{{{str(self.contents.to_string())}}}")
return Tagless(contents=f"{{{str(self.contents)}}}")
return Tagless(contents=str(self.contents))
diff --git a/reflex/components/base/body.pyi b/reflex/components/base/body.pyi
index 74f3333e5..8a20a6c06 100644
--- a/reflex/components/base/body.pyi
+++ b/reflex/components/base/body.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,22 +21,22 @@ class Body(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Body":
"""Create the component.
diff --git a/reflex/components/base/document.pyi b/reflex/components/base/document.pyi
index a4a956369..5b5e1a7f4 100644
--- a/reflex/components/base/document.pyi
+++ b/reflex/components/base/document.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,22 +21,22 @@ class NextDocumentLib(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "NextDocumentLib":
"""Create the component.
@@ -68,22 +68,22 @@ class Html(NextDocumentLib):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Html":
"""Create the component.
@@ -114,22 +114,22 @@ class DocumentHead(NextDocumentLib):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DocumentHead":
"""Create the component.
@@ -160,22 +160,22 @@ class Main(NextDocumentLib):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Main":
"""Create the component.
@@ -206,22 +206,22 @@ class NextScript(NextDocumentLib):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "NextScript":
"""Create the component.
diff --git a/reflex/components/base/error_boundary.py b/reflex/components/base/error_boundary.py
index 66a9c43c8..f328773c2 100644
--- a/reflex/components/base/error_boundary.py
+++ b/reflex/components/base/error_boundary.py
@@ -2,16 +2,33 @@
from __future__ import annotations
-from typing import List
+from typing import Dict, Tuple
-from reflex.compiler.compiler import _compile_component
from reflex.components.component import Component
-from reflex.components.el import div, p
-from reflex.constants import Hooks, Imports
-from reflex.event import EventChain, EventHandler
-from reflex.utils.imports import ImportVar
+from reflex.components.datadisplay.logo import svg_logo
+from reflex.components.el import a, button, details, div, h2, hr, p, pre, summary
+from reflex.event import EventHandler, set_clipboard
+from reflex.state import FrontendEventExceptionState
from reflex.vars.base import Var
-from reflex.vars.function import FunctionVar
+from reflex.vars.function import ArgsFunctionOperation
+
+
+def on_error_spec(
+ error: Var[Dict[str, str]], info: Var[Dict[str, str]]
+) -> Tuple[Var[str], Var[str]]:
+ """The spec for the on_error event handler.
+
+ Args:
+ error: The error message.
+ info: Additional information about the error.
+
+ Returns:
+ The arguments for the event handler.
+ """
+ return (
+ error.stack,
+ info.componentStack,
+ )
class ErrorBoundary(Component):
@@ -21,59 +38,118 @@ class ErrorBoundary(Component):
tag = "ErrorBoundary"
# Fired when the boundary catches an error.
- on_error: EventHandler[lambda error, info: [error, info]] = Var( # type: ignore
- "logFrontendError"
- ).to(FunctionVar, EventChain)
+ on_error: EventHandler[on_error_spec]
# Rendered instead of the children when an error is caught.
- Fallback_component: Var[Component] = Var(_js_expr="Fallback")._replace(
- _var_type=Component
- )
+ fallback_render: Var[Component]
- def add_imports(self) -> dict[str, list[ImportVar]]:
- """Add imports for the component.
+ @classmethod
+ def create(cls, *children, **props):
+ """Create an ErrorBoundary component.
+
+ Args:
+ *children: The children of the component.
+ **props: The props of the component.
Returns:
- The imports to add.
+ The ErrorBoundary component.
"""
- return Imports.EVENTS
-
- def add_hooks(self) -> List[str | Var]:
- """Add hooks for the component.
-
- Returns:
- The hooks to add.
- """
- return [Hooks.EVENTS, Hooks.FRONTEND_ERRORS]
-
- def add_custom_code(self) -> List[str]:
- """Add custom Javascript code into the page that contains this component.
-
- Custom code is inserted at module level, after any imports.
-
- Returns:
- The custom code to add.
- """
- fallback_container = div(
- p("Ooops...Unknown Reflex error has occured:"),
- p(
- Var(_js_expr="error.message"),
- color="red",
- ),
- p("Please contact the support."),
- )
-
- compiled_fallback = _compile_component(fallback_container)
-
- return [
- f"""
- function Fallback({{ error, resetErrorBoundary }}) {{
- return (
- {compiled_fallback}
- );
- }}
- """
- ]
+ if "on_error" not in props:
+ props["on_error"] = FrontendEventExceptionState.handle_frontend_exception
+ if "fallback_render" not in props:
+ props["fallback_render"] = ArgsFunctionOperation.create(
+ ("event_args",),
+ Var.create(
+ div(
+ div(
+ div(
+ h2(
+ "An error occurred while rendering this page.",
+ font_size="1.25rem",
+ font_weight="bold",
+ ),
+ p(
+ "This is an error with the application itself.",
+ opacity="0.75",
+ ),
+ details(
+ summary("Error message", padding="0.5rem"),
+ div(
+ div(
+ pre(
+ Var(
+ _js_expr="event_args.error.stack",
+ ),
+ ),
+ padding="0.5rem",
+ width="fit-content",
+ ),
+ width="100%",
+ max_height="50vh",
+ overflow="auto",
+ background="#000",
+ color="#fff",
+ border_radius="0.25rem",
+ ),
+ button(
+ "Copy",
+ on_click=set_clipboard(
+ Var(_js_expr="event_args.error.stack"),
+ ),
+ padding="0.35rem 0.75rem",
+ margin="0.5rem",
+ background="#fff",
+ color="#000",
+ border="1px solid #000",
+ border_radius="0.25rem",
+ font_weight="bold",
+ ),
+ ),
+ display="flex",
+ flex_direction="column",
+ gap="1rem",
+ max_width="50ch",
+ border="1px solid #888888",
+ border_radius="0.25rem",
+ padding="1rem",
+ ),
+ hr(
+ border_color="currentColor",
+ opacity="0.25",
+ ),
+ a(
+ div(
+ "Built with ",
+ svg_logo("currentColor"),
+ display="flex",
+ align_items="baseline",
+ justify_content="center",
+ font_family="monospace",
+ gap="0.5rem",
+ ),
+ href="https://reflex.dev",
+ ),
+ display="flex",
+ flex_direction="column",
+ gap="1rem",
+ ),
+ height="100%",
+ width="100%",
+ position="absolute",
+ display="flex",
+ align_items="center",
+ justify_content="center",
+ )
+ ),
+ _var_type=Component,
+ )
+ else:
+ props["fallback_render"] = ArgsFunctionOperation.create(
+ ("event_args",),
+ props["fallback_render"],
+ _var_type=Component,
+ )
+ return super().create(*children, **props)
error_boundary = ErrorBoundary.create
diff --git a/reflex/components/base/error_boundary.pyi b/reflex/components/base/error_boundary.pyi
index aaf5584e4..2e01c7da0 100644
--- a/reflex/components/base/error_boundary.pyi
+++ b/reflex/components/base/error_boundary.pyi
@@ -3,53 +3,60 @@
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
-from typing import Any, Dict, List, Optional, Union, overload
+from typing import Any, Dict, Optional, Tuple, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
-from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
+def on_error_spec(
+ error: Var[Dict[str, str]], info: Var[Dict[str, str]]
+) -> Tuple[Var[str], Var[str]]: ...
+
class ErrorBoundary(Component):
- def add_imports(self) -> dict[str, list[ImportVar]]: ...
- def add_hooks(self) -> List[str | Var]: ...
- def add_custom_code(self) -> List[str]: ...
@overload
@classmethod
def create( # type: ignore
cls,
*children,
- Fallback_component: Optional[Union[Component, Var[Component]]] = None,
+ fallback_render: Optional[Union[Component, Var[Component]]] = 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_error: Optional[EventType] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_error: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, str], BASE_STATE],
+ ]
+ ] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ErrorBoundary":
- """Create the component.
+ """Create an ErrorBoundary component.
Args:
*children: The children of the component.
- Fallback_component: Rendered instead of the children when an error is caught.
+ on_error: Fired when the boundary catches an error.
+ fallback_render: Rendered instead of the children when an error is caught.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -59,7 +66,7 @@ class ErrorBoundary(Component):
**props: The props of the component.
Returns:
- The component.
+ The ErrorBoundary component.
"""
...
diff --git a/reflex/components/base/fragment.pyi b/reflex/components/base/fragment.pyi
index b49bf4cad..33030bc01 100644
--- a/reflex/components/base/fragment.pyi
+++ b/reflex/components/base/fragment.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,22 +21,22 @@ class Fragment(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Fragment":
"""Create the component.
diff --git a/reflex/components/base/head.pyi b/reflex/components/base/head.pyi
index 148dbe486..b01778094 100644
--- a/reflex/components/base/head.pyi
+++ b/reflex/components/base/head.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component, MemoizationLeaf
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,22 +21,22 @@ class NextHeadLib(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "NextHeadLib":
"""Create the component.
@@ -67,22 +67,22 @@ class Head(NextHeadLib, MemoizationLeaf):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Head":
"""Create a new memoization leaf component.
diff --git a/reflex/components/base/link.pyi b/reflex/components/base/link.pyi
index 61ff66029..b48fae3a5 100644
--- a/reflex/components/base/link.pyi
+++ b/reflex/components/base/link.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -23,22 +23,22 @@ class RawLink(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RawLink":
"""Create the component.
@@ -78,22 +78,22 @@ class ScriptTag(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ScriptTag":
"""Create the component.
diff --git a/reflex/components/base/meta.pyi b/reflex/components/base/meta.pyi
index e91626cde..b388b4794 100644
--- a/reflex/components/base/meta.pyi
+++ b/reflex/components/base/meta.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -22,22 +22,22 @@ class Title(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Title":
"""Create the component.
@@ -73,22 +73,22 @@ class Meta(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Meta":
"""Create the component.
@@ -129,22 +129,22 @@ class Description(Meta):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Description":
"""Create the component.
@@ -185,22 +185,22 @@ class Image(Meta):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Image":
"""Create the component.
diff --git a/reflex/components/base/script.py b/reflex/components/base/script.py
index eb37d53e7..15145ecbf 100644
--- a/reflex/components/base/script.py
+++ b/reflex/components/base/script.py
@@ -8,7 +8,7 @@ from __future__ import annotations
from typing import Literal
from reflex.components.component import Component
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.vars.base import LiteralVar, Var
@@ -35,13 +35,13 @@ class Script(Component):
)
# Triggered when the script is loading
- on_load: EventHandler[empty_event]
+ on_load: EventHandler[no_args_event_spec]
# Triggered when the script has loaded
- on_ready: EventHandler[empty_event]
+ on_ready: EventHandler[no_args_event_spec]
# Triggered when the script has errored
- on_error: EventHandler[empty_event]
+ on_error: EventHandler[no_args_event_spec]
@classmethod
def create(cls, *children, **props) -> Component:
diff --git a/reflex/components/base/script.pyi b/reflex/components/base/script.pyi
index 2d13180bc..1633fdb70 100644
--- a/reflex/components/base/script.pyi
+++ b/reflex/components/base/script.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -28,25 +28,25 @@ class Script(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_error: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_load: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_ready: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_error: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_load: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_ready: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Script":
"""Create an inline or user-defined script.
@@ -65,6 +65,9 @@ class Script(Component):
*children: The children of the component.
src: Required unless inline script is used
strategy: When the script will execute: afterInteractive (defer-like behavior) | beforeInteractive | lazyOnload (async-like behavior)
+ on_load: Triggered when the script is loading
+ on_ready: Triggered when the script has loaded
+ on_error: Triggered when the script has errored
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/component.py b/reflex/components/component.py
index a0d9c93b0..18dedbf0e 100644
--- a/reflex/components/component.py
+++ b/reflex/components/component.py
@@ -3,6 +3,7 @@
from __future__ import annotations
import copy
+import dataclasses
import typing
from abc import ABC, abstractmethod
from functools import lru_cache, wraps
@@ -16,6 +17,7 @@ from typing import (
Iterator,
List,
Optional,
+ Sequence,
Set,
Type,
Union,
@@ -37,7 +39,9 @@ from reflex.constants import (
PageNames,
)
from reflex.constants.compiler import SpecialAttributes
+from reflex.constants.state import FRONTEND_EVENT_STATE
from reflex.event import (
+ EventCallback,
EventChain,
EventChainVar,
EventHandler,
@@ -45,8 +49,8 @@ from reflex.event import (
EventVar,
call_event_fn,
call_event_handler,
- empty_event,
get_handler_args,
+ no_args_event_spec,
)
from reflex.style import Style, format_as_emotion
from reflex.utils import format, imports, types
@@ -58,7 +62,15 @@ from reflex.utils.imports import (
parse_imports,
)
from reflex.vars import VarData
-from reflex.vars.base import LiteralVar, Var
+from reflex.vars.base import (
+ CachedVarOperation,
+ LiteralVar,
+ Var,
+ cached_property_no_lock,
+)
+from reflex.vars.function import ArgsFunctionOperation, FunctionStringVar
+from reflex.vars.number import ternary_operation
+from reflex.vars.object import ObjectVar
from reflex.vars.sequence import LiteralArrayVar
@@ -146,7 +158,6 @@ class ComponentNamespace(SimpleNamespace):
def __hash__(self) -> int:
"""Get the hash of the namespace.
-
Returns:
The hash of the namespace.
"""
@@ -175,6 +186,23 @@ ComponentStyle = Dict[
ComponentChild = Union[types.PrimitiveType, Var, BaseComponent]
+def satisfies_type_hint(obj: Any, type_hint: Any) -> bool:
+ """Check if an object satisfies a type hint.
+
+ Args:
+ obj: The object to check.
+ type_hint: The type hint to check against.
+
+ Returns:
+ Whether the object satisfies the type hint.
+ """
+ if isinstance(obj, LiteralVar):
+ return types._isinstance(obj._var_value, type_hint)
+ if isinstance(obj, Var):
+ return types._issubclass(obj._var_type, type_hint)
+ return types._isinstance(obj, type_hint)
+
+
class Component(BaseComponent, ABC):
"""A component with style, event trigger and other props."""
@@ -218,7 +246,7 @@ class Component(BaseComponent, ABC):
_rename_props: Dict[str, str] = {}
# custom attribute
- custom_attrs: Dict[str, Union[Var, str]] = {}
+ custom_attrs: Dict[str, Union[Var, Any]] = {}
# When to memoize this component and its children.
_memoization_mode: MemoizationMode = MemoizationMode()
@@ -449,8 +477,7 @@ class Component(BaseComponent, ABC):
)
) or (
# Else just check if the passed var type is valid.
- not passed_types
- and not types._issubclass(passed_type, expected_type, value)
+ not passed_types and not satisfies_type_hint(value, expected_type)
):
value_name = value._js_expr if isinstance(value, Var) else value
@@ -470,6 +497,7 @@ class Component(BaseComponent, ABC):
kwargs["event_triggers"][key] = self._create_event_chain(
value=value, # type: ignore
args_spec=component_specific_triggers[key],
+ key=key,
)
# Remove any keys that were added as events.
@@ -522,7 +550,7 @@ class Component(BaseComponent, ABC):
def _create_event_chain(
self,
- args_spec: Any,
+ args_spec: types.ArgsSpec | Sequence[types.ArgsSpec],
value: Union[
Var,
EventHandler,
@@ -530,12 +558,14 @@ class Component(BaseComponent, ABC):
List[Union[EventHandler, EventSpec, EventVar]],
Callable,
],
+ key: Optional[str] = None,
) -> Union[EventChain, Var]:
"""Create an event chain from a variety of input types.
Args:
args_spec: The args_spec of the event trigger being bound.
value: The value to create the event chain from.
+ key: The key of the event trigger being bound.
Returns:
The event chain.
@@ -550,7 +580,7 @@ class Component(BaseComponent, ABC):
elif isinstance(value, EventVar):
value = [value]
elif issubclass(value._var_type, (EventChain, EventSpec)):
- return self._create_event_chain(args_spec, value.guess_type())
+ return self._create_event_chain(args_spec, value.guess_type(), key=key)
else:
raise ValueError(
f"Invalid event chain: {str(value)} of type {value._var_type}"
@@ -569,10 +599,10 @@ class Component(BaseComponent, ABC):
for v in value:
if isinstance(v, (EventHandler, EventSpec)):
# Call the event handler to get the event.
- events.append(call_event_handler(v, args_spec))
+ events.append(call_event_handler(v, args_spec, key=key))
elif isinstance(v, Callable):
# Call the lambda to get the event chain.
- result = call_event_fn(v, args_spec)
+ result = call_event_fn(v, args_spec, key=key)
if isinstance(result, Var):
raise ValueError(
f"Invalid event chain: {v}. Cannot use a Var-returning "
@@ -586,10 +616,10 @@ class Component(BaseComponent, ABC):
# If the input is a callable, create an event chain.
elif isinstance(value, Callable):
- result = call_event_fn(value, args_spec)
+ result = call_event_fn(value, args_spec, key=key)
if isinstance(result, Var):
# Recursively call this function if the lambda returned an EventChain Var.
- return self._create_event_chain(args_spec, result)
+ return self._create_event_chain(args_spec, result, key=key)
events = [*result]
# Otherwise, raise an error.
@@ -616,40 +646,42 @@ class Component(BaseComponent, ABC):
event_actions={},
)
- def get_event_triggers(self) -> Dict[str, Any]:
+ def get_event_triggers(
+ self,
+ ) -> Dict[str, types.ArgsSpec | Sequence[types.ArgsSpec]]:
"""Get the event triggers for the component.
Returns:
The event triggers.
"""
- default_triggers = {
- EventTriggers.ON_FOCUS: empty_event,
- EventTriggers.ON_BLUR: empty_event,
- EventTriggers.ON_CLICK: empty_event,
- EventTriggers.ON_CONTEXT_MENU: empty_event,
- EventTriggers.ON_DOUBLE_CLICK: empty_event,
- EventTriggers.ON_MOUSE_DOWN: empty_event,
- EventTriggers.ON_MOUSE_ENTER: empty_event,
- EventTriggers.ON_MOUSE_LEAVE: empty_event,
- EventTriggers.ON_MOUSE_MOVE: empty_event,
- EventTriggers.ON_MOUSE_OUT: empty_event,
- EventTriggers.ON_MOUSE_OVER: empty_event,
- EventTriggers.ON_MOUSE_UP: empty_event,
- EventTriggers.ON_SCROLL: empty_event,
- EventTriggers.ON_MOUNT: empty_event,
- EventTriggers.ON_UNMOUNT: empty_event,
+ default_triggers: Dict[str, types.ArgsSpec | Sequence[types.ArgsSpec]] = {
+ EventTriggers.ON_FOCUS: no_args_event_spec,
+ EventTriggers.ON_BLUR: no_args_event_spec,
+ EventTriggers.ON_CLICK: no_args_event_spec,
+ EventTriggers.ON_CONTEXT_MENU: no_args_event_spec,
+ EventTriggers.ON_DOUBLE_CLICK: no_args_event_spec,
+ EventTriggers.ON_MOUSE_DOWN: no_args_event_spec,
+ EventTriggers.ON_MOUSE_ENTER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_LEAVE: no_args_event_spec,
+ EventTriggers.ON_MOUSE_MOVE: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OUT: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OVER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_UP: no_args_event_spec,
+ EventTriggers.ON_SCROLL: no_args_event_spec,
+ EventTriggers.ON_MOUNT: no_args_event_spec,
+ EventTriggers.ON_UNMOUNT: no_args_event_spec,
}
# Look for component specific triggers,
# e.g. variable declared as EventHandler types.
for field in self.get_fields().values():
- if types._issubclass(field.type_, EventHandler):
+ if types._issubclass(field.outer_type_, EventHandler):
args_spec = None
annotation = field.annotation
if (metadata := getattr(annotation, "__metadata__", None)) is not None:
args_spec = metadata[0]
- default_triggers[field.name] = args_spec or (empty_event) # type: ignore
+ default_triggers[field.name] = args_spec or (no_args_event_spec) # type: ignore
return default_triggers
def __repr__(self) -> str:
@@ -1126,8 +1158,13 @@ class Component(BaseComponent, ABC):
for trigger in self.event_triggers.values():
if isinstance(trigger, EventChain):
for event in trigger.events:
+ if isinstance(event, EventCallback):
+ continue
if isinstance(event, EventSpec):
- if event.handler.state_full_name:
+ if (
+ event.handler.state_full_name
+ and event.handler.state_full_name != FRONTEND_EVENT_STATE
+ ):
return True
else:
if event._var_state:
@@ -1305,7 +1342,9 @@ class Component(BaseComponent, ABC):
if self._get_ref_hook():
# Handle hooks needed for attaching react refs to DOM nodes.
_imports.setdefault("react", set()).add(ImportVar(tag="useRef"))
- _imports.setdefault(f"/{Dirs.STATE_PATH}", set()).add(ImportVar(tag="refs"))
+ _imports.setdefault(f"$/{Dirs.STATE_PATH}", set()).add(
+ ImportVar(tag="refs")
+ )
if self._get_mount_lifecycle_hook():
# Handle hooks for `on_mount` / `on_unmount`.
@@ -1427,7 +1466,7 @@ class Component(BaseComponent, ABC):
"""
ref = self.get_ref()
if ref is not None:
- return f"const {ref} = useRef(null); {str(Var(_js_expr=ref).as_ref())} = {ref};"
+ return f"const {ref} = useRef(null); {str(Var(_js_expr=ref)._as_ref())} = {ref};"
def _get_vars_hooks(self) -> dict[str, None]:
"""Get the hooks required by vars referenced in this component.
@@ -1662,7 +1701,7 @@ class CustomComponent(Component):
"""A custom user-defined component."""
# Use the components library.
- library = f"/{Dirs.COMPONENTS_PATH}"
+ library = f"$/{Dirs.COMPONENTS_PATH}"
# The function that creates the component.
component_fn: Callable[..., Component] = Component.create
@@ -1706,8 +1745,9 @@ class CustomComponent(Component):
value = self._create_event_chain(
value=value,
args_spec=event_triggers_in_component_declaration.get(
- key, empty_event
+ key, no_args_event_spec
),
+ key=key,
)
self.props[format.to_camel_case(key)] = value
continue
@@ -1880,6 +1920,11 @@ memo = custom_component
class NoSSRComponent(Component):
"""A dynamic component that is not rendered on the server."""
+ def _get_import_name(self) -> None | str:
+ if not self.library:
+ return None
+ return f"${self.library}" if self.library.startswith("/") else self.library
+
def _get_imports(self) -> ParsedImportDict:
"""Get the imports for the component.
@@ -1893,8 +1938,9 @@ class NoSSRComponent(Component):
_imports = super()._get_imports()
# Do NOT import the main library/tag statically.
- if self.library is not None:
- _imports[self.library] = [
+ import_name = self._get_import_name()
+ if import_name is not None:
+ _imports[import_name] = [
imports.ImportVar(
tag=None,
render=False,
@@ -1912,10 +1958,10 @@ class NoSSRComponent(Component):
opts_fragment = ", { ssr: false });"
# extract the correct import name from library name
- if self.library is None:
+ base_import_name = self._get_import_name()
+ if base_import_name is None:
raise ValueError("Undefined library for NoSSRComponent")
-
- import_name = format.format_library_name(self.library)
+ import_name = format.format_library_name(base_import_name)
library_import = f"const {self.alias if self.alias else self.tag} = dynamic(() => import('{import_name}')"
mod_import = (
@@ -2230,7 +2276,7 @@ class StatefulComponent(BaseComponent):
"""
if self.rendered_as_shared:
return {
- f"/{Dirs.UTILS}/{PageNames.STATEFUL_COMPONENTS}": [
+ f"$/{Dirs.UTILS}/{PageNames.STATEFUL_COMPONENTS}": [
ImportVar(tag=self.tag)
]
}
@@ -2340,3 +2386,203 @@ class MemoizationLeaf(Component):
load_dynamic_serializer()
+
+
+class ComponentVar(Var[Component], python_types=BaseComponent):
+ """A Var that represents a Component."""
+
+
+def empty_component() -> Component:
+ """Create an empty component.
+
+ Returns:
+ An empty component.
+ """
+ from reflex.components.base.bare import Bare
+
+ return Bare.create("")
+
+
+def render_dict_to_var(tag: dict | Component | str, imported_names: set[str]) -> Var:
+ """Convert a render dict to a Var.
+
+ Args:
+ tag: The render dict.
+ imported_names: The names of the imported components.
+
+ Returns:
+ The Var.
+ """
+ if not isinstance(tag, dict):
+ if isinstance(tag, Component):
+ return render_dict_to_var(tag.render(), imported_names)
+ return Var.create(tag)
+
+ if "iterable" in tag:
+ function_return = Var.create(
+ [
+ render_dict_to_var(child.render(), imported_names)
+ for child in tag["children"]
+ ]
+ )
+
+ func = ArgsFunctionOperation.create(
+ (tag["arg_var_name"], tag["index_var_name"]),
+ function_return,
+ )
+
+ return FunctionStringVar.create("Array.prototype.map.call").call(
+ tag["iterable"]
+ if not isinstance(tag["iterable"], ObjectVar)
+ else tag["iterable"].items(),
+ func,
+ )
+
+ if tag["name"] == "match":
+ element = tag["cond"]
+
+ conditionals = tag["default"]
+
+ for case in tag["match_cases"][::-1]:
+ condition = case[0].to_string() == element.to_string()
+ for pattern in case[1:-1]:
+ condition = condition | (pattern.to_string() == element.to_string())
+
+ conditionals = ternary_operation(
+ condition,
+ case[-1],
+ conditionals,
+ )
+
+ return conditionals
+
+ if "cond" in tag:
+ return ternary_operation(
+ tag["cond"],
+ render_dict_to_var(tag["true_value"], imported_names),
+ render_dict_to_var(tag["false_value"], imported_names)
+ if tag["false_value"] is not None
+ else Var.create(None),
+ )
+
+ props = {}
+
+ special_props = []
+
+ for prop_str in tag["props"]:
+ if "=" not in prop_str:
+ special_props.append(Var(prop_str).to(ObjectVar))
+ continue
+ prop = prop_str.index("=")
+ key = prop_str[:prop]
+ value = prop_str[prop + 2 : -1]
+ props[key] = value
+
+ props = Var.create({Var.create(k): Var(v) for k, v in props.items()})
+
+ for prop in special_props:
+ props = props.merge(prop)
+
+ contents = tag["contents"][1:-1] if tag["contents"] else None
+
+ raw_tag_name = tag.get("name")
+ tag_name = Var(raw_tag_name or "Fragment")
+
+ tag_name = (
+ Var.create(raw_tag_name)
+ if raw_tag_name
+ and raw_tag_name.split(".")[0] not in imported_names
+ and raw_tag_name.lower() == raw_tag_name
+ else tag_name
+ )
+
+ return FunctionStringVar.create(
+ "jsx",
+ ).call(
+ tag_name,
+ props,
+ *([Var(contents)] if contents is not None else []),
+ *[render_dict_to_var(child, imported_names) for child in tag["children"]],
+ )
+
+
+@dataclasses.dataclass(
+ eq=False,
+ frozen=True,
+)
+class LiteralComponentVar(CachedVarOperation, LiteralVar, ComponentVar):
+ """A Var that represents a Component."""
+
+ _var_value: BaseComponent = dataclasses.field(default_factory=empty_component)
+
+ @cached_property_no_lock
+ def _cached_var_name(self) -> str:
+ """Get the name of the var.
+
+ Returns:
+ The name of the var.
+ """
+ var_data = self._get_all_var_data()
+ if var_data is not None:
+ # flatten imports
+ imported_names = {j.alias or j.name for i in var_data.imports for j in i[1]}
+ else:
+ imported_names = set()
+ return str(render_dict_to_var(self._var_value.render(), imported_names))
+
+ @cached_property_no_lock
+ def _cached_get_all_var_data(self) -> VarData | None:
+ """Get the VarData for the var.
+
+ Returns:
+ The VarData for the var.
+ """
+ return VarData.merge(
+ VarData(
+ imports={
+ "@emotion/react": [
+ ImportVar(tag="jsx"),
+ ],
+ }
+ ),
+ VarData(
+ imports=self._var_value._get_all_imports(),
+ ),
+ VarData(
+ imports={
+ "react": [
+ ImportVar(tag="Fragment"),
+ ],
+ }
+ ),
+ )
+
+ def __hash__(self) -> int:
+ """Get the hash of the var.
+
+ Returns:
+ The hash of the var.
+ """
+ return hash((self.__class__.__name__, self._js_expr))
+
+ @classmethod
+ def create(
+ cls,
+ value: Component,
+ _var_data: VarData | None = None,
+ ):
+ """Create a var from a value.
+
+ Args:
+ value: The value of the var.
+ _var_data: Additional hooks and imports associated with the Var.
+
+ Returns:
+ The var.
+ """
+ return LiteralComponentVar(
+ _js_expr="",
+ _var_type=type(value),
+ _var_data=_var_data,
+ _var_value=value,
+ )
diff --git a/reflex/components/core/banner.py b/reflex/components/core/banner.py
index 29897cffa..f6abbab90 100644
--- a/reflex/components/core/banner.py
+++ b/reflex/components/core/banner.py
@@ -66,8 +66,8 @@ class WebsocketTargetURL(Var):
_js_expr="getBackendURL(env.EVENT).href",
_var_data=VarData(
imports={
- "/env.json": [ImportVar(tag="env", is_default=True)],
- f"/{Dirs.STATE_PATH}": [ImportVar(tag="getBackendURL")],
+ "$/env.json": [ImportVar(tag="env", is_default=True)],
+ f"$/{Dirs.STATE_PATH}": [ImportVar(tag="getBackendURL")],
},
),
_var_type=WebsocketTargetURL,
@@ -110,7 +110,7 @@ class ConnectionToaster(Toaster):
individual_hooks = [
f"const toast_props = {str(LiteralVar.create(props))};",
- f"const [userDismissed, setUserDismissed] = useState(false);",
+ "const [userDismissed, setUserDismissed] = useState(false);",
FunctionStringVar(
"useEffect",
_var_data=VarData(
diff --git a/reflex/components/core/banner.pyi b/reflex/components/core/banner.pyi
index 7c2be272c..3296b84ee 100644
--- a/reflex/components/core/banner.pyi
+++ b/reflex/components/core/banner.pyi
@@ -10,7 +10,7 @@ from reflex.components.el.elements.typography import Div
from reflex.components.lucide.icon import Icon
from reflex.components.sonner.toast import Toaster, ToastProps
from reflex.constants.compiler import CompileVars
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportVar
from reflex.vars import VarData
@@ -88,22 +88,22 @@ class ConnectionToaster(Toaster):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ConnectionToaster":
"""Create a connection toaster component.
@@ -148,22 +148,22 @@ class ConnectionBanner(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ConnectionBanner":
"""Create a connection banner component.
@@ -187,22 +187,22 @@ class ConnectionModal(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ConnectionModal":
"""Create a connection banner component.
@@ -227,22 +227,22 @@ class WifiOffPulse(Icon):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "WifiOffPulse":
"""Create a wifi_off icon with an animated opacity pulse.
@@ -300,22 +300,22 @@ class ConnectionPulser(Div):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ConnectionPulser":
"""Create a connection pulser component.
diff --git a/reflex/components/core/client_side_routing.py b/reflex/components/core/client_side_routing.py
index efa622f81..342c69632 100644
--- a/reflex/components/core/client_side_routing.py
+++ b/reflex/components/core/client_side_routing.py
@@ -21,7 +21,7 @@ route_not_found: Var = Var(_js_expr=constants.ROUTE_NOT_FOUND)
class ClientSideRouting(Component):
"""The client-side routing component."""
- library = "/utils/client_side_routing"
+ library = "$/utils/client_side_routing"
tag = "useClientSideRouting"
def add_hooks(self) -> list[str]:
diff --git a/reflex/components/core/client_side_routing.pyi b/reflex/components/core/client_side_routing.pyi
index 1d528daaf..bb853e2c7 100644
--- a/reflex/components/core/client_side_routing.pyi
+++ b/reflex/components/core/client_side_routing.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -25,22 +25,22 @@ class ClientSideRouting(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ClientSideRouting":
"""Create the component.
@@ -74,22 +74,22 @@ class Default404Page(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Default404Page":
"""Create the component.
diff --git a/reflex/components/core/clipboard.py b/reflex/components/core/clipboard.py
index 88aa2d145..6d6a38acc 100644
--- a/reflex/components/core/clipboard.py
+++ b/reflex/components/core/clipboard.py
@@ -6,7 +6,7 @@ from typing import Dict, List, Tuple, Union
from reflex.components.base.fragment import Fragment
from reflex.components.tags.tag import Tag
-from reflex.event import EventChain, EventHandler, identity_event
+from reflex.event import EventChain, EventHandler, passthrough_event_spec
from reflex.utils.format import format_prop, wrap
from reflex.utils.imports import ImportVar
from reflex.vars import get_unique_variable_name
@@ -20,7 +20,7 @@ class Clipboard(Fragment):
targets: Var[List[str]]
# Called when the user pastes data into the document. Data is a list of tuples of (mime_type, data). Binary types will be base64 encoded as a data uri.
- on_paste: EventHandler[identity_event(List[Tuple[str, str]])]
+ on_paste: EventHandler[passthrough_event_spec(List[Tuple[str, str]])]
# Save the original event actions for the on_paste event.
on_paste_event_actions: Var[Dict[str, Union[bool, int]]]
@@ -67,7 +67,7 @@ class Clipboard(Fragment):
The import dict for the component.
"""
return {
- "/utils/helpers/paste.js": ImportVar(
+ "$/utils/helpers/paste.js": ImportVar(
tag="usePasteHandler", is_default=True
),
}
diff --git a/reflex/components/core/clipboard.pyi b/reflex/components/core/clipboard.pyi
index e2f6afc8d..69e0e866d 100644
--- a/reflex/components/core/clipboard.pyi
+++ b/reflex/components/core/clipboard.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, List, Optional, Union, overload
from reflex.components.base.fragment import Fragment
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
@@ -26,23 +26,28 @@ class Clipboard(Fragment):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_paste: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_paste: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[list[tuple[str, str]]], BASE_STATE],
+ ]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Clipboard":
"""Create a Clipboard component.
@@ -50,6 +55,7 @@ class Clipboard(Fragment):
Args:
*children: The children of the component.
targets: The element ids to attach the event listener to. Defaults to all child components or the document.
+ on_paste: Called when the user pastes data into the document. Data is a list of tuples of (mime_type, data). Binary types will be base64 encoded as a data uri.
on_paste_event_actions: Save the original event actions for the on_paste event.
style: The style of the component.
key: A unique key for the component.
diff --git a/reflex/components/core/cond.py b/reflex/components/core/cond.py
index 1590875d3..5b6ee2a7f 100644
--- a/reflex/components/core/cond.py
+++ b/reflex/components/core/cond.py
@@ -15,7 +15,7 @@ from reflex.vars.base import LiteralVar, Var
from reflex.vars.number import ternary_operation
_IS_TRUE_IMPORT: ImportDict = {
- f"/{Dirs.STATE_PATH}": [ImportVar(tag="isTrue")],
+ f"$/{Dirs.STATE_PATH}": [ImportVar(tag="isTrue")],
}
@@ -171,6 +171,14 @@ def cond(condition: Any, c1: Any, c2: Any = None) -> Component | Var:
)
+@overload
+def color_mode_cond(light: Component, dark: Component | None = None) -> Component: ... # type: ignore
+
+
+@overload
+def color_mode_cond(light: Any, dark: Any = None) -> Var: ...
+
+
def color_mode_cond(light: Any, dark: Any = None) -> Var | Component:
"""Create a component or Prop based on color_mode.
diff --git a/reflex/components/core/debounce.py b/reflex/components/core/debounce.py
index 07ad1d69e..12cc94426 100644
--- a/reflex/components/core/debounce.py
+++ b/reflex/components/core/debounce.py
@@ -6,7 +6,7 @@ from typing import Any, Type, Union
from reflex.components.component import Component
from reflex.constants import EventTriggers
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.vars import VarData
from reflex.vars.base import Var
@@ -46,7 +46,7 @@ class DebounceInput(Component):
element: Var[Type[Component]]
# Fired when the input value changes
- on_change: EventHandler[empty_event]
+ on_change: EventHandler[no_args_event_spec]
@classmethod
def create(cls, *children: Component, **props: Any) -> Component:
@@ -118,7 +118,7 @@ class DebounceInput(Component):
_var_type=Type[Component],
_var_data=VarData(
imports=child._get_imports(),
- hooks=child._get_hooks_internal(),
+ hooks=child._get_all_hooks(),
),
),
)
@@ -128,6 +128,10 @@ class DebounceInput(Component):
component.event_triggers.update(child.event_triggers)
component.children = child.children
component._rename_props = child._rename_props
+ outer_get_all_custom_code = component._get_all_custom_code
+ component._get_all_custom_code = lambda: outer_get_all_custom_code().union(
+ child._get_all_custom_code()
+ )
return component
def _render(self):
diff --git a/reflex/components/core/debounce.pyi b/reflex/components/core/debounce.pyi
index 6d7b76510..9e61af6e3 100644
--- a/reflex/components/core/debounce.pyi
+++ b/reflex/components/core/debounce.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Type, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -30,23 +30,23 @@ class DebounceInput(Component):
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[EventType[[]]] = None,
- on_change: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DebounceInput":
"""Create a DebounceInput component.
diff --git a/reflex/components/core/html.pyi b/reflex/components/core/html.pyi
index 7f3ff603d..ffa7f88bb 100644
--- a/reflex/components/core/html.pyi
+++ b/reflex/components/core/html.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.el.elements.typography import Div
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -48,22 +48,22 @@ class Html(Div):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Html":
"""Create a html component.
diff --git a/reflex/components/core/upload.py b/reflex/components/core/upload.py
index be97b170d..87488d98a 100644
--- a/reflex/components/core/upload.py
+++ b/reflex/components/core/upload.py
@@ -2,26 +2,34 @@
from __future__ import annotations
-import os
from pathlib import Path
from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple
-from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
+from reflex.components.base.fragment import Fragment
+from reflex.components.component import (
+ Component,
+ ComponentNamespace,
+ MemoizationLeaf,
+ StatefulComponent,
+)
from reflex.components.el.elements.forms import Input
from reflex.components.radix.themes.layout.box import Box
+from reflex.config import environment
from reflex.constants import Dirs
+from reflex.constants.compiler import Hooks, Imports
from reflex.event import (
CallableEventSpec,
EventChain,
EventHandler,
EventSpec,
call_event_fn,
- call_script,
parse_args_spec,
+ run_script,
)
+from reflex.utils import format
from reflex.utils.imports import ImportVar
from reflex.vars import VarData
-from reflex.vars.base import CallableVar, LiteralVar, Var
+from reflex.vars.base import CallableVar, LiteralVar, Var, get_unique_variable_name
from reflex.vars.sequence import LiteralStringVar
DEFAULT_UPLOAD_ID: str = "default"
@@ -29,7 +37,7 @@ DEFAULT_UPLOAD_ID: str = "default"
upload_files_context_var_data: VarData = VarData(
imports={
"react": "useContext",
- f"/{Dirs.CONTEXTS_PATH}": "UploadFilesContext",
+ f"$/{Dirs.CONTEXTS_PATH}": "UploadFilesContext",
},
hooks={
"const [filesById, setFilesById] = useContext(UploadFilesContext);": None,
@@ -99,8 +107,8 @@ def clear_selected_files(id_: str = DEFAULT_UPLOAD_ID) -> EventSpec:
"""
# UploadFilesProvider assigns a special function to clear selected files
# into the shared global refs object to make it accessible outside a React
- # component via `call_script` (otherwise backend could never clear files).
- return call_script(f"refs['__clear_selected_files']({id_!r})")
+ # component via `run_script` (otherwise backend could never clear files).
+ return run_script(f"refs['__clear_selected_files']({id_!r})")
def cancel_upload(upload_id: str) -> EventSpec:
@@ -112,7 +120,7 @@ def cancel_upload(upload_id: str) -> EventSpec:
Returns:
An event spec that cancels the upload when triggered.
"""
- return call_script(
+ return run_script(
f"upload_controllers[{str(LiteralVar.create(upload_id))}]?.abort()"
)
@@ -125,9 +133,7 @@ def get_upload_dir() -> Path:
"""
Upload.is_used = True
- uploaded_files_dir = Path(
- os.environ.get("REFLEX_UPLOADED_FILES_DIR", "./uploaded_files")
- )
+ uploaded_files_dir = environment.REFLEX_UPLOADED_FILES_DIR.get()
uploaded_files_dir.mkdir(parents=True, exist_ok=True)
return uploaded_files_dir
@@ -136,8 +142,8 @@ uploaded_files_url_prefix = Var(
_js_expr="getBackendURL(env.UPLOAD)",
_var_data=VarData(
imports={
- f"/{Dirs.STATE_PATH}": "getBackendURL",
- "/env.json": ImportVar(tag="env", is_default=True),
+ f"$/{Dirs.STATE_PATH}": "getBackendURL",
+ "$/env.json": ImportVar(tag="env", is_default=True),
}
),
).to(str)
@@ -172,18 +178,23 @@ def _on_drop_spec(files: Var) -> Tuple[Var[Any]]:
class UploadFilesProvider(Component):
"""AppWrap component that provides a dict of selected files by ID via useContext."""
- library = f"/{Dirs.CONTEXTS_PATH}"
+ library = f"$/{Dirs.CONTEXTS_PATH}"
tag = "UploadFilesProvider"
+class GhostUpload(Fragment):
+ """A ghost upload component."""
+
+ # Fired when files are dropped.
+ on_drop: EventHandler[_on_drop_spec]
+
+
class Upload(MemoizationLeaf):
"""A file upload component."""
- library = "react-dropzone@14.2.9"
+ library = "react-dropzone@14.2.10"
- tag = "ReactDropzone"
-
- is_default = True
+ tag = ""
# The list of accepted file types. This should be a dictionary of MIME types as keys and array of file formats as
# values.
@@ -203,7 +214,7 @@ class Upload(MemoizationLeaf):
min_size: Var[int]
# Whether to allow multiple files to be uploaded.
- multiple: Var[bool] = True # type: ignore
+ multiple: Var[bool]
# Whether to disable click to upload.
no_click: Var[bool]
@@ -234,6 +245,8 @@ class Upload(MemoizationLeaf):
# Mark the Upload component as used in the app.
cls.is_used = True
+ props.setdefault("multiple", True)
+
# Apply the default classname
given_class_name = props.pop("class_name", [])
if isinstance(given_class_name, str):
@@ -245,17 +258,6 @@ class Upload(MemoizationLeaf):
upload_props = {
key: value for key, value in props.items() if key in supported_props
}
- # The file input to use.
- upload = Input.create(type="file")
- upload.special_props = [Var(_js_expr="{...getInputProps()}", _var_type=None)]
-
- # The dropzone to use.
- zone = Box.create(
- upload,
- *children,
- **{k: v for k, v in props.items() if k not in supported_props},
- )
- zone.special_props = [Var(_js_expr="{...getRootProps()}", _var_type=None)]
# Create the component.
upload_props["id"] = props.get("id", DEFAULT_UPLOAD_ID)
@@ -277,9 +279,75 @@ class Upload(MemoizationLeaf):
),
)
upload_props["on_drop"] = on_drop
+
+ input_props_unique_name = get_unique_variable_name()
+ root_props_unique_name = get_unique_variable_name()
+
+ event_var, callback_str = StatefulComponent._get_memoized_event_triggers(
+ GhostUpload.create(on_drop=upload_props["on_drop"])
+ )["on_drop"]
+
+ upload_props["on_drop"] = event_var
+
+ upload_props = {
+ format.to_camel_case(key): value for key, value in upload_props.items()
+ }
+
+ use_dropzone_arguments = Var.create(
+ {
+ "onDrop": event_var,
+ **upload_props,
+ }
+ )
+
+ left_side = f"const {{getRootProps: {root_props_unique_name}, getInputProps: {input_props_unique_name}}} "
+ right_side = f"useDropzone({str(use_dropzone_arguments)})"
+
+ var_data = VarData.merge(
+ VarData(
+ imports=Imports.EVENTS,
+ hooks={Hooks.EVENTS: None},
+ ),
+ event_var._get_all_var_data(),
+ use_dropzone_arguments._get_all_var_data(),
+ VarData(
+ hooks={
+ callback_str: None,
+ f"{left_side} = {right_side};": None,
+ },
+ imports={
+ "react-dropzone": "useDropzone",
+ **Imports.EVENTS,
+ },
+ ),
+ )
+
+ # The file input to use.
+ upload = Input.create(type="file")
+ upload.special_props = [
+ Var(
+ _js_expr=f"{{...{input_props_unique_name}()}}",
+ _var_type=None,
+ _var_data=var_data,
+ )
+ ]
+
+ # The dropzone to use.
+ zone = Box.create(
+ upload,
+ *children,
+ **{k: v for k, v in props.items() if k not in supported_props},
+ )
+ zone.special_props = [
+ Var(
+ _js_expr=f"{{...{root_props_unique_name}()}}",
+ _var_type=None,
+ _var_data=var_data,
+ )
+ ]
+
return super().create(
zone,
- **upload_props,
)
@classmethod
@@ -297,11 +365,6 @@ class Upload(MemoizationLeaf):
return (arg_value[0], placeholder)
return arg_value
- def _render(self):
- out = super()._render()
- out.args = ("getRootProps", "getInputProps")
- return out
-
@staticmethod
def _get_app_wrap_components() -> dict[tuple[int, str], Component]:
return {
diff --git a/reflex/components/core/upload.pyi b/reflex/components/core/upload.pyi
index 5bbae892f..6238ff9cb 100644
--- a/reflex/components/core/upload.pyi
+++ b/reflex/components/core/upload.pyi
@@ -6,13 +6,10 @@
from pathlib import Path
from typing import Any, ClassVar, Dict, List, Optional, Union, overload
+from reflex.components.base.fragment import Fragment
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
from reflex.constants import Dirs
-from reflex.event import (
- CallableEventSpec,
- EventSpec,
- EventType,
-)
+from reflex.event import BASE_STATE, CallableEventSpec, EventSpec, EventType
from reflex.style import Style
from reflex.utils.imports import ImportVar
from reflex.vars import VarData
@@ -34,8 +31,8 @@ uploaded_files_url_prefix = Var(
_js_expr="getBackendURL(env.UPLOAD)",
_var_data=VarData(
imports={
- f"/{Dirs.STATE_PATH}": "getBackendURL",
- "/env.json": ImportVar(tag="env", is_default=True),
+ f"$/{Dirs.STATE_PATH}": "getBackendURL",
+ "$/env.json": ImportVar(tag="env", is_default=True),
}
),
).to(str)
@@ -53,22 +50,22 @@ class UploadFilesProvider(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "UploadFilesProvider":
"""Create the component.
@@ -88,6 +85,56 @@ class UploadFilesProvider(Component):
"""
...
+class GhostUpload(Fragment):
+ @overload
+ @classmethod
+ def create( # type: ignore
+ 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, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_drop: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
+ ] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ **props,
+ ) -> "GhostUpload":
+ """Create the component.
+
+ Args:
+ *children: The children of the component.
+ on_drop: Fired when files are dropped.
+ 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.
+ """
+ ...
+
class Upload(MemoizationLeaf):
is_used: ClassVar[bool] = False
@@ -110,23 +157,25 @@ class Upload(MemoizationLeaf):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_drop: Optional[EventType[Any]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_drop: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
+ ] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Upload":
"""Create an upload component.
@@ -142,6 +191,7 @@ class Upload(MemoizationLeaf):
no_click: Whether to disable click to upload.
no_drag: Whether to disable drag and drop.
no_keyboard: Whether to disable using the space/enter keys to upload.
+ on_drop: Fired when files are dropped.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -175,23 +225,25 @@ class StyledUpload(Upload):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_drop: Optional[EventType[Any]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_drop: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
+ ] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "StyledUpload":
"""Create the styled upload component.
@@ -207,6 +259,7 @@ class StyledUpload(Upload):
no_click: Whether to disable click to upload.
no_drag: Whether to disable drag and drop.
no_keyboard: Whether to disable using the space/enter keys to upload.
+ on_drop: Fired when files are dropped.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -240,23 +293,25 @@ class UploadNamespace(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_drop: Optional[EventType[Any]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_drop: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[Any], BASE_STATE]]
+ ] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "StyledUpload":
"""Create the styled upload component.
@@ -272,6 +327,7 @@ class UploadNamespace(ComponentNamespace):
no_click: Whether to disable click to upload.
no_drag: Whether to disable drag and drop.
no_keyboard: Whether to disable using the space/enter keys to upload.
+ on_drop: Fired when files are dropped.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/datadisplay/code.py b/reflex/components/datadisplay/code.py
index c18e44885..b514bc888 100644
--- a/reflex/components/datadisplay/code.py
+++ b/reflex/components/datadisplay/code.py
@@ -8,13 +8,14 @@ from typing import ClassVar, Dict, Literal, Optional, Union
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.cond import color_mode_cond
from reflex.components.lucide.icon import Icon
+from reflex.components.markdown.markdown import _LANGUAGE, MarkdownComponentMap
from reflex.components.radix.themes.components.button import Button
from reflex.components.radix.themes.layout.box import Box
from reflex.constants.colors import Color
from reflex.event import set_clipboard
from reflex.style import Style
from reflex.utils import console, format
-from reflex.utils.imports import ImportDict, ImportVar
+from reflex.utils.imports import ImportVar
from reflex.vars.base import LiteralVar, Var, VarData
LiteralCodeLanguage = Literal[
@@ -378,10 +379,10 @@ for theme_name in dir(Theme):
setattr(Theme, theme_name, getattr(Theme, theme_name)._replace(_var_type=Theme))
-class CodeBlock(Component):
+class CodeBlock(Component, MarkdownComponentMap):
"""A code block."""
- library = "react-syntax-highlighter@15.5.0"
+ library = "react-syntax-highlighter@15.6.0"
tag = "PrismAsyncLight"
@@ -391,7 +392,7 @@ class CodeBlock(Component):
theme: Var[Union[Theme, str]] = Theme.one_light
# The language to use.
- language: Var[LiteralCodeLanguage] = "python" # type: ignore
+ language: Var[LiteralCodeLanguage] = Var.create("python")
# The code to display.
code: Var[str]
@@ -411,53 +412,22 @@ class CodeBlock(Component):
# Props passed down to the code tag.
code_tag_props: Var[Dict[str, str]]
- def add_imports(self) -> ImportDict:
- """Add imports for the CodeBlock component.
+ # Whether a copy button should appear.
+ can_copy: Optional[bool] = False
- Returns:
- The import dict.
- """
- imports_: ImportDict = {}
-
- if (
- self.language is not None
- and (language_without_quotes := str(self.language).replace('"', ""))
- in LiteralCodeLanguage.__args__ # type: ignore
- ):
- imports_[
- f"react-syntax-highlighter/dist/cjs/languages/prism/{language_without_quotes}"
- ] = [
- ImportVar(
- tag=format.to_camel_case(language_without_quotes),
- is_default=True,
- install=False,
- )
- ]
-
- return imports_
-
- def _get_custom_code(self) -> Optional[str]:
- if (
- self.language is not None
- and (language_without_quotes := str(self.language).replace('"', ""))
- in LiteralCodeLanguage.__args__ # type: ignore
- ):
- return f"{self.alias}.registerLanguage('{language_without_quotes}', {format.to_camel_case(language_without_quotes)})"
+ # A custom copy button to override the default one.
+ copy_button: Optional[Union[bool, Component]] = None
@classmethod
def create(
cls,
*children,
- can_copy: Optional[bool] = False,
- copy_button: Optional[Union[bool, Component]] = None,
**props,
):
"""Create a text component.
Args:
*children: The children of the component.
- can_copy: Whether a copy button should appears.
- copy_button: A custom copy button to override the default one.
**props: The props to pass to the component.
Returns:
@@ -465,6 +435,8 @@ class CodeBlock(Component):
"""
# This component handles style in a special prop.
custom_style = props.pop("custom_style", {})
+ can_copy = props.pop("can_copy", False)
+ copy_button = props.pop("copy_button", None)
if "theme" not in props:
# Default color scheme responds to global color mode.
@@ -530,12 +502,55 @@ class CodeBlock(Component):
theme = self.theme
- out.add_props(style=theme).remove_props("theme", "code").add_props(
- children=self.code
+ out.add_props(style=theme).remove_props("theme", "code", "language").add_props(
+ children=self.code, language=_LANGUAGE
)
return out
+ def _exclude_props(self) -> list[str]:
+ return ["can_copy", "copy_button"]
+
+ @classmethod
+ def _get_language_registration_hook(cls) -> str:
+ """Get the hook to register the language.
+
+ Returns:
+ The hook to register the language.
+ """
+ return f"""
+ if ({str(_LANGUAGE)}) {{
+ (async () => {{
+ try {{
+ const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${{{str(_LANGUAGE)}}}`);
+ SyntaxHighlighter.registerLanguage({str(_LANGUAGE)}, module.default);
+ }} catch (error) {{
+ console.error(`Error importing language module for ${{{str(_LANGUAGE)}}}:`, error);
+ }}
+ }})();
+ }}
+"""
+
+ @classmethod
+ def get_component_map_custom_code(cls) -> str:
+ """Get the custom code for the component.
+
+ Returns:
+ The custom code for the component.
+ """
+ return cls._get_language_registration_hook()
+
+ def add_hooks(self) -> list[str | Var]:
+ """Add hooks for the component.
+
+ Returns:
+ The hooks for the component.
+ """
+ return [
+ f"const {str(_LANGUAGE)} = {str(self.language)}",
+ self._get_language_registration_hook(),
+ ]
+
class CodeblockNamespace(ComponentNamespace):
"""Namespace for the CodeBlock component."""
diff --git a/reflex/components/datadisplay/code.pyi b/reflex/components/datadisplay/code.pyi
index 0bf3dd956..da89195ce 100644
--- a/reflex/components/datadisplay/code.pyi
+++ b/reflex/components/datadisplay/code.pyi
@@ -7,10 +7,10 @@ import dataclasses
from typing import Any, ClassVar, Dict, Literal, Optional, Union, overload
from reflex.components.component import Component, ComponentNamespace
+from reflex.components.markdown.markdown import MarkdownComponentMap
from reflex.constants.colors import Color
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
-from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
LiteralCodeLanguage = Literal[
@@ -349,15 +349,12 @@ for theme_name in dir(Theme):
continue
setattr(Theme, theme_name, getattr(Theme, theme_name)._replace(_var_type=Theme))
-class CodeBlock(Component):
- def add_imports(self) -> ImportDict: ...
+class CodeBlock(Component, MarkdownComponentMap):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
- can_copy: Optional[bool] = False,
- copy_button: Optional[Union[Component, bool]] = None,
theme: Optional[Union[Theme, Var[Union[Theme, str]], str]] = None,
language: Optional[
Union[
@@ -933,35 +930,35 @@ class CodeBlock(Component):
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
+ can_copy: Optional[bool] = None,
+ copy_button: Optional[Union[Component, 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CodeBlock":
"""Create a text component.
Args:
*children: The children of the component.
- can_copy: Whether a copy button should appears.
- copy_button: A custom copy button to override the default one.
theme: The theme to use ("light" or "dark").
language: The language to use.
code: The code to display.
@@ -970,6 +967,8 @@ class CodeBlock(Component):
wrap_long_lines: Whether to wrap long lines.
custom_style: A custom style for the code block.
code_tag_props: Props passed down to the code tag.
+ can_copy: Whether a copy button should appear.
+ copy_button: A custom copy button to override the default one.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -984,6 +983,9 @@ class CodeBlock(Component):
...
def add_style(self): ...
+ @classmethod
+ def get_component_map_custom_code(cls) -> str: ...
+ def add_hooks(self) -> list[str | Var]: ...
class CodeblockNamespace(ComponentNamespace):
themes = Theme
@@ -991,8 +993,6 @@ class CodeblockNamespace(ComponentNamespace):
@staticmethod
def __call__(
*children,
- can_copy: Optional[bool] = False,
- copy_button: Optional[Union[Component, bool]] = None,
theme: Optional[Union[Theme, Var[Union[Theme, str]], str]] = None,
language: Optional[
Union[
@@ -1568,35 +1568,35 @@ class CodeblockNamespace(ComponentNamespace):
wrap_long_lines: Optional[Union[Var[bool], bool]] = None,
custom_style: Optional[Dict[str, Union[str, Var, Color]]] = None,
code_tag_props: Optional[Union[Dict[str, str], Var[Dict[str, str]]]] = None,
+ can_copy: Optional[bool] = None,
+ copy_button: Optional[Union[Component, 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CodeBlock":
"""Create a text component.
Args:
*children: The children of the component.
- can_copy: Whether a copy button should appears.
- copy_button: A custom copy button to override the default one.
theme: The theme to use ("light" or "dark").
language: The language to use.
code: The code to display.
@@ -1605,6 +1605,8 @@ class CodeblockNamespace(ComponentNamespace):
wrap_long_lines: Whether to wrap long lines.
custom_style: A custom style for the code block.
code_tag_props: Props passed down to the code tag.
+ can_copy: Whether a copy button should appear.
+ copy_button: A custom copy button to override the default one.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/datadisplay/dataeditor.py b/reflex/components/datadisplay/dataeditor.py
index 01255dd14..e3f0b7117 100644
--- a/reflex/components/datadisplay/dataeditor.py
+++ b/reflex/components/datadisplay/dataeditor.py
@@ -5,10 +5,12 @@ from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
+from typing_extensions import TypedDict
+
from reflex.base import Base
from reflex.components.component import Component, NoSSRComponent
from reflex.components.literals import LiteralRowMarker
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.utils import console, format, types
from reflex.utils.imports import ImportDict, ImportVar
from reflex.utils.serializers import serializer
@@ -107,17 +109,76 @@ class DataEditorTheme(Base):
text_medium: Optional[str] = None
-def on_edit_spec(pos, data: dict[str, Any]):
- """The on edit spec function.
+class Bounds(TypedDict):
+ """The bounds of the group header."""
- Args:
- pos: The position of the edit event.
- data: The data of the edit event.
+ x: int
+ y: int
+ width: int
+ height: int
- Returns:
- The position and data.
- """
- return [pos, data]
+
+class CompatSelection(TypedDict):
+ """The selection."""
+
+ items: list
+
+
+class Rectangle(TypedDict):
+ """The bounds of the group header."""
+
+ x: int
+ y: int
+ width: int
+ height: int
+
+
+class GridSelectionCurrent(TypedDict):
+ """The current selection."""
+
+ cell: tuple[int, int]
+ range: Rectangle
+ rangeStack: list[Rectangle]
+
+
+class GridSelection(TypedDict):
+ """The grid selection."""
+
+ current: Optional[GridSelectionCurrent]
+ columns: CompatSelection
+ rows: CompatSelection
+
+
+class GroupHeaderClickedEventArgs(TypedDict):
+ """The arguments for the group header clicked event."""
+
+ kind: str
+ group: str
+ location: tuple[int, int]
+ bounds: Bounds
+ isEdge: bool
+ shiftKey: bool
+ ctrlKey: bool
+ metaKey: bool
+ isTouch: bool
+ localEventX: int
+ localEventY: int
+ button: int
+ buttons: int
+ scrollEdge: tuple[int, int]
+
+
+class GridCell(TypedDict):
+ """The grid cell."""
+
+ span: Optional[List[int]]
+
+
+class GridColumn(TypedDict):
+ """The grid column."""
+
+ title: str
+ group: Optional[str]
class DataEditor(NoSSRComponent):
@@ -128,7 +189,6 @@ class DataEditor(NoSSRComponent):
library: str = "@glideapps/glide-data-grid@^6.0.3"
lib_dependencies: List[str] = [
"lodash@^4.17.21",
- "marked@^14.1.2",
"react-responsive-carousel@^3.2.7",
]
@@ -145,7 +205,7 @@ class DataEditor(NoSSRComponent):
get_cell_content: Var[str]
# Allow selection for copying.
- get_cell_for_selection: Var[bool]
+ get_cells_for_selection: Var[bool]
# Allow paste.
on_paste: Var[bool]
@@ -223,52 +283,58 @@ class DataEditor(NoSSRComponent):
theme: Var[Union[DataEditorTheme, Dict]]
# Fired when a cell is activated.
- on_cell_activated: EventHandler[identity_event(Tuple[int, int])]
+ on_cell_activated: EventHandler[passthrough_event_spec(Tuple[int, int])]
# Fired when a cell is clicked.
- on_cell_clicked: EventHandler[identity_event(Tuple[int, int])]
+ on_cell_clicked: EventHandler[passthrough_event_spec(Tuple[int, int])]
# Fired when a cell is right-clicked.
- on_cell_context_menu: EventHandler[identity_event(Tuple[int, int])]
+ on_cell_context_menu: EventHandler[passthrough_event_spec(Tuple[int, int])]
# Fired when a cell is edited.
- on_cell_edited: EventHandler[on_edit_spec]
+ on_cell_edited: EventHandler[passthrough_event_spec(Tuple[int, int], GridCell)]
# Fired when a group header is clicked.
- on_group_header_clicked: EventHandler[on_edit_spec]
+ on_group_header_clicked: EventHandler[
+ passthrough_event_spec(Tuple[int, int], GridCell)
+ ]
# Fired when a group header is right-clicked.
- on_group_header_context_menu: EventHandler[lambda grp_idx, data: [grp_idx, data]]
+ on_group_header_context_menu: EventHandler[
+ passthrough_event_spec(int, GroupHeaderClickedEventArgs)
+ ]
# Fired when a group header is renamed.
- on_group_header_renamed: EventHandler[lambda idx, val: [idx, val]]
+ on_group_header_renamed: EventHandler[passthrough_event_spec(str, str)]
# Fired when a header is clicked.
- on_header_clicked: EventHandler[identity_event(Tuple[int, int])]
+ on_header_clicked: EventHandler[passthrough_event_spec(Tuple[int, int])]
# Fired when a header is right-clicked.
- on_header_context_menu: EventHandler[identity_event(Tuple[int, int])]
+ on_header_context_menu: EventHandler[passthrough_event_spec(Tuple[int, int])]
# Fired when a header menu item is clicked.
- on_header_menu_click: EventHandler[lambda col, pos: [col, pos]]
+ on_header_menu_click: EventHandler[passthrough_event_spec(int, Rectangle)]
# Fired when an item is hovered.
- on_item_hovered: EventHandler[identity_event(Tuple[int, int])]
+ on_item_hovered: EventHandler[passthrough_event_spec(Tuple[int, int])]
# Fired when a selection is deleted.
- on_delete: EventHandler[lambda selection: [selection]]
+ on_delete: EventHandler[passthrough_event_spec(GridSelection)]
# Fired when editing is finished.
- on_finished_editing: EventHandler[lambda new_value, movement: [new_value, movement]]
+ on_finished_editing: EventHandler[
+ passthrough_event_spec(Union[GridCell, None], tuple[int, int])
+ ]
# Fired when a row is appended.
- on_row_appended: EventHandler[empty_event]
+ on_row_appended: EventHandler[no_args_event_spec]
# Fired when the selection is cleared.
- on_selection_cleared: EventHandler[empty_event]
+ on_selection_cleared: EventHandler[no_args_event_spec]
# Fired when a column is resized.
- on_column_resize: EventHandler[lambda col, width: [col, width]]
+ on_column_resize: EventHandler[passthrough_event_spec(GridColumn, int)]
def add_imports(self) -> ImportDict:
"""Add imports for the component.
@@ -279,7 +345,7 @@ class DataEditor(NoSSRComponent):
return {
"": f"{format.format_library_name(self.library)}/dist/index.css",
self.library: "GridCellKind",
- "/utils/helpers/dataeditor.js": ImportVar(
+ "$/utils/helpers/dataeditor.js": ImportVar(
tag="formatDataEditorCells", is_default=False, install=False
),
}
@@ -359,7 +425,7 @@ class DataEditor(NoSSRComponent):
props["theme"] = DataEditorTheme(**theme)
# Allow by default to select a region of cells in the grid.
- props.setdefault("get_cell_for_selection", True)
+ props.setdefault("get_cells_for_selection", True)
# Disable on_paste by default if not provided.
props.setdefault("on_paste", False)
diff --git a/reflex/components/datadisplay/dataeditor.pyi b/reflex/components/datadisplay/dataeditor.pyi
index 1b8fed287..aa4b3b2e8 100644
--- a/reflex/components/datadisplay/dataeditor.pyi
+++ b/reflex/components/datadisplay/dataeditor.pyi
@@ -6,9 +6,11 @@
from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Union, overload
+from typing_extensions import TypedDict
+
from reflex.base import Base
from reflex.components.component import NoSSRComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.utils.serializers import serializer
@@ -76,7 +78,53 @@ class DataEditorTheme(Base):
text_light: Optional[str]
text_medium: Optional[str]
-def on_edit_spec(pos, data: dict[str, Any]): ...
+class Bounds(TypedDict):
+ x: int
+ y: int
+ width: int
+ height: int
+
+class CompatSelection(TypedDict):
+ items: list
+
+class Rectangle(TypedDict):
+ x: int
+ y: int
+ width: int
+ height: int
+
+class GridSelectionCurrent(TypedDict):
+ cell: tuple[int, int]
+ range: Rectangle
+ rangeStack: list[Rectangle]
+
+class GridSelection(TypedDict):
+ current: Optional[GridSelectionCurrent]
+ columns: CompatSelection
+ rows: CompatSelection
+
+class GroupHeaderClickedEventArgs(TypedDict):
+ kind: str
+ group: str
+ location: tuple[int, int]
+ bounds: Bounds
+ isEdge: bool
+ shiftKey: bool
+ ctrlKey: bool
+ metaKey: bool
+ isTouch: bool
+ localEventX: int
+ localEventY: int
+ button: int
+ buttons: int
+ scrollEdge: tuple[int, int]
+
+class GridCell(TypedDict):
+ span: Optional[List[int]]
+
+class GridColumn(TypedDict):
+ title: str
+ group: Optional[str]
class DataEditor(NoSSRComponent):
def add_imports(self) -> ImportDict: ...
@@ -92,7 +140,7 @@ class DataEditor(NoSSRComponent):
] = None,
data: Optional[Union[List[List[Any]], Var[List[List[Any]]]]] = None,
get_cell_content: Optional[Union[Var[str], str]] = None,
- get_cell_for_selection: Optional[Union[Var[bool], bool]] = None,
+ get_cells_for_selection: Optional[Union[Var[bool], bool]] = None,
on_paste: Optional[Union[Var[bool], bool]] = None,
draw_focus_ring: Optional[Union[Var[bool], bool]] = None,
fixed_shadow_x: Optional[Union[Var[bool], bool]] = None,
@@ -134,38 +182,94 @@ class DataEditor(NoSSRComponent):
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[EventType[[]]] = None,
- on_cell_activated: Optional[EventType] = None,
- on_cell_clicked: Optional[EventType] = None,
- on_cell_context_menu: Optional[EventType] = None,
- on_cell_edited: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_column_resize: Optional[EventType] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_delete: Optional[EventType] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_finished_editing: Optional[EventType] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_group_header_clicked: Optional[EventType] = None,
- on_group_header_context_menu: Optional[EventType] = None,
- on_group_header_renamed: Optional[EventType] = None,
- on_header_clicked: Optional[EventType] = None,
- on_header_context_menu: Optional[EventType] = None,
- on_header_menu_click: Optional[EventType] = None,
- on_item_hovered: Optional[EventType] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_row_appended: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_selection_cleared: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_cell_activated: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[tuple[int, int]], BASE_STATE]]
+ ] = None,
+ on_cell_clicked: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[tuple[int, int]], BASE_STATE]]
+ ] = None,
+ on_cell_context_menu: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[tuple[int, int]], BASE_STATE]]
+ ] = None,
+ on_cell_edited: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[tuple[int, int]], BASE_STATE],
+ EventType[[tuple[int, int], GridCell], BASE_STATE],
+ ]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_column_resize: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[GridColumn], BASE_STATE],
+ EventType[[GridColumn, int], BASE_STATE],
+ ]
+ ] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_delete: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[GridSelection], BASE_STATE]]
+ ] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_finished_editing: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[Union[GridCell, None]], BASE_STATE],
+ EventType[[Union[GridCell, None], tuple[int, int]], BASE_STATE],
+ ]
+ ] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_group_header_clicked: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[tuple[int, int]], BASE_STATE],
+ EventType[[tuple[int, int], GridCell], BASE_STATE],
+ ]
+ ] = None,
+ on_group_header_context_menu: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[int], BASE_STATE],
+ EventType[[int, GroupHeaderClickedEventArgs], BASE_STATE],
+ ]
+ ] = None,
+ on_group_header_renamed: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, str], BASE_STATE],
+ ]
+ ] = None,
+ on_header_clicked: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[tuple[int, int]], BASE_STATE]]
+ ] = None,
+ on_header_context_menu: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[tuple[int, int]], BASE_STATE]]
+ ] = None,
+ on_header_menu_click: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[int], BASE_STATE],
+ EventType[[int, Rectangle], BASE_STATE],
+ ]
+ ] = None,
+ on_item_hovered: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[tuple[int, int]], BASE_STATE]]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_row_appended: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_selection_cleared: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DataEditor":
"""Create the DataEditor component.
@@ -176,7 +280,7 @@ class DataEditor(NoSSRComponent):
columns: Headers of the columns for the data grid.
data: The data.
get_cell_content: The name of the callback used to find the data to display.
- get_cell_for_selection: Allow selection for copying.
+ get_cells_for_selection: Allow selection for copying.
on_paste: Allow paste.
draw_focus_ring: Controls the drawing of the focus ring.
fixed_shadow_x: Enables or disables the overlay shadow when scrolling horizontally.
@@ -201,6 +305,22 @@ class DataEditor(NoSSRComponent):
scroll_offset_x: Initial scroll offset on the horizontal axis.
scroll_offset_y: Initial scroll offset on the vertical axis.
theme: global theme
+ on_cell_activated: Fired when a cell is activated.
+ on_cell_clicked: Fired when a cell is clicked.
+ on_cell_context_menu: Fired when a cell is right-clicked.
+ on_cell_edited: Fired when a cell is edited.
+ on_group_header_clicked: Fired when a group header is clicked.
+ on_group_header_context_menu: Fired when a group header is right-clicked.
+ on_group_header_renamed: Fired when a group header is renamed.
+ on_header_clicked: Fired when a header is clicked.
+ on_header_context_menu: Fired when a header is right-clicked.
+ on_header_menu_click: Fired when a header menu item is clicked.
+ on_item_hovered: Fired when an item is hovered.
+ on_delete: Fired when a selection is deleted.
+ on_finished_editing: Fired when editing is finished.
+ on_row_appended: Fired when a row is appended.
+ on_selection_cleared: Fired when the selection is cleared.
+ on_column_resize: Fired when a column is resized.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/datadisplay/logo.py b/reflex/components/datadisplay/logo.py
index beb9b9d10..d960b8cee 100644
--- a/reflex/components/datadisplay/logo.py
+++ b/reflex/components/datadisplay/logo.py
@@ -1,22 +1,23 @@
"""A Reflex logo component."""
+from typing import Union
+
import reflex as rx
-def logo(**props):
- """A Reflex logo.
+def svg_logo(color: Union[str, rx.Var[str]] = rx.color_mode_cond("#110F1F", "white")):
+ """A Reflex logo SVG.
Args:
- **props: The props to pass to the component.
+ color: The color of the logo.
Returns:
- The logo component.
+ The Reflex logo SVG.
"""
def logo_path(d):
return rx.el.svg.path(
d=d,
- fill=rx.color_mode_cond("#110F1F", "white"),
)
paths = [
@@ -28,18 +29,30 @@ def logo(**props):
"M47.04 4.8799V0.399902H49.28V4.8799H47.04ZM53.76 4.8799V0.399902H56V4.8799H53.76ZM49.28 7.1199V4.8799H53.76V7.1199H49.28ZM47.04 11.5999V7.1199H49.28V11.5999H47.04ZM53.76 11.5999V7.1199H56V11.5999H53.76Z",
]
+ return rx.el.svg(
+ *[logo_path(d) for d in paths],
+ width="56",
+ height="12",
+ viewBox="0 0 56 12",
+ fill=color,
+ xmlns="http://www.w3.org/2000/svg",
+ )
+
+
+def logo(**props):
+ """A Reflex logo.
+
+ Args:
+ **props: The props to pass to the component.
+
+ Returns:
+ The logo component.
+ """
return rx.center(
rx.link(
rx.hstack(
"Built with ",
- rx.el.svg(
- *[logo_path(d) for d in paths],
- width="56",
- height="12",
- viewBox="0 0 56 12",
- fill="none",
- xmlns="http://www.w3.org/2000/svg",
- ),
+ svg_logo(),
text_align="center",
align="center",
padding="1em",
diff --git a/reflex/components/datadisplay/shiki_code_block.py b/reflex/components/datadisplay/shiki_code_block.py
new file mode 100644
index 000000000..2b4e1f506
--- /dev/null
+++ b/reflex/components/datadisplay/shiki_code_block.py
@@ -0,0 +1,846 @@
+"""Shiki syntax hghlighter component."""
+
+from __future__ import annotations
+
+import re
+from collections import defaultdict
+from typing import Any, Literal, Optional, Union
+
+from reflex.base import Base
+from reflex.components.component import Component, ComponentNamespace
+from reflex.components.core.colors import color
+from reflex.components.core.cond import color_mode_cond
+from reflex.components.el.elements.forms import Button
+from reflex.components.lucide.icon import Icon
+from reflex.components.markdown.markdown import MarkdownComponentMap
+from reflex.components.props import NoExtrasAllowedProps
+from reflex.components.radix.themes.layout.box import Box
+from reflex.event import run_script, set_clipboard
+from reflex.style import Style
+from reflex.utils.exceptions import VarTypeError
+from reflex.utils.imports import ImportVar
+from reflex.vars.base import LiteralVar, Var
+from reflex.vars.function import FunctionStringVar
+from reflex.vars.sequence import StringVar, string_replace_operation
+
+
+def copy_script() -> Any:
+ """Copy script for the code block and modify the child SVG element.
+
+ Returns:
+ Any: The result of calling the script.
+ """
+ return run_script(
+ """
+// Event listener for the parent click
+document.addEventListener('click', function(event) {
+ // Find the closest button (parent element)
+ const parent = event.target.closest('button');
+ // If the parent is found
+ if (parent) {
+ // Find the SVG element within the parent
+ const svgIcon = parent.querySelector('svg');
+ // If the SVG exists, proceed with the script
+ if (svgIcon) {
+ const originalPath = svgIcon.innerHTML;
+ const checkmarkPath = ''; // Checkmark SVG path
+ function transition(element, scale, opacity) {
+ element.style.transform = `scale(${scale})`;
+ element.style.opacity = opacity;
+ }
+ // Animate the SVG
+ transition(svgIcon, 0, '0');
+ setTimeout(() => {
+ svgIcon.innerHTML = checkmarkPath; // Replace content with checkmark
+ svgIcon.setAttribute('viewBox', '0 0 24 24'); // Adjust viewBox if necessary
+ transition(svgIcon, 1, '1');
+ setTimeout(() => {
+ transition(svgIcon, 0, '0');
+ setTimeout(() => {
+ svgIcon.innerHTML = originalPath; // Restore original SVG content
+ transition(svgIcon, 1, '1');
+ }, 125);
+ }, 600);
+ }, 125);
+ } else {
+ // console.error('SVG element not found within the parent.');
+ }
+ } else {
+ // console.error('Parent element not found.');
+ }
+})
+"""
+ )
+
+
+SHIKIJS_TRANSFORMER_FNS = {
+ "transformerNotationDiff",
+ "transformerNotationHighlight",
+ "transformerNotationWordHighlight",
+ "transformerNotationFocus",
+ "transformerNotationErrorLevel",
+ "transformerRenderWhitespace",
+ "transformerMetaHighlight",
+ "transformerMetaWordHighlight",
+ "transformerCompactLineOptions",
+ # TODO: this transformer when included adds a weird behavior which removes other code lines. Need to figure out why.
+ # "transformerRemoveLineBreak",
+ "transformerRemoveNotationEscape",
+}
+LINE_NUMBER_STYLING = {
+ "code": {
+ "counter-reset": "step",
+ "counter-increment": "step 0",
+ "display": "grid",
+ "line-height": "1.7",
+ "font-size": "0.875em",
+ },
+ "code .line::before": {
+ "content": "counter(step)",
+ "counter-increment": "step",
+ "width": "1rem",
+ "margin-right": "1.5rem",
+ "display": "inline-block",
+ "text-align": "right",
+ "color": "rgba(115,138,148,.4)",
+ },
+}
+BOX_PARENT_STYLING = {
+ "pre": {
+ "margin": "0",
+ "padding": "24px",
+ "background": "transparent",
+ "overflow-x": "auto",
+ "border-radius": "6px",
+ },
+}
+
+THEME_MAPPING = {
+ "light": "one-light",
+ "dark": "one-dark-pro",
+ "a11y-dark": "github-dark",
+}
+LANGUAGE_MAPPING = {"bash": "shellscript"}
+LiteralCodeLanguage = Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+]
+LiteralCodeTheme = Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ # rose-pine themes dont work with the current version of shikijs transformers
+ # https://github.com/shikijs/shiki/issues/730
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+]
+
+
+class Position(NoExtrasAllowedProps):
+ """Position of the decoration."""
+
+ line: int
+ character: int
+
+
+class ShikiDecorations(NoExtrasAllowedProps):
+ """Decorations for the code block."""
+
+ start: Union[int, Position]
+ end: Union[int, Position]
+ tag_name: str = "span"
+ properties: dict[str, Any] = {}
+ always_wrap: bool = False
+
+
+class ShikiBaseTransformers(Base):
+ """Base for creating transformers."""
+
+ library: str
+ fns: list[FunctionStringVar]
+ style: Optional[Style]
+
+
+class ShikiJsTransformer(ShikiBaseTransformers):
+ """A Wrapped shikijs transformer."""
+
+ library: str = "@shikijs/transformers"
+ fns: list[FunctionStringVar] = [
+ FunctionStringVar.create(fn) for fn in SHIKIJS_TRANSFORMER_FNS
+ ]
+ style: Optional[Style] = Style(
+ {
+ "code": {"line-height": "1.7", "font-size": "0.875em", "display": "grid"},
+ # Diffs
+ ".diff": {
+ "margin": "0 -24px",
+ "padding": "0 24px",
+ "width": "calc(100% + 48px)",
+ "display": "inline-block",
+ },
+ ".diff.add": {
+ "background-color": "rgba(16, 185, 129, .14)",
+ "position": "relative",
+ },
+ ".diff.remove": {
+ "background-color": "rgba(244, 63, 94, .14)",
+ "opacity": "0.7",
+ "position": "relative",
+ },
+ ".diff.remove:after": {
+ "position": "absolute",
+ "left": "10px",
+ "content": "'-'",
+ "color": "#b34e52",
+ },
+ ".diff.add:after": {
+ "position": "absolute",
+ "left": "10px",
+ "content": "'+'",
+ "color": "#18794e",
+ },
+ # Highlight
+ ".highlighted": {
+ "background-color": "rgba(142, 150, 170, .14)",
+ "margin": "0 -24px",
+ "padding": "0 24px",
+ "width": "calc(100% + 48px)",
+ "display": "inline-block",
+ },
+ ".highlighted.error": {
+ "background-color": "rgba(244, 63, 94, .14)",
+ },
+ ".highlighted.warning": {
+ "background-color": "rgba(234, 179, 8, .14)",
+ },
+ # Highlighted Word
+ ".highlighted-word": {
+ "background-color": color("gray", 2),
+ "border": f"1px solid {color('gray', 5)}",
+ "padding": "1px 3px",
+ "margin": "-1px -3px",
+ "border-radius": "4px",
+ },
+ # Focused Lines
+ ".has-focused .line:not(.focused)": {
+ "opacity": "0.7",
+ "filter": "blur(0.095rem)",
+ "transition": "filter .35s, opacity .35s",
+ },
+ ".has-focused:hover .line:not(.focused)": {
+ "opacity": "1",
+ "filter": "none",
+ },
+ # White Space
+ # ".tab, .space": {
+ # "position": "relative",
+ # },
+ # ".tab::before": {
+ # "content": "'⇥'",
+ # "position": "absolute",
+ # "opacity": "0.3",
+ # },
+ # ".space::before": {
+ # "content": "'·'",
+ # "position": "absolute",
+ # "opacity": "0.3",
+ # },
+ }
+ )
+
+ def __init__(self, **kwargs):
+ """Initialize the transformer.
+
+ Args:
+ kwargs: Kwargs to initialize the props.
+
+ """
+ fns = kwargs.pop("fns", None)
+ style = kwargs.pop("style", None)
+ if fns:
+ kwargs["fns"] = [
+ (
+ FunctionStringVar.create(x)
+ if not isinstance(x, FunctionStringVar)
+ else x
+ )
+ for x in fns
+ ]
+
+ if style:
+ kwargs["style"] = Style(style)
+ super().__init__(**kwargs)
+
+
+class ShikiCodeBlock(Component, MarkdownComponentMap):
+ """A Code block."""
+
+ library = "/components/shiki/code"
+
+ tag = "Code"
+
+ alias = "ShikiCode"
+
+ lib_dependencies: list[str] = ["shiki"]
+
+ # The language to use.
+ language: Var[LiteralCodeLanguage] = Var.create("python")
+
+ # The theme to use ("light" or "dark").
+ theme: Var[LiteralCodeTheme] = Var.create("one-light")
+
+ # The set of themes to use for different modes.
+ themes: Var[Union[list[dict[str, Any]], dict[str, str]]]
+
+ # The code to display.
+ code: Var[str]
+
+ # The transformers to use for the syntax highlighter.
+ transformers: Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]] = Var.create(
+ []
+ )
+
+ # The decorations to use for the syntax highlighter.
+ decorations: Var[list[ShikiDecorations]] = Var.create([])
+
+ @classmethod
+ def create(
+ cls,
+ *children,
+ **props,
+ ) -> Component:
+ """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
+
+ Args:
+ *children: The children of the component.
+ **props: The props to pass to the component.
+
+ Returns:
+ The code block component.
+ """
+ # Separate props for the code block and the wrapper
+ code_block_props = {}
+ code_wrapper_props = {}
+ decorations = props.pop("decorations", [])
+
+ class_props = cls.get_props()
+
+ # Distribute props between the code block and wrapper
+ for key, value in props.items():
+ (code_block_props if key in class_props else code_wrapper_props)[key] = (
+ value
+ )
+
+ # cast decorations into ShikiDecorations.
+ decorations = [
+ ShikiDecorations(**decoration)
+ if not isinstance(decoration, ShikiDecorations)
+ else decoration
+ for decoration in decorations
+ ]
+ code_block_props["decorations"] = decorations
+
+ code_block_props["code"] = children[0]
+ code_block = super().create(**code_block_props)
+
+ transformer_styles = {}
+ # Collect styles from transformers and wrapper
+ for transformer in code_block.transformers._var_value: # type: ignore
+ if isinstance(transformer, ShikiBaseTransformers) and transformer.style:
+ transformer_styles.update(transformer.style)
+ transformer_styles.update(code_wrapper_props.pop("style", {}))
+
+ return Box.create(
+ code_block,
+ *children[1:],
+ style=Style({**transformer_styles, **BOX_PARENT_STYLING}),
+ **code_wrapper_props,
+ )
+
+ def add_imports(self) -> dict[str, list[str]]:
+ """Add the necessary imports.
+ We add all referenced transformer functions as imports from their corresponding
+ libraries.
+
+ Returns:
+ Imports for the component.
+ """
+ imports = defaultdict(list)
+ for transformer in self.transformers._var_value:
+ if isinstance(transformer, ShikiBaseTransformers):
+ imports[transformer.library].extend(
+ [ImportVar(tag=str(fn)) for fn in transformer.fns]
+ )
+ (
+ self.lib_dependencies.append(transformer.library)
+ if transformer.library not in self.lib_dependencies
+ else None
+ )
+ return imports
+
+ @classmethod
+ def create_transformer(cls, library: str, fns: list[str]) -> ShikiBaseTransformers:
+ """Create a transformer from a third party library.
+
+ Args:
+ library: The name of the library.
+ fns: The str names of the functions/callables to invoke from the library.
+
+ Returns:
+ A transformer for the specified library.
+
+ Raises:
+ ValueError: If a supplied function name is not valid str.
+ """
+ if any(not isinstance(fn_name, str) for fn_name in fns):
+ raise ValueError(
+ f"the function names should be str names of functions in the specified transformer: {library!r}"
+ )
+ return ShikiBaseTransformers( # type: ignore
+ library=library, fns=[FunctionStringVar.create(fn) for fn in fns]
+ )
+
+ def _render(self, props: dict[str, Any] | None = None):
+ """Renders the component with the given properties, processing transformers if present.
+
+ Args:
+ props: Optional properties to pass to the render function.
+
+ Returns:
+ Rendered component output.
+ """
+ # Ensure props is initialized from class attributes if not provided
+ props = props or {
+ attr.rstrip("_"): getattr(self, attr) for attr in self.get_props()
+ }
+
+ # Extract transformers and apply transformations
+ transformers = props.get("transformers")
+ if transformers is not None:
+ transformed_values = self._process_transformers(transformers._var_value)
+ props["transformers"] = LiteralVar.create(transformed_values)
+
+ return super()._render(props)
+
+ def _process_transformers(self, transformer_list: list) -> list:
+ """Processes a list of transformers, applying transformations where necessary.
+
+ Args:
+ transformer_list: List of transformer objects or values.
+
+ Returns:
+ list: A list of transformed values.
+ """
+ processed = []
+
+ for transformer in transformer_list:
+ if isinstance(transformer, ShikiBaseTransformers):
+ processed.extend(fn.call() for fn in transformer.fns)
+ else:
+ processed.append(transformer)
+
+ return processed
+
+
+class ShikiHighLevelCodeBlock(ShikiCodeBlock):
+ """High level component for the shiki syntax highlighter."""
+
+ # If this is enabled, the default transformers(shikijs transformer) will be used.
+ use_transformers: Var[bool]
+
+ # If this is enabled line numbers will be shown next to the code block.
+ show_line_numbers: Var[bool]
+
+ # Whether a copy button should appear.
+ can_copy: bool = False
+
+ # copy_button: A custom copy button to override the default one.
+ copy_button: Optional[Union[Component, bool]] = None
+
+ @classmethod
+ def create(
+ cls,
+ *children,
+ **props,
+ ) -> Component:
+ """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
+
+ Args:
+ *children: The children of the component.
+ **props: The props to pass to the component.
+
+ Returns:
+ The code block component.
+ """
+ use_transformers = props.pop("use_transformers", False)
+ show_line_numbers = props.pop("show_line_numbers", False)
+ language = props.pop("language", None)
+ can_copy = props.pop("can_copy", False)
+ copy_button = props.pop("copy_button", None)
+
+ if use_transformers:
+ props["transformers"] = [ShikiJsTransformer()]
+
+ if language is not None:
+ props["language"] = cls._map_languages(language)
+
+ # line numbers are generated via css
+ if show_line_numbers:
+ props["style"] = {**LINE_NUMBER_STYLING, **props.get("style", {})}
+
+ theme = props.pop("theme", None)
+ props["theme"] = props["theme"] = (
+ cls._map_themes(theme)
+ if theme is not None
+ else color_mode_cond( # Default color scheme responds to global color mode.
+ light="one-light",
+ dark="one-dark-pro",
+ )
+ )
+
+ if can_copy:
+ code = children[0]
+ copy_button = ( # type: ignore
+ copy_button
+ if copy_button is not None
+ else Button.create(
+ Icon.create(tag="copy", size=16, color=color("gray", 11)),
+ on_click=[
+ set_clipboard(cls._strip_transformer_triggers(code)), # type: ignore
+ copy_script(),
+ ],
+ style=Style(
+ {
+ "position": "absolute",
+ "top": "4px",
+ "right": "4px",
+ "background": color("gray", 3),
+ "border": "1px solid",
+ "border-color": color("gray", 5),
+ "border-radius": "6px",
+ "padding": "5px",
+ "opacity": "1",
+ "cursor": "pointer",
+ "_hover": {
+ "background": color("gray", 4),
+ },
+ "transition": "background 0.250s ease-out",
+ "&>svg": {
+ "transition": "transform 0.250s ease-out, opacity 0.250s ease-out",
+ },
+ "_active": {
+ "background": color("gray", 5),
+ },
+ }
+ ),
+ )
+ )
+
+ if copy_button:
+ return ShikiCodeBlock.create(
+ children[0], copy_button, position="relative", **props
+ )
+ else:
+ return ShikiCodeBlock.create(children[0], **props)
+
+ @staticmethod
+ def _map_themes(theme: str) -> str:
+ if isinstance(theme, str) and theme in THEME_MAPPING:
+ return THEME_MAPPING[theme]
+ return theme
+
+ @staticmethod
+ def _map_languages(language: str) -> str:
+ if isinstance(language, str) and language in LANGUAGE_MAPPING:
+ return LANGUAGE_MAPPING[language]
+ return language
+
+ @staticmethod
+ def _strip_transformer_triggers(code: str | StringVar) -> StringVar | str:
+ if not isinstance(code, (StringVar, str)):
+ raise VarTypeError(
+ f"code should be string literal or a StringVar type. Got {type(code)} instead."
+ )
+ regex_pattern = r"[\/#]+ *\[!code.*?\]"
+
+ if isinstance(code, Var):
+ return string_replace_operation(
+ code, StringVar(_js_expr=f"/{regex_pattern}/g", _var_type=str), ""
+ )
+ if isinstance(code, str):
+ return re.sub(regex_pattern, "", code)
+
+
+class TransformerNamespace(ComponentNamespace):
+ """Namespace for the Transformers."""
+
+ shikijs = ShikiJsTransformer
+
+
+class CodeblockNamespace(ComponentNamespace):
+ """Namespace for the CodeBlock component."""
+
+ root = staticmethod(ShikiCodeBlock.create)
+ create_transformer = staticmethod(ShikiCodeBlock.create_transformer)
+ transformers = TransformerNamespace()
+ __call__ = staticmethod(ShikiHighLevelCodeBlock.create)
+
+
+code_block = CodeblockNamespace()
diff --git a/reflex/components/datadisplay/shiki_code_block.pyi b/reflex/components/datadisplay/shiki_code_block.pyi
new file mode 100644
index 000000000..92546ee4f
--- /dev/null
+++ b/reflex/components/datadisplay/shiki_code_block.pyi
@@ -0,0 +1,2232 @@
+"""Stub file for reflex/components/datadisplay/shiki_code_block.py"""
+
+# ------------------- DO NOT EDIT ----------------------
+# This file was generated by `reflex/utils/pyi_generator.py`!
+# ------------------------------------------------------
+from typing import Any, Dict, Literal, Optional, Union, overload
+
+from reflex.base import Base
+from reflex.components.component import Component, ComponentNamespace
+from reflex.components.markdown.markdown import MarkdownComponentMap
+from reflex.components.props import NoExtrasAllowedProps
+from reflex.event import BASE_STATE, EventType
+from reflex.style import Style
+from reflex.vars.base import Var
+from reflex.vars.function import FunctionStringVar
+
+def copy_script() -> Any: ...
+
+SHIKIJS_TRANSFORMER_FNS = {
+ "transformerNotationDiff",
+ "transformerNotationHighlight",
+ "transformerNotationWordHighlight",
+ "transformerNotationFocus",
+ "transformerNotationErrorLevel",
+ "transformerRenderWhitespace",
+ "transformerMetaHighlight",
+ "transformerMetaWordHighlight",
+ "transformerCompactLineOptions",
+ "transformerRemoveNotationEscape",
+}
+LINE_NUMBER_STYLING = {
+ "code": {
+ "counter-reset": "step",
+ "counter-increment": "step 0",
+ "display": "grid",
+ "line-height": "1.7",
+ "font-size": "0.875em",
+ },
+ "code .line::before": {
+ "content": "counter(step)",
+ "counter-increment": "step",
+ "width": "1rem",
+ "margin-right": "1.5rem",
+ "display": "inline-block",
+ "text-align": "right",
+ "color": "rgba(115,138,148,.4)",
+ },
+}
+BOX_PARENT_STYLING = {
+ "pre": {
+ "margin": "0",
+ "padding": "24px",
+ "background": "transparent",
+ "overflow-x": "auto",
+ "border-radius": "6px",
+ }
+}
+THEME_MAPPING = {
+ "light": "one-light",
+ "dark": "one-dark-pro",
+ "a11y-dark": "github-dark",
+}
+LANGUAGE_MAPPING = {"bash": "shellscript"}
+LiteralCodeLanguage = Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+]
+LiteralCodeTheme = Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+]
+
+class Position(NoExtrasAllowedProps):
+ line: int
+ character: int
+
+class ShikiDecorations(NoExtrasAllowedProps):
+ start: Union[int, Position]
+ end: Union[int, Position]
+ tag_name: str
+ properties: dict[str, Any]
+ always_wrap: bool
+
+class ShikiBaseTransformers(Base):
+ library: str
+ fns: list[FunctionStringVar]
+ style: Optional[Style]
+
+class ShikiJsTransformer(ShikiBaseTransformers):
+ library: str
+ fns: list[FunctionStringVar]
+ style: Optional[Style]
+
+class ShikiCodeBlock(Component, MarkdownComponentMap):
+ @overload
+ @classmethod
+ def create( # type: ignore
+ cls,
+ *children,
+ language: Optional[
+ Union[
+ Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+ ],
+ Var[
+ Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+ ]
+ ],
+ ]
+ ] = None,
+ theme: Optional[
+ Union[
+ Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+ ],
+ Var[
+ Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+ ]
+ ],
+ ]
+ ] = None,
+ themes: Optional[
+ Union[
+ Var[Union[dict[str, str], list[dict[str, Any]]]],
+ dict[str, str],
+ list[dict[str, Any]],
+ ]
+ ] = None,
+ code: Optional[Union[Var[str], str]] = None,
+ transformers: Optional[
+ Union[
+ Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]],
+ list[Union[ShikiBaseTransformers, dict[str, Any]]],
+ ]
+ ] = None,
+ decorations: Optional[
+ Union[Var[list[ShikiDecorations]], list[ShikiDecorations]]
+ ] = 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, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ **props,
+ ) -> "ShikiCodeBlock":
+ """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
+
+ Args:
+ *children: The children of the component.
+ language: The language to use.
+ theme: The theme to use ("light" or "dark").
+ themes: The set of themes to use for different modes.
+ code: The code to display.
+ transformers: The transformers to use for the syntax highlighter.
+ decorations: The decorations to use for the syntax highlighter.
+ 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 to pass to the component.
+
+ Returns:
+ The code block component.
+ """
+ ...
+
+ def add_imports(self) -> dict[str, list[str]]: ...
+ @classmethod
+ def create_transformer(
+ cls, library: str, fns: list[str]
+ ) -> ShikiBaseTransformers: ...
+
+class ShikiHighLevelCodeBlock(ShikiCodeBlock):
+ @overload
+ @classmethod
+ def create( # type: ignore
+ cls,
+ *children,
+ use_transformers: Optional[Union[Var[bool], bool]] = None,
+ show_line_numbers: Optional[Union[Var[bool], bool]] = None,
+ can_copy: Optional[bool] = None,
+ copy_button: Optional[Union[Component, bool]] = None,
+ language: Optional[
+ Union[
+ Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+ ],
+ Var[
+ Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+ ]
+ ],
+ ]
+ ] = None,
+ theme: Optional[
+ Union[
+ Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+ ],
+ Var[
+ Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+ ]
+ ],
+ ]
+ ] = None,
+ themes: Optional[
+ Union[
+ Var[Union[dict[str, str], list[dict[str, Any]]]],
+ dict[str, str],
+ list[dict[str, Any]],
+ ]
+ ] = None,
+ code: Optional[Union[Var[str], str]] = None,
+ transformers: Optional[
+ Union[
+ Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]],
+ list[Union[ShikiBaseTransformers, dict[str, Any]]],
+ ]
+ ] = None,
+ decorations: Optional[
+ Union[Var[list[ShikiDecorations]], list[ShikiDecorations]]
+ ] = 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, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ **props,
+ ) -> "ShikiHighLevelCodeBlock":
+ """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
+
+ Args:
+ *children: The children of the component.
+ use_transformers: If this is enabled, the default transformers(shikijs transformer) will be used.
+ show_line_numbers: If this is enabled line numbers will be shown next to the code block.
+ can_copy: Whether a copy button should appear.
+ copy_button: copy_button: A custom copy button to override the default one.
+ language: The language to use.
+ theme: The theme to use ("light" or "dark").
+ themes: The set of themes to use for different modes.
+ code: The code to display.
+ transformers: The transformers to use for the syntax highlighter.
+ decorations: The decorations to use for the syntax highlighter.
+ 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 to pass to the component.
+
+ Returns:
+ The code block component.
+ """
+ ...
+
+class TransformerNamespace(ComponentNamespace):
+ shikijs = ShikiJsTransformer
+
+class CodeblockNamespace(ComponentNamespace):
+ root = staticmethod(ShikiCodeBlock.create)
+ create_transformer = staticmethod(ShikiCodeBlock.create_transformer)
+ transformers = TransformerNamespace()
+
+ @staticmethod
+ def __call__(
+ *children,
+ use_transformers: Optional[Union[Var[bool], bool]] = None,
+ show_line_numbers: Optional[Union[Var[bool], bool]] = None,
+ can_copy: Optional[bool] = None,
+ copy_button: Optional[Union[Component, bool]] = None,
+ language: Optional[
+ Union[
+ Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+ ],
+ Var[
+ Literal[
+ "abap",
+ "actionscript-3",
+ "ada",
+ "angular-html",
+ "angular-ts",
+ "apache",
+ "apex",
+ "apl",
+ "applescript",
+ "ara",
+ "asciidoc",
+ "asm",
+ "astro",
+ "awk",
+ "ballerina",
+ "bat",
+ "beancount",
+ "berry",
+ "bibtex",
+ "bicep",
+ "blade",
+ "c",
+ "cadence",
+ "clarity",
+ "clojure",
+ "cmake",
+ "cobol",
+ "codeowners",
+ "codeql",
+ "coffee",
+ "common-lisp",
+ "coq",
+ "cpp",
+ "crystal",
+ "csharp",
+ "css",
+ "csv",
+ "cue",
+ "cypher",
+ "d",
+ "dart",
+ "dax",
+ "desktop",
+ "diff",
+ "docker",
+ "dotenv",
+ "dream-maker",
+ "edge",
+ "elixir",
+ "elm",
+ "emacs-lisp",
+ "erb",
+ "erlang",
+ "fennel",
+ "fish",
+ "fluent",
+ "fortran-fixed-form",
+ "fortran-free-form",
+ "fsharp",
+ "gdresource",
+ "gdscript",
+ "gdshader",
+ "genie",
+ "gherkin",
+ "git-commit",
+ "git-rebase",
+ "gleam",
+ "glimmer-js",
+ "glimmer-ts",
+ "glsl",
+ "gnuplot",
+ "go",
+ "graphql",
+ "groovy",
+ "hack",
+ "haml",
+ "handlebars",
+ "haskell",
+ "haxe",
+ "hcl",
+ "hjson",
+ "hlsl",
+ "html",
+ "html-derivative",
+ "http",
+ "hxml",
+ "hy",
+ "imba",
+ "ini",
+ "java",
+ "javascript",
+ "jinja",
+ "jison",
+ "json",
+ "json5",
+ "jsonc",
+ "jsonl",
+ "jsonnet",
+ "jssm",
+ "jsx",
+ "julia",
+ "kotlin",
+ "kusto",
+ "latex",
+ "lean",
+ "less",
+ "liquid",
+ "log",
+ "logo",
+ "lua",
+ "luau",
+ "make",
+ "markdown",
+ "marko",
+ "matlab",
+ "mdc",
+ "mdx",
+ "mermaid",
+ "mojo",
+ "move",
+ "narrat",
+ "nextflow",
+ "nginx",
+ "nim",
+ "nix",
+ "nushell",
+ "objective-c",
+ "objective-cpp",
+ "ocaml",
+ "pascal",
+ "perl",
+ "php",
+ "plain",
+ "plsql",
+ "po",
+ "postcss",
+ "powerquery",
+ "powershell",
+ "prisma",
+ "prolog",
+ "proto",
+ "pug",
+ "puppet",
+ "purescript",
+ "python",
+ "qml",
+ "qmldir",
+ "qss",
+ "r",
+ "racket",
+ "raku",
+ "razor",
+ "reg",
+ "regexp",
+ "rel",
+ "riscv",
+ "rst",
+ "ruby",
+ "rust",
+ "sas",
+ "sass",
+ "scala",
+ "scheme",
+ "scss",
+ "shaderlab",
+ "shellscript",
+ "shellsession",
+ "smalltalk",
+ "solidity",
+ "soy",
+ "sparql",
+ "splunk",
+ "sql",
+ "ssh-config",
+ "stata",
+ "stylus",
+ "svelte",
+ "swift",
+ "system-verilog",
+ "systemd",
+ "tasl",
+ "tcl",
+ "templ",
+ "terraform",
+ "tex",
+ "toml",
+ "ts-tags",
+ "tsv",
+ "tsx",
+ "turtle",
+ "twig",
+ "typescript",
+ "typespec",
+ "typst",
+ "v",
+ "vala",
+ "vb",
+ "verilog",
+ "vhdl",
+ "viml",
+ "vue",
+ "vue-html",
+ "vyper",
+ "wasm",
+ "wenyan",
+ "wgsl",
+ "wikitext",
+ "wolfram",
+ "xml",
+ "xsl",
+ "yaml",
+ "zenscript",
+ "zig",
+ ]
+ ],
+ ]
+ ] = None,
+ theme: Optional[
+ Union[
+ Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+ ],
+ Var[
+ Literal[
+ "andromeeda",
+ "aurora-x",
+ "ayu-dark",
+ "catppuccin-frappe",
+ "catppuccin-latte",
+ "catppuccin-macchiato",
+ "catppuccin-mocha",
+ "dark-plus",
+ "dracula",
+ "dracula-soft",
+ "everforest-dark",
+ "everforest-light",
+ "github-dark",
+ "github-dark-default",
+ "github-dark-dimmed",
+ "github-dark-high-contrast",
+ "github-light",
+ "github-light-default",
+ "github-light-high-contrast",
+ "houston",
+ "laserwave",
+ "light-plus",
+ "material-theme",
+ "material-theme-darker",
+ "material-theme-lighter",
+ "material-theme-ocean",
+ "material-theme-palenight",
+ "min-dark",
+ "min-light",
+ "monokai",
+ "night-owl",
+ "nord",
+ "one-dark-pro",
+ "one-light",
+ "plastic",
+ "poimandres",
+ "red",
+ "rose-pine",
+ "rose-pine-dawn",
+ "rose-pine-moon",
+ "slack-dark",
+ "slack-ochin",
+ "snazzy-light",
+ "solarized-dark",
+ "solarized-light",
+ "synthwave-84",
+ "tokyo-night",
+ "vesper",
+ "vitesse-black",
+ "vitesse-dark",
+ "vitesse-light",
+ ]
+ ],
+ ]
+ ] = None,
+ themes: Optional[
+ Union[
+ Var[Union[dict[str, str], list[dict[str, Any]]]],
+ dict[str, str],
+ list[dict[str, Any]],
+ ]
+ ] = None,
+ code: Optional[Union[Var[str], str]] = None,
+ transformers: Optional[
+ Union[
+ Var[list[Union[ShikiBaseTransformers, dict[str, Any]]]],
+ list[Union[ShikiBaseTransformers, dict[str, Any]]],
+ ]
+ ] = None,
+ decorations: Optional[
+ Union[Var[list[ShikiDecorations]], list[ShikiDecorations]]
+ ] = 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, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ **props,
+ ) -> "ShikiHighLevelCodeBlock":
+ """Create a code block component using [shiki syntax highlighter](https://shiki.matsu.io/).
+
+ Args:
+ *children: The children of the component.
+ use_transformers: If this is enabled, the default transformers(shikijs transformer) will be used.
+ show_line_numbers: If this is enabled line numbers will be shown next to the code block.
+ can_copy: Whether a copy button should appear.
+ copy_button: copy_button: A custom copy button to override the default one.
+ language: The language to use.
+ theme: The theme to use ("light" or "dark").
+ themes: The set of themes to use for different modes.
+ code: The code to display.
+ transformers: The transformers to use for the syntax highlighter.
+ decorations: The decorations to use for the syntax highlighter.
+ 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 to pass to the component.
+
+ Returns:
+ The code block component.
+ """
+ ...
+
+code_block = CodeblockNamespace()
diff --git a/reflex/components/dynamic.py b/reflex/components/dynamic.py
index 9c498fb61..ce59c3f30 100644
--- a/reflex/components/dynamic.py
+++ b/reflex/components/dynamic.py
@@ -63,6 +63,9 @@ def load_dynamic_serializer():
"""
# Causes a circular import, so we import here.
from reflex.compiler import templates, utils
+ from reflex.components.base.bare import Bare
+
+ component = Bare.create(Var.create(component))
rendered_components = {}
# Include dynamic imports in the shared component.
@@ -90,7 +93,7 @@ def load_dynamic_serializer():
for lib, names in component._get_all_imports().items():
formatted_lib_name = format_library_name(lib)
if (
- not lib.startswith((".", "/"))
+ not lib.startswith((".", "/", "$/"))
and not lib.startswith("http")
and formatted_lib_name not in libs_in_window
):
@@ -106,11 +109,11 @@ def load_dynamic_serializer():
# Rewrite imports from `/` to destructure from window
for ix, line in enumerate(module_code_lines[:]):
if line.startswith("import "):
- if 'from "/' in line:
+ if 'from "$/' in line or 'from "/' in line:
module_code_lines[ix] = (
- line.replace("import ", "const ", 1).replace(
- " from ", " = window['__reflex'][", 1
- )
+ line.replace("import ", "const ", 1)
+ .replace(" as ", ": ")
+ .replace(" from ", " = window['__reflex'][", 1)
+ "]"
)
else:
@@ -127,14 +130,15 @@ def load_dynamic_serializer():
module_code_lines[ix] = line.replace(
"export function", "export default function", 1
)
+ line_stripped = line.strip()
+ if line_stripped.startswith("{") and line_stripped.endswith("}"):
+ module_code_lines[ix] = line_stripped[1:-1]
module_code_lines.insert(0, "const React = window.__reflex.react;")
return "\n".join(
[
"//__reflex_evaluate",
- "/** @jsx jsx */",
- "const { jsx } = window.__reflex['@emotion/react']",
*module_code_lines,
]
)
@@ -157,7 +161,7 @@ def load_dynamic_serializer():
merge_var_data=VarData.merge(
VarData(
imports={
- f"/{constants.Dirs.STATE_PATH}": [
+ f"$/{constants.Dirs.STATE_PATH}": [
imports.ImportVar(tag="evalReactComponent"),
],
"react": [
diff --git a/reflex/components/el/__init__.pyi b/reflex/components/el/__init__.pyi
index 4815bcd27..cbfb65f58 100644
--- a/reflex/components/el/__init__.pyi
+++ b/reflex/components/el/__init__.pyi
@@ -5,6 +5,7 @@
from . import elements as elements
from .elements.forms import Button as Button
+from .elements.forms import Datalist as Datalist
from .elements.forms import Fieldset as Fieldset
from .elements.forms import Form as Form
from .elements.forms import Input as Input
@@ -18,6 +19,7 @@ from .elements.forms import Progress as Progress
from .elements.forms import Select as Select
from .elements.forms import Textarea as Textarea
from .elements.forms import button as button
+from .elements.forms import datalist as datalist
from .elements.forms import fieldset as fieldset
from .elements.forms import form as form
from .elements.forms import input as input
diff --git a/reflex/components/el/element.pyi b/reflex/components/el/element.pyi
index f6d76cd02..de5dee956 100644
--- a/reflex/components/el/element.pyi
+++ b/reflex/components/el/element.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,22 +21,22 @@ class Element(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Element":
"""Create the component.
diff --git a/reflex/components/el/elements/__init__.py b/reflex/components/el/elements/__init__.py
index 17fdb77ca..45a7e04b8 100644
--- a/reflex/components/el/elements/__init__.py
+++ b/reflex/components/el/elements/__init__.py
@@ -7,6 +7,7 @@ from reflex.utils import lazy_loader
_MAPPING = {
"forms": [
"button",
+ "datalist",
"fieldset",
"form",
"input",
diff --git a/reflex/components/el/elements/__init__.pyi b/reflex/components/el/elements/__init__.pyi
index b35e70dd2..c96a80987 100644
--- a/reflex/components/el/elements/__init__.pyi
+++ b/reflex/components/el/elements/__init__.pyi
@@ -4,6 +4,7 @@
# ------------------------------------------------------
from .forms import Button as Button
+from .forms import Datalist as Datalist
from .forms import Fieldset as Fieldset
from .forms import Form as Form
from .forms import Input as Input
@@ -17,6 +18,7 @@ from .forms import Progress as Progress
from .forms import Select as Select
from .forms import Textarea as Textarea
from .forms import button as button
+from .forms import datalist as datalist
from .forms import fieldset as fieldset
from .forms import form as form
from .forms import input as input
@@ -226,6 +228,7 @@ from .typography import ul as ul
_MAPPING = {
"forms": [
"button",
+ "datalist",
"fieldset",
"form",
"input",
diff --git a/reflex/components/el/elements/base.pyi b/reflex/components/el/elements/base.pyi
index 6e943d0d0..4d1d2c5c4 100644
--- a/reflex/components/el/elements/base.pyi
+++ b/reflex/components/el/elements/base.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.el.element import Element
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -45,22 +45,22 @@ class BaseHTML(Element):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "BaseHTML":
"""Create the component.
diff --git a/reflex/components/el/elements/forms.py b/reflex/components/el/elements/forms.py
index a343991d5..56dab5c7f 100644
--- a/reflex/components/el/elements/forms.py
+++ b/reflex/components/el/elements/forms.py
@@ -111,6 +111,15 @@ def on_submit_event_spec() -> Tuple[Var[Dict[str, Any]]]:
return (FORM_DATA,)
+def on_submit_string_event_spec() -> Tuple[Var[Dict[str, str]]]:
+ """Event handler spec for the on_submit event.
+
+ Returns:
+ The event handler spec.
+ """
+ return (FORM_DATA,)
+
+
class Form(BaseHTML):
"""Display the form element."""
@@ -150,7 +159,7 @@ class Form(BaseHTML):
handle_submit_unique_name: Var[str]
# Fired when the form is submitted
- on_submit: EventHandler[on_submit_event_spec]
+ on_submit: EventHandler[on_submit_event_spec, on_submit_string_event_spec]
@classmethod
def create(cls, *children, **props):
@@ -187,7 +196,7 @@ class Form(BaseHTML):
"""
return {
"react": "useCallback",
- f"/{Dirs.STATE_PATH}": ["getRefValue", "getRefValues"],
+ f"$/{Dirs.STATE_PATH}": ["getRefValue", "getRefValues"],
}
def add_hooks(self) -> list[str]:
@@ -230,13 +239,13 @@ class Form(BaseHTML):
# when ref start with refs_ it's an array of refs, so we need different method
# to collect data
if ref.startswith("refs_"):
- ref_var = Var(_js_expr=ref[:-3]).as_ref()
+ ref_var = Var(_js_expr=ref[:-3])._as_ref()
form_refs[ref[len("refs_") : -3]] = Var(
_js_expr=f"getRefValues({str(ref_var)})",
_var_data=VarData.merge(ref_var._get_all_var_data()),
)
else:
- ref_var = Var(_js_expr=ref).as_ref()
+ ref_var = Var(_js_expr=ref)._as_ref()
form_refs[ref[4:]] = Var(
_js_expr=f"getRefValue({str(ref_var)})",
_var_data=VarData.merge(ref_var._get_all_var_data()),
@@ -561,6 +570,9 @@ class Textarea(BaseHTML):
# Visible width of the text control, in average character widths
cols: Var[Union[str, int, bool]]
+ # The default value of the textarea when initially rendered
+ default_value: Var[str]
+
# Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted
dirname: Var[Union[str, int, bool]]
@@ -615,6 +627,42 @@ class Textarea(BaseHTML):
# Fired when a key is released
on_key_up: EventHandler[key_event]
+ @classmethod
+ def create(cls, *children, **props):
+ """Create a textarea component.
+
+ Args:
+ *children: The children of the textarea.
+ **props: The properties of the textarea.
+
+ Returns:
+ The textarea component.
+
+ Raises:
+ ValueError: when `enter_key_submit` is combined with `on_key_down`.
+ """
+ enter_key_submit = props.get("enter_key_submit")
+ auto_height = props.get("auto_height")
+ custom_attrs = props.setdefault("custom_attrs", {})
+
+ if enter_key_submit is not None:
+ enter_key_submit = Var.create(enter_key_submit)
+ if "on_key_down" in props:
+ raise ValueError(
+ "Cannot combine `enter_key_submit` with `on_key_down`.",
+ )
+ custom_attrs["on_key_down"] = Var(
+ _js_expr=f"(e) => enterKeySubmitOnKeyDown(e, {str(enter_key_submit)})",
+ _var_data=VarData.merge(enter_key_submit._get_all_var_data()),
+ )
+ if auto_height is not None:
+ auto_height = Var.create(auto_height)
+ custom_attrs["on_input"] = Var(
+ _js_expr=f"(e) => autoHeightOnInput(e, {str(auto_height)})",
+ _var_data=VarData.merge(auto_height._get_all_var_data()),
+ )
+ return super().create(*children, **props)
+
def _exclude_props(self) -> list[str]:
return super()._exclude_props() + [
"auto_height",
@@ -634,30 +682,9 @@ class Textarea(BaseHTML):
custom_code.add(ENTER_KEY_SUBMIT_JS)
return custom_code
- def _render(self) -> Tag:
- tag = super()._render()
- if self.enter_key_submit is not None:
- if "on_key_down" in self.event_triggers:
- raise ValueError(
- "Cannot combine `enter_key_submit` with `on_key_down`.",
- )
- tag.add_props(
- on_key_down=Var(
- _js_expr=f"(e) => enterKeySubmitOnKeyDown(e, {str(self.enter_key_submit)})",
- _var_data=VarData.merge(self.enter_key_submit._get_all_var_data()),
- )
- )
- if self.auto_height is not None:
- tag.add_props(
- on_input=Var(
- _js_expr=f"(e) => autoHeightOnInput(e, {str(self.auto_height)})",
- _var_data=VarData.merge(self.auto_height._get_all_var_data()),
- )
- )
- return tag
-
button = Button.create
+datalist = Datalist.create
fieldset = Fieldset.create
form = Form.create
input = Input.create
diff --git a/reflex/components/el/elements/forms.pyi b/reflex/components/el/elements/forms.pyi
index 135291213..e2d659338 100644
--- a/reflex/components/el/elements/forms.pyi
+++ b/reflex/components/el/elements/forms.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, Optional, Tuple, Union, overload
from jinja2 import Environment
from reflex.components.el.element import Element
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType, KeyInputInfo
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
@@ -70,22 +70,22 @@ class Button(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Button":
"""Create the component.
@@ -167,22 +167,22 @@ class Datalist(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Datalist":
"""Create the component.
@@ -232,22 +232,22 @@ class Fieldset(Element):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Fieldset":
"""Create the component.
@@ -271,6 +271,7 @@ class Fieldset(Element):
...
def on_submit_event_spec() -> Tuple[Var[Dict[str, Any]]]: ...
+def on_submit_string_event_spec() -> Tuple[Var[Dict[str, str]]]: ...
class Form(BaseHTML):
@overload
@@ -322,23 +323,32 @@ class Form(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_submit: Optional[EventType[Dict[str, Any]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_submit: Optional[
+ Union[
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, Any]], BASE_STATE]
+ ],
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, str]], BASE_STATE]
+ ],
+ ]
+ ] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Form":
"""Create a form component.
@@ -356,6 +366,7 @@ class Form(BaseHTML):
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.
+ 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.
@@ -462,25 +473,43 @@ class Input(BaseHTML):
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[EventType[str]] = None,
- on_change: Optional[EventType[str]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[str]] = None,
- on_key_down: Optional[EventType[str]] = None,
- on_key_up: Optional[EventType[str]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_key_down: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_key_up: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Input":
"""Create the component.
@@ -520,6 +549,11 @@ class Input(BaseHTML):
type: Specifies the type of input
use_map: Name of the image map used with the input
value: Value of the input
+ on_change: Fired when the input value changes
+ on_focus: Fired when the input gains focus
+ on_blur: Fired when the input loses focus
+ on_key_down: Fired when a key is pressed down
+ on_key_up: Fired when a key is released
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.
@@ -586,22 +620,22 @@ class Label(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Label":
"""Create the component.
@@ -674,22 +708,22 @@ class Legend(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Legend":
"""Create the component.
@@ -767,22 +801,22 @@ class Meter(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Meter":
"""Create the component.
@@ -862,22 +896,22 @@ class Optgroup(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Optgroup":
"""Create the component.
@@ -954,22 +988,22 @@ class Option(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Option":
"""Create the component.
@@ -1047,22 +1081,22 @@ class Output(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Output":
"""Create the component.
@@ -1139,22 +1173,22 @@ class Progress(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Progress":
"""Create the component.
@@ -1238,23 +1272,25 @@ class Select(BaseHTML):
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[EventType[[]]] = None,
- on_change: Optional[EventType[str]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Select":
"""Create the component.
@@ -1269,6 +1305,7 @@ class Select(BaseHTML):
name: Name of the select, used when submitting the form
required: Indicates that the select control must have a selected option
size: Number of visible options in a drop-down list
+ on_change: Fired when the select value changes
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.
@@ -1313,6 +1350,7 @@ class Textarea(BaseHTML):
auto_focus: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
auto_height: Optional[Union[Var[bool], bool]] = None,
cols: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
+ default_value: Optional[Union[Var[str], str]] = None,
dirname: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
disabled: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
enter_key_submit: Optional[Union[Var[bool], bool]] = None,
@@ -1355,35 +1393,54 @@ class Textarea(BaseHTML):
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[EventType[str]] = None,
- on_change: Optional[EventType[str]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[str]] = None,
- on_key_down: Optional[EventType[str]] = None,
- on_key_up: Optional[EventType[str]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_key_down: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_key_up: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Textarea":
- """Create the component.
+ """Create a textarea component.
Args:
- *children: The children of the component.
+ *children: The children of the textarea.
auto_complete: Whether the form control should have autocomplete enabled
auto_focus: Automatically focuses the textarea when the page loads
auto_height: Automatically fit the content height to the text (use min-height with this prop)
cols: Visible width of the text control, in average character widths
+ default_value: The default value of the textarea when initially rendered
dirname: Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted
disabled: Disables the textarea
enter_key_submit: Enter key submits form (shift-enter adds new line)
@@ -1397,6 +1454,11 @@ class Textarea(BaseHTML):
rows: Visible number of lines in the text control
value: The controlled value of the textarea, read only unless used with on_change
wrap: How the text in the textarea is to be wrapped when submitting the form
+ on_change: Fired when the input value changes
+ on_focus: Fired when the input gains focus
+ on_blur: Fired when the input loses focus
+ on_key_down: Fired when a key is pressed down
+ on_key_up: Fired when a key is released
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.
@@ -1419,14 +1481,18 @@ class Textarea(BaseHTML):
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 textarea.
Returns:
- The component.
+ The textarea component.
+
+ Raises:
+ ValueError: when `enter_key_submit` is combined with `on_key_down`.
"""
...
button = Button.create
+datalist = Datalist.create
fieldset = Fieldset.create
form = Form.create
input = Input.create
diff --git a/reflex/components/el/elements/inline.pyi b/reflex/components/el/elements/inline.pyi
index 336e4d3de..1b4af4fc8 100644
--- a/reflex/components/el/elements/inline.pyi
+++ b/reflex/components/el/elements/inline.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -57,22 +57,22 @@ class A(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "A":
"""Create the component.
@@ -152,22 +152,22 @@ class Abbr(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Abbr":
"""Create the component.
@@ -238,22 +238,22 @@ class B(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "B":
"""Create the component.
@@ -324,22 +324,22 @@ class Bdi(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Bdi":
"""Create the component.
@@ -410,22 +410,22 @@ class Bdo(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Bdo":
"""Create the component.
@@ -496,22 +496,22 @@ class Br(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Br":
"""Create the component.
@@ -582,22 +582,22 @@ class Cite(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Cite":
"""Create the component.
@@ -668,22 +668,22 @@ class Code(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Code":
"""Create the component.
@@ -755,22 +755,22 @@ class Data(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Data":
"""Create the component.
@@ -842,22 +842,22 @@ class Dfn(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Dfn":
"""Create the component.
@@ -928,22 +928,22 @@ class Em(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Em":
"""Create the component.
@@ -1014,22 +1014,22 @@ class I(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "I":
"""Create the component.
@@ -1100,22 +1100,22 @@ class Kbd(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Kbd":
"""Create the component.
@@ -1186,22 +1186,22 @@ class Mark(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Mark":
"""Create the component.
@@ -1273,22 +1273,22 @@ class Q(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Q":
"""Create the component.
@@ -1360,22 +1360,22 @@ class Rp(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Rp":
"""Create the component.
@@ -1446,22 +1446,22 @@ class Rt(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Rt":
"""Create the component.
@@ -1532,22 +1532,22 @@ class Ruby(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Ruby":
"""Create the component.
@@ -1618,22 +1618,22 @@ class S(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "S":
"""Create the component.
@@ -1704,22 +1704,22 @@ class Samp(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Samp":
"""Create the component.
@@ -1790,22 +1790,22 @@ class Small(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Small":
"""Create the component.
@@ -1876,22 +1876,22 @@ class Span(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Span":
"""Create the component.
@@ -1962,22 +1962,22 @@ class Strong(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Strong":
"""Create the component.
@@ -2048,22 +2048,22 @@ class Sub(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Sub":
"""Create the component.
@@ -2134,22 +2134,22 @@ class Sup(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Sup":
"""Create the component.
@@ -2221,22 +2221,22 @@ class Time(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Time":
"""Create the component.
@@ -2308,22 +2308,22 @@ class U(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "U":
"""Create the component.
@@ -2394,22 +2394,22 @@ class Wbr(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Wbr":
"""Create the component.
diff --git a/reflex/components/el/elements/media.pyi b/reflex/components/el/elements/media.pyi
index 382f3c79c..edaf1228e 100644
--- a/reflex/components/el/elements/media.pyi
+++ b/reflex/components/el/elements/media.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Optional, Union, overload
from reflex import ComponentNamespace
from reflex.constants.colors import Color
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -61,22 +61,22 @@ class Area(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Area":
"""Create the component.
@@ -168,22 +168,22 @@ class Audio(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Audio":
"""Create the component.
@@ -280,22 +280,22 @@ class Img(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Img":
"""Override create method to apply source attribute to value if user fails to pass in attribute.
@@ -380,22 +380,22 @@ class Map(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Map":
"""Create the component.
@@ -472,22 +472,22 @@ class Track(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Track":
"""Create the component.
@@ -577,22 +577,22 @@ class Video(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Video":
"""Create the component.
@@ -675,22 +675,22 @@ class Embed(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Embed":
"""Create the component.
@@ -774,22 +774,22 @@ class Iframe(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Iframe":
"""Create the component.
@@ -874,22 +874,22 @@ class Object(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Object":
"""Create the component.
@@ -965,22 +965,22 @@ class Picture(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Picture":
"""Create the component.
@@ -1051,22 +1051,22 @@ class Portal(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Portal":
"""Create the component.
@@ -1142,22 +1142,22 @@ class Source(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Source":
"""Create the component.
@@ -1236,22 +1236,22 @@ class Svg(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Svg":
"""Create the component.
@@ -1332,22 +1332,22 @@ class Text(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Text":
"""Create the component.
@@ -1430,22 +1430,22 @@ class Line(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Line":
"""Create the component.
@@ -1525,22 +1525,22 @@ class Circle(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Circle":
"""Create the component.
@@ -1620,22 +1620,22 @@ class Ellipse(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Ellipse":
"""Create the component.
@@ -1718,22 +1718,22 @@ class Rect(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Rect":
"""Create the component.
@@ -1813,22 +1813,22 @@ class Polygon(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Polygon":
"""Create the component.
@@ -1901,22 +1901,22 @@ class Defs(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Defs":
"""Create the component.
@@ -1994,22 +1994,22 @@ class LinearGradient(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "LinearGradient":
"""Create the component.
@@ -2096,22 +2096,22 @@ class RadialGradient(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadialGradient":
"""Create the component.
@@ -2198,22 +2198,22 @@ class Stop(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Stop":
"""Create the component.
@@ -2288,22 +2288,22 @@ class Path(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Path":
"""Create the component.
@@ -2388,22 +2388,22 @@ class SVG(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Svg":
"""Create the component.
diff --git a/reflex/components/el/elements/metadata.pyi b/reflex/components/el/elements/metadata.pyi
index 498695a80..5af92e2b2 100644
--- a/reflex/components/el/elements/metadata.pyi
+++ b/reflex/components/el/elements/metadata.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.el.element import Element
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -49,22 +49,22 @@ class Base(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Base":
"""Create the component.
@@ -135,22 +135,22 @@ class Head(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Head":
"""Create the component.
@@ -234,22 +234,22 @@ class Link(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Link":
"""Create the component.
@@ -333,22 +333,22 @@ class Meta(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Meta":
"""Create the component.
@@ -399,22 +399,22 @@ class Title(Element):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Title":
"""Create the component.
@@ -446,22 +446,22 @@ class StyleEl(Element):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "StyleEl":
"""Create the component.
diff --git a/reflex/components/el/elements/other.pyi b/reflex/components/el/elements/other.pyi
index db884a78b..3d65af647 100644
--- a/reflex/components/el/elements/other.pyi
+++ b/reflex/components/el/elements/other.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -47,22 +47,22 @@ class Details(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Details":
"""Create the component.
@@ -135,22 +135,22 @@ class Dialog(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Dialog":
"""Create the component.
@@ -222,22 +222,22 @@ class Summary(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Summary":
"""Create the component.
@@ -308,22 +308,22 @@ class Slot(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Slot":
"""Create the component.
@@ -394,22 +394,22 @@ class Template(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Template":
"""Create the component.
@@ -480,22 +480,22 @@ class Math(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Math":
"""Create the component.
@@ -567,22 +567,22 @@ class Html(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Html":
"""Create the component.
diff --git a/reflex/components/el/elements/scripts.pyi b/reflex/components/el/elements/scripts.pyi
index 774fcfc22..6f03c20cb 100644
--- a/reflex/components/el/elements/scripts.pyi
+++ b/reflex/components/el/elements/scripts.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -46,22 +46,22 @@ class Canvas(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Canvas":
"""Create the component.
@@ -132,22 +132,22 @@ class Noscript(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Noscript":
"""Create the component.
@@ -231,22 +231,22 @@ class Script(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Script":
"""Create the component.
diff --git a/reflex/components/el/elements/sectioning.pyi b/reflex/components/el/elements/sectioning.pyi
index 963d2d651..e34d53ee2 100644
--- a/reflex/components/el/elements/sectioning.pyi
+++ b/reflex/components/el/elements/sectioning.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -46,22 +46,22 @@ class Body(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Body":
"""Create the component.
@@ -132,22 +132,22 @@ class Address(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Address":
"""Create the component.
@@ -218,22 +218,22 @@ class Article(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Article":
"""Create the component.
@@ -304,22 +304,22 @@ class Aside(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Aside":
"""Create the component.
@@ -390,22 +390,22 @@ class Footer(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Footer":
"""Create the component.
@@ -476,22 +476,22 @@ class Header(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Header":
"""Create the component.
@@ -562,22 +562,22 @@ class H1(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "H1":
"""Create the component.
@@ -648,22 +648,22 @@ class H2(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "H2":
"""Create the component.
@@ -734,22 +734,22 @@ class H3(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "H3":
"""Create the component.
@@ -820,22 +820,22 @@ class H4(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "H4":
"""Create the component.
@@ -906,22 +906,22 @@ class H5(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "H5":
"""Create the component.
@@ -992,22 +992,22 @@ class H6(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "H6":
"""Create the component.
@@ -1078,22 +1078,22 @@ class Main(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Main":
"""Create the component.
@@ -1164,22 +1164,22 @@ class Nav(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Nav":
"""Create the component.
@@ -1250,22 +1250,22 @@ class Section(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Section":
"""Create the component.
diff --git a/reflex/components/el/elements/tables.pyi b/reflex/components/el/elements/tables.pyi
index 4d874f460..b0495009d 100644
--- a/reflex/components/el/elements/tables.pyi
+++ b/reflex/components/el/elements/tables.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -47,22 +47,22 @@ class Caption(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Caption":
"""Create the component.
@@ -136,22 +136,22 @@ class Col(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Col":
"""Create the component.
@@ -226,22 +226,22 @@ class Colgroup(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Colgroup":
"""Create the component.
@@ -316,22 +316,22 @@ class Table(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Table":
"""Create the component.
@@ -405,22 +405,22 @@ class Tbody(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Tbody":
"""Create the component.
@@ -496,22 +496,22 @@ class Td(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Td":
"""Create the component.
@@ -587,22 +587,22 @@ class Tfoot(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Tfoot":
"""Create the component.
@@ -679,22 +679,22 @@ class Th(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Th":
"""Create the component.
@@ -771,22 +771,22 @@ class Thead(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Thead":
"""Create the component.
@@ -859,22 +859,22 @@ class Tr(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Tr":
"""Create the component.
diff --git a/reflex/components/el/elements/typography.pyi b/reflex/components/el/elements/typography.pyi
index 548371ce6..b28af1c40 100644
--- a/reflex/components/el/elements/typography.pyi
+++ b/reflex/components/el/elements/typography.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -47,22 +47,22 @@ class Blockquote(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Blockquote":
"""Create the component.
@@ -134,22 +134,22 @@ class Dd(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Dd":
"""Create the component.
@@ -220,22 +220,22 @@ class Div(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Div":
"""Create the component.
@@ -306,22 +306,22 @@ class Dl(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Dl":
"""Create the component.
@@ -392,22 +392,22 @@ class Dt(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Dt":
"""Create the component.
@@ -478,22 +478,22 @@ class Figcaption(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Figcaption":
"""Create the component.
@@ -565,22 +565,22 @@ class Hr(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Hr":
"""Create the component.
@@ -652,22 +652,22 @@ class Li(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Li":
"""Create the component.
@@ -739,22 +739,22 @@ class Menu(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Menu":
"""Create the component.
@@ -829,22 +829,22 @@ class Ol(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Ol":
"""Create the component.
@@ -918,22 +918,22 @@ class P(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "P":
"""Create the component.
@@ -1004,22 +1004,22 @@ class Pre(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Pre":
"""Create the component.
@@ -1090,22 +1090,22 @@ class Ul(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Ul":
"""Create the component.
@@ -1178,22 +1178,22 @@ class Ins(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Ins":
"""Create the component.
@@ -1268,22 +1268,22 @@ class Del(BaseHTML):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Del":
"""Create the component.
diff --git a/reflex/components/gridjs/datatable.pyi b/reflex/components/gridjs/datatable.pyi
index ec4a5405a..f3f732db3 100644
--- a/reflex/components/gridjs/datatable.pyi
+++ b/reflex/components/gridjs/datatable.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, List, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
@@ -22,22 +22,22 @@ class Gridjs(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Gridjs":
"""Create the component.
@@ -74,22 +74,22 @@ class DataTable(Gridjs):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DataTable":
"""Create a datatable component.
diff --git a/reflex/components/lucide/icon.py b/reflex/components/lucide/icon.py
index 1ee68aaa3..b32fb8de3 100644
--- a/reflex/components/lucide/icon.py
+++ b/reflex/components/lucide/icon.py
@@ -58,7 +58,7 @@ class Icon(LucideIconComponent):
props["tag"] = format.to_title_case(format.to_snake_case(props["tag"])) + "Icon"
props["alias"] = f"Lucide{props['tag']}"
- props.setdefault("color", f"var(--current-color)")
+ props.setdefault("color", "var(--current-color)")
return super().create(*children, **props)
diff --git a/reflex/components/lucide/icon.pyi b/reflex/components/lucide/icon.pyi
index 661d91dbe..7f59edec5 100644
--- a/reflex/components/lucide/icon.pyi
+++ b/reflex/components/lucide/icon.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,22 +21,22 @@ class LucideIconComponent(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "LucideIconComponent":
"""Create the component.
@@ -68,22 +68,22 @@ class Icon(LucideIconComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Icon":
"""Initialize the Icon component.
diff --git a/reflex/components/markdown/markdown.py b/reflex/components/markdown/markdown.py
index 1665144fd..376cb8bd6 100644
--- a/reflex/components/markdown/markdown.py
+++ b/reflex/components/markdown/markdown.py
@@ -2,30 +2,26 @@
from __future__ import annotations
+import dataclasses
import textwrap
from functools import lru_cache
from hashlib import md5
-from typing import Any, Callable, Dict, Union
+from typing import Any, Callable, Dict, Sequence, Union
from reflex.components.component import Component, CustomComponent
-from reflex.components.radix.themes.layout.list import (
- ListItem,
- OrderedList,
- UnorderedList,
-)
-from reflex.components.radix.themes.typography.heading import Heading
-from reflex.components.radix.themes.typography.link import Link
-from reflex.components.radix.themes.typography.text import Text
from reflex.components.tags.tag import Tag
from reflex.utils import types
from reflex.utils.imports import ImportDict, ImportVar
from reflex.vars.base import LiteralVar, Var
+from reflex.vars.function import ARRAY_ISARRAY, ArgsFunctionOperation, DestructuredArg
+from reflex.vars.number import ternary_operation
# Special vars used in the component map.
_CHILDREN = Var(_js_expr="children", _var_type=str)
_PROPS = Var(_js_expr="...props")
_PROPS_IN_TAG = Var(_js_expr="{...props}")
_MOCK_ARG = Var(_js_expr="", _var_type=str)
+_LANGUAGE = Var(_js_expr="_language", _var_type=str)
# Special remark plugins.
_REMARK_MATH = Var(_js_expr="remarkMath")
@@ -51,7 +47,15 @@ def get_base_component_map() -> dict[str, Callable]:
The base component map.
"""
from reflex.components.datadisplay.code import CodeBlock
+ from reflex.components.radix.themes.layout.list import (
+ ListItem,
+ OrderedList,
+ UnorderedList,
+ )
from reflex.components.radix.themes.typography.code import Code
+ from reflex.components.radix.themes.typography.heading import Heading
+ from reflex.components.radix.themes.typography.link import Link
+ from reflex.components.radix.themes.typography.text import Text
return {
"h1": lambda value: Heading.create(value, as_="h1", size="6", margin_y="0.5em"),
@@ -72,6 +76,67 @@ def get_base_component_map() -> dict[str, Callable]:
}
+@dataclasses.dataclass()
+class MarkdownComponentMap:
+ """Mixin class for handling custom component maps in Markdown components."""
+
+ _explicit_return: bool = dataclasses.field(default=False)
+
+ @classmethod
+ def get_component_map_custom_code(cls) -> str:
+ """Get the custom code for the component map.
+
+ Returns:
+ The custom code for the component map.
+ """
+ return ""
+
+ @classmethod
+ def create_map_fn_var(
+ cls,
+ fn_body: Var | None = None,
+ fn_args: Sequence[str] | None = None,
+ explicit_return: bool | None = None,
+ ) -> Var:
+ """Create a function Var for the component map.
+
+ Args:
+ fn_body: The formatted component as a string.
+ fn_args: The function arguments.
+ explicit_return: Whether to use explicit return syntax.
+
+ Returns:
+ The function Var for the component map.
+ """
+ fn_args = fn_args or cls.get_fn_args()
+ fn_body = fn_body if fn_body is not None else cls.get_fn_body()
+ explicit_return = explicit_return or cls._explicit_return
+
+ return ArgsFunctionOperation.create(
+ args_names=(DestructuredArg(fields=tuple(fn_args)),),
+ return_expr=fn_body,
+ explicit_return=explicit_return,
+ )
+
+ @classmethod
+ def get_fn_args(cls) -> Sequence[str]:
+ """Get the function arguments for the component map.
+
+ Returns:
+ The function arguments as a list of strings.
+ """
+ return ["node", _CHILDREN._js_expr, _PROPS._js_expr]
+
+ @classmethod
+ def get_fn_body(cls) -> Var:
+ """Get the function body for the component map.
+
+ Returns:
+ The function body as a string.
+ """
+ return Var(_js_expr="undefined", _var_type=None)
+
+
class Markdown(Component):
"""A markdown component."""
@@ -151,9 +216,6 @@ class Markdown(Component):
Returns:
The imports for the markdown component.
"""
- from reflex.components.datadisplay.code import CodeBlock, Theme
- from reflex.components.radix.themes.typography.code import Code
-
return [
{
"": "katex/dist/katex.min.css",
@@ -177,10 +239,71 @@ class Markdown(Component):
component(_MOCK_ARG)._get_all_imports() # type: ignore
for component in self.component_map.values()
],
- CodeBlock.create(theme=Theme.light)._get_imports(),
- Code.create()._get_imports(),
]
+ def _get_tag_map_fn_var(self, tag: str) -> Var:
+ return self._get_map_fn_var_from_children(self.get_component(tag), tag)
+
+ def format_component_map(self) -> dict[str, Var]:
+ """Format the component map for rendering.
+
+ Returns:
+ The formatted component map.
+ """
+ components = {
+ tag: self._get_tag_map_fn_var(tag)
+ for tag in self.component_map
+ if tag not in ("code", "codeblock")
+ }
+
+ # Separate out inline code and code blocks.
+ components["code"] = self._get_inline_code_fn_var()
+
+ return components
+
+ def _get_inline_code_fn_var(self) -> Var:
+ """Get the function variable for inline code.
+
+ This function creates a Var that represents a function to handle
+ both inline code and code blocks in markdown.
+
+ Returns:
+ The Var for inline code.
+ """
+ # Get any custom code from the codeblock and code components.
+ custom_code_list = self._get_map_fn_custom_code_from_children(
+ self.get_component("codeblock")
+ )
+ custom_code_list.extend(
+ self._get_map_fn_custom_code_from_children(self.get_component("code"))
+ )
+
+ codeblock_custom_code = "\n".join(custom_code_list)
+
+ # Format the code to handle inline and block code.
+ formatted_code = f"""
+const match = (className || '').match(/language-(?.*)/);
+const {str(_LANGUAGE)} = match ? match[1] : '';
+{codeblock_custom_code};
+ return inline ? (
+ {self.format_component("code")}
+ ) : (
+ {self.format_component("codeblock", language=_LANGUAGE)}
+ );
+ """.replace("\n", " ")
+
+ return MarkdownComponentMap.create_map_fn_var(
+ fn_args=(
+ "node",
+ "inline",
+ "className",
+ _CHILDREN._js_expr,
+ _PROPS._js_expr,
+ ),
+ fn_body=Var(_js_expr=formatted_code),
+ explicit_return=True,
+ )
+
def get_component(self, tag: str, **props) -> Component:
"""Get the component for a tag and props.
@@ -199,7 +322,16 @@ class Markdown(Component):
raise ValueError(f"No markdown component found for tag: {tag}.")
special_props = [_PROPS_IN_TAG]
- children = [_CHILDREN]
+ children = [
+ _CHILDREN
+ if tag != "codeblock"
+ # For codeblock, the mapping for some cases returns an array of elements. Let's join them into a string.
+ else ternary_operation(
+ ARRAY_ISARRAY.call(_CHILDREN), # type: ignore
+ _CHILDREN.to(list).join("\n"),
+ _CHILDREN,
+ ).to(str)
+ ]
# For certain tags, the props from the markdown renderer are not actually valid for the component.
if tag in NO_PROPS_TAGS:
@@ -228,43 +360,53 @@ class Markdown(Component):
"""
return str(self.get_component(tag, **props)).replace("\n", "")
- def format_component_map(self) -> dict[str, Var]:
- """Format the component map for rendering.
+ def _get_map_fn_var_from_children(self, component: Component, tag: str) -> Var:
+ """Create a function Var for the component map for the specified tag.
+
+ Args:
+ component: The component to check for custom code.
+ tag: The tag of the component.
Returns:
- The formatted component map.
+ The function Var for the component map.
"""
- components = {
- tag: Var(
- _js_expr=f"(({{node, {_CHILDREN._js_expr}, {_PROPS._js_expr}}}) => ({self.format_component(tag)}))"
- )
- for tag in self.component_map
- }
-
- # Separate out inline code and code blocks.
- components["code"] = Var(
- _js_expr=f"""(({{node, inline, className, {_CHILDREN._js_expr}, {_PROPS._js_expr}}}) => {{
- const match = (className || '').match(/language-(?.*)/);
- const language = match ? match[1] : '';
- if (language) {{
- (async () => {{
- try {{
- const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${{language}}`);
- SyntaxHighlighter.registerLanguage(language, module.default);
- }} catch (error) {{
- console.error(`Error importing language module for ${{language}}:`, error);
- }}
- }})();
- }}
- return inline ? (
- {self.format_component("code")}
- ) : (
- {self.format_component("codeblock", language=Var(_js_expr="language", _var_type=str))}
- );
- }})""".replace("\n", " ")
+ formatted_component = Var(
+ _js_expr=f"({self.format_component(tag)})", _var_type=str
)
+ if isinstance(component, MarkdownComponentMap):
+ return component.create_map_fn_var(fn_body=formatted_component)
- return components
+ # fallback to the default fn Var creation if the component is not a MarkdownComponentMap.
+ return MarkdownComponentMap.create_map_fn_var(fn_body=formatted_component)
+
+ def _get_map_fn_custom_code_from_children(self, component) -> list[str]:
+ """Recursively get markdown custom code from children components.
+
+ Args:
+ component: The component to check for custom code.
+
+ Returns:
+ A list of markdown custom code strings.
+ """
+ custom_code_list = []
+ if isinstance(component, MarkdownComponentMap):
+ custom_code_list.append(component.get_component_map_custom_code())
+
+ # If the component is a custom component(rx.memo), obtain the underlining
+ # component and get the custom code from the children.
+ if isinstance(component, CustomComponent):
+ custom_code_list.extend(
+ self._get_map_fn_custom_code_from_children(
+ component.component_fn(*component.get_prop_vars())
+ )
+ )
+ elif isinstance(component, Component):
+ for child in component.children:
+ custom_code_list.extend(
+ self._get_map_fn_custom_code_from_children(child)
+ )
+
+ return custom_code_list
@staticmethod
def _component_map_hash(component_map) -> str:
@@ -277,12 +419,12 @@ class Markdown(Component):
return f"ComponentMap_{self.component_map_hash}"
def _get_custom_code(self) -> str | None:
- hooks = set()
+ hooks = {}
for _component in self.component_map.values():
comp = _component(_MOCK_ARG)
hooks.update(comp._get_all_hooks_internal())
hooks.update(comp._get_all_hooks())
- formatted_hooks = "\n".join(hooks)
+ formatted_hooks = "\n".join(hooks.keys())
return f"""
function {self._get_component_map_name()} () {{
{formatted_hooks}
diff --git a/reflex/components/markdown/markdown.pyi b/reflex/components/markdown/markdown.pyi
index 1cad04013..1c329fb8c 100644
--- a/reflex/components/markdown/markdown.pyi
+++ b/reflex/components/markdown/markdown.pyi
@@ -3,11 +3,12 @@
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
+import dataclasses
from functools import lru_cache
-from typing import Any, Callable, Dict, Optional, Union, overload
+from typing import Any, Callable, Dict, Optional, Sequence, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.vars.base import LiteralVar, Var
@@ -16,6 +17,7 @@ _CHILDREN = Var(_js_expr="children", _var_type=str)
_PROPS = Var(_js_expr="...props")
_PROPS_IN_TAG = Var(_js_expr="{...props}")
_MOCK_ARG = Var(_js_expr="", _var_type=str)
+_LANGUAGE = Var(_js_expr="_language", _var_type=str)
_REMARK_MATH = Var(_js_expr="remarkMath")
_REMARK_GFM = Var(_js_expr="remarkGfm")
_REMARK_UNWRAP_IMAGES = Var(_js_expr="remarkUnwrapImages")
@@ -27,6 +29,21 @@ NO_PROPS_TAGS = ("ul", "ol", "li")
@lru_cache
def get_base_component_map() -> dict[str, Callable]: ...
+@dataclasses.dataclass()
+class MarkdownComponentMap:
+ @classmethod
+ def get_component_map_custom_code(cls) -> str: ...
+ @classmethod
+ def create_map_fn_var(
+ cls,
+ fn_body: Var | None = None,
+ fn_args: Sequence[str] | None = None,
+ explicit_return: bool | None = None,
+ ) -> Var: ...
+ @classmethod
+ def get_fn_args(cls) -> Sequence[str]: ...
+ @classmethod
+ def get_fn_body(cls) -> Var: ...
class Markdown(Component):
@overload
@@ -41,22 +58,22 @@ class Markdown(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Markdown":
"""Create a markdown component.
@@ -82,6 +99,6 @@ class Markdown(Component):
...
def add_imports(self) -> ImportDict | list[ImportDict]: ...
+ def format_component_map(self) -> dict[str, Var]: ...
def get_component(self, tag: str, **props) -> Component: ...
def format_component(self, tag: str, **props) -> str: ...
- def format_component_map(self) -> dict[str, Var]: ...
diff --git a/reflex/components/moment/moment.py b/reflex/components/moment/moment.py
index 51b09d55d..80940d228 100644
--- a/reflex/components/moment/moment.py
+++ b/reflex/components/moment/moment.py
@@ -1,12 +1,13 @@
"""Moment component for humanized date rendering."""
import dataclasses
-from typing import List, Optional
+from datetime import date, datetime, time, timedelta
+from typing import List, Optional, Union
-from reflex.components.component import Component, NoSSRComponent
-from reflex.event import EventHandler, identity_event
+from reflex.components.component import NoSSRComponent
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportDict
-from reflex.vars.base import Var
+from reflex.vars.base import LiteralVar, Var
@dataclasses.dataclass(frozen=True)
@@ -19,7 +20,7 @@ class MomentDelta:
weeks: Optional[int] = dataclasses.field(default=None)
days: Optional[int] = dataclasses.field(default=None)
hours: Optional[int] = dataclasses.field(default=None)
- minutess: Optional[int] = dataclasses.field(default=None)
+ minutes: Optional[int] = dataclasses.field(default=None)
seconds: Optional[int] = dataclasses.field(default=None)
milliseconds: Optional[int] = dataclasses.field(default=None)
@@ -78,7 +79,7 @@ class Moment(NoSSRComponent):
duration: Var[str]
# The date to display (also work if passed as children).
- date: Var[str]
+ date: Var[Union[str, datetime, date, time, timedelta]]
# Shows the duration (elapsed time) between now and the provided datetime.
duration_from_now: Var[bool]
@@ -92,8 +93,11 @@ class Moment(NoSSRComponent):
# Display the date in the given timezone.
tz: Var[str]
+ # The locale to use when rendering.
+ locale: Var[str]
+
# Fires when the date changes.
- on_change: EventHandler[identity_event(str)]
+ on_change: EventHandler[passthrough_event_spec(str)]
def add_imports(self) -> ImportDict:
"""Add the imports for the Moment component.
@@ -101,22 +105,15 @@ class Moment(NoSSRComponent):
Returns:
The import dict for the component.
"""
+ imports = {}
+
+ if isinstance(self.locale, LiteralVar):
+ imports[""] = f"moment/locale/{self.locale._var_value}"
+ elif self.locale is not None:
+ # If the user is using a variable for the locale, we can't know the
+ # value at compile time so import all locales available.
+ imports[""] = "moment/min/locales"
if self.tz is not None:
- return {"moment-timezone": ""}
- return {}
+ imports["moment-timezone"] = ""
- @classmethod
- def create(cls, *children, **props) -> Component:
- """Create a Moment component.
-
- Args:
- *children: The children of the component.
- **props: The properties of the component.
-
- Returns:
- The Moment Component.
- """
- comp = super().create(*children, **props)
- if "tz" in props:
- comp.lib_dependencies.append("moment-timezone")
- return comp
+ return imports
diff --git a/reflex/components/moment/moment.pyi b/reflex/components/moment/moment.pyi
index 4f58fda7d..83ab670b0 100644
--- a/reflex/components/moment/moment.pyi
+++ b/reflex/components/moment/moment.pyi
@@ -4,10 +4,11 @@
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
import dataclasses
+from datetime import date, datetime, time, timedelta
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import NoSSRComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
@@ -20,7 +21,7 @@ class MomentDelta:
weeks: Optional[int]
days: Optional[int]
hours: Optional[int]
- minutess: Optional[int]
+ minutes: Optional[int]
seconds: Optional[int]
milliseconds: Optional[int]
@@ -46,36 +47,48 @@ class Moment(NoSSRComponent):
decimal: Optional[Union[Var[bool], bool]] = None,
unit: Optional[Union[Var[str], str]] = None,
duration: Optional[Union[Var[str], str]] = None,
- date: Optional[Union[Var[str], str]] = None,
+ date: Optional[
+ Union[
+ Var[Union[date, datetime, str, time, timedelta]],
+ date,
+ datetime,
+ str,
+ time,
+ timedelta,
+ ]
+ ] = None,
duration_from_now: Optional[Union[Var[bool], bool]] = None,
unix: Optional[Union[Var[bool], bool]] = None,
local: Optional[Union[Var[bool], bool]] = None,
tz: Optional[Union[Var[str], str]] = None,
+ locale: 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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Moment":
- """Create a Moment component.
+ """Create the component.
Args:
*children: The children of the component.
@@ -99,15 +112,17 @@ class Moment(NoSSRComponent):
unix: Tells Moment to parse the given date value as a unix timestamp.
local: Outputs the result in local time.
tz: Display the date in the given timezone.
+ locale: The locale to use when rendering.
+ on_change: Fires when the date changes.
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 properties of the component.
+ **props: The props of the component.
Returns:
- The Moment Component.
+ The component.
"""
...
diff --git a/reflex/components/next/base.pyi b/reflex/components/next/base.pyi
index 1d49c5e66..4a82d7bef 100644
--- a/reflex/components/next/base.pyi
+++ b/reflex/components/next/base.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -23,22 +23,22 @@ class NextComponent(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "NextComponent":
"""Create the component.
diff --git a/reflex/components/next/image.py b/reflex/components/next/image.py
index fe74b0935..237c308ce 100644
--- a/reflex/components/next/image.py
+++ b/reflex/components/next/image.py
@@ -2,7 +2,7 @@
from typing import Any, Literal, Optional, Union
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.utils import types
from reflex.vars.base import Var
@@ -56,10 +56,10 @@ class Image(NextComponent):
blurDataURL: Var[str]
# Fires when the image has loaded.
- on_load: EventHandler[empty_event]
+ on_load: EventHandler[no_args_event_spec]
# Fires when the image has an error.
- on_error: EventHandler[empty_event]
+ on_error: EventHandler[no_args_event_spec]
@classmethod
def create(
diff --git a/reflex/components/next/image.pyi b/reflex/components/next/image.pyi
index 5d72584a9..0c1bf01f2 100644
--- a/reflex/components/next/image.pyi
+++ b/reflex/components/next/image.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Literal, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -36,24 +36,24 @@ class Image(NextComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_error: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_load: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_error: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_load: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Image":
"""Create an Image component from next/image.
@@ -72,6 +72,8 @@ class Image(NextComponent):
placeholder: A placeholder to use while the image is loading. Possible values are blur, empty, or data:image/.... Defaults to empty.
loading: Allows passing CSS styles to the underlying image element. style: Var[Any] The loading behavior of the image. Defaults to lazy. Can hurt performance, recommended to use `priority` instead.
blurDataURL: A Data URL to be used as a placeholder image before the src image successfully loads. Only takes effect when combined with placeholder="blur".
+ on_load: Fires when the image has loaded.
+ on_error: Fires when the image has an error.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/next/link.pyi b/reflex/components/next/link.pyi
index fa9ae530f..fdccc9ee6 100644
--- a/reflex/components/next/link.pyi
+++ b/reflex/components/next/link.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -23,22 +23,22 @@ class NextLink(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "NextLink":
"""Create the component.
diff --git a/reflex/components/next/video.pyi b/reflex/components/next/video.pyi
index f8c93b6f1..8f31748f7 100644
--- a/reflex/components/next/video.pyi
+++ b/reflex/components/next/video.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -25,22 +25,22 @@ class Video(NextComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Video":
"""Create a Video component.
diff --git a/reflex/components/plotly/plotly.py b/reflex/components/plotly/plotly.py
index c93488d40..2c0dccd3e 100644
--- a/reflex/components/plotly/plotly.py
+++ b/reflex/components/plotly/plotly.py
@@ -2,12 +2,13 @@
from __future__ import annotations
-from typing import Any, Dict, List
+from typing import Any, Dict, List, Tuple, Union
+
+from typing_extensions import TypedDict, TypeVar
-from reflex.base import Base
from reflex.components.component import Component, NoSSRComponent
from reflex.components.core.cond import color_mode_cond
-from reflex.event import EventHandler
+from reflex.event import EventHandler, no_args_event_spec
from reflex.utils import console
from reflex.vars.base import LiteralVar, Var
@@ -21,19 +22,7 @@ except ImportError:
Template = Any # type: ignore
-def _event_data_signature(e0: Var) -> List[Any]:
- """For plotly events with event data and no points.
-
- Args:
- e0: The event data.
-
- Returns:
- The event key extracted from the event data (if defined).
- """
- return [Var(_js_expr=f"{e0}?.event")]
-
-
-def _event_points_data_signature(e0: Var) -> List[Any]:
+def _event_points_data_signature(e0: Var) -> Tuple[Var[List[Point]]]:
"""For plotly events with event data containing a point array.
Args:
@@ -42,51 +31,63 @@ def _event_points_data_signature(e0: Var) -> List[Any]:
Returns:
The event data and the extracted points.
"""
- return [
- Var(_js_expr=f"{e0}?.event"),
- Var(_js_expr=f"extractPoints({e0}?.points)"),
+ return (Var(_js_expr=f"extractPoints({e0}?.points)"),)
+
+
+T = TypeVar("T")
+
+ItemOrList = Union[T, List[T]]
+
+
+class BBox(TypedDict):
+ """Bounding box for a point in a plotly graph."""
+
+ x0: Union[float, int, None]
+ x1: Union[float, int, None]
+ y0: Union[float, int, None]
+ y1: Union[float, int, None]
+ z0: Union[float, int, None]
+ z1: Union[float, int, None]
+
+
+class Point(TypedDict):
+ """A point in a plotly graph."""
+
+ x: Union[float, int, None]
+ y: Union[float, int, None]
+ z: Union[float, int, None]
+ lat: Union[float, int, None]
+ lon: Union[float, int, None]
+ curveNumber: Union[int, None]
+ pointNumber: Union[int, None]
+ pointNumbers: Union[List[int], None]
+ pointIndex: Union[int, None]
+ markerColor: Union[
+ ItemOrList[
+ ItemOrList[
+ Union[
+ float,
+ int,
+ str,
+ None,
+ ]
+ ]
+ ],
+ None,
]
-
-
-class _ButtonClickData(Base):
- """Event data structure for plotly UI buttons."""
-
- menu: Any
- button: Any
- active: Any
-
-
-def _button_click_signature(e0: _ButtonClickData) -> List[Any]:
- """For plotly button click events.
-
- Args:
- e0: The button click data.
-
- Returns:
- The menu, button, and active state.
- """
- return [e0.menu, e0.button, e0.active]
-
-
-def _passthrough_signature(e0: Var) -> List[Any]:
- """For plotly events with arbitrary serializable data, passed through directly.
-
- Args:
- e0: The event data.
-
- Returns:
- The event data.
- """
- return [e0]
-
-
-def _null_signature() -> List[Any]:
- """For plotly events with no data or non-serializable data. Nothing passed through.
-
- Returns:
- An empty list (nothing passed through).
- """
- return []
+ markerSize: Union[
+ ItemOrList[
+ ItemOrList[
+ Union[
+ float,
+ int,
+ None,
+ ]
+ ]
+ ],
+ None,
+ ]
+ bbox: Union[BBox, None]
class Plotly(NoSSRComponent):
@@ -116,49 +117,49 @@ class Plotly(NoSSRComponent):
use_resize_handler: Var[bool] = LiteralVar.create(True)
# Fired after the plot is redrawn.
- on_after_plot: EventHandler[_passthrough_signature]
+ on_after_plot: EventHandler[no_args_event_spec]
# Fired after the plot was animated.
- on_animated: EventHandler[_null_signature]
+ on_animated: EventHandler[no_args_event_spec]
# Fired while animating a single frame (does not currently pass data through).
- on_animating_frame: EventHandler[_null_signature]
+ on_animating_frame: EventHandler[no_args_event_spec]
# Fired when an animation is interrupted (to start a new animation for example).
- on_animation_interrupted: EventHandler[_null_signature]
+ on_animation_interrupted: EventHandler[no_args_event_spec]
# Fired when the plot is responsively sized.
- on_autosize: EventHandler[_event_data_signature]
+ on_autosize: EventHandler[no_args_event_spec]
# Fired whenever mouse moves over a plot.
- on_before_hover: EventHandler[_event_data_signature]
+ on_before_hover: EventHandler[no_args_event_spec]
# Fired when a plotly UI button is clicked.
- on_button_clicked: EventHandler[_button_click_signature]
+ on_button_clicked: EventHandler[no_args_event_spec]
# Fired when the plot is clicked.
on_click: EventHandler[_event_points_data_signature]
# Fired when a selection is cleared (via double click).
- on_deselect: EventHandler[_null_signature]
+ on_deselect: EventHandler[no_args_event_spec]
# Fired when the plot is double clicked.
- on_double_click: EventHandler[_passthrough_signature]
+ on_double_click: EventHandler[no_args_event_spec]
# Fired when a plot element is hovered over.
on_hover: EventHandler[_event_points_data_signature]
# Fired after the plot is layed out (zoom, pan, etc).
- on_relayout: EventHandler[_passthrough_signature]
+ on_relayout: EventHandler[no_args_event_spec]
# Fired while the plot is being layed out.
- on_relayouting: EventHandler[_passthrough_signature]
+ on_relayouting: EventHandler[no_args_event_spec]
# Fired after the plot style is changed.
- on_restyle: EventHandler[_passthrough_signature]
+ on_restyle: EventHandler[no_args_event_spec]
# Fired after the plot is redrawn.
- on_redraw: EventHandler[_event_data_signature]
+ on_redraw: EventHandler[no_args_event_spec]
# Fired after selecting plot elements.
on_selected: EventHandler[_event_points_data_signature]
@@ -167,10 +168,10 @@ class Plotly(NoSSRComponent):
on_selecting: EventHandler[_event_points_data_signature]
# Fired while an animation is occuring.
- on_transitioning: EventHandler[_event_data_signature]
+ on_transitioning: EventHandler[no_args_event_spec]
# Fired when a transition is stopped early.
- on_transition_interrupted: EventHandler[_event_data_signature]
+ on_transition_interrupted: EventHandler[no_args_event_spec]
# Fired when a hovered element is no longer hovered.
on_unhover: EventHandler[_event_points_data_signature]
@@ -216,8 +217,8 @@ const extractPoints = (points) => {
pointNumber: point.pointNumber,
pointNumbers: point.pointNumbers,
pointIndex: point.pointIndex,
- 'marker.color': point['marker.color'],
- 'marker.size': point['marker.size'],
+ markerColor: point['marker.color'],
+ markerSize: point['marker.size'],
bbox: bbox,
})
})
@@ -254,7 +255,7 @@ const extractPoints = (points) => {
def _render(self):
tag = super()._render()
- figure = self.data.to(dict)
+ figure = self.data.to(dict) if self.data is not None else Var.create({})
merge_dicts = [] # Data will be merged and spread from these dict Vars
if self.layout is not None:
# Why is this not a literal dict? Great question... it didn't work
@@ -264,7 +265,7 @@ const extractPoints = (points) => {
merge_dicts.append(layout_dict)
if self.template is not None:
template_dict = LiteralVar.create({"layout": {"template": self.template}})
- merge_dicts.append(template_dict.without_data())
+ merge_dicts.append(template_dict._without_data())
if merge_dicts:
tag.special_props.append(
# Merge all dictionaries and spread the result over props.
diff --git a/reflex/components/plotly/plotly.pyi b/reflex/components/plotly/plotly.pyi
index 29464415d..2d606b8a2 100644
--- a/reflex/components/plotly/plotly.pyi
+++ b/reflex/components/plotly/plotly.pyi
@@ -3,11 +3,12 @@
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
-from typing import Any, Dict, Optional, Union, overload
+from typing import Any, Dict, List, Optional, Union, overload
+
+from typing_extensions import TypedDict, TypeVar
-from reflex.base import Base
from reflex.components.component import NoSSRComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils import console
from reflex.vars.base import Var
@@ -20,11 +21,30 @@ except ImportError:
console.warn("Plotly is not installed. Please run `pip install plotly`.")
Figure = Any
Template = Any
+T = TypeVar("T")
+ItemOrList = Union[T, List[T]]
-class _ButtonClickData(Base):
- menu: Any
- button: Any
- active: Any
+class BBox(TypedDict):
+ x0: Union[float, int, None]
+ x1: Union[float, int, None]
+ y0: Union[float, int, None]
+ y1: Union[float, int, None]
+ z0: Union[float, int, None]
+ z1: Union[float, int, None]
+
+class Point(TypedDict):
+ x: Union[float, int, None]
+ y: Union[float, int, None]
+ z: Union[float, int, None]
+ lat: Union[float, int, None]
+ lon: Union[float, int, None]
+ curveNumber: Union[int, None]
+ pointNumber: Union[int, None]
+ pointNumbers: Union[List[int], None]
+ pointIndex: Union[int, None]
+ markerColor: Union[ItemOrList[ItemOrList[Union[float, int, str, None]]], None]
+ markerSize: Union[ItemOrList[ItemOrList[Union[float, int, None]]], None]
+ bbox: Union[BBox, None]
class Plotly(NoSSRComponent):
def add_imports(self) -> dict[str, str]: ...
@@ -44,40 +64,50 @@ class Plotly(NoSSRComponent):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_after_plot: Optional[EventType] = None,
- on_animated: Optional[EventType] = None,
- on_animating_frame: Optional[EventType] = None,
- on_animation_interrupted: Optional[EventType] = None,
- on_autosize: Optional[EventType] = None,
- on_before_hover: Optional[EventType] = None,
- on_blur: Optional[EventType[[]]] = None,
- on_button_clicked: Optional[EventType] = None,
- on_click: Optional[EventType] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_deselect: Optional[EventType] = None,
- on_double_click: Optional[EventType] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_hover: Optional[EventType] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_redraw: Optional[EventType] = None,
- on_relayout: Optional[EventType] = None,
- on_relayouting: Optional[EventType] = None,
- on_restyle: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_selected: Optional[EventType] = None,
- on_selecting: Optional[EventType] = None,
- on_transition_interrupted: Optional[EventType] = None,
- on_transitioning: Optional[EventType] = None,
- on_unhover: Optional[EventType] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_after_plot: Optional[EventType[[], BASE_STATE]] = None,
+ on_animated: Optional[EventType[[], BASE_STATE]] = None,
+ on_animating_frame: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_interrupted: Optional[EventType[[], BASE_STATE]] = None,
+ on_autosize: Optional[EventType[[], BASE_STATE]] = None,
+ on_before_hover: Optional[EventType[[], BASE_STATE]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_button_clicked: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
+ ] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_deselect: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_hover: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_redraw: Optional[EventType[[], BASE_STATE]] = None,
+ on_relayout: Optional[EventType[[], BASE_STATE]] = None,
+ on_relayouting: Optional[EventType[[], BASE_STATE]] = None,
+ on_restyle: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_selected: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
+ ] = None,
+ on_selecting: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
+ ] = None,
+ on_transition_interrupted: Optional[EventType[[], BASE_STATE]] = None,
+ on_transitioning: Optional[EventType[[], BASE_STATE]] = None,
+ on_unhover: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
+ ] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Plotly":
"""Create the Plotly component.
@@ -89,6 +119,26 @@ class Plotly(NoSSRComponent):
template: The template for visual appearance of the graph.
config: The config of the graph.
use_resize_handler: If true, the graph will resize when the window is resized.
+ on_after_plot: Fired after the plot is redrawn.
+ on_animated: Fired after the plot was animated.
+ on_animating_frame: Fired while animating a single frame (does not currently pass data through).
+ on_animation_interrupted: Fired when an animation is interrupted (to start a new animation for example).
+ on_autosize: Fired when the plot is responsively sized.
+ on_before_hover: Fired whenever mouse moves over a plot.
+ on_button_clicked: Fired when a plotly UI button is clicked.
+ on_click: Fired when the plot is clicked.
+ on_deselect: Fired when a selection is cleared (via double click).
+ on_double_click: Fired when the plot is double clicked.
+ on_hover: Fired when a plot element is hovered over.
+ on_relayout: Fired after the plot is layed out (zoom, pan, etc).
+ on_relayouting: Fired while the plot is being layed out.
+ on_restyle: Fired after the plot style is changed.
+ on_redraw: Fired after the plot is redrawn.
+ on_selected: Fired after selecting plot elements.
+ on_selecting: Fired while dragging a selection.
+ on_transitioning: Fired while an animation is occuring.
+ on_transition_interrupted: Fired when a transition is stopped early.
+ on_unhover: Fired when a hovered element is no longer hovered.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/props.py b/reflex/components/props.py
index 92dbe8144..adce134fc 100644
--- a/reflex/components/props.py
+++ b/reflex/components/props.py
@@ -2,8 +2,11 @@
from __future__ import annotations
+from pydantic import ValidationError
+
from reflex.base import Base
from reflex.utils import format
+from reflex.utils.exceptions import InvalidPropValueError
from reflex.vars.object import LiteralObjectVar
@@ -40,3 +43,34 @@ class PropsBase(Base):
format.to_camel_case(key): value
for key, value in super().dict(*args, **kwargs).items()
}
+
+
+class NoExtrasAllowedProps(Base):
+ """A class that holds props to be passed or applied to a component with no extra props allowed."""
+
+ def __init__(self, component_name=None, **kwargs):
+ """Initialize the props.
+
+ Args:
+ component_name: The custom name of the component.
+ kwargs: Kwargs to initialize the props.
+
+ Raises:
+ InvalidPropValueError: If invalid props are passed on instantiation.
+ """
+ component_name = component_name or type(self).__name__
+ try:
+ super().__init__(**kwargs)
+ except ValidationError as e:
+ invalid_fields = ", ".join([error["loc"][0] for error in e.errors()]) # type: ignore
+ supported_props_str = ", ".join(f'"{field}"' for field in self.get_fields())
+ raise InvalidPropValueError(
+ f"Invalid prop(s) {invalid_fields} for {component_name!r}. Supported props are {supported_props_str}"
+ ) from None
+
+ class Config:
+ """Pydantic config."""
+
+ arbitrary_types_allowed = True
+ use_enum_values = True
+ extra = "forbid"
diff --git a/reflex/components/radix/primitives/accordion.py b/reflex/components/radix/primitives/accordion.py
index bbcecb1d8..608fee69d 100644
--- a/reflex/components/radix/primitives/accordion.py
+++ b/reflex/components/radix/primitives/accordion.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, List, Literal, Optional, Tuple, Union
+from typing import Any, List, Literal, Tuple, Union
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.colors import color
@@ -193,6 +193,11 @@ class AccordionItem(AccordionComponent):
# When true, prevents the user from interacting with the item.
disabled: Var[bool]
+ # The header of the accordion item.
+ header: Var[Union[Component, str]]
+ # The content of the accordion item.
+ content: Var[Union[Component, str]] = Var.create(None)
+
_valid_children: List[str] = [
"AccordionHeader",
"AccordionTrigger",
@@ -205,21 +210,20 @@ class AccordionItem(AccordionComponent):
def create(
cls,
*children,
- header: Optional[Component | Var] = None,
- content: Optional[Component | Var] = None,
**props,
) -> Component:
"""Create an accordion item.
Args:
*children: The list of children to use if header and content are not provided.
- header: The header of the accordion item.
- content: The content of the accordion item.
**props: Additional properties to apply to the accordion item.
Returns:
The accordion item.
"""
+ header = props.pop("header", None)
+ content = props.pop("content", None)
+
# The item requires a value to toggle (use a random unique name if not provided).
value = props.pop("value", get_uuid_string_var())
@@ -291,6 +295,9 @@ class AccordionItem(AccordionComponent):
},
}
+ def _exclude_props(self) -> list[str]:
+ return ["header", "content"]
+
class AccordionHeader(AccordionComponent):
"""An accordion component."""
@@ -375,7 +382,7 @@ class AccordionTrigger(AccordionComponent):
"background_color": color("accent", 4),
},
"& > .AccordionChevron": {
- "transition": f"transform var(--animation-duration) var(--animation-easing)",
+ "transition": "transform var(--animation-duration) var(--animation-easing)",
},
_inherited_variant_selector("classic"): {
"color": "var(--accent-contrast)",
@@ -478,11 +485,11 @@ to {
The style of the component.
"""
slideDown = LiteralVar.create(
- f"${{slideDown}} var(--animation-duration) var(--animation-easing)",
+ "${slideDown} var(--animation-duration) var(--animation-easing)",
)
slideUp = LiteralVar.create(
- f"${{slideUp}} var(--animation-duration) var(--animation-easing)",
+ "${slideUp} var(--animation-duration) var(--animation-easing)",
)
return {
diff --git a/reflex/components/radix/primitives/accordion.pyi b/reflex/components/radix/primitives/accordion.pyi
index b975cfebe..03208f496 100644
--- a/reflex/components/radix/primitives/accordion.pyi
+++ b/reflex/components/radix/primitives/accordion.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
from reflex.components.component import Component, ComponentNamespace
from reflex.components.lucide.icon import Icon
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -100,22 +100,22 @@ class AccordionComponent(RadixPrimitiveComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AccordionComponent":
"""Create the component.
@@ -246,23 +246,25 @@ class AccordionRoot(AccordionComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
- on_value_change: Optional[EventType[str | List[str]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ on_value_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str | List[str]], BASE_STATE]]
+ ] = None,
**props,
) -> "AccordionRoot":
"""Create the component.
@@ -280,6 +282,7 @@ class AccordionRoot(AccordionComponent):
duration: The time in milliseconds to animate open and close
easing: The easing function to use for the animation.
show_dividers: Whether to show divider lines between items.
+ on_value_change: Fired when the opened the accordions changes.
color_scheme: The color scheme of the component.
variant: The variant of the component.
as_child: Change the default rendered element for the one passed as a child.
@@ -302,10 +305,10 @@ class AccordionItem(AccordionComponent):
def create( # type: ignore
cls,
*children,
- header: Optional[Union[Component, Var]] = None,
- content: Optional[Union[Component, Var]] = None,
value: Optional[Union[Var[str], str]] = None,
disabled: Optional[Union[Var[bool], bool]] = None,
+ header: Optional[Union[Component, Var[Union[Component, str]], str]] = None,
+ content: Optional[Union[Component, Var[Union[Component, str]], str]] = None,
color_scheme: Optional[
Union[
Literal[
@@ -380,32 +383,32 @@ class AccordionItem(AccordionComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AccordionItem":
"""Create an accordion item.
Args:
*children: The list of children to use if header and content are not provided.
- header: The header of the accordion item.
- content: The content of the accordion item.
value: A unique identifier for the item.
disabled: When true, prevents the user from interacting with the item.
+ header: The header of the accordion item.
+ content: The content of the accordion item.
color_scheme: The color scheme of the component.
variant: The variant of the component.
as_child: Change the default rendered element for the one passed as a child.
@@ -504,22 +507,22 @@ class AccordionHeader(AccordionComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AccordionHeader":
"""Create the Accordion header component.
@@ -624,22 +627,22 @@ class AccordionTrigger(AccordionComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AccordionTrigger":
"""Create the Accordion trigger component.
@@ -676,22 +679,22 @@ class AccordionIcon(Icon):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AccordionIcon":
"""Create the Accordion icon component.
@@ -793,22 +796,22 @@ class AccordionContent(AccordionComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AccordionContent":
"""Create the Accordion content component.
diff --git a/reflex/components/radix/primitives/base.pyi b/reflex/components/radix/primitives/base.pyi
index 3eacd3f07..42847f160 100644
--- a/reflex/components/radix/primitives/base.pyi
+++ b/reflex/components/radix/primitives/base.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.component import Component
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -22,22 +22,22 @@ class RadixPrimitiveComponent(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadixPrimitiveComponent":
"""Create the component.
@@ -70,22 +70,22 @@ class RadixPrimitiveComponentWithClassName(RadixPrimitiveComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadixPrimitiveComponentWithClassName":
"""Create the component.
diff --git a/reflex/components/radix/primitives/drawer.py b/reflex/components/radix/primitives/drawer.py
index 6fe4d10dd..ed57dcbd8 100644
--- a/reflex/components/radix/primitives/drawer.py
+++ b/reflex/components/radix/primitives/drawer.py
@@ -10,8 +10,7 @@ from reflex.components.component import Component, ComponentNamespace
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
from reflex.components.radix.themes.base import Theme
from reflex.components.radix.themes.layout.flex import Flex
-from reflex.event import EventHandler, empty_event, identity_event
-from reflex.utils import console
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
@@ -33,14 +32,29 @@ class DrawerRoot(DrawerComponent):
alias = "Vaul" + tag
+ # The open state of the drawer when it is initially rendered. Use when you do not need to control its open state.
+ default_open: Var[bool]
+
# Whether the drawer is open or not.
open: Var[bool]
- # Enable background scaling, it requires an element with [vaul-drawer-wrapper] data attribute to scale its background.
- should_scale_background: Var[bool]
+ # Fires when the drawer is opened or closed.
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
- # Number between 0 and 1 that determines when the drawer should be closed.
- close_threshold: Var[float]
+ # When `False`, it allows interaction with elements outside of the drawer without closing it. Defaults to `True`.
+ modal: Var[bool]
+
+ # Direction of the drawer. This adjusts the animations and the drag direction. Defaults to `"bottom"`
+ direction: Var[LiteralDirectionType]
+
+ # Gets triggered after the open or close animation ends, it receives an open argument with the open state of the drawer by the time the function was triggered.
+ on_animation_end: EventHandler[passthrough_event_spec(bool)]
+
+ # When `False`, dragging, clicking outside, pressing esc, etc. will not close the drawer. Use this in combination with the open prop, otherwise you won't be able to open/close the drawer.
+ dismissible: Var[bool]
+
+ # When `True`, dragging will only be possible by the handle.
+ handle_only: Var[bool]
# Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account.
snap_points: Optional[List[Union[str, float]]]
@@ -51,17 +65,14 @@ class DrawerRoot(DrawerComponent):
# Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
scroll_lock_timeout: Var[int]
- # When `False`, it allows to interact with elements outside of the drawer without closing it. Defaults to `True`.
- modal: Var[bool]
-
- # Direction of the drawer. Defaults to `"bottom"`
- direction: Var[LiteralDirectionType]
-
# When `True`, it prevents scroll restoration. Defaults to `True`.
preventScrollRestoration: Var[bool]
- # Fires when the drawer is opened.
- on_open_change: EventHandler[identity_event(bool)]
+ # Enable background scaling, it requires container element with `vaul-drawer-wrapper` attribute to scale its background.
+ should_scale_background: Var[bool]
+
+ # Number between 0 and 1 that determines when the drawer should be closed.
+ close_threshold: Var[float]
class DrawerTrigger(DrawerComponent):
@@ -79,8 +90,8 @@ class DrawerTrigger(DrawerComponent):
"""Create a new DrawerTrigger instance.
Args:
- children: The children of the element.
- props: The properties of the element.
+ *children: The children of the element.
+ **props: The properties of the element.
Returns:
The new DrawerTrigger instance.
@@ -128,20 +139,20 @@ class DrawerContent(DrawerComponent):
base_style.update(style)
return {"css": base_style}
- # Fired when the drawer content is opened. Deprecated.
- on_open_auto_focus: EventHandler[empty_event]
+ # Fired when the drawer content is opened.
+ on_open_auto_focus: EventHandler[no_args_event_spec]
- # Fired when the drawer content is closed. Deprecated.
- on_close_auto_focus: EventHandler[empty_event]
+ # Fired when the drawer content is closed.
+ on_close_auto_focus: EventHandler[no_args_event_spec]
- # Fired when the escape key is pressed. Deprecated.
- on_escape_key_down: EventHandler[empty_event]
+ # Fired when the escape key is pressed.
+ on_escape_key_down: EventHandler[no_args_event_spec]
- # Fired when the pointer is down outside the drawer content. Deprecated.
- on_pointer_down_outside: EventHandler[empty_event]
+ # Fired when the pointer is down outside the drawer content.
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
- # Fired when interacting outside the drawer content. Deprecated.
- on_interact_outside: EventHandler[empty_event]
+ # Fired when interacting outside the drawer content.
+ on_interact_outside: EventHandler[no_args_event_spec]
@classmethod
def create(cls, *children, **props):
@@ -158,23 +169,6 @@ class DrawerContent(DrawerComponent):
Returns:
The drawer content.
"""
- deprecated_properties = [
- "on_open_auto_focus",
- "on_close_auto_focus",
- "on_escape_key_down",
- "on_pointer_down_outside",
- "on_interact_outside",
- ]
-
- for prop in deprecated_properties:
- if prop in props:
- console.deprecate(
- feature_name="drawer content events",
- reason=f"The `{prop}` event is deprecated and will be removed in 0.7.0.",
- deprecation_version="0.6.3",
- removal_version="0.7.0",
- )
-
comp = super().create(*children, **props)
return Theme.create(comp)
@@ -263,6 +257,14 @@ class DrawerDescription(DrawerComponent):
return {"css": base_style}
+class DrawerHandle(DrawerComponent):
+ """A description for the drawer."""
+
+ tag = "Drawer.Handle"
+
+ alias = "Vaul" + tag
+
+
class Drawer(ComponentNamespace):
"""A namespace for Drawer components."""
@@ -274,6 +276,7 @@ class Drawer(ComponentNamespace):
close = staticmethod(DrawerClose.create)
title = staticmethod(DrawerTitle.create)
description = staticmethod(DrawerDescription.create)
+ handle = staticmethod(DrawerHandle.create)
drawer = Drawer()
diff --git a/reflex/components/radix/primitives/drawer.pyi b/reflex/components/radix/primitives/drawer.pyi
index 9c5463e56..1ca1e4325 100644
--- a/reflex/components/radix/primitives/drawer.pyi
+++ b/reflex/components/radix/primitives/drawer.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -23,22 +23,22 @@ class DrawerComponent(RadixPrimitiveComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerComponent":
"""Create the component.
@@ -67,12 +67,8 @@ class DrawerRoot(DrawerComponent):
def create( # type: ignore
cls,
*children,
+ default_open: Optional[Union[Var[bool], bool]] = None,
open: Optional[Union[Var[bool], bool]] = None,
- should_scale_background: Optional[Union[Var[bool], bool]] = None,
- close_threshold: Optional[Union[Var[float], float]] = None,
- snap_points: Optional[List[Union[float, str]]] = None,
- fade_from_index: Optional[Union[Var[int], int]] = None,
- scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
modal: Optional[Union[Var[bool], bool]] = None,
direction: Optional[
Union[
@@ -80,45 +76,62 @@ class DrawerRoot(DrawerComponent):
Var[Literal["bottom", "left", "right", "top"]],
]
] = None,
+ dismissible: Optional[Union[Var[bool], bool]] = None,
+ handle_only: Optional[Union[Var[bool], bool]] = None,
+ snap_points: Optional[List[Union[float, str]]] = None,
+ fade_from_index: Optional[Union[Var[int], int]] = None,
+ scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
preventScrollRestoration: Optional[Union[Var[bool], bool]] = None,
+ should_scale_background: Optional[Union[Var[bool], bool]] = None,
+ close_threshold: Optional[Union[Var[float], float]] = None,
as_child: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerRoot":
"""Create the component.
Args:
*children: The children of the component.
+ default_open: The open state of the drawer when it is initially rendered. Use when you do not need to control its open state.
open: Whether the drawer is open or not.
- should_scale_background: Enable background scaling, it requires an element with [vaul-drawer-wrapper] data attribute to scale its background.
- close_threshold: Number between 0 and 1 that determines when the drawer should be closed.
+ on_open_change: Fires when the drawer is opened or closed.
+ modal: When `False`, it allows interaction with elements outside of the drawer without closing it. Defaults to `True`.
+ direction: Direction of the drawer. This adjusts the animations and the drag direction. Defaults to `"bottom"`
+ on_animation_end: Gets triggered after the open or close animation ends, it receives an open argument with the open state of the drawer by the time the function was triggered.
+ dismissible: When `False`, dragging, clicking outside, pressing esc, etc. will not close the drawer. Use this in combination with the open prop, otherwise you won't be able to open/close the drawer.
+ handle_only: When `True`, dragging will only be possible by the handle.
snap_points: Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account.
fade_from_index: Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
scroll_lock_timeout: Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
- modal: When `False`, it allows to interact with elements outside of the drawer without closing it. Defaults to `True`.
- direction: Direction of the drawer. Defaults to `"bottom"`
preventScrollRestoration: When `True`, it prevents scroll restoration. Defaults to `True`.
+ should_scale_background: Enable background scaling, it requires container element with `vaul-drawer-wrapper` attribute to scale its background.
+ close_threshold: Number between 0 and 1 that determines when the drawer should be closed.
as_child: Change the default rendered element for the one passed as a child.
style: The style of the component.
key: A unique key for the component.
@@ -145,29 +158,36 @@ class DrawerTrigger(DrawerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerTrigger":
"""Create a new DrawerTrigger instance.
Args:
- children: The children of the element.
- props: The properties of the element.
+ *children: The children of the element.
+ as_child: Change the default rendered element for the one passed as a child.
+ 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 properties of the element.
Returns:
The new DrawerTrigger instance.
@@ -186,22 +206,22 @@ class DrawerPortal(DrawerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerPortal":
"""Create the component.
@@ -234,27 +254,27 @@ class DrawerContent(DrawerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_close_auto_focus: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_interact_outside: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_auto_focus: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_close_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_interact_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerContent":
"""Create a Drawer Content.
@@ -291,22 +311,22 @@ class DrawerOverlay(DrawerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerOverlay":
"""Create the component.
@@ -339,29 +359,36 @@ class DrawerClose(DrawerTrigger):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerClose":
"""Create a new DrawerTrigger instance.
Args:
- children: The children of the element.
- props: The properties of the element.
+ *children: The children of the element.
+ as_child: Change the default rendered element for the one passed as a child.
+ 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 properties of the element.
Returns:
The new DrawerTrigger instance.
@@ -380,22 +407,22 @@ class DrawerTitle(DrawerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerTitle":
"""Create the component.
@@ -428,22 +455,22 @@ class DrawerDescription(DrawerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerDescription":
"""Create the component.
@@ -464,6 +491,54 @@ class DrawerDescription(DrawerComponent):
"""
...
+class DrawerHandle(DrawerComponent):
+ @overload
+ @classmethod
+ def create( # type: ignore
+ cls,
+ *children,
+ as_child: 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, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ **props,
+ ) -> "DrawerHandle":
+ """Create the component.
+
+ Args:
+ *children: The children of the component.
+ as_child: Change the default rendered element for the one passed as a child.
+ 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.
+ """
+ ...
+
class Drawer(ComponentNamespace):
root = staticmethod(DrawerRoot.create)
trigger = staticmethod(DrawerTrigger.create)
@@ -473,16 +548,13 @@ class Drawer(ComponentNamespace):
close = staticmethod(DrawerClose.create)
title = staticmethod(DrawerTitle.create)
description = staticmethod(DrawerDescription.create)
+ handle = staticmethod(DrawerHandle.create)
@staticmethod
def __call__(
*children,
+ default_open: Optional[Union[Var[bool], bool]] = None,
open: Optional[Union[Var[bool], bool]] = None,
- should_scale_background: Optional[Union[Var[bool], bool]] = None,
- close_threshold: Optional[Union[Var[float], float]] = None,
- snap_points: Optional[List[Union[float, str]]] = None,
- fade_from_index: Optional[Union[Var[int], int]] = None,
- scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
modal: Optional[Union[Var[bool], bool]] = None,
direction: Optional[
Union[
@@ -490,45 +562,62 @@ class Drawer(ComponentNamespace):
Var[Literal["bottom", "left", "right", "top"]],
]
] = None,
+ dismissible: Optional[Union[Var[bool], bool]] = None,
+ handle_only: Optional[Union[Var[bool], bool]] = None,
+ snap_points: Optional[List[Union[float, str]]] = None,
+ fade_from_index: Optional[Union[Var[int], int]] = None,
+ scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
preventScrollRestoration: Optional[Union[Var[bool], bool]] = None,
+ should_scale_background: Optional[Union[Var[bool], bool]] = None,
+ close_threshold: Optional[Union[Var[float], float]] = None,
as_child: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerRoot":
"""Create the component.
Args:
*children: The children of the component.
+ default_open: The open state of the drawer when it is initially rendered. Use when you do not need to control its open state.
open: Whether the drawer is open or not.
- should_scale_background: Enable background scaling, it requires an element with [vaul-drawer-wrapper] data attribute to scale its background.
- close_threshold: Number between 0 and 1 that determines when the drawer should be closed.
+ on_open_change: Fires when the drawer is opened or closed.
+ modal: When `False`, it allows interaction with elements outside of the drawer without closing it. Defaults to `True`.
+ direction: Direction of the drawer. This adjusts the animations and the drag direction. Defaults to `"bottom"`
+ on_animation_end: Gets triggered after the open or close animation ends, it receives an open argument with the open state of the drawer by the time the function was triggered.
+ dismissible: When `False`, dragging, clicking outside, pressing esc, etc. will not close the drawer. Use this in combination with the open prop, otherwise you won't be able to open/close the drawer.
+ handle_only: When `True`, dragging will only be possible by the handle.
snap_points: Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Also Accept px values, which doesn't take screen height into account.
fade_from_index: Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
scroll_lock_timeout: Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
- modal: When `False`, it allows to interact with elements outside of the drawer without closing it. Defaults to `True`.
- direction: Direction of the drawer. Defaults to `"bottom"`
preventScrollRestoration: When `True`, it prevents scroll restoration. Defaults to `True`.
+ should_scale_background: Enable background scaling, it requires container element with `vaul-drawer-wrapper` attribute to scale its background.
+ close_threshold: Number between 0 and 1 that determines when the drawer should be closed.
as_child: Change the default rendered element for the one passed as a child.
style: The style of the component.
key: A unique key for the component.
diff --git a/reflex/components/radix/primitives/form.py b/reflex/components/radix/primitives/form.py
index 4d4be7e40..f2b8201ad 100644
--- a/reflex/components/radix/primitives/form.py
+++ b/reflex/components/radix/primitives/form.py
@@ -8,7 +8,7 @@ from reflex.components.component import ComponentNamespace
from reflex.components.core.debounce import DebounceInput
from reflex.components.el.elements.forms import Form as HTMLForm
from reflex.components.radix.themes.components.text_field import TextFieldRoot
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.vars.base import Var
from .base import RadixPrimitiveComponentWithClassName
@@ -28,7 +28,7 @@ class FormRoot(FormComponent, HTMLForm):
alias = "RadixFormRoot"
# Fired when the errors are cleared.
- on_clear_server_errors: EventHandler[empty_event]
+ on_clear_server_errors: EventHandler[no_args_event_spec]
def add_style(self) -> dict[str, Any] | None:
"""Add style to the component.
diff --git a/reflex/components/radix/primitives/form.pyi b/reflex/components/radix/primitives/form.pyi
index 2139f0c23..77c8be77c 100644
--- a/reflex/components/radix/primitives/form.pyi
+++ b/reflex/components/radix/primitives/form.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.el.elements.forms import Form as HTMLForm
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -25,22 +25,22 @@ class FormComponent(RadixPrimitiveComponentWithClassName):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormComponent":
"""Create the component.
@@ -113,30 +113,40 @@ class FormRoot(FormComponent, HTMLForm):
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[EventType[[]]] = None,
- on_clear_server_errors: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_submit: Optional[EventType[Dict[str, Any]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_clear_server_errors: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_submit: Optional[
+ Union[
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, Any]], BASE_STATE]
+ ],
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, str]], BASE_STATE]
+ ],
+ ]
+ ] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormRoot":
"""Create a form component.
Args:
*children: The children of the form.
+ on_clear_server_errors: Fired when the errors are cleared.
as_child: Change the default rendered element for the one passed as a child.
accept: MIME types the server accepts for file upload
accept_charset: Character encodings to be used for form submission
@@ -149,6 +159,7 @@ class FormRoot(FormComponent, 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.
+ 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.
@@ -193,22 +204,22 @@ class FormField(FormComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormField":
"""Create the component.
@@ -244,22 +255,22 @@ class FormLabel(FormComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormLabel":
"""Create the component.
@@ -292,22 +303,22 @@ class FormControl(FormComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormControl":
"""Create a Form Control component.
@@ -390,22 +401,22 @@ class FormMessage(FormComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormMessage":
"""Create the component.
@@ -441,22 +452,22 @@ class FormValidityState(FormComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormValidityState":
"""Create the component.
@@ -489,22 +500,22 @@ class FormSubmit(FormComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FormSubmit":
"""Create the component.
@@ -578,30 +589,40 @@ class Form(FormRoot):
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[EventType[[]]] = None,
- on_clear_server_errors: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_submit: Optional[EventType[Dict[str, Any]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_clear_server_errors: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_submit: Optional[
+ Union[
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, Any]], BASE_STATE]
+ ],
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, str]], BASE_STATE]
+ ],
+ ]
+ ] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Form":
"""Create a form component.
Args:
*children: The children of the form.
+ on_clear_server_errors: Fired when the errors are cleared.
as_child: Change the default rendered element for the one passed as a child.
accept: MIME types the server accepts for file upload
accept_charset: Character encodings to be used for form submission
@@ -614,6 +635,7 @@ class Form(FormRoot):
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.
+ 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.
@@ -700,30 +722,40 @@ class FormNamespace(ComponentNamespace):
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[EventType[[]]] = None,
- on_clear_server_errors: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_submit: Optional[EventType[Dict[str, Any]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_clear_server_errors: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_submit: Optional[
+ Union[
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, Any]], BASE_STATE]
+ ],
+ Union[
+ EventType[[], BASE_STATE], EventType[[Dict[str, str]], BASE_STATE]
+ ],
+ ]
+ ] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Form":
"""Create a form component.
Args:
*children: The children of the form.
+ on_clear_server_errors: Fired when the errors are cleared.
as_child: Change the default rendered element for the one passed as a child.
accept: MIME types the server accepts for file upload
accept_charset: Character encodings to be used for form submission
@@ -736,6 +768,7 @@ class FormNamespace(ComponentNamespace):
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.
+ 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.
diff --git a/reflex/components/radix/primitives/progress.pyi b/reflex/components/radix/primitives/progress.pyi
index c760c0a57..32e4bb155 100644
--- a/reflex/components/radix/primitives/progress.pyi
+++ b/reflex/components/radix/primitives/progress.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -23,22 +23,22 @@ class ProgressComponent(RadixPrimitiveComponentWithClassName):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ProgressComponent":
"""Create the component.
@@ -78,22 +78,22 @@ class ProgressRoot(ProgressComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ProgressRoot":
"""Create the component.
@@ -192,22 +192,22 @@ class ProgressIndicator(ProgressComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ProgressIndicator":
"""Create the component.
@@ -313,22 +313,22 @@ class Progress(ProgressRoot):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Progress":
"""High-level API for progress bar.
@@ -435,22 +435,22 @@ class ProgressNamespace(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Progress":
"""High-level API for progress bar.
diff --git a/reflex/components/radix/primitives/slider.pyi b/reflex/components/radix/primitives/slider.pyi
index 3d57fbe5c..2a14ba518 100644
--- a/reflex/components/radix/primitives/slider.pyi
+++ b/reflex/components/radix/primitives/slider.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
from reflex.components.component import Component, ComponentNamespace
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -26,22 +26,22 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SliderComponent":
"""Create the component.
@@ -93,30 +93,36 @@ class SliderRoot(SliderComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
- on_value_change: Optional[EventType[List[int]]] = None,
- on_value_commit: Optional[EventType[List[int]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ on_value_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[List[int]], BASE_STATE]]
+ ] = None,
+ on_value_commit: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[List[int]], BASE_STATE]]
+ ] = None,
**props,
) -> "SliderRoot":
"""Create the component.
Args:
*children: The children of the component.
+ on_value_change: Fired when the value of a thumb changes.
+ on_value_commit: Fired when a thumb is released.
as_child: Change the default rendered element for the one passed as a child.
style: The style of the component.
key: A unique key for the component.
@@ -144,22 +150,22 @@ class SliderTrack(SliderComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SliderTrack":
"""Create the component.
@@ -193,22 +199,22 @@ class SliderRange(SliderComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SliderRange":
"""Create the component.
@@ -242,22 +248,22 @@ class SliderThumb(SliderComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SliderThumb":
"""Create the component.
diff --git a/reflex/components/radix/themes/base.py b/reflex/components/radix/themes/base.py
index e41c5e7b0..65a9ae835 100644
--- a/reflex/components/radix/themes/base.py
+++ b/reflex/components/radix/themes/base.py
@@ -5,6 +5,7 @@ from __future__ import annotations
from typing import Any, Dict, Literal
from reflex.components import Component
+from reflex.components.core.breakpoints import Responsive
from reflex.components.tags import Tag
from reflex.config import get_config
from reflex.utils.imports import ImportDict, ImportVar
@@ -74,6 +75,31 @@ class CommonMarginProps(Component):
ml: Var[LiteralSpacing]
+class CommonPaddingProps(Component):
+ """Many radix-themes elements accept shorthand padding props."""
+
+ # Padding: "0" - "9"
+ p: Var[Responsive[LiteralSpacing]]
+
+ # Padding horizontal: "0" - "9"
+ px: Var[Responsive[LiteralSpacing]]
+
+ # Padding vertical: "0" - "9"
+ py: Var[Responsive[LiteralSpacing]]
+
+ # Padding top: "0" - "9"
+ pt: Var[Responsive[LiteralSpacing]]
+
+ # Padding right: "0" - "9"
+ pr: Var[Responsive[LiteralSpacing]]
+
+ # Padding bottom: "0" - "9"
+ pb: Var[Responsive[LiteralSpacing]]
+
+ # Padding left: "0" - "9"
+ pl: Var[Responsive[LiteralSpacing]]
+
+
class RadixLoadingProp(Component):
"""Base class for components that can be in a loading state."""
@@ -86,6 +112,9 @@ class RadixThemesComponent(Component):
library = "@radix-ui/themes@^3.0.0"
+ # Temporary pin < 3.1.5 until radix-ui/themes#627 is resolved.
+ library = library + " && <3.1.5"
+
# "Fake" prop color_scheme is used to avoid shadowing CSS prop "color".
_rename_props: Dict[str, str] = {"colorScheme": "color"}
@@ -221,7 +250,7 @@ class Theme(RadixThemesComponent):
The import dict.
"""
_imports: ImportDict = {
- "/utils/theme.js": [ImportVar(tag="theme", is_default=True)],
+ "$/utils/theme.js": [ImportVar(tag="theme", is_default=True)],
}
if get_config().tailwind is None:
# When tailwind is disabled, import the radix-ui styles directly because they will
@@ -236,7 +265,7 @@ class Theme(RadixThemesComponent):
tag = super()._render(props)
tag.add_props(
css=Var(
- _js_expr=f"{{...theme.styles.global[':root'], ...theme.styles.global.body}}"
+ _js_expr="{...theme.styles.global[':root'], ...theme.styles.global.body}"
),
)
return tag
@@ -265,7 +294,7 @@ class ThemePanel(RadixThemesComponent):
class RadixThemesColorModeProvider(Component):
"""Next-themes integration for radix themes components."""
- library = "/components/reflex/radix_themes_color_mode_provider.js"
+ library = "$/components/reflex/radix_themes_color_mode_provider.js"
tag = "RadixThemesColorModeProvider"
is_default = True
diff --git a/reflex/components/radix/themes/base.pyi b/reflex/components/radix/themes/base.pyi
index 0f0de5401..b0a8e2fcb 100644
--- a/reflex/components/radix/themes/base.pyi
+++ b/reflex/components/radix/themes/base.pyi
@@ -6,7 +6,8 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components import Component
-from reflex.event import EventType
+from reflex.components.core.breakpoints import Breakpoints
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
@@ -102,22 +103,22 @@ class CommonMarginProps(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CommonMarginProps":
"""Create the component.
@@ -144,6 +145,178 @@ class CommonMarginProps(Component):
"""
...
+class CommonPaddingProps(Component):
+ @overload
+ @classmethod
+ def create( # type: ignore
+ cls,
+ *children,
+ p: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ px: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ py: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pt: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pr: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pb: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pl: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = 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, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ **props,
+ ) -> "CommonPaddingProps":
+ """Create the component.
+
+ Args:
+ *children: The children of the component.
+ p: Padding: "0" - "9"
+ px: Padding horizontal: "0" - "9"
+ py: Padding vertical: "0" - "9"
+ pt: Padding top: "0" - "9"
+ pr: Padding right: "0" - "9"
+ pb: Padding bottom: "0" - "9"
+ pl: Padding left: "0" - "9"
+ 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.
+ """
+ ...
+
class RadixLoadingProp(Component):
@overload
@classmethod
@@ -156,22 +329,22 @@ class RadixLoadingProp(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadixLoadingProp":
"""Create the component.
@@ -203,22 +376,22 @@ class RadixThemesComponent(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadixThemesComponent":
"""Create a new component instance.
@@ -252,22 +425,22 @@ class RadixThemesTriggerComponent(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadixThemesTriggerComponent":
"""Create a new RadixThemesTriggerComponent instance.
@@ -384,22 +557,22 @@ class Theme(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Theme":
"""Create a new Radix Theme specification.
@@ -443,22 +616,22 @@ class ThemePanel(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ThemePanel":
"""Create a new component instance.
@@ -493,22 +666,22 @@ class RadixThemesColorModeProvider(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadixThemesColorModeProvider":
"""Create the component.
diff --git a/reflex/components/radix/themes/color_mode.py b/reflex/components/radix/themes/color_mode.py
index b1083ba94..2dd0f5e83 100644
--- a/reflex/components/radix/themes/color_mode.py
+++ b/reflex/components/radix/themes/color_mode.py
@@ -17,7 +17,7 @@ rx.text(
from __future__ import annotations
-from typing import Dict, List, Literal, get_args
+from typing import Dict, List, Literal, Optional, Union, get_args
from reflex.components.component import BaseComponent
from reflex.components.core.cond import Cond, color_mode_cond, cond
@@ -96,26 +96,31 @@ def _set_static_default(props, position, prop, default):
class ColorModeIconButton(IconButton):
"""Icon Button for toggling light / dark mode via toggle_color_mode."""
+ # The position of the icon button. Follow document flow if None.
+ position: Optional[Union[LiteralPosition, Var[LiteralPosition]]] = None
+
+ # Allow picking the "system" value for the color mode.
+ allow_system: bool = False
+
@classmethod
def create(
cls,
- position: LiteralPosition | None = None,
- allow_system: bool = False,
**props,
):
- """Create a icon button component that calls toggle_color_mode on click.
+ """Create an icon button component that calls toggle_color_mode on click.
Args:
- position: The position of the icon button. Follow document flow if None.
- allow_system: Allow picking the "system" value for the color mode.
**props: The props to pass to the component.
Returns:
The button component.
"""
+ position = props.pop("position", None)
+ allow_system = props.pop("allow_system", False)
+
# position is used to set nice defaults for positioning the icon button
if isinstance(position, Var):
- _set_var_default(props, position, "position", "fixed", position)
+ _set_var_default(props, position, "position", "fixed", position) # type: ignore
_set_var_default(props, position, "bottom", "2rem")
_set_var_default(props, position, "top", "2rem")
_set_var_default(props, position, "left", "2rem")
@@ -155,12 +160,15 @@ class ColorModeIconButton(IconButton):
color_mode_item("system"),
),
)
- return super().create(
+ return IconButton.create(
ColorModeIcon.create(),
on_click=toggle_color_mode,
**props,
)
+ def _exclude_props(self) -> list[str]:
+ return ["position", "allow_system"]
+
class ColorModeSwitch(Switch):
"""Switch for toggling light / dark mode via toggle_color_mode."""
@@ -195,5 +203,5 @@ class ColorModeNamespace(Var):
color_mode = color_mode_var_and_namespace = ColorModeNamespace(
_js_expr=color_mode._js_expr,
_var_type=color_mode._var_type,
- _var_data=color_mode.get_default_value(),
+ _var_data=color_mode._get_default_value(),
)
diff --git a/reflex/components/radix/themes/color_mode.pyi b/reflex/components/radix/themes/color_mode.pyi
index 43703dc37..eb3c4234a 100644
--- a/reflex/components/radix/themes/color_mode.pyi
+++ b/reflex/components/radix/themes/color_mode.pyi
@@ -10,11 +10,8 @@ from reflex.components.core.breakpoints import Breakpoints
from reflex.components.core.cond import Cond
from reflex.components.lucide.icon import Icon
from reflex.components.radix.themes.components.switch import Switch
-from reflex.event import EventType
-from reflex.style import (
- Style,
- color_mode,
-)
+from reflex.event import BASE_STATE, EventType
+from reflex.style import Style, color_mode
from reflex.vars.base import Var
from .components.icon_button import IconButton
@@ -36,22 +33,22 @@ class ColorModeIcon(Cond):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ColorModeIcon":
"""Create an icon component based on color_mode.
@@ -75,6 +72,18 @@ class ColorModeIconButton(IconButton):
def create( # type: ignore
cls,
*children,
+ position: Optional[
+ Union[
+ Literal["bottom-left", "bottom-right", "top-left", "top-right"],
+ Union[
+ Literal["bottom-left", "bottom-right", "top-left", "top-right"],
+ Var[
+ Literal["bottom-left", "bottom-right", "top-left", "top-right"]
+ ],
+ ],
+ ]
+ ] = None,
+ allow_system: Optional[bool] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
size: Optional[
Union[
@@ -208,25 +217,25 @@ class ColorModeIconButton(IconButton):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ColorModeIconButton":
- """Create a icon button component that calls toggle_color_mode on click.
+ """Create an icon button component that calls toggle_color_mode on click.
Args:
position: The position of the icon button. Follow document flow if None.
@@ -381,23 +390,25 @@ class ColorModeSwitch(Switch):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ColorModeSwitch":
"""Create a switch component bound to color_mode.
@@ -416,6 +427,7 @@ class ColorModeSwitch(Switch):
color_scheme: Override theme color for switch
high_contrast: Whether to render the switch with higher contrast color against background
radius: Override theme radius for switch: "none" | "small" | "full"
+ on_change: Props to rename Fired when the value of the switch changes
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -437,5 +449,5 @@ class ColorModeNamespace(Var):
color_mode = color_mode_var_and_namespace = ColorModeNamespace(
_js_expr=color_mode._js_expr,
_var_type=color_mode._var_type,
- _var_data=color_mode.get_default_value(),
+ _var_data=color_mode._get_default_value(),
)
diff --git a/reflex/components/radix/themes/components/alert_dialog.py b/reflex/components/radix/themes/components/alert_dialog.py
index f3c8ec319..36d38532c 100644
--- a/reflex/components/radix/themes/components/alert_dialog.py
+++ b/reflex/components/radix/themes/components/alert_dialog.py
@@ -5,7 +5,7 @@ from typing import Literal
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
from ..base import RadixThemesComponent, RadixThemesTriggerComponent
@@ -22,7 +22,10 @@ class AlertDialogRoot(RadixThemesComponent):
open: Var[bool]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
+
+ # The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
+ default_open: Var[bool]
class AlertDialogTrigger(RadixThemesTriggerComponent):
@@ -43,13 +46,13 @@ class AlertDialogContent(elements.Div, RadixThemesComponent):
force_mount: Var[bool]
# Fired when the dialog is opened.
- on_open_auto_focus: EventHandler[empty_event]
+ on_open_auto_focus: EventHandler[no_args_event_spec]
# Fired when the dialog is closed.
- on_close_auto_focus: EventHandler[empty_event]
+ on_close_auto_focus: EventHandler[no_args_event_spec]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
class AlertDialogTitle(RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/alert_dialog.pyi b/reflex/components/radix/themes/components/alert_dialog.pyi
index d63fcae53..ad243df34 100644
--- a/reflex/components/radix/themes/components/alert_dialog.pyi
+++ b/reflex/components/radix/themes/components/alert_dialog.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -23,28 +23,31 @@ class AlertDialogRoot(RadixThemesComponent):
cls,
*children,
open: Optional[Union[Var[bool], bool]] = None,
+ default_open: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AlertDialogRoot":
"""Create a new component instance.
@@ -55,6 +58,8 @@ class AlertDialogRoot(RadixThemesComponent):
Args:
*children: Child components.
open: The controlled open state of the dialog.
+ on_open_change: Fired when the open state changes.
+ default_open: The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -79,22 +84,22 @@ class AlertDialogTrigger(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AlertDialogTrigger":
"""Create a new RadixThemesTriggerComponent instance.
@@ -156,25 +161,25 @@ class AlertDialogContent(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_close_auto_focus: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_auto_focus: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_close_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AlertDialogContent":
"""Create a new component instance.
@@ -186,6 +191,9 @@ class AlertDialogContent(elements.Div, RadixThemesComponent):
*children: Child components.
size: The size of the content.
force_mount: Whether to force mount the content on open.
+ on_open_auto_focus: Fired when the dialog is opened.
+ on_close_auto_focus: Fired when the dialog is closed.
+ on_escape_key_down: Fired when the escape key is pressed.
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.
@@ -226,22 +234,22 @@ class AlertDialogTitle(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AlertDialogTitle":
"""Create a new component instance.
@@ -275,22 +283,22 @@ class AlertDialogDescription(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AlertDialogDescription":
"""Create a new component instance.
@@ -324,22 +332,22 @@ class AlertDialogAction(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AlertDialogAction":
"""Create a new RadixThemesTriggerComponent instance.
@@ -364,22 +372,22 @@ class AlertDialogCancel(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AlertDialogCancel":
"""Create a new RadixThemesTriggerComponent instance.
diff --git a/reflex/components/radix/themes/components/aspect_ratio.pyi b/reflex/components/radix/themes/components/aspect_ratio.pyi
index 848d2064a..882014073 100644
--- a/reflex/components/radix/themes/components/aspect_ratio.pyi
+++ b/reflex/components/radix/themes/components/aspect_ratio.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -23,22 +23,22 @@ class AspectRatio(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AspectRatio":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/avatar.py b/reflex/components/radix/themes/components/avatar.py
index 4f3956e76..77a305e29 100644
--- a/reflex/components/radix/themes/components/avatar.py
+++ b/reflex/components/radix/themes/components/avatar.py
@@ -5,11 +5,7 @@ from typing import Literal
from reflex.components.core.breakpoints import Responsive
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- LiteralRadius,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, LiteralRadius, RadixThemesComponent
LiteralSize = Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]
diff --git a/reflex/components/radix/themes/components/avatar.pyi b/reflex/components/radix/themes/components/avatar.pyi
index fc42457da..e0ff0d913 100644
--- a/reflex/components/radix/themes/components/avatar.pyi
+++ b/reflex/components/radix/themes/components/avatar.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -113,22 +113,22 @@ class Avatar(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Avatar":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/badge.py b/reflex/components/radix/themes/components/badge.py
index 9391e53c3..389012bf0 100644
--- a/reflex/components/radix/themes/components/badge.py
+++ b/reflex/components/radix/themes/components/badge.py
@@ -6,11 +6,7 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- LiteralRadius,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, LiteralRadius, RadixThemesComponent
class Badge(elements.Span, RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/badge.pyi b/reflex/components/radix/themes/components/badge.pyi
index 405b7b835..3e4f19f6e 100644
--- a/reflex/components/radix/themes/components/badge.pyi
+++ b/reflex/components/radix/themes/components/badge.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -134,22 +134,22 @@ class Badge(elements.Span, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Badge":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/button.pyi b/reflex/components/radix/themes/components/button.pyi
index f9702d3b5..ea2b63fbe 100644
--- a/reflex/components/radix/themes/components/button.pyi
+++ b/reflex/components/radix/themes/components/button.pyi
@@ -7,14 +7,11 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from ..base import (
- RadixLoadingProp,
- RadixThemesComponent,
-)
+from ..base import RadixLoadingProp, RadixThemesComponent
LiteralButtonSize = Literal["1", "2", "3", "4"]
@@ -157,22 +154,22 @@ class Button(elements.Button, RadixLoadingProp, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Button":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/callout.py b/reflex/components/radix/themes/components/callout.py
index 926e0ad54..6b0a1d399 100644
--- a/reflex/components/radix/themes/components/callout.py
+++ b/reflex/components/radix/themes/components/callout.py
@@ -9,10 +9,7 @@ from reflex.components.el import elements
from reflex.components.lucide.icon import Icon
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
CalloutVariant = Literal["soft", "surface", "outline"]
diff --git a/reflex/components/radix/themes/components/callout.pyi b/reflex/components/radix/themes/components/callout.pyi
index 18ae5a357..b2643b558 100644
--- a/reflex/components/radix/themes/components/callout.pyi
+++ b/reflex/components/radix/themes/components/callout.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -132,22 +132,22 @@ class CalloutRoot(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CalloutRoot":
"""Create a new component instance.
@@ -226,22 +226,22 @@ class CalloutIcon(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CalloutIcon":
"""Create a new component instance.
@@ -315,22 +315,22 @@ class CalloutText(elements.P, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CalloutText":
"""Create a new component instance.
@@ -487,22 +487,22 @@ class Callout(CalloutRoot):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Callout":
"""Create a callout component.
@@ -665,22 +665,22 @@ class CalloutNamespace(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Callout":
"""Create a callout component.
diff --git a/reflex/components/radix/themes/components/card.py b/reflex/components/radix/themes/components/card.py
index 4983cdd41..30823de56 100644
--- a/reflex/components/radix/themes/components/card.py
+++ b/reflex/components/radix/themes/components/card.py
@@ -6,9 +6,7 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
-)
+from ..base import RadixThemesComponent
class Card(elements.Div, RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/card.pyi b/reflex/components/radix/themes/components/card.pyi
index dc45bc226..74b91f8ab 100644
--- a/reflex/components/radix/themes/components/card.pyi
+++ b/reflex/components/radix/themes/components/card.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -67,22 +67,22 @@ class Card(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Card":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/checkbox.py b/reflex/components/radix/themes/components/checkbox.py
index 2944b1f11..42277bfea 100644
--- a/reflex/components/radix/themes/components/checkbox.py
+++ b/reflex/components/radix/themes/components/checkbox.py
@@ -6,14 +6,10 @@ from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.radix.themes.layout.flex import Flex
from reflex.components.radix.themes.typography.text import Text
-from reflex.event import EventHandler, identity_event
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.vars.base import LiteralVar, Var
-from ..base import (
- LiteralAccentColor,
- LiteralSpacing,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, LiteralSpacing, RadixThemesComponent
LiteralCheckboxSize = Literal["1", "2", "3"]
LiteralCheckboxVariant = Literal["classic", "surface", "soft"]
@@ -61,7 +57,7 @@ class Checkbox(RadixThemesComponent):
_rename_props = {"onChange": "onCheckedChange"}
# Fired when the checkbox is checked or unchecked.
- on_change: EventHandler[identity_event(bool)]
+ on_change: EventHandler[passthrough_event_spec(bool)]
class HighLevelCheckbox(RadixThemesComponent):
@@ -112,7 +108,7 @@ class HighLevelCheckbox(RadixThemesComponent):
_rename_props = {"onChange": "onCheckedChange"}
# Fired when the checkbox is checked or unchecked.
- on_change: EventHandler[identity_event(bool)]
+ on_change: EventHandler[passthrough_event_spec(bool)]
@classmethod
def create(cls, text: Var[str] = LiteralVar.create(""), **props) -> Component:
diff --git a/reflex/components/radix/themes/components/checkbox.pyi b/reflex/components/radix/themes/components/checkbox.pyi
index fad4f5210..a8ac3a0b6 100644
--- a/reflex/components/radix/themes/components/checkbox.pyi
+++ b/reflex/components/radix/themes/components/checkbox.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -114,23 +114,25 @@ class Checkbox(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Checkbox":
"""Create a new component instance.
@@ -151,6 +153,7 @@ class Checkbox(RadixThemesComponent):
required: Whether the checkbox is required
name: The name of the checkbox control when submitting the form.
value: The value of the checkbox control when submitting the form.
+ on_change: Props to rename 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.
@@ -261,23 +264,25 @@ class HighLevelCheckbox(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HighLevelCheckbox":
"""Create a checkbox with a label.
@@ -297,6 +302,7 @@ class HighLevelCheckbox(RadixThemesComponent):
required: Whether the checkbox is required
name: The name of the checkbox control when submitting the form.
value: The value of the checkbox control when submitting the form.
+ on_change: Props to rename 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.
@@ -405,23 +411,25 @@ class CheckboxNamespace(ComponentNamespace):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HighLevelCheckbox":
"""Create a checkbox with a label.
@@ -441,6 +449,7 @@ class CheckboxNamespace(ComponentNamespace):
required: Whether the checkbox is required
name: The name of the checkbox control when submitting the form.
value: The value of the checkbox control when submitting the form.
+ on_change: Props to rename 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.
diff --git a/reflex/components/radix/themes/components/checkbox_cards.pyi b/reflex/components/radix/themes/components/checkbox_cards.pyi
index 062fc1357..64eb151b0 100644
--- a/reflex/components/radix/themes/components/checkbox_cards.pyi
+++ b/reflex/components/radix/themes/components/checkbox_cards.pyi
@@ -7,7 +7,7 @@ from types import SimpleNamespace
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -147,22 +147,22 @@ class CheckboxCardsRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CheckboxCardsRoot":
"""Create a new component instance.
@@ -202,22 +202,22 @@ class CheckboxCardsItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CheckboxCardsItem":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/checkbox_group.pyi b/reflex/components/radix/themes/components/checkbox_group.pyi
index 363be0599..ffeeb75cf 100644
--- a/reflex/components/radix/themes/components/checkbox_group.pyi
+++ b/reflex/components/radix/themes/components/checkbox_group.pyi
@@ -7,7 +7,7 @@ from types import SimpleNamespace
from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -106,22 +106,22 @@ class CheckboxGroupRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CheckboxGroupRoot":
"""Create a new component instance.
@@ -163,22 +163,22 @@ class CheckboxGroupItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CheckboxGroupItem":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/context_menu.py b/reflex/components/radix/themes/components/context_menu.py
index 3eb54a457..ea4902233 100644
--- a/reflex/components/radix/themes/components/context_menu.py
+++ b/reflex/components/radix/themes/components/context_menu.py
@@ -1,16 +1,28 @@
"""Interactive components provided by @radix-ui/themes."""
-from typing import List, Literal
+from typing import Dict, List, Literal, Union
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
+
+LiteralDirType = Literal["ltr", "rtl"]
+
+LiteralSizeType = Literal["1", "2"]
+
+LiteralVariantType = Literal["solid", "soft"]
+
+LiteralSideType = Literal["top", "right", "bottom", "left"]
+
+LiteralAlignType = Literal["start", "center", "end"]
+
+LiteralStickyType = Literal[
+ "partial",
+ "always",
+]
class ContextMenuRoot(RadixThemesComponent):
@@ -24,7 +36,10 @@ class ContextMenuRoot(RadixThemesComponent):
_invalid_children: List[str] = ["ContextMenuItem"]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
+
+ # The reading direction of submenus when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
+ dir: Var[LiteralDirType]
class ContextMenuTrigger(RadixThemesComponent):
@@ -45,38 +60,65 @@ class ContextMenuContent(RadixThemesComponent):
tag = "ContextMenu.Content"
- # Button size "1" - "4"
- size: Var[Responsive[Literal["1", "2"]]]
+ # Dropdown Menu Content size "1" - "2"
+ size: Var[Responsive[LiteralSizeType]]
- # Variant of button: "solid" | "soft" | "outline" | "ghost"
- variant: Var[Literal["solid", "soft"]]
+ # Variant of Dropdown Menu Content: "solid" | "soft"
+ variant: Var[LiteralVariantType]
- # Override theme color for button
+ # Override theme color for Dropdown Menu Content
color_scheme: Var[LiteralAccentColor]
- # Whether to render the button with higher contrast color against background
+ # Renders the Dropdown Menu Content in higher contrast
high_contrast: Var[bool]
- # The vertical distance in pixels from the anchor.
- align_offset: Var[int]
+ # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
+ as_child: Var[bool]
- # When true, overrides the side and aligns preferences to prevent collisions with boundary edges.
+ # When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False.
+ loop: Var[bool]
+
+ # Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
+ force_mount: Var[bool]
+
+ # The preferred side of the trigger to render against when open. Will be reversed when collisions occur and `avoid_collisions` is enabled.The position of the tooltip. Defaults to "top".
+ side: Var[LiteralSideType]
+
+ # The distance in pixels from the trigger. Defaults to 0.
+ side_offset: Var[Union[float, int]]
+
+ # The preferred alignment against the trigger. May change when collisions occur. Defaults to "center".
+ align: Var[LiteralAlignType]
+
+ # An offset in pixels from the "start" or "end" alignment options.
+ align_offset: Var[Union[float, int]]
+
+ # When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
avoid_collisions: Var[bool]
- # Fired when the context menu is closed.
- on_close_auto_focus: EventHandler[empty_event]
+ # The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
+ collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
+
+ # The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
+ sticky: Var[LiteralStickyType]
+
+ # Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ hide_when_detached: Var[bool]
+
+ # Fired when focus moves back after closing.
+ on_close_auto_focus: EventHandler[no_args_event_spec]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
# Fired when a pointer down event happens outside the context menu.
- on_pointer_down_outside: EventHandler[empty_event]
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
# Fired when focus moves outside the context menu.
- on_focus_outside: EventHandler[empty_event]
+ on_focus_outside: EventHandler[no_args_event_spec]
- # Fired when interacting outside the context menu.
- on_interact_outside: EventHandler[empty_event]
+ # Fired when the pointer interacts outside the context menu.
+ on_interact_outside: EventHandler[no_args_event_spec]
class ContextMenuSub(RadixThemesComponent):
@@ -84,15 +126,30 @@ class ContextMenuSub(RadixThemesComponent):
tag = "ContextMenu.Sub"
+ # The controlled open state of the submenu. Must be used in conjunction with `on_open_change`.
+ open: Var[bool]
+
+ # The open state of the submenu when it is initially rendered. Use when you do not need to control its open state.
+ default_open: Var[bool]
+
+ # Fired when the open state changes.
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
+
class ContextMenuSubTrigger(RadixThemesComponent):
"""An item that opens a submenu."""
tag = "ContextMenu.SubTrigger"
+ # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
+ as_child: Var[bool]
+
# Whether the trigger is disabled
disabled: Var[bool]
+ # Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
+ text_value: Var[str]
+
_valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSub"]
@@ -101,22 +158,46 @@ class ContextMenuSubContent(RadixThemesComponent):
tag = "ContextMenu.SubContent"
- # When true, keyboard navigation will loop from last item to first, and vice versa.
+ # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
+ as_child: Var[bool]
+
+ # When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False.
loop: Var[bool]
+ # Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
+ force_mount: Var[bool]
+
+ # The distance in pixels from the trigger. Defaults to 0.
+ side_offset: Var[Union[float, int]]
+
+ # An offset in pixels from the "start" or "end" alignment options.
+ align_offset: Var[Union[float, int]]
+
+ # When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
+ avoid_collisions: Var[bool]
+
+ # The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
+ collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
+
+ # The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
+ sticky: Var[LiteralStickyType]
+
+ # Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ hide_when_detached: Var[bool]
+
_valid_parents: List[str] = ["ContextMenuSub"]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
# Fired when a pointer down event happens outside the context menu.
- on_pointer_down_outside: EventHandler[empty_event]
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
# Fired when focus moves outside the context menu.
- on_focus_outside: EventHandler[empty_event]
+ on_focus_outside: EventHandler[no_args_event_spec]
# Fired when interacting outside the context menu.
- on_interact_outside: EventHandler[empty_event]
+ on_interact_outside: EventHandler[no_args_event_spec]
class ContextMenuItem(RadixThemesComponent):
@@ -130,8 +211,20 @@ class ContextMenuItem(RadixThemesComponent):
# Shortcut to render a menu item as a link
shortcut: Var[str]
+ # Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
+ as_child: Var[bool]
+
+ # When true, prevents the user from interacting with the item.
+ disabled: Var[bool]
+
+ # Optional text used for typeahead purposes. By default the typeahead behavior will use the content of the item. Use this when the content is complex, or you have non-textual content inside.
+ text_value: Var[str]
+
_valid_parents: List[str] = ["ContextMenuContent", "ContextMenuSubContent"]
+ # Fired when the item is selected.
+ on_select: EventHandler[no_args_event_spec]
+
class ContextMenuSeparator(RadixThemesComponent):
"""Separates items in a context menu."""
diff --git a/reflex/components/radix/themes/components/context_menu.pyi b/reflex/components/radix/themes/components/context_menu.pyi
index fbefa88de..c5ef757d1 100644
--- a/reflex/components/radix/themes/components/context_menu.pyi
+++ b/reflex/components/radix/themes/components/context_menu.pyi
@@ -7,12 +7,19 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
from ..base import RadixThemesComponent
+LiteralDirType = Literal["ltr", "rtl"]
+LiteralSizeType = Literal["1", "2"]
+LiteralVariantType = Literal["solid", "soft"]
+LiteralSideType = Literal["top", "right", "bottom", "left"]
+LiteralAlignType = Literal["start", "center", "end"]
+LiteralStickyType = Literal["partial", "always"]
+
class ContextMenuRoot(RadixThemesComponent):
@overload
@classmethod
@@ -20,28 +27,31 @@ class ContextMenuRoot(RadixThemesComponent):
cls,
*children,
modal: Optional[Union[Var[bool], bool]] = None,
+ dir: Optional[Union[Literal["ltr", "rtl"], Var[Literal["ltr", "rtl"]]]] = 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuRoot":
"""Create a new component instance.
@@ -52,6 +62,8 @@ class ContextMenuRoot(RadixThemesComponent):
Args:
*children: Child components.
modal: The modality of the context menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.
+ on_open_change: Fired when the open state changes.
+ dir: The reading direction of submenus when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -77,22 +89,22 @@ class ContextMenuTrigger(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuTrigger":
"""Create a new component instance.
@@ -195,34 +207,62 @@ class ContextMenuContent(RadixThemesComponent):
]
] = None,
high_contrast: Optional[Union[Var[bool], bool]] = None,
- align_offset: Optional[Union[Var[int], int]] = None,
+ as_child: Optional[Union[Var[bool], bool]] = None,
+ loop: Optional[Union[Var[bool], bool]] = None,
+ force_mount: Optional[Union[Var[bool], bool]] = None,
+ side: Optional[
+ Union[
+ Literal["bottom", "left", "right", "top"],
+ Var[Literal["bottom", "left", "right", "top"]],
+ ]
+ ] = None,
+ side_offset: Optional[Union[Var[Union[float, int]], float, int]] = None,
+ align: Optional[
+ Union[
+ Literal["center", "end", "start"],
+ Var[Literal["center", "end", "start"]],
+ ]
+ ] = None,
+ align_offset: Optional[Union[Var[Union[float, int]], float, int]] = None,
avoid_collisions: Optional[Union[Var[bool], bool]] = None,
+ collision_padding: Optional[
+ Union[
+ Dict[str, Union[float, int]],
+ Var[Union[Dict[str, Union[float, int]], float, int]],
+ float,
+ int,
+ ]
+ ] = None,
+ sticky: Optional[
+ Union[Literal["always", "partial"], Var[Literal["always", "partial"]]]
+ ] = None,
+ hide_when_detached: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_close_auto_focus: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_focus_outside: Optional[EventType[[]]] = None,
- on_interact_outside: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_close_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_interact_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuContent":
"""Create a new component instance.
@@ -232,12 +272,26 @@ class ContextMenuContent(RadixThemesComponent):
Args:
*children: Child components.
- size: Button size "1" - "4"
- variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
- color_scheme: Override theme color for button
- high_contrast: Whether to render the button with higher contrast color against background
- align_offset: The vertical distance in pixels from the anchor.
- avoid_collisions: When true, overrides the side and aligns preferences to prevent collisions with boundary edges.
+ size: Dropdown Menu Content size "1" - "2"
+ variant: Variant of Dropdown Menu Content: "solid" | "soft"
+ color_scheme: Override theme color for Dropdown Menu Content
+ high_contrast: Renders the Dropdown Menu Content in higher contrast
+ as_child: Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
+ loop: When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False.
+ force_mount: Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
+ side: The preferred side of the trigger to render against when open. Will be reversed when collisions occur and `avoid_collisions` is enabled.The position of the tooltip. Defaults to "top".
+ side_offset: The distance in pixels from the trigger. Defaults to 0.
+ align: The preferred alignment against the trigger. May change when collisions occur. Defaults to "center".
+ align_offset: An offset in pixels from the "start" or "end" alignment options.
+ avoid_collisions: When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
+ collision_padding: The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
+ sticky: The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
+ hide_when_detached: Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ on_close_auto_focus: Fired when focus moves back after closing.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when a pointer down event happens outside the context menu.
+ on_focus_outside: Fired when focus moves outside the context menu.
+ on_interact_outside: Fired when the pointer interacts outside the context menu.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -257,27 +311,32 @@ class ContextMenuSub(RadixThemesComponent):
def create( # type: ignore
cls,
*children,
+ open: Optional[Union[Var[bool], bool]] = None,
+ default_open: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuSub":
"""Create a new component instance.
@@ -287,6 +346,9 @@ class ContextMenuSub(RadixThemesComponent):
Args:
*children: Child components.
+ open: The controlled open state of the submenu. Must be used in conjunction with `on_open_change`.
+ default_open: The open state of the submenu when it is initially rendered. Use when you do not need to control its open state.
+ on_open_change: Fired when the open state changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -306,28 +368,30 @@ class ContextMenuSubTrigger(RadixThemesComponent):
def create( # type: ignore
cls,
*children,
+ as_child: Optional[Union[Var[bool], bool]] = None,
disabled: Optional[Union[Var[bool], bool]] = None,
+ text_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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuSubTrigger":
"""Create a new component instance.
@@ -337,7 +401,9 @@ class ContextMenuSubTrigger(RadixThemesComponent):
Args:
*children: Child components.
+ as_child: Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
disabled: Whether the trigger is disabled
+ text_value: Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -357,32 +423,49 @@ class ContextMenuSubContent(RadixThemesComponent):
def create( # type: ignore
cls,
*children,
+ as_child: Optional[Union[Var[bool], bool]] = None,
loop: Optional[Union[Var[bool], bool]] = None,
+ force_mount: Optional[Union[Var[bool], bool]] = None,
+ side_offset: Optional[Union[Var[Union[float, int]], float, int]] = None,
+ align_offset: Optional[Union[Var[Union[float, int]], float, int]] = None,
+ avoid_collisions: Optional[Union[Var[bool], bool]] = None,
+ collision_padding: Optional[
+ Union[
+ Dict[str, Union[float, int]],
+ Var[Union[Dict[str, Union[float, int]], float, int]],
+ float,
+ int,
+ ]
+ ] = None,
+ sticky: Optional[
+ Union[Literal["always", "partial"], Var[Literal["always", "partial"]]]
+ ] = None,
+ hide_when_detached: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_focus_outside: Optional[EventType[[]]] = None,
- on_interact_outside: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_interact_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuSubContent":
"""Create a new component instance.
@@ -392,7 +475,19 @@ class ContextMenuSubContent(RadixThemesComponent):
Args:
*children: Child components.
- loop: When true, keyboard navigation will loop from last item to first, and vice versa.
+ as_child: Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
+ loop: When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False.
+ force_mount: Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
+ side_offset: The distance in pixels from the trigger. Defaults to 0.
+ align_offset: An offset in pixels from the "start" or "end" alignment options.
+ avoid_collisions: When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
+ collision_padding: The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
+ sticky: The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
+ hide_when_detached: Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when a pointer down event happens outside the context menu.
+ on_focus_outside: Fired when focus moves outside the context menu.
+ on_interact_outside: Fired when interacting outside the context menu.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -475,27 +570,31 @@ class ContextMenuItem(RadixThemesComponent):
]
] = None,
shortcut: Optional[Union[Var[str], str]] = None,
+ as_child: Optional[Union[Var[bool], bool]] = None,
+ disabled: Optional[Union[Var[bool], bool]] = None,
+ text_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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_select: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuItem":
"""Create a new component instance.
@@ -507,6 +606,10 @@ class ContextMenuItem(RadixThemesComponent):
*children: Child components.
color_scheme: Override theme color for button
shortcut: Shortcut to render a menu item as a link
+ as_child: Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
+ disabled: When true, prevents the user from interacting with the item.
+ text_value: Optional text used for typeahead purposes. By default the typeahead behavior will use the content of the item. Use this when the content is complex, or you have non-textual content inside.
+ on_select: Fired when the item is selected.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -531,22 +634,22 @@ class ContextMenuSeparator(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ContextMenuSeparator":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/data_list.pyi b/reflex/components/radix/themes/components/data_list.pyi
index 342fa6e77..3b409363b 100644
--- a/reflex/components/radix/themes/components/data_list.pyi
+++ b/reflex/components/radix/themes/components/data_list.pyi
@@ -7,7 +7,7 @@ from types import SimpleNamespace
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -59,22 +59,22 @@ class DataListRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DataListRoot":
"""Create a new component instance.
@@ -128,22 +128,22 @@ class DataListItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DataListItem":
"""Create a new component instance.
@@ -249,22 +249,22 @@ class DataListLabel(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DataListLabel":
"""Create a new component instance.
@@ -302,22 +302,22 @@ class DataListValue(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DataListValue":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/dialog.py b/reflex/components/radix/themes/components/dialog.py
index e8da506ed..1b7c3b532 100644
--- a/reflex/components/radix/themes/components/dialog.py
+++ b/reflex/components/radix/themes/components/dialog.py
@@ -5,13 +5,10 @@ from typing import Literal
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
- RadixThemesTriggerComponent,
-)
+from ..base import RadixThemesComponent, RadixThemesTriggerComponent
class DialogRoot(RadixThemesComponent):
@@ -23,7 +20,10 @@ class DialogRoot(RadixThemesComponent):
open: Var[bool]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
+
+ # The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
+ default_open: Var[bool]
class DialogTrigger(RadixThemesTriggerComponent):
@@ -47,19 +47,19 @@ class DialogContent(elements.Div, RadixThemesComponent):
size: Var[Responsive[Literal["1", "2", "3", "4"]]]
# Fired when the dialog is opened.
- on_open_auto_focus: EventHandler[empty_event]
+ on_open_auto_focus: EventHandler[no_args_event_spec]
# Fired when the dialog is closed.
- on_close_auto_focus: EventHandler[empty_event]
+ on_close_auto_focus: EventHandler[no_args_event_spec]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
# Fired when the pointer is down outside the dialog.
- on_pointer_down_outside: EventHandler[empty_event]
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
# Fired when the pointer interacts outside the dialog.
- on_interact_outside: EventHandler[empty_event]
+ on_interact_outside: EventHandler[no_args_event_spec]
class DialogDescription(RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/dialog.pyi b/reflex/components/radix/themes/components/dialog.pyi
index e3f17d7e8..4c3045741 100644
--- a/reflex/components/radix/themes/components/dialog.pyi
+++ b/reflex/components/radix/themes/components/dialog.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -21,28 +21,31 @@ class DialogRoot(RadixThemesComponent):
cls,
*children,
open: Optional[Union[Var[bool], bool]] = None,
+ default_open: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DialogRoot":
"""Create a new component instance.
@@ -53,6 +56,8 @@ class DialogRoot(RadixThemesComponent):
Args:
*children: Child components.
open: The controlled open state of the dialog.
+ on_open_change: Fired when the open state changes.
+ default_open: The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -77,22 +82,22 @@ class DialogTrigger(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DialogTrigger":
"""Create a new RadixThemesTriggerComponent instance.
@@ -117,22 +122,22 @@ class DialogTitle(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DialogTitle":
"""Create a new component instance.
@@ -202,27 +207,27 @@ class DialogContent(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_close_auto_focus: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_interact_outside: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_auto_focus: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_close_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_interact_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DialogContent":
"""Create a new component instance.
@@ -233,6 +238,11 @@ class DialogContent(elements.Div, RadixThemesComponent):
Args:
*children: Child components.
size: DialogContent size "1" - "4"
+ on_open_auto_focus: Fired when the dialog is opened.
+ on_close_auto_focus: Fired when the dialog is closed.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when the pointer is down outside the dialog.
+ on_interact_outside: Fired when the pointer interacts outside the dialog.
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.
@@ -273,22 +283,22 @@ class DialogDescription(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DialogDescription":
"""Create a new component instance.
@@ -322,22 +332,22 @@ class DialogClose(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DialogClose":
"""Create a new RadixThemesTriggerComponent instance.
@@ -363,28 +373,31 @@ class Dialog(ComponentNamespace):
def __call__(
*children,
open: Optional[Union[Var[bool], bool]] = None,
+ default_open: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DialogRoot":
"""Create a new component instance.
@@ -395,6 +408,8 @@ class Dialog(ComponentNamespace):
Args:
*children: Child components.
open: The controlled open state of the dialog.
+ on_open_change: Fired when the open state changes.
+ default_open: The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/components/dropdown_menu.py b/reflex/components/radix/themes/components/dropdown_menu.py
index 885e8df35..abce3e3bb 100644
--- a/reflex/components/radix/themes/components/dropdown_menu.py
+++ b/reflex/components/radix/themes/components/dropdown_menu.py
@@ -4,14 +4,10 @@ from typing import Dict, List, Literal, Union
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
- RadixThemesTriggerComponent,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent, RadixThemesTriggerComponent
LiteralDirType = Literal["ltr", "rtl"]
@@ -23,7 +19,6 @@ LiteralSideType = Literal["top", "right", "bottom", "left"]
LiteralAlignType = Literal["start", "center", "end"]
-
LiteralStickyType = Literal[
"partial",
"always",
@@ -50,7 +45,7 @@ class DropdownMenuRoot(RadixThemesComponent):
_invalid_children: List[str] = ["DropdownMenuItem"]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
class DropdownMenuTrigger(RadixThemesTriggerComponent):
@@ -110,9 +105,6 @@ class DropdownMenuContent(RadixThemesComponent):
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
- # The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0.
- arrow_padding: Var[Union[float, int]]
-
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
sticky: Var[LiteralStickyType]
@@ -120,19 +112,19 @@ class DropdownMenuContent(RadixThemesComponent):
hide_when_detached: Var[bool]
# Fired when the dialog is closed.
- on_close_auto_focus: EventHandler[empty_event]
+ on_close_auto_focus: EventHandler[no_args_event_spec]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
# Fired when the pointer is down outside the dialog.
- on_pointer_down_outside: EventHandler[empty_event]
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
# Fired when focus moves outside the dialog.
- on_focus_outside: EventHandler[empty_event]
+ on_focus_outside: EventHandler[no_args_event_spec]
# Fired when the pointer interacts outside the dialog.
- on_interact_outside: EventHandler[empty_event]
+ on_interact_outside: EventHandler[no_args_event_spec]
class DropdownMenuSubTrigger(RadixThemesTriggerComponent):
@@ -164,7 +156,7 @@ class DropdownMenuSub(RadixThemesComponent):
default_open: Var[bool]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
class DropdownMenuSubContent(RadixThemesComponent):
@@ -193,9 +185,6 @@ class DropdownMenuSubContent(RadixThemesComponent):
# The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
- # The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0.
- arrow_padding: Var[Union[float, int]]
-
# The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
sticky: Var[LiteralStickyType]
@@ -205,16 +194,16 @@ class DropdownMenuSubContent(RadixThemesComponent):
_valid_parents: List[str] = ["DropdownMenuSub"]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
# Fired when the pointer is down outside the dialog.
- on_pointer_down_outside: EventHandler[empty_event]
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
# Fired when focus moves outside the dialog.
- on_focus_outside: EventHandler[empty_event]
+ on_focus_outside: EventHandler[no_args_event_spec]
# Fired when the pointer interacts outside the dialog.
- on_interact_outside: EventHandler[empty_event]
+ on_interact_outside: EventHandler[no_args_event_spec]
class DropdownMenuItem(RadixThemesComponent):
@@ -240,7 +229,7 @@ class DropdownMenuItem(RadixThemesComponent):
_valid_parents: List[str] = ["DropdownMenuContent", "DropdownMenuSubContent"]
# Fired when the item is selected.
- on_select: EventHandler[empty_event]
+ on_select: EventHandler[no_args_event_spec]
class DropdownMenuSeparator(RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/dropdown_menu.pyi b/reflex/components/radix/themes/components/dropdown_menu.pyi
index dba619e7d..96c624f89 100644
--- a/reflex/components/radix/themes/components/dropdown_menu.pyi
+++ b/reflex/components/radix/themes/components/dropdown_menu.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -35,23 +35,25 @@ class DropdownMenuRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuRoot":
"""Create a new component instance.
@@ -65,6 +67,7 @@ class DropdownMenuRoot(RadixThemesComponent):
open: The controlled open state of the dropdown menu. Must be used in conjunction with onOpenChange.
modal: The modality of the dropdown menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers. Defaults to True.
dir: The reading direction of submenus when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
+ on_open_change: Fired when the open state changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -90,22 +93,22 @@ class DropdownMenuTrigger(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuTrigger":
"""Create a new RadixThemesTriggerComponent instance.
@@ -224,7 +227,6 @@ class DropdownMenuContent(RadixThemesComponent):
int,
]
] = None,
- arrow_padding: Optional[Union[Var[Union[float, int]], float, int]] = None,
sticky: Optional[
Union[Literal["always", "partial"], Var[Literal["always", "partial"]]]
] = None,
@@ -234,27 +236,27 @@ class DropdownMenuContent(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_close_auto_focus: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_focus_outside: Optional[EventType[[]]] = None,
- on_interact_outside: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_close_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_interact_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuContent":
"""Create a new component instance.
@@ -277,9 +279,13 @@ class DropdownMenuContent(RadixThemesComponent):
align_offset: An offset in pixels from the "start" or "end" alignment options.
avoid_collisions: When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
collision_padding: The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
- arrow_padding: The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0.
sticky: The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
hide_when_detached: Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ on_close_auto_focus: Fired when the dialog is closed.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when the pointer is down outside the dialog.
+ on_focus_outside: Fired when focus moves outside the dialog.
+ on_interact_outside: Fired when the pointer interacts outside the dialog.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -307,22 +313,22 @@ class DropdownMenuSubTrigger(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuSubTrigger":
"""Create a new RadixThemesTriggerComponent instance.
@@ -349,23 +355,25 @@ class DropdownMenuSub(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuSub":
"""Create a new component instance.
@@ -377,6 +385,7 @@ class DropdownMenuSub(RadixThemesComponent):
*children: Child components.
open: The controlled open state of the submenu. Must be used in conjunction with `on_open_change`.
default_open: The open state of the submenu when it is initially rendered. Use when you do not need to control its open state.
+ on_open_change: Fired when the open state changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -410,7 +419,6 @@ class DropdownMenuSubContent(RadixThemesComponent):
int,
]
] = None,
- arrow_padding: Optional[Union[Var[Union[float, int]], float, int]] = None,
sticky: Optional[
Union[Literal["always", "partial"], Var[Literal["always", "partial"]]]
] = None,
@@ -420,26 +428,26 @@ class DropdownMenuSubContent(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_focus_outside: Optional[EventType[[]]] = None,
- on_interact_outside: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_interact_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuSubContent":
"""Create a new component instance.
@@ -456,9 +464,12 @@ class DropdownMenuSubContent(RadixThemesComponent):
align_offset: An offset in pixels from the "start" or "end" alignment options.
avoid_collisions: When true, overrides the side and align preferences to prevent collisions with boundary edges. Defaults to True.
collision_padding: The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
- arrow_padding: The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners. Defaults to 0.
sticky: The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
hide_when_detached: Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when the pointer is down outside the dialog.
+ on_focus_outside: Fired when focus moves outside the dialog.
+ on_interact_outside: Fired when the pointer interacts outside the dialog.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -549,23 +560,23 @@ class DropdownMenuItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_select: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_select: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuItem":
"""Create a new component instance.
@@ -580,6 +591,7 @@ class DropdownMenuItem(RadixThemesComponent):
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
disabled: When true, prevents the user from interacting with the item.
text_value: Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside.
+ on_select: Fired when the item is selected.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -604,22 +616,22 @@ class DropdownMenuSeparator(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DropdownMenuSeparator":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/hover_card.py b/reflex/components/radix/themes/components/hover_card.py
index e76184795..bd5489ce6 100644
--- a/reflex/components/radix/themes/components/hover_card.py
+++ b/reflex/components/radix/themes/components/hover_card.py
@@ -1,17 +1,14 @@
"""Interactive components provided by @radix-ui/themes."""
-from typing import Literal
+from typing import Dict, Literal, Union
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
-from reflex.event import EventHandler, identity_event
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
- RadixThemesTriggerComponent,
-)
+from ..base import RadixThemesComponent, RadixThemesTriggerComponent
class HoverCardRoot(RadixThemesComponent):
@@ -32,7 +29,7 @@ class HoverCardRoot(RadixThemesComponent):
close_delay: Var[int]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
class HoverCardTrigger(RadixThemesTriggerComponent):
@@ -55,9 +52,24 @@ class HoverCardContent(elements.Div, RadixThemesComponent):
# The preferred alignment against the trigger. May change when collisions occur.
align: Var[Literal["start", "center", "end"]]
+ # An offset in pixels from the "start" or "end" alignment options.
+ align_offset: Var[int]
+
# Whether or not the hover card should avoid collisions with its trigger.
avoid_collisions: Var[bool]
+ # The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { top: 20, left: 20 }.
+ collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
+
+ # The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless
+ sticky: Var[Literal["partial", "always"]]
+
+ # Whether to hide the content when the trigger becomes fully occluded.
+ hide_when_detached: Var[bool]
+
+ # Hovercard size "1" - "3"
+ size: Var[Responsive[Literal["1", "2", "3"]]]
+
class HoverCard(ComponentNamespace):
"""For sighted users to preview content available behind a link."""
diff --git a/reflex/components/radix/themes/components/hover_card.pyi b/reflex/components/radix/themes/components/hover_card.pyi
index 8924ef1a8..4b1de0d89 100644
--- a/reflex/components/radix/themes/components/hover_card.pyi
+++ b/reflex/components/radix/themes/components/hover_card.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -29,23 +29,25 @@ class HoverCardRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HoverCardRoot":
"""Create a new component instance.
@@ -59,6 +61,7 @@ class HoverCardRoot(RadixThemesComponent):
open: The controlled open state of the hover card. Must be used in conjunction with onOpenChange.
open_delay: The duration from when the mouse enters the trigger until the hover card opens.
close_delay: The duration from when the mouse leaves the trigger until the hover card closes.
+ on_open_change: Fired when the open state changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -83,22 +86,22 @@ class HoverCardTrigger(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HoverCardTrigger":
"""Create a new RadixThemesTriggerComponent instance.
@@ -137,7 +140,31 @@ class HoverCardContent(elements.Div, RadixThemesComponent):
Var[Literal["center", "end", "start"]],
]
] = None,
+ align_offset: Optional[Union[Var[int], int]] = None,
avoid_collisions: Optional[Union[Var[bool], bool]] = None,
+ collision_padding: Optional[
+ Union[
+ Dict[str, Union[float, int]],
+ Var[Union[Dict[str, Union[float, int]], float, int]],
+ float,
+ int,
+ ]
+ ] = None,
+ sticky: Optional[
+ Union[Literal["always", "partial"], Var[Literal["always", "partial"]]]
+ ] = None,
+ hide_when_detached: Optional[Union[Var[bool], bool]] = None,
+ size: Optional[
+ Union[
+ Breakpoints[str, Literal["1", "2", "3"]],
+ Literal["1", "2", "3"],
+ Var[
+ Union[
+ Breakpoints[str, Literal["1", "2", "3"]], Literal["1", "2", "3"]
+ ]
+ ],
+ ]
+ ] = None,
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
auto_capitalize: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
@@ -167,22 +194,22 @@ class HoverCardContent(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HoverCardContent":
"""Create a new component instance.
@@ -195,7 +222,12 @@ class HoverCardContent(elements.Div, RadixThemesComponent):
side: The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
side_offset: The distance in pixels from the trigger.
align: The preferred alignment against the trigger. May change when collisions occur.
+ align_offset: An offset in pixels from the "start" or "end" alignment options.
avoid_collisions: Whether or not the hover card should avoid collisions with its trigger.
+ collision_padding: The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { top: 20, left: 20 }.
+ sticky: The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless
+ hide_when_detached: Whether to hide the content when the trigger becomes fully occluded.
+ size: Hovercard size "1" - "3"
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.
@@ -242,23 +274,25 @@ class HoverCard(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HoverCardRoot":
"""Create a new component instance.
@@ -272,6 +306,7 @@ class HoverCard(ComponentNamespace):
open: The controlled open state of the hover card. Must be used in conjunction with onOpenChange.
open_delay: The duration from when the mouse enters the trigger until the hover card opens.
close_delay: The duration from when the mouse leaves the trigger until the hover card closes.
+ on_open_change: Fired when the open state changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/components/icon_button.pyi b/reflex/components/radix/themes/components/icon_button.pyi
index 901c8d6ff..e600a9bee 100644
--- a/reflex/components/radix/themes/components/icon_button.pyi
+++ b/reflex/components/radix/themes/components/icon_button.pyi
@@ -7,14 +7,11 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from ..base import (
- RadixLoadingProp,
- RadixThemesComponent,
-)
+from ..base import RadixLoadingProp, RadixThemesComponent
LiteralButtonSize = Literal["1", "2", "3", "4"]
@@ -157,22 +154,22 @@ class IconButton(elements.Button, RadixLoadingProp, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "IconButton":
"""Create a IconButton component.
diff --git a/reflex/components/radix/themes/components/inset.py b/reflex/components/radix/themes/components/inset.py
index 347b9f6b0..059858272 100644
--- a/reflex/components/radix/themes/components/inset.py
+++ b/reflex/components/radix/themes/components/inset.py
@@ -6,9 +6,7 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
-)
+from ..base import RadixThemesComponent
LiteralButtonSize = Literal["1", "2", "3", "4"]
diff --git a/reflex/components/radix/themes/components/inset.pyi b/reflex/components/radix/themes/components/inset.pyi
index d6b0cce04..c4f07320b 100644
--- a/reflex/components/radix/themes/components/inset.pyi
+++ b/reflex/components/radix/themes/components/inset.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -132,22 +132,22 @@ class Inset(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Inset":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/popover.py b/reflex/components/radix/themes/components/popover.py
index 2535a8a22..bdf5f4af3 100644
--- a/reflex/components/radix/themes/components/popover.py
+++ b/reflex/components/radix/themes/components/popover.py
@@ -1,17 +1,14 @@
"""Interactive components provided by @radix-ui/themes."""
-from typing import Literal
+from typing import Dict, Literal, Union
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
- RadixThemesTriggerComponent,
-)
+from ..base import RadixThemesComponent, RadixThemesTriggerComponent
class PopoverRoot(RadixThemesComponent):
@@ -26,7 +23,10 @@ class PopoverRoot(RadixThemesComponent):
modal: Var[bool]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
+
+ # The open state of the popover when it is initially rendered. Use when you do not need to control its open state.
+ default_open: Var[bool]
class PopoverTrigger(RadixThemesTriggerComponent):
@@ -58,23 +58,32 @@ class PopoverContent(elements.Div, RadixThemesComponent):
# When true, overrides the side andalign preferences to prevent collisions with boundary edges.
avoid_collisions: Var[bool]
+ # The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
+ collision_padding: Var[Union[float, int, Dict[str, Union[float, int]]]]
+
+ # The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
+ sticky: Var[Literal["partial", "always"]]
+
+ # Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ hide_when_detached: Var[bool]
+
# Fired when the dialog is opened.
- on_open_auto_focus: EventHandler[empty_event]
+ on_open_auto_focus: EventHandler[no_args_event_spec]
# Fired when the dialog is closed.
- on_close_auto_focus: EventHandler[empty_event]
+ on_close_auto_focus: EventHandler[no_args_event_spec]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
# Fired when the pointer is down outside the dialog.
- on_pointer_down_outside: EventHandler[empty_event]
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
# Fired when focus moves outside the dialog.
- on_focus_outside: EventHandler[empty_event]
+ on_focus_outside: EventHandler[no_args_event_spec]
# Fired when the pointer interacts outside the dialog.
- on_interact_outside: EventHandler[empty_event]
+ on_interact_outside: EventHandler[no_args_event_spec]
class PopoverClose(RadixThemesTriggerComponent):
diff --git a/reflex/components/radix/themes/components/popover.pyi b/reflex/components/radix/themes/components/popover.pyi
index 984a139d0..d4b324817 100644
--- a/reflex/components/radix/themes/components/popover.pyi
+++ b/reflex/components/radix/themes/components/popover.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -22,28 +22,31 @@ class PopoverRoot(RadixThemesComponent):
*children,
open: Optional[Union[Var[bool], bool]] = None,
modal: Optional[Union[Var[bool], bool]] = None,
+ default_open: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PopoverRoot":
"""Create a new component instance.
@@ -55,6 +58,8 @@ class PopoverRoot(RadixThemesComponent):
*children: Child components.
open: The controlled open state of the popover.
modal: The modality of the popover. When set to true, interaction with outside elements will be disabled and only popover content will be visible to screen readers.
+ on_open_change: Fired when the open state changes.
+ default_open: The open state of the popover when it is initially rendered. Use when you do not need to control its open state.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -79,22 +84,22 @@ class PopoverTrigger(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PopoverTrigger":
"""Create a new RadixThemesTriggerComponent instance.
@@ -141,6 +146,18 @@ class PopoverContent(elements.Div, RadixThemesComponent):
] = None,
align_offset: Optional[Union[Var[int], int]] = None,
avoid_collisions: Optional[Union[Var[bool], bool]] = None,
+ collision_padding: Optional[
+ Union[
+ Dict[str, Union[float, int]],
+ Var[Union[Dict[str, Union[float, int]], float, int]],
+ float,
+ int,
+ ]
+ ] = None,
+ sticky: Optional[
+ Union[Literal["always", "partial"], Var[Literal["always", "partial"]]]
+ ] = None,
+ hide_when_detached: Optional[Union[Var[bool], bool]] = None,
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
auto_capitalize: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
@@ -170,28 +187,28 @@ class PopoverContent(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_close_auto_focus: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_focus_outside: Optional[EventType[[]]] = None,
- on_interact_outside: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_auto_focus: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_close_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_interact_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PopoverContent":
"""Create a new component instance.
@@ -207,6 +224,15 @@ class PopoverContent(elements.Div, RadixThemesComponent):
align: The preferred alignment against the anchor. May change when collisions occur.
align_offset: The vertical distance in pixels from the anchor.
avoid_collisions: When true, overrides the side andalign preferences to prevent collisions with boundary edges.
+ collision_padding: The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { "top": 20, "left": 20 }. Defaults to 0.
+ sticky: The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless. Defaults to "partial".
+ hide_when_detached: Whether to hide the content when the trigger becomes fully occluded. Defaults to False.
+ on_open_auto_focus: Fired when the dialog is opened.
+ on_close_auto_focus: Fired when the dialog is closed.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when the pointer is down outside the dialog.
+ on_focus_outside: Fired when focus moves outside the dialog.
+ on_interact_outside: Fired when the pointer interacts outside the dialog.
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.
@@ -247,22 +273,22 @@ class PopoverClose(RadixThemesTriggerComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PopoverClose":
"""Create a new RadixThemesTriggerComponent instance.
diff --git a/reflex/components/radix/themes/components/progress.pyi b/reflex/components/radix/themes/components/progress.pyi
index 6470842f3..5b3f8ba51 100644
--- a/reflex/components/radix/themes/components/progress.pyi
+++ b/reflex/components/radix/themes/components/progress.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -113,22 +113,22 @@ class Progress(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Progress":
"""Create a Progress component.
diff --git a/reflex/components/radix/themes/components/radio.pyi b/reflex/components/radix/themes/components/radio.pyi
index f1a6b131a..49490286f 100644
--- a/reflex/components/radix/themes/components/radio.pyi
+++ b/reflex/components/radix/themes/components/radio.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -103,22 +103,22 @@ class Radio(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Radio":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/radio_cards.py b/reflex/components/radix/themes/components/radio_cards.py
index e0aa2a749..e075a1ba2 100644
--- a/reflex/components/radix/themes/components/radio_cards.py
+++ b/reflex/components/radix/themes/components/radio_cards.py
@@ -4,7 +4,7 @@ from types import SimpleNamespace
from typing import Literal, Union
from reflex.components.core.breakpoints import Responsive
-from reflex.event import EventHandler, identity_event
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.vars.base import Var
from ..base import LiteralAccentColor, RadixThemesComponent
@@ -65,7 +65,7 @@ class RadioCardsRoot(RadixThemesComponent):
loop: Var[bool]
# Event handler called when the value changes.
- on_value_change: EventHandler[identity_event(str)]
+ on_value_change: EventHandler[passthrough_event_spec(str)]
class RadioCardsItem(RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/radio_cards.pyi b/reflex/components/radix/themes/components/radio_cards.pyi
index d73447622..5ba01d0a0 100644
--- a/reflex/components/radix/themes/components/radio_cards.pyi
+++ b/reflex/components/radix/themes/components/radio_cards.pyi
@@ -7,7 +7,7 @@ from types import SimpleNamespace
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -161,23 +161,25 @@ class RadioCardsRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
- on_value_change: Optional[EventType] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ on_value_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
**props,
) -> "RadioCardsRoot":
"""Create a new component instance.
@@ -201,6 +203,7 @@ class RadioCardsRoot(RadixThemesComponent):
orientation: The orientation of the component.
dir: The reading direction of the radio group. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
loop: When true, keyboard navigation will loop from last item to first, and vice versa.
+ on_value_change: Event handler called when the value changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -229,22 +232,22 @@ class RadioCardsItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadioCardsItem":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/radio_group.py b/reflex/components/radix/themes/components/radio_group.py
index a55ca3a41..dc9c11f5a 100644
--- a/reflex/components/radix/themes/components/radio_group.py
+++ b/reflex/components/radix/themes/components/radio_group.py
@@ -9,16 +9,12 @@ from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.radix.themes.layout.flex import Flex
from reflex.components.radix.themes.typography.text import Text
-from reflex.event import EventHandler, identity_event
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils import types
from reflex.vars.base import LiteralVar, Var
from reflex.vars.sequence import StringVar
-from ..base import (
- LiteralAccentColor,
- LiteralSpacing,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, LiteralSpacing, RadixThemesComponent
LiteralFlexDirection = Literal["row", "column", "row-reverse", "column-reverse"]
@@ -59,7 +55,7 @@ class RadioGroupRoot(RadixThemesComponent):
_rename_props = {"onChange": "onValueChange"}
# Fired when the value of the radio group changes.
- on_change: EventHandler[identity_event(str)]
+ on_change: EventHandler[passthrough_event_spec(str)]
class RadioGroupItem(RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/radio_group.pyi b/reflex/components/radix/themes/components/radio_group.pyi
index c984fa1f2..f251f541f 100644
--- a/reflex/components/radix/themes/components/radio_group.pyi
+++ b/reflex/components/radix/themes/components/radio_group.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -111,23 +111,25 @@ class RadioGroupRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadioGroupRoot":
"""Create a new component instance.
@@ -146,6 +148,7 @@ class RadioGroupRoot(RadixThemesComponent):
disabled: Whether the radio group is disabled
name: The name of the group. Submitted with its owning form as part of a name/value pair.
required: Whether the radio group is required
+ on_change: Props to rename Fired when the value of the radio group changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -173,22 +176,22 @@ class RadioGroupItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadioGroupItem":
"""Create a new component instance.
@@ -315,22 +318,22 @@ class HighLevelRadioGroup(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HighLevelRadioGroup":
"""Create a radio group component.
@@ -467,22 +470,22 @@ class RadioGroup(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HighLevelRadioGroup":
"""Create a radio group component.
diff --git a/reflex/components/radix/themes/components/scroll_area.py b/reflex/components/radix/themes/components/scroll_area.py
index bd58118dd..516649e12 100644
--- a/reflex/components/radix/themes/components/scroll_area.py
+++ b/reflex/components/radix/themes/components/scroll_area.py
@@ -4,9 +4,7 @@ from typing import Literal
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
-)
+from ..base import RadixThemesComponent
class ScrollArea(RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/scroll_area.pyi b/reflex/components/radix/themes/components/scroll_area.pyi
index 8deeb0fe9..5945cc3af 100644
--- a/reflex/components/radix/themes/components/scroll_area.pyi
+++ b/reflex/components/radix/themes/components/scroll_area.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Literal, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -35,22 +35,22 @@ class ScrollArea(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ScrollArea":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/segmented_control.py b/reflex/components/radix/themes/components/segmented_control.py
index 22725eaa6..f2dd9dc7c 100644
--- a/reflex/components/radix/themes/components/segmented_control.py
+++ b/reflex/components/radix/themes/components/segmented_control.py
@@ -12,7 +12,9 @@ from reflex.vars.base import Var
from ..base import LiteralAccentColor, RadixThemesComponent
-def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]:
+def on_value_change(
+ value: Var[Union[str, List[str]]],
+) -> Tuple[Var[Union[str, List[str]]]]:
"""Handle the on_value_change event.
Args:
diff --git a/reflex/components/radix/themes/components/segmented_control.pyi b/reflex/components/radix/themes/components/segmented_control.pyi
index cb1990a7c..c7e87ca34 100644
--- a/reflex/components/radix/themes/components/segmented_control.pyi
+++ b/reflex/components/radix/themes/components/segmented_control.pyi
@@ -7,13 +7,15 @@ from types import SimpleNamespace
from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
from ..base import RadixThemesComponent
-def on_value_change(value: Var[str | List[str]]) -> Tuple[Var[str | List[str]]]: ...
+def on_value_change(
+ value: Var[Union[str, List[str]]],
+) -> Tuple[Var[Union[str, List[str]]]]: ...
class SegmentedControlRoot(RadixThemesComponent):
@overload
@@ -115,23 +117,28 @@ class SegmentedControlRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType[str | List[str]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[Union[str, List[str]]], BASE_STATE],
+ ]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SegmentedControlRoot":
"""Create a new component instance.
@@ -148,6 +155,7 @@ class SegmentedControlRoot(RadixThemesComponent):
radius: The radius of the segmented control: "none" | "small" | "medium" | "large" | "full"
default_value: The default value of the segmented control.
value: The current value of the segmented control.
+ on_change: Handles the `onChange` event for the SegmentedControl component.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -173,22 +181,22 @@ class SegmentedControlItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SegmentedControlItem":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/select.py b/reflex/components/radix/themes/components/select.py
index 47a1eaf3f..45e5712bc 100644
--- a/reflex/components/radix/themes/components/select.py
+++ b/reflex/components/radix/themes/components/select.py
@@ -5,14 +5,10 @@ from typing import List, Literal, Union
import reflex as rx
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.breakpoints import Responsive
-from reflex.event import empty_event, identity_event
+from reflex.event import no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- LiteralRadius,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, LiteralRadius, RadixThemesComponent
class SelectRoot(RadixThemesComponent):
@@ -48,10 +44,10 @@ class SelectRoot(RadixThemesComponent):
_rename_props = {"onChange": "onValueChange"}
# Fired when the value of the select changes.
- on_change: rx.EventHandler[identity_event(str)]
+ on_change: rx.EventHandler[passthrough_event_spec(str)]
# Fired when the select is opened or closed.
- on_open_change: rx.EventHandler[identity_event(bool)]
+ on_open_change: rx.EventHandler[passthrough_event_spec(bool)]
class SelectTrigger(RadixThemesComponent):
@@ -104,13 +100,13 @@ class SelectContent(RadixThemesComponent):
align_offset: Var[int]
# Fired when the select content is closed.
- on_close_auto_focus: rx.EventHandler[empty_event]
+ on_close_auto_focus: rx.EventHandler[no_args_event_spec]
# Fired when the escape key is pressed.
- on_escape_key_down: rx.EventHandler[empty_event]
+ on_escape_key_down: rx.EventHandler[no_args_event_spec]
# Fired when a pointer down event happens outside the select content.
- on_pointer_down_outside: rx.EventHandler[empty_event]
+ on_pointer_down_outside: rx.EventHandler[no_args_event_spec]
class SelectGroup(RadixThemesComponent):
diff --git a/reflex/components/radix/themes/components/select.pyi b/reflex/components/radix/themes/components/select.pyi
index c43d58ada..39caeef9c 100644
--- a/reflex/components/radix/themes/components/select.pyi
+++ b/reflex/components/radix/themes/components/select.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -42,24 +42,28 @@ class SelectRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SelectRoot":
"""Create a new component instance.
@@ -77,6 +81,8 @@ class SelectRoot(RadixThemesComponent):
name: The name of the select control when submitting the form.
disabled: When True, prevents the user from interacting with select.
required: When True, indicates that the user must select a value before the owning form can be submitted.
+ on_change: Props to rename Fired when the value of the select changes.
+ on_open_change: Fired when the select is opened or closed.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -176,22 +182,22 @@ class SelectTrigger(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SelectTrigger":
"""Create a new component instance.
@@ -315,25 +321,25 @@ class SelectContent(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_close_auto_focus: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_close_auto_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SelectContent":
"""Create a new component instance.
@@ -351,6 +357,9 @@ class SelectContent(RadixThemesComponent):
side_offset: The distance in pixels from the anchor. Only available when position is set to popper.
align: The preferred alignment against the anchor. May change when collisions occur. Only available when position is set to popper.
align_offset: The vertical distance in pixels from the anchor. Only available when position is set to popper.
+ on_close_auto_focus: Fired when the select content is closed.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when a pointer down event happens outside the select content.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -375,22 +384,22 @@ class SelectGroup(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SelectGroup":
"""Create a new component instance.
@@ -426,22 +435,22 @@ class SelectItem(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SelectItem":
"""Create a new component instance.
@@ -477,22 +486,22 @@ class SelectLabel(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SelectLabel":
"""Create a new component instance.
@@ -526,22 +535,22 @@ class SelectSeparator(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SelectSeparator":
"""Create a new component instance.
@@ -678,24 +687,28 @@ class HighLevelSelect(SelectRoot):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HighLevelSelect":
"""Create a select component.
@@ -719,6 +732,8 @@ class HighLevelSelect(SelectRoot):
name: The name of the select control when submitting the form.
disabled: When True, prevents the user from interacting with select.
required: When True, indicates that the user must select a value before the owning form can be submitted.
+ on_change: Props to rename Fired when the value of the select changes.
+ on_open_change: Fired when the select is opened or closed.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -852,24 +867,28 @@ class Select(ComponentNamespace):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HighLevelSelect":
"""Create a select component.
@@ -893,6 +912,8 @@ class Select(ComponentNamespace):
name: The name of the select control when submitting the form.
disabled: When True, prevents the user from interacting with select.
required: When True, indicates that the user must select a value before the owning form can be submitted.
+ on_change: Props to rename Fired when the value of the select changes.
+ on_open_change: Fired when the select is opened or closed.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/components/separator.py b/reflex/components/radix/themes/components/separator.py
index 1689717d2..9fc06807a 100644
--- a/reflex/components/radix/themes/components/separator.py
+++ b/reflex/components/radix/themes/components/separator.py
@@ -5,10 +5,7 @@ from typing import Literal
from reflex.components.core.breakpoints import Responsive
from reflex.vars.base import LiteralVar, Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
LiteralSeperatorSize = Literal["1", "2", "3", "4"]
diff --git a/reflex/components/radix/themes/components/separator.pyi b/reflex/components/radix/themes/components/separator.pyi
index 0f2895403..7c4bcd55f 100644
--- a/reflex/components/radix/themes/components/separator.pyi
+++ b/reflex/components/radix/themes/components/separator.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -112,22 +112,22 @@ class Separator(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Separator":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/skeleton.pyi b/reflex/components/radix/themes/components/skeleton.pyi
index 61b57c275..859954ccc 100644
--- a/reflex/components/radix/themes/components/skeleton.pyi
+++ b/reflex/components/radix/themes/components/skeleton.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -42,22 +42,22 @@ class Skeleton(RadixLoadingProp, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Skeleton":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/slider.py b/reflex/components/radix/themes/components/slider.py
index 0d99eda27..6acc21497 100644
--- a/reflex/components/radix/themes/components/slider.py
+++ b/reflex/components/radix/themes/components/slider.py
@@ -2,33 +2,22 @@
from __future__ import annotations
-from typing import List, Literal, Optional, Tuple, Union
+from typing import List, Literal, Optional, Union
from reflex.components.component import Component
from reflex.components.core.breakpoints import Responsive
-from reflex.event import EventHandler
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
+from ..base import LiteralAccentColor, RadixThemesComponent
+
+on_value_event_spec = (
+ passthrough_event_spec(list[Union[int, float]]),
+ passthrough_event_spec(list[int]),
+ passthrough_event_spec(list[float]),
)
-def on_value_event_spec(
- value: Var[List[int | float]],
-) -> Tuple[Var[List[int | float]]]:
- """Event handler spec for the value event.
-
- Args:
- value: The value of the event.
-
- Returns:
- The event handler spec.
- """
- return (value,) # type: ignore
-
-
class Slider(RadixThemesComponent):
"""Provides user selection from a range of values."""
@@ -61,6 +50,9 @@ class Slider(RadixThemesComponent):
# The name of the slider. Submitted with its owning form as part of a name/value pair.
name: Var[str]
+ # The width of the slider.
+ width: Var[Optional[str]] = Var.create("100%")
+
# The minimum value of the slider.
min: Var[Union[float, int]]
@@ -89,20 +81,19 @@ class Slider(RadixThemesComponent):
def create(
cls,
*children,
- width: Optional[str] = "100%",
**props,
) -> Component:
"""Create a Slider component.
Args:
*children: The children of the component.
- width: The width of the slider.
**props: The properties of the component.
Returns:
The component.
"""
default_value = props.pop("default_value", [50])
+ width = props.pop("width", "100%")
if isinstance(default_value, Var):
if issubclass(default_value._var_type, (int, float)):
diff --git a/reflex/components/radix/themes/components/slider.pyi b/reflex/components/radix/themes/components/slider.pyi
index dec836835..972385e52 100644
--- a/reflex/components/radix/themes/components/slider.pyi
+++ b/reflex/components/radix/themes/components/slider.pyi
@@ -3,18 +3,20 @@
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
-from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
+from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType, passthrough_event_spec
from reflex.style import Style
from reflex.vars.base import Var
from ..base import RadixThemesComponent
-def on_value_event_spec(
- value: Var[List[int | float]],
-) -> Tuple[Var[List[int | float]]]: ...
+on_value_event_spec = (
+ passthrough_event_spec(list[Union[int, float]]),
+ passthrough_event_spec(list[int]),
+ passthrough_event_spec(list[float]),
+)
class Slider(RadixThemesComponent):
@overload
@@ -22,7 +24,6 @@ class Slider(RadixThemesComponent):
def create( # type: ignore
cls,
*children,
- width: Optional[str] = "100%",
as_child: Optional[Union[Var[bool], bool]] = None,
size: Optional[
Union[
@@ -121,6 +122,7 @@ class Slider(RadixThemesComponent):
Union[List[Union[float, int]], Var[List[Union[float, int]]]]
] = None,
name: Optional[Union[Var[str], str]] = None,
+ width: Optional[Union[Var[Optional[str]], str]] = None,
min: Optional[Union[Var[Union[float, int]], float, int]] = None,
max: Optional[Union[Var[Union[float, int]], float, int]] = None,
step: Optional[Union[Var[Union[float, int]], float, int]] = None,
@@ -136,31 +138,48 @@ class Slider(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType[List[int | float]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
- on_value_commit: Optional[EventType[List[int | float]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[list[Union[int, float]]], BASE_STATE],
+ ],
+ Union[EventType[[], BASE_STATE], EventType[[list[int]], BASE_STATE]],
+ Union[EventType[[], BASE_STATE], EventType[[list[float]], BASE_STATE]],
+ ]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ on_value_commit: Optional[
+ Union[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[list[Union[int, float]]], BASE_STATE],
+ ],
+ Union[EventType[[], BASE_STATE], EventType[[list[int]], BASE_STATE]],
+ Union[EventType[[], BASE_STATE], EventType[[list[float]], BASE_STATE]],
+ ]
+ ] = None,
**props,
) -> "Slider":
"""Create a Slider component.
Args:
*children: The children of the component.
- width: The width of the slider.
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
size: Button size "1" - "3"
variant: Variant of button
@@ -170,11 +189,14 @@ class Slider(RadixThemesComponent):
default_value: The value of the slider when initially rendered. Use when you do not need to control the state of the slider.
value: The controlled value of the slider. Must be used in conjunction with onValueChange.
name: The name of the slider. Submitted with its owning form as part of a name/value pair.
+ width: The width of the slider.
min: The minimum value of the slider.
max: The maximum value of the slider.
step: The step value of the slider.
disabled: Whether the slider is disabled
orientation: The orientation of the slider.
+ on_change: Props to rename Fired when the value of the slider changes.
+ on_value_commit: Fired when a thumb is released after being dragged.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/components/spinner.py b/reflex/components/radix/themes/components/spinner.py
index cc29d6091..620d248c4 100644
--- a/reflex/components/radix/themes/components/spinner.py
+++ b/reflex/components/radix/themes/components/spinner.py
@@ -5,10 +5,7 @@ from typing import Literal
from reflex.components.core.breakpoints import Responsive
from reflex.vars.base import Var
-from ..base import (
- RadixLoadingProp,
- RadixThemesComponent,
-)
+from ..base import RadixLoadingProp, RadixThemesComponent
LiteralSpinnerSize = Literal["1", "2", "3"]
diff --git a/reflex/components/radix/themes/components/spinner.pyi b/reflex/components/radix/themes/components/spinner.pyi
index 87033f05c..1c2b9c65e 100644
--- a/reflex/components/radix/themes/components/spinner.pyi
+++ b/reflex/components/radix/themes/components/spinner.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -37,22 +37,22 @@ class Spinner(RadixLoadingProp, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Spinner":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/components/switch.py b/reflex/components/radix/themes/components/switch.py
index 13be32d83..2af4f55bb 100644
--- a/reflex/components/radix/themes/components/switch.py
+++ b/reflex/components/radix/themes/components/switch.py
@@ -3,13 +3,10 @@
from typing import Literal
from reflex.components.core.breakpoints import Responsive
-from reflex.event import EventHandler, identity_event
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
LiteralSwitchSize = Literal["1", "2", "3"]
@@ -59,7 +56,7 @@ class Switch(RadixThemesComponent):
_rename_props = {"onChange": "onCheckedChange"}
# Fired when the value of the switch changes
- on_change: EventHandler[identity_event(bool)]
+ on_change: EventHandler[passthrough_event_spec(bool)]
switch = Switch.create
diff --git a/reflex/components/radix/themes/components/switch.pyi b/reflex/components/radix/themes/components/switch.pyi
index ba9c2595e..8a858040a 100644
--- a/reflex/components/radix/themes/components/switch.pyi
+++ b/reflex/components/radix/themes/components/switch.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -117,23 +117,25 @@ class Switch(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Switch":
"""Create a new component instance.
@@ -155,6 +157,7 @@ class Switch(RadixThemesComponent):
color_scheme: Override theme color for switch
high_contrast: Whether to render the switch with higher contrast color against background
radius: Override theme radius for switch: "none" | "small" | "full"
+ on_change: Props to rename Fired when the value of the switch changes
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/components/table.py b/reflex/components/radix/themes/components/table.py
index e1f03d4e2..a16002f58 100644
--- a/reflex/components/radix/themes/components/table.py
+++ b/reflex/components/radix/themes/components/table.py
@@ -7,9 +7,7 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
-)
+from ..base import CommonPaddingProps, RadixThemesComponent
class TableRoot(elements.Table, RadixThemesComponent):
@@ -53,6 +51,12 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
# The justification of the column
justify: Var[Literal["start", "center", "end"]]
+ # The minimum width of the cell
+ min_width: Var[Responsive[str]]
+
+ # The maximum width of the cell
+ max_width: Var[Responsive[str]]
+
_invalid_children: List[str] = [
"TableBody",
"TableHeader",
@@ -78,7 +82,7 @@ class TableBody(elements.Tbody, RadixThemesComponent):
_valid_parents: List[str] = ["TableRoot"]
-class TableCell(elements.Td, RadixThemesComponent):
+class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent):
"""A cell containing data."""
tag = "Table.Cell"
@@ -86,6 +90,12 @@ class TableCell(elements.Td, RadixThemesComponent):
# The justification of the column
justify: Var[Literal["start", "center", "end"]]
+ # The minimum width of the cell
+ min_width: Var[Responsive[str]]
+
+ # The maximum width of the cell
+ max_width: Var[Responsive[str]]
+
_invalid_children: List[str] = [
"TableBody",
"TableHeader",
@@ -95,7 +105,7 @@ class TableCell(elements.Td, RadixThemesComponent):
]
-class TableRowHeaderCell(elements.Th, RadixThemesComponent):
+class TableRowHeaderCell(elements.Th, CommonPaddingProps, RadixThemesComponent):
"""A table cell that is semantically treated as a row header."""
tag = "Table.RowHeaderCell"
@@ -103,6 +113,12 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
# The justification of the column
justify: Var[Literal["start", "center", "end"]]
+ # The minimum width of the cell
+ min_width: Var[Responsive[str]]
+
+ # The maximum width of the cell
+ max_width: Var[Responsive[str]]
+
_invalid_children: List[str] = [
"TableBody",
"TableHeader",
diff --git a/reflex/components/radix/themes/components/table.pyi b/reflex/components/radix/themes/components/table.pyi
index 8b1ef355f..9bc7bf730 100644
--- a/reflex/components/radix/themes/components/table.pyi
+++ b/reflex/components/radix/themes/components/table.pyi
@@ -8,11 +8,11 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from ..base import RadixThemesComponent
+from ..base import CommonPaddingProps, RadixThemesComponent
class TableRoot(elements.Table, RadixThemesComponent):
@overload
@@ -65,22 +65,22 @@ class TableRoot(elements.Table, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TableRoot":
"""Create a new component instance.
@@ -159,22 +159,22 @@ class TableHeader(elements.Thead, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TableHeader":
"""Create a new component instance.
@@ -255,22 +255,22 @@ class TableRow(elements.Tr, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TableRow":
"""Create a new component instance.
@@ -322,6 +322,12 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
Var[Literal["center", "end", "start"]],
]
] = None,
+ min_width: Optional[
+ Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str]
+ ] = None,
+ max_width: Optional[
+ Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str]
+ ] = None,
align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
@@ -356,22 +362,22 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TableColumnHeaderCell":
"""Create a new component instance.
@@ -382,6 +388,8 @@ class TableColumnHeaderCell(elements.Th, RadixThemesComponent):
Args:
*children: Child components.
justify: The justification of the column
+ min_width: The minimum width of the cell
+ max_width: The maximum width of the cell
align: Alignment of the content within the table header cell
col_span: Number of columns a header cell should span
headers: IDs of the headers associated with this header cell
@@ -452,22 +460,22 @@ class TableBody(elements.Tbody, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TableBody":
"""Create a new component instance.
@@ -507,7 +515,7 @@ class TableBody(elements.Tbody, RadixThemesComponent):
"""
...
-class TableCell(elements.Td, RadixThemesComponent):
+class TableCell(elements.Td, CommonPaddingProps, RadixThemesComponent):
@overload
@classmethod
def create( # type: ignore
@@ -519,6 +527,12 @@ class TableCell(elements.Td, RadixThemesComponent):
Var[Literal["center", "end", "start"]],
]
] = None,
+ min_width: Optional[
+ Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str]
+ ] = None,
+ max_width: Optional[
+ Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str]
+ ] = None,
align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
@@ -547,27 +561,146 @@ class TableCell(elements.Td, RadixThemesComponent):
spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
+ p: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ px: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ py: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pt: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pr: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pb: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pl: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TableCell":
"""Create a new component instance.
@@ -578,6 +711,8 @@ class TableCell(elements.Td, RadixThemesComponent):
Args:
*children: Child components.
justify: The justification of the column
+ min_width: The minimum width of the cell
+ max_width: The maximum width of the cell
align: Alignment of the content within the table cell
col_span: Number of columns a cell should span
headers: IDs of the headers associated with this cell
@@ -598,6 +733,13 @@ class TableCell(elements.Td, RadixThemesComponent):
spell_check: Defines whether the element may be checked for spelling errors.
tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element.
+ p: Padding: "0" - "9"
+ px: Padding horizontal: "0" - "9"
+ py: Padding vertical: "0" - "9"
+ pt: Padding top: "0" - "9"
+ pr: Padding right: "0" - "9"
+ pb: Padding bottom: "0" - "9"
+ pl: Padding left: "0" - "9"
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -611,7 +753,7 @@ class TableCell(elements.Td, RadixThemesComponent):
"""
...
-class TableRowHeaderCell(elements.Th, RadixThemesComponent):
+class TableRowHeaderCell(elements.Th, CommonPaddingProps, RadixThemesComponent):
@overload
@classmethod
def create( # type: ignore
@@ -623,6 +765,12 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
Var[Literal["center", "end", "start"]],
]
] = None,
+ min_width: Optional[
+ Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str]
+ ] = None,
+ max_width: Optional[
+ Union[Breakpoints[str, str], Var[Union[Breakpoints[str, str], str]], str]
+ ] = None,
align: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
col_span: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
headers: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
@@ -652,27 +800,146 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
+ p: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ px: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ py: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pt: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pr: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pb: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = None,
+ pl: Optional[
+ Union[
+ Breakpoints[
+ str, Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[
+ Union[
+ Breakpoints[
+ str,
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ],
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ ]
+ ],
+ ]
+ ] = 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TableRowHeaderCell":
"""Create a new component instance.
@@ -683,6 +950,8 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
Args:
*children: Child components.
justify: The justification of the column
+ min_width: The minimum width of the cell
+ max_width: The maximum width of the cell
align: Alignment of the content within the table header cell
col_span: Number of columns a header cell should span
headers: IDs of the headers associated with this header cell
@@ -704,6 +973,13 @@ class TableRowHeaderCell(elements.Th, RadixThemesComponent):
spell_check: Defines whether the element may be checked for spelling errors.
tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element.
+ p: Padding: "0" - "9"
+ px: Padding horizontal: "0" - "9"
+ py: Padding vertical: "0" - "9"
+ pt: Padding top: "0" - "9"
+ pr: Padding right: "0" - "9"
+ pb: Padding bottom: "0" - "9"
+ pl: Padding left: "0" - "9"
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/components/tabs.py b/reflex/components/radix/themes/components/tabs.py
index 12359b528..adfb32fab 100644
--- a/reflex/components/radix/themes/components/tabs.py
+++ b/reflex/components/radix/themes/components/tabs.py
@@ -7,13 +7,10 @@ from typing import Any, Dict, List, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.core.colors import color
-from reflex.event import EventHandler, identity_event
+from reflex.event import EventHandler, passthrough_event_spec
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
vertical_orientation_css = "&[data-orientation='vertical']"
@@ -42,7 +39,7 @@ class TabsRoot(RadixThemesComponent):
_rename_props = {"onChange": "onValueChange"}
# Fired when the value of the tabs changes.
- on_change: EventHandler[identity_event(str)]
+ on_change: EventHandler[passthrough_event_spec(str)]
def add_style(self) -> Dict[str, Any] | None:
"""Add style for the component.
diff --git a/reflex/components/radix/themes/components/tabs.pyi b/reflex/components/radix/themes/components/tabs.pyi
index 7b67bad6e..b5e7de5f4 100644
--- a/reflex/components/radix/themes/components/tabs.pyi
+++ b/reflex/components/radix/themes/components/tabs.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -39,23 +39,25 @@ class TabsRoot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TabsRoot":
"""Create a new component instance.
@@ -70,6 +72,7 @@ class TabsRoot(RadixThemesComponent):
orientation: The orientation of the tabs.
dir: Reading direction of the tabs.
activation_mode: The mode of activation for the tabs. "automatic" will activate the tab when focused. "manual" will activate the tab when clicked.
+ on_change: Props to rename Fired when the value of the tabs changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -103,22 +106,22 @@ class TabsList(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TabsList":
"""Create a new component instance.
@@ -218,22 +221,22 @@ class TabsTrigger(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TabsTrigger":
"""Create a TabsTrigger component.
@@ -272,22 +275,22 @@ class TabsContent(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TabsContent":
"""Create a new component instance.
@@ -338,23 +341,25 @@ class Tabs(ComponentNamespace):
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[EventType[[]]] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TabsRoot":
"""Create a new component instance.
@@ -369,6 +374,7 @@ class Tabs(ComponentNamespace):
orientation: The orientation of the tabs.
dir: Reading direction of the tabs.
activation_mode: The mode of activation for the tabs. "automatic" will activate the tab when focused. "manual" will activate the tab when clicked.
+ on_change: Props to rename Fired when the value of the tabs changes.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/components/text_area.py b/reflex/components/radix/themes/components/text_area.py
index 9f006c2e3..83fa8a593 100644
--- a/reflex/components/radix/themes/components/text_area.py
+++ b/reflex/components/radix/themes/components/text_area.py
@@ -8,11 +8,7 @@ from reflex.components.core.debounce import DebounceInput
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- LiteralRadius,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, LiteralRadius, RadixThemesComponent
LiteralTextAreaSize = Literal["1", "2", "3"]
@@ -45,6 +41,9 @@ class TextArea(RadixThemesComponent, elements.Textarea):
# Automatically focuses the textarea when the page loads
auto_focus: Var[bool]
+ # The default value of the textarea when initially rendered
+ default_value: Var[str]
+
# Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted
dirname: Var[str]
diff --git a/reflex/components/radix/themes/components/text_area.pyi b/reflex/components/radix/themes/components/text_area.pyi
index f234d9150..63d474842 100644
--- a/reflex/components/radix/themes/components/text_area.pyi
+++ b/reflex/components/radix/themes/components/text_area.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType, KeyInputInfo
from reflex.style import Style
from reflex.vars.base import Var
@@ -123,6 +123,7 @@ class TextArea(RadixThemesComponent, elements.Textarea):
] = None,
auto_complete: Optional[Union[Var[bool], bool]] = None,
auto_focus: Optional[Union[Var[bool], bool]] = None,
+ default_value: Optional[Union[Var[str], str]] = None,
dirname: Optional[Union[Var[str], str]] = None,
disabled: Optional[Union[Var[bool], bool]] = None,
form: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
@@ -167,25 +168,43 @@ class TextArea(RadixThemesComponent, elements.Textarea):
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[EventType[str]] = None,
- on_change: Optional[EventType[str]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[str]] = None,
- on_key_down: Optional[EventType[str]] = None,
- on_key_up: Optional[EventType[str]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_key_down: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_key_up: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TextArea":
"""Create an Input component.
@@ -199,6 +218,7 @@ class TextArea(RadixThemesComponent, elements.Textarea):
radius: The radius of the text area: "none" | "small" | "medium" | "large" | "full"
auto_complete: Whether the form control should have autocomplete enabled
auto_focus: Automatically focuses the textarea when the page loads
+ default_value: The default value of the textarea when initially rendered
dirname: Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted
disabled: Disables the textarea
form: Associates the textarea with a form (by id)
@@ -214,6 +234,11 @@ class TextArea(RadixThemesComponent, elements.Textarea):
auto_height: Automatically fit the content height to the text (use min-height with this prop)
cols: Visible width of the text control, in average character widths
enter_key_submit: Enter key submits form (shift-enter adds new line)
+ on_change: Fired when the input value changes
+ on_focus: Fired when the input gains focus
+ on_blur: Fired when the input loses focus
+ on_key_down: Fired when a key is pressed down
+ on_key_up: Fired when a key is released
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.
diff --git a/reflex/components/radix/themes/components/text_field.py b/reflex/components/radix/themes/components/text_field.py
index 4277e93e0..3dabe0936 100644
--- a/reflex/components/radix/themes/components/text_field.py
+++ b/reflex/components/radix/themes/components/text_field.py
@@ -11,11 +11,7 @@ from reflex.components.el import elements
from reflex.event import EventHandler, input_event, key_event
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- LiteralRadius,
- RadixThemesComponent,
-)
+from ..base import LiteralAccentColor, LiteralRadius, RadixThemesComponent
LiteralTextFieldSize = Literal["1", "2", "3"]
LiteralTextFieldVariant = Literal["classic", "surface", "soft"]
@@ -71,6 +67,9 @@ class TextFieldRoot(elements.Div, RadixThemesComponent):
# Value of the input
value: Var[Union[str, int, float]]
+ # References a datalist for suggested options
+ list: Var[Union[str, int, bool]]
+
# Fired when the value of the textarea changes.
on_change: EventHandler[input_event]
diff --git a/reflex/components/radix/themes/components/text_field.pyi b/reflex/components/radix/themes/components/text_field.pyi
index 7ea0860b5..edce803eb 100644
--- a/reflex/components/radix/themes/components/text_field.pyi
+++ b/reflex/components/radix/themes/components/text_field.pyi
@@ -8,7 +8,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType, KeyInputInfo
from reflex.style import Style
from reflex.vars.base import Var
@@ -119,6 +119,7 @@ class TextFieldRoot(elements.Div, RadixThemesComponent):
required: Optional[Union[Var[bool], bool]] = None,
type: Optional[Union[Var[str], str]] = None,
value: Optional[Union[Var[Union[float, int, str]], float, int, str]] = None,
+ list: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
auto_capitalize: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
@@ -148,25 +149,43 @@ class TextFieldRoot(elements.Div, RadixThemesComponent):
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[EventType[str]] = None,
- on_change: Optional[EventType[str]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[str]] = None,
- on_key_down: Optional[EventType[str]] = None,
- on_key_up: Optional[EventType[str]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_key_down: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_key_up: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TextFieldRoot":
"""Create an Input component.
@@ -188,6 +207,12 @@ class TextFieldRoot(elements.Div, RadixThemesComponent):
required: Indicates that the input is required
type: Specifies the type of input
value: Value of the input
+ list: References a datalist for suggested options
+ on_change: Fired when the value of the textarea changes.
+ on_focus: Fired when the textarea is focused.
+ on_blur: Fired when the textarea is blurred.
+ on_key_down: Fired when a key is pressed down.
+ on_key_up: Fired when a key is released.
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.
@@ -290,22 +315,22 @@ class TextFieldSlot(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TextFieldSlot":
"""Create a new component instance.
@@ -431,6 +456,7 @@ class TextField(ComponentNamespace):
required: Optional[Union[Var[bool], bool]] = None,
type: Optional[Union[Var[str], str]] = None,
value: Optional[Union[Var[Union[float, int, str]], float, int, str]] = None,
+ list: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
auto_capitalize: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
@@ -460,25 +486,43 @@ class TextField(ComponentNamespace):
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[EventType[str]] = None,
- on_change: Optional[EventType[str]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[str]] = None,
- on_key_down: Optional[EventType[str]] = None,
- on_key_up: Optional[EventType[str]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_key_down: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_key_up: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, KeyInputInfo], BASE_STATE],
+ ]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "TextFieldRoot":
"""Create an Input component.
@@ -500,6 +544,12 @@ class TextField(ComponentNamespace):
required: Indicates that the input is required
type: Specifies the type of input
value: Value of the input
+ list: References a datalist for suggested options
+ on_change: Fired when the value of the textarea changes.
+ on_focus: Fired when the textarea is focused.
+ on_blur: Fired when the textarea is blurred.
+ on_key_down: Fired when a key is pressed down.
+ on_key_up: Fired when a key is released.
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.
diff --git a/reflex/components/radix/themes/components/tooltip.py b/reflex/components/radix/themes/components/tooltip.py
index ac35c86d1..07bab1a4a 100644
--- a/reflex/components/radix/themes/components/tooltip.py
+++ b/reflex/components/radix/themes/components/tooltip.py
@@ -3,13 +3,11 @@
from typing import Dict, Literal, Union
from reflex.components.component import Component
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.utils import format
from reflex.vars.base import Var
-from ..base import (
- RadixThemesComponent,
-)
+from ..base import RadixThemesComponent
LiteralSideType = Literal[
"top",
@@ -85,13 +83,13 @@ class Tooltip(RadixThemesComponent):
aria_label: Var[str]
# Fired when the open state changes.
- on_open_change: EventHandler[identity_event(bool)]
+ on_open_change: EventHandler[passthrough_event_spec(bool)]
# Fired when the escape key is pressed.
- on_escape_key_down: EventHandler[empty_event]
+ on_escape_key_down: EventHandler[no_args_event_spec]
# Fired when the pointer is down outside the tooltip.
- on_pointer_down_outside: EventHandler[empty_event]
+ on_pointer_down_outside: EventHandler[no_args_event_spec]
@classmethod
def create(cls, *children, **props) -> Component:
diff --git a/reflex/components/radix/themes/components/tooltip.pyi b/reflex/components/radix/themes/components/tooltip.pyi
index ad7c4402f..fab1d0c12 100644
--- a/reflex/components/radix/themes/components/tooltip.pyi
+++ b/reflex/components/radix/themes/components/tooltip.pyi
@@ -5,7 +5,7 @@
# ------------------------------------------------------
from typing import Any, Dict, Literal, Optional, Union, overload
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -61,25 +61,27 @@ class Tooltip(RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_escape_key_down: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_pointer_down_outside: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_escape_key_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_pointer_down_outside: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Tooltip":
"""Initialize the Tooltip component.
@@ -104,6 +106,9 @@ class Tooltip(RadixThemesComponent):
disable_hoverable_content: Prevents Tooltip content from remaining open when hovering.
force_mount: Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
aria_label: By default, screenreaders will announce the content inside the component. If this is not descriptive enough, or you have content that cannot be announced, use aria-label as a more descriptive label.
+ on_open_change: Fired when the open state changes.
+ on_escape_key_down: Fired when the escape key is pressed.
+ on_pointer_down_outside: Fired when the pointer is down outside the tooltip.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/layout/base.py b/reflex/components/radix/themes/layout/base.py
index 3ee78d209..f31f6a72c 100644
--- a/reflex/components/radix/themes/layout/base.py
+++ b/reflex/components/radix/themes/layout/base.py
@@ -7,42 +7,17 @@ from typing import Literal
from reflex.components.core.breakpoints import Responsive
from reflex.vars.base import Var
-from ..base import (
- CommonMarginProps,
- LiteralSpacing,
- RadixThemesComponent,
-)
+from ..base import CommonMarginProps, CommonPaddingProps, RadixThemesComponent
LiteralBoolNumber = Literal["0", "1"]
-class LayoutComponent(CommonMarginProps, RadixThemesComponent):
+class LayoutComponent(CommonMarginProps, CommonPaddingProps, RadixThemesComponent):
"""Box, Flex and Grid are foundational elements you'll use to construct
layouts. Box provides block-level spacing and sizing, while Flex and Grid
let you create flexible columns, rows and grids.
"""
- # Padding: "0" - "9"
- p: Var[Responsive[LiteralSpacing]]
-
- # Padding horizontal: "0" - "9"
- px: Var[Responsive[LiteralSpacing]]
-
- # Padding vertical: "0" - "9"
- py: Var[Responsive[LiteralSpacing]]
-
- # Padding top: "0" - "9"
- pt: Var[Responsive[LiteralSpacing]]
-
- # Padding right: "0" - "9"
- pr: Var[Responsive[LiteralSpacing]]
-
- # Padding bottom: "0" - "9"
- pb: Var[Responsive[LiteralSpacing]]
-
- # Padding left: "0" - "9"
- pl: Var[Responsive[LiteralSpacing]]
-
# Whether the element will take up the smallest possible space: "0" | "1"
flex_shrink: Var[Responsive[LiteralBoolNumber]]
diff --git a/reflex/components/radix/themes/layout/base.pyi b/reflex/components/radix/themes/layout/base.pyi
index df51b07f9..440ec882a 100644
--- a/reflex/components/radix/themes/layout/base.pyi
+++ b/reflex/components/radix/themes/layout/base.pyi
@@ -6,20 +6,76 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from ..base import CommonMarginProps, RadixThemesComponent
+from ..base import CommonMarginProps, CommonPaddingProps, RadixThemesComponent
LiteralBoolNumber = Literal["0", "1"]
-class LayoutComponent(CommonMarginProps, RadixThemesComponent):
+class LayoutComponent(CommonMarginProps, CommonPaddingProps, RadixThemesComponent):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
+ flex_shrink: Optional[
+ Union[
+ Breakpoints[str, Literal["0", "1"]],
+ Literal["0", "1"],
+ Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]],
+ ]
+ ] = None,
+ flex_grow: Optional[
+ Union[
+ Breakpoints[str, Literal["0", "1"]],
+ Literal["0", "1"],
+ Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]],
+ ]
+ ] = None,
+ m: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ mx: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ my: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ mt: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ mr: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ mb: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ ml: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
p: Optional[
Union[
Breakpoints[
@@ -139,83 +195,27 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
- flex_shrink: Optional[
- Union[
- Breakpoints[str, Literal["0", "1"]],
- Literal["0", "1"],
- Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]],
- ]
- ] = None,
- flex_grow: Optional[
- Union[
- Breakpoints[str, Literal["0", "1"]],
- Literal["0", "1"],
- Var[Union[Breakpoints[str, Literal["0", "1"]], Literal["0", "1"]]],
- ]
- ] = None,
- m: Optional[
- Union[
- Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
- Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
- ]
- ] = None,
- mx: Optional[
- Union[
- Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
- Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
- ]
- ] = None,
- my: Optional[
- Union[
- Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
- Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
- ]
- ] = None,
- mt: Optional[
- Union[
- Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
- Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
- ]
- ] = None,
- mr: Optional[
- Union[
- Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
- Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
- ]
- ] = None,
- mb: Optional[
- Union[
- Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
- Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
- ]
- ] = None,
- ml: Optional[
- Union[
- Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
- Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
- ]
- ] = 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "LayoutComponent":
"""Create a new component instance.
@@ -225,13 +225,6 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
Args:
*children: Child components.
- p: Padding: "0" - "9"
- px: Padding horizontal: "0" - "9"
- py: Padding vertical: "0" - "9"
- pt: Padding top: "0" - "9"
- pr: Padding right: "0" - "9"
- pb: Padding bottom: "0" - "9"
- pl: Padding left: "0" - "9"
flex_shrink: Whether the element will take up the smallest possible space: "0" | "1"
flex_grow: Whether the element will take up the largest possible space: "0" | "1"
m: Margin: "0" - "9"
@@ -241,6 +234,13 @@ class LayoutComponent(CommonMarginProps, RadixThemesComponent):
mr: Margin right: "0" - "9"
mb: Margin bottom: "0" - "9"
ml: Margin left: "0" - "9"
+ p: Padding: "0" - "9"
+ px: Padding horizontal: "0" - "9"
+ py: Padding vertical: "0" - "9"
+ pt: Padding top: "0" - "9"
+ pr: Padding right: "0" - "9"
+ pb: Padding bottom: "0" - "9"
+ pl: Padding left: "0" - "9"
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/layout/box.pyi b/reflex/components/radix/themes/layout/box.pyi
index 895725a35..648995b01 100644
--- a/reflex/components/radix/themes/layout/box.pyi
+++ b/reflex/components/radix/themes/layout/box.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Optional, Union, overload
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -47,22 +47,22 @@ class Box(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Box":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/layout/center.pyi b/reflex/components/radix/themes/layout/center.pyi
index eb976892e..e932be6c8 100644
--- a/reflex/components/radix/themes/layout/center.pyi
+++ b/reflex/components/radix/themes/layout/center.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -124,22 +124,22 @@ class Center(Flex):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Center":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/layout/container.pyi b/reflex/components/radix/themes/layout/container.pyi
index a5e50b9f3..36ea79457 100644
--- a/reflex/components/radix/themes/layout/container.pyi
+++ b/reflex/components/radix/themes/layout/container.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -64,22 +64,22 @@ class Container(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Container":
"""Create the container component.
diff --git a/reflex/components/radix/themes/layout/flex.py b/reflex/components/radix/themes/layout/flex.py
index 8be16973d..4403a9542 100644
--- a/reflex/components/radix/themes/layout/flex.py
+++ b/reflex/components/radix/themes/layout/flex.py
@@ -8,12 +8,7 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- LiteralAlign,
- LiteralJustify,
- LiteralSpacing,
- RadixThemesComponent,
-)
+from ..base import LiteralAlign, LiteralJustify, LiteralSpacing, RadixThemesComponent
LiteralFlexDirection = Literal["row", "column", "row-reverse", "column-reverse"]
LiteralFlexWrap = Literal["nowrap", "wrap", "wrap-reverse"]
diff --git a/reflex/components/radix/themes/layout/flex.pyi b/reflex/components/radix/themes/layout/flex.pyi
index aba864f4f..8462720d0 100644
--- a/reflex/components/radix/themes/layout/flex.pyi
+++ b/reflex/components/radix/themes/layout/flex.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -127,22 +127,22 @@ class Flex(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Flex":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/layout/grid.py b/reflex/components/radix/themes/layout/grid.py
index b9ac28d41..3601e213a 100644
--- a/reflex/components/radix/themes/layout/grid.py
+++ b/reflex/components/radix/themes/layout/grid.py
@@ -8,12 +8,7 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- LiteralAlign,
- LiteralJustify,
- LiteralSpacing,
- RadixThemesComponent,
-)
+from ..base import LiteralAlign, LiteralJustify, LiteralSpacing, RadixThemesComponent
LiteralGridFlow = Literal["row", "column", "dense", "row-dense", "column-dense"]
diff --git a/reflex/components/radix/themes/layout/grid.pyi b/reflex/components/radix/themes/layout/grid.pyi
index faf63712e..0f4be760f 100644
--- a/reflex/components/radix/themes/layout/grid.pyi
+++ b/reflex/components/radix/themes/layout/grid.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -156,22 +156,22 @@ class Grid(elements.Div, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Grid":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/layout/list.py b/reflex/components/radix/themes/layout/list.py
index 699028380..96fa169a0 100644
--- a/reflex/components/radix/themes/layout/list.py
+++ b/reflex/components/radix/themes/layout/list.py
@@ -2,12 +2,13 @@
from __future__ import annotations
-from typing import Any, Iterable, Literal, Optional, Union
+from typing import Any, Iterable, Literal, Union
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import Foreach
from reflex.components.el.elements.typography import Li, Ol, Ul
from reflex.components.lucide.icon import Icon
+from reflex.components.markdown.markdown import MarkdownComponentMap
from reflex.components.radix.themes.typography.text import Text
from reflex.vars.base import Var
@@ -36,7 +37,7 @@ LiteralListStyleTypeOrdered = Literal[
]
-class BaseList(Component):
+class BaseList(Component, MarkdownComponentMap):
"""Base class for ordered and unordered lists."""
tag = "ul"
@@ -44,27 +45,30 @@ class BaseList(Component):
# The style of the list. Default to "none".
list_style_type: Var[
Union[LiteralListStyleTypeUnordered, LiteralListStyleTypeOrdered]
- ]
+ ] = Var.create("none")
+
+ # A list of items to add to the list.
+ items: Var[Iterable] = Var.create([])
@classmethod
def create(
cls,
*children,
- items: Optional[Var[Iterable]] = None,
**props,
):
"""Create a list component.
Args:
*children: The children of the component.
- items: A list of items to add to the list.
**props: The properties of the component.
Returns:
The list component.
"""
+ items = props.pop("items", None)
list_style_type = props.pop("list_style_type", "none")
+
if not children and items is not None:
if isinstance(items, Var):
children = [Foreach.create(items, ListItem.create)]
@@ -87,6 +91,9 @@ class BaseList(Component):
"direction": "column",
}
+ def _exclude_props(self) -> list[str]:
+ return ["items", "list_style_type"]
+
class UnorderedList(BaseList, Ul):
"""Display an unordered list."""
@@ -97,22 +104,21 @@ class UnorderedList(BaseList, Ul):
def create(
cls,
*children,
- items: Optional[Var[Iterable]] = None,
- list_style_type: LiteralListStyleTypeUnordered = "disc",
**props,
):
- """Create a unordered list component.
+ """Create an unordered list component.
Args:
*children: The children of the component.
- items: A list of items to add to the list.
- list_style_type: The style of the list.
**props: The properties of the component.
Returns:
The list component.
"""
+ items = props.pop("items", None)
+ list_style_type = props.pop("list_style_type", "disc")
+
props["margin_left"] = props.get("margin_left", "1.5rem")
return super().create(
*children, items=items, list_style_type=list_style_type, **props
@@ -128,29 +134,28 @@ class OrderedList(BaseList, Ol):
def create(
cls,
*children,
- items: Optional[Var[Iterable]] = None,
- list_style_type: LiteralListStyleTypeOrdered = "decimal",
**props,
):
"""Create an ordered list component.
Args:
*children: The children of the component.
- items: A list of items to add to the list.
- list_style_type: The style of the list.
**props: The properties of the component.
Returns:
The list component.
"""
+ items = props.pop("items", None)
+ list_style_type = props.pop("list_style_type", "decimal")
+
props["margin_left"] = props.get("margin_left", "1.5rem")
return super().create(
*children, items=items, list_style_type=list_style_type, **props
)
-class ListItem(Li):
+class ListItem(Li, MarkdownComponentMap):
"""Display an item of an ordered or unordered list."""
@classmethod
diff --git a/reflex/components/radix/themes/layout/list.pyi b/reflex/components/radix/themes/layout/list.pyi
index b72afbaa7..b42f689b9 100644
--- a/reflex/components/radix/themes/layout/list.pyi
+++ b/reflex/components/radix/themes/layout/list.pyi
@@ -7,7 +7,8 @@ from typing import Any, Dict, Iterable, Literal, Optional, Union, overload
from reflex.components.component import Component, ComponentNamespace
from reflex.components.el.elements.typography import Li, Ol, Ul
-from reflex.event import EventType
+from reflex.components.markdown.markdown import MarkdownComponentMap
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -29,13 +30,12 @@ LiteralListStyleTypeOrdered = Literal[
"katakana",
]
-class BaseList(Component):
+class BaseList(Component, MarkdownComponentMap):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
- items: Optional[Union[Iterable, Var[Iterable]]] = None,
list_style_type: Optional[
Union[
Literal[
@@ -78,35 +78,36 @@ class BaseList(Component):
],
]
] = None,
+ items: Optional[Union[Iterable, Var[Iterable]]] = 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "BaseList":
"""Create a list component.
Args:
*children: The children of the component.
- items: A list of items to add to the list.
list_style_type: The style of the list. Default to "none".
+ items: A list of items to add to the list.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -129,8 +130,49 @@ class UnorderedList(BaseList, Ul):
def create( # type: ignore
cls,
*children,
+ list_style_type: Optional[
+ Union[
+ Literal[
+ "armenian",
+ "decimal",
+ "decimal-leading-zero",
+ "georgian",
+ "hiragana",
+ "katakana",
+ "lower-alpha",
+ "lower-greek",
+ "lower-latin",
+ "lower-roman",
+ "none",
+ "upper-alpha",
+ "upper-latin",
+ "upper-roman",
+ ],
+ Literal["circle", "disc", "none", "square"],
+ Var[
+ Union[
+ Literal[
+ "armenian",
+ "decimal",
+ "decimal-leading-zero",
+ "georgian",
+ "hiragana",
+ "katakana",
+ "lower-alpha",
+ "lower-greek",
+ "lower-latin",
+ "lower-roman",
+ "none",
+ "upper-alpha",
+ "upper-latin",
+ "upper-roman",
+ ],
+ Literal["circle", "disc", "none", "square"],
+ ]
+ ],
+ ]
+ ] = None,
items: Optional[Union[Iterable, Var[Iterable]]] = None,
- list_style_type: Optional[LiteralListStyleTypeUnordered] = "disc",
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
auto_capitalize: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
@@ -160,30 +202,30 @@ class UnorderedList(BaseList, Ul):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "UnorderedList":
- """Create a unordered list component.
+ """Create an unordered list component.
Args:
*children: The children of the component.
+ list_style_type: The style of the list. Default to "none".
items: A list of items to add to the list.
- list_style_type: The style of the list.
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.
@@ -220,8 +262,49 @@ class OrderedList(BaseList, Ol):
def create( # type: ignore
cls,
*children,
+ list_style_type: Optional[
+ Union[
+ Literal[
+ "armenian",
+ "decimal",
+ "decimal-leading-zero",
+ "georgian",
+ "hiragana",
+ "katakana",
+ "lower-alpha",
+ "lower-greek",
+ "lower-latin",
+ "lower-roman",
+ "none",
+ "upper-alpha",
+ "upper-latin",
+ "upper-roman",
+ ],
+ Literal["circle", "disc", "none", "square"],
+ Var[
+ Union[
+ Literal[
+ "armenian",
+ "decimal",
+ "decimal-leading-zero",
+ "georgian",
+ "hiragana",
+ "katakana",
+ "lower-alpha",
+ "lower-greek",
+ "lower-latin",
+ "lower-roman",
+ "none",
+ "upper-alpha",
+ "upper-latin",
+ "upper-roman",
+ ],
+ Literal["circle", "disc", "none", "square"],
+ ]
+ ],
+ ]
+ ] = None,
items: Optional[Union[Iterable, Var[Iterable]]] = None,
- list_style_type: Optional[LiteralListStyleTypeOrdered] = "decimal",
reversed: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
start: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
type: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
@@ -254,30 +337,30 @@ class OrderedList(BaseList, Ol):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "OrderedList":
"""Create an ordered list component.
Args:
*children: The children of the component.
+ list_style_type: The style of the list. Default to "none".
items: A list of items to add to the list.
- list_style_type: The style of the list.
reversed: Reverses the order of the list.
start: Specifies the start value of the first list item in an ordered list.
type: Specifies the kind of marker to use in the list (letters or numbers).
@@ -311,7 +394,7 @@ class OrderedList(BaseList, Ol):
"""
...
-class ListItem(Li):
+class ListItem(Li, MarkdownComponentMap):
@overload
@classmethod
def create( # type: ignore
@@ -346,22 +429,22 @@ class ListItem(Li):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ListItem":
"""Create a list item component.
@@ -406,7 +489,6 @@ class List(ComponentNamespace):
@staticmethod
def __call__(
*children,
- items: Optional[Union[Iterable, Var[Iterable]]] = None,
list_style_type: Optional[
Union[
Literal[
@@ -449,35 +531,36 @@ class List(ComponentNamespace):
],
]
] = None,
+ items: Optional[Union[Iterable, Var[Iterable]]] = 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "BaseList":
"""Create a list component.
Args:
*children: The children of the component.
- items: A list of items to add to the list.
list_style_type: The style of the list. Default to "none".
+ items: A list of items to add to the list.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/radix/themes/layout/section.pyi b/reflex/components/radix/themes/layout/section.pyi
index 9fb790b9f..7e909bf64 100644
--- a/reflex/components/radix/themes/layout/section.pyi
+++ b/reflex/components/radix/themes/layout/section.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -61,22 +61,22 @@ class Section(elements.Section, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Section":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/layout/spacer.pyi b/reflex/components/radix/themes/layout/spacer.pyi
index f83d7a4c9..bd98ac656 100644
--- a/reflex/components/radix/themes/layout/spacer.pyi
+++ b/reflex/components/radix/themes/layout/spacer.pyi
@@ -6,7 +6,7 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -124,22 +124,22 @@ class Spacer(Flex):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Spacer":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/layout/stack.py b/reflex/components/radix/themes/layout/stack.py
index 94bba4fb6..d11c3488b 100644
--- a/reflex/components/radix/themes/layout/stack.py
+++ b/reflex/components/radix/themes/layout/stack.py
@@ -12,20 +12,22 @@ from .flex import Flex, LiteralFlexDirection
class Stack(Flex):
"""A stack component."""
+ # The spacing between each stack item.
+ spacing: Var[LiteralSpacing] = Var.create("3")
+
+ # The alignment of the stack items.
+ align: Var[LiteralAlign] = Var.create("start")
+
@classmethod
def create(
cls,
*children,
- spacing: LiteralSpacing = "3",
- align: LiteralAlign = "start",
**props,
) -> Component:
"""Create a new instance of the component.
Args:
*children: The children of the stack.
- spacing: The spacing between each stack item.
- align: The alignment of the stack items.
**props: The properties of the stack.
Returns:
@@ -39,8 +41,6 @@ class Stack(Flex):
return super().create(
*children,
- spacing=spacing,
- align=align,
**props,
)
diff --git a/reflex/components/radix/themes/layout/stack.pyi b/reflex/components/radix/themes/layout/stack.pyi
index 5eed3db46..712e050a8 100644
--- a/reflex/components/radix/themes/layout/stack.pyi
+++ b/reflex/components/radix/themes/layout/stack.pyi
@@ -6,11 +6,10 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from ..base import LiteralAlign, LiteralSpacing
from .flex import Flex
class Stack(Flex):
@@ -19,8 +18,18 @@ class Stack(Flex):
def create( # type: ignore
cls,
*children,
- spacing: Optional[LiteralSpacing] = "3",
- align: Optional[LiteralAlign] = "start",
+ spacing: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ align: Optional[
+ Union[
+ Literal["baseline", "center", "end", "start", "stretch"],
+ Var[Literal["baseline", "center", "end", "start", "stretch"]],
+ ]
+ ] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
direction: Optional[
Union[
@@ -92,30 +101,30 @@ class Stack(Flex):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Stack":
"""Create a new instance of the component.
Args:
*children: The children of the stack.
- spacing: The spacing between each stack item.
- align: The alignment of the stack items.
+ spacing: Gap between children: "0" - "9"
+ align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
@@ -155,14 +164,24 @@ class VStack(Stack):
def create( # type: ignore
cls,
*children,
- spacing: Optional[LiteralSpacing] = "3",
- align: Optional[LiteralAlign] = "start",
direction: Optional[
Union[
Literal["column", "column-reverse", "row", "row-reverse"],
Var[Literal["column", "column-reverse", "row", "row-reverse"]],
]
] = None,
+ spacing: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ align: Optional[
+ Union[
+ Literal["baseline", "center", "end", "start", "stretch"],
+ Var[Literal["baseline", "center", "end", "start", "stretch"]],
+ ]
+ ] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
justify: Optional[
Union[
@@ -217,31 +236,31 @@ class VStack(Stack):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "VStack":
"""Create a new instance of the component.
Args:
*children: The children of the stack.
- spacing: The spacing between each stack item.
- align: The alignment of the stack items.
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
+ spacing: Gap between children: "0" - "9"
+ align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
@@ -280,14 +299,24 @@ class HStack(Stack):
def create( # type: ignore
cls,
*children,
- spacing: Optional[LiteralSpacing] = "3",
- align: Optional[LiteralAlign] = "start",
direction: Optional[
Union[
Literal["column", "column-reverse", "row", "row-reverse"],
Var[Literal["column", "column-reverse", "row", "row-reverse"]],
]
] = None,
+ spacing: Optional[
+ Union[
+ Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+ Var[Literal["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]],
+ ]
+ ] = None,
+ align: Optional[
+ Union[
+ Literal["baseline", "center", "end", "start", "stretch"],
+ Var[Literal["baseline", "center", "end", "start", "stretch"]],
+ ]
+ ] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
justify: Optional[
Union[
@@ -342,31 +371,31 @@ class HStack(Stack):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "HStack":
"""Create a new instance of the component.
Args:
*children: The children of the stack.
- spacing: The spacing between each stack item.
- align: The alignment of the stack items.
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
+ spacing: Gap between children: "0" - "9"
+ align: Alignment of children along the main axis: "start" | "center" | "end" | "baseline" | "stretch"
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
diff --git a/reflex/components/radix/themes/typography/blockquote.py b/reflex/components/radix/themes/typography/blockquote.py
index a60c05471..e32172e00 100644
--- a/reflex/components/radix/themes/typography/blockquote.py
+++ b/reflex/components/radix/themes/typography/blockquote.py
@@ -9,14 +9,8 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
-from .base import (
- LiteralTextSize,
- LiteralTextWeight,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
+from .base import LiteralTextSize, LiteralTextWeight
class Blockquote(elements.Blockquote, RadixThemesComponent):
diff --git a/reflex/components/radix/themes/typography/blockquote.pyi b/reflex/components/radix/themes/typography/blockquote.pyi
index 3a9ae5c72..efb18a5b2 100644
--- a/reflex/components/radix/themes/typography/blockquote.pyi
+++ b/reflex/components/radix/themes/typography/blockquote.pyi
@@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -138,22 +138,22 @@ class Blockquote(elements.Blockquote, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Blockquote":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/typography/code.py b/reflex/components/radix/themes/typography/code.py
index 663f260da..ab610b505 100644
--- a/reflex/components/radix/themes/typography/code.py
+++ b/reflex/components/radix/themes/typography/code.py
@@ -7,20 +7,14 @@ from __future__ import annotations
from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
+from reflex.components.markdown.markdown import MarkdownComponentMap
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- LiteralVariant,
- RadixThemesComponent,
-)
-from .base import (
- LiteralTextSize,
- LiteralTextWeight,
-)
+from ..base import LiteralAccentColor, LiteralVariant, RadixThemesComponent
+from .base import LiteralTextSize, LiteralTextWeight
-class Code(elements.Code, RadixThemesComponent):
+class Code(elements.Code, RadixThemesComponent, MarkdownComponentMap):
"""A block level extended quotation."""
tag = "Code"
diff --git a/reflex/components/radix/themes/typography/code.pyi b/reflex/components/radix/themes/typography/code.pyi
index 2cda39ddf..0276eb982 100644
--- a/reflex/components/radix/themes/typography/code.pyi
+++ b/reflex/components/radix/themes/typography/code.pyi
@@ -7,13 +7,14 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.components.markdown.markdown import MarkdownComponentMap
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
from ..base import RadixThemesComponent
-class Code(elements.Code, RadixThemesComponent):
+class Code(elements.Code, RadixThemesComponent, MarkdownComponentMap):
@overload
@classmethod
def create( # type: ignore
@@ -143,22 +144,22 @@ class Code(elements.Code, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Code":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/typography/heading.py b/reflex/components/radix/themes/typography/heading.py
index f5fec8bb1..ce1eaa68f 100644
--- a/reflex/components/radix/themes/typography/heading.py
+++ b/reflex/components/radix/themes/typography/heading.py
@@ -7,21 +7,14 @@ from __future__ import annotations
from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
+from reflex.components.markdown.markdown import MarkdownComponentMap
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
-from .base import (
- LiteralTextAlign,
- LiteralTextSize,
- LiteralTextTrim,
- LiteralTextWeight,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
+from .base import LiteralTextAlign, LiteralTextSize, LiteralTextTrim, LiteralTextWeight
-class Heading(elements.H1, RadixThemesComponent):
+class Heading(elements.H1, RadixThemesComponent, MarkdownComponentMap):
"""A foundational text primitive based on the element."""
tag = "Heading"
diff --git a/reflex/components/radix/themes/typography/heading.pyi b/reflex/components/radix/themes/typography/heading.pyi
index 78ef8ba60..b5cb5c9d3 100644
--- a/reflex/components/radix/themes/typography/heading.pyi
+++ b/reflex/components/radix/themes/typography/heading.pyi
@@ -7,13 +7,14 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.components.markdown.markdown import MarkdownComponentMap
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
from ..base import RadixThemesComponent
-class Heading(elements.H1, RadixThemesComponent):
+class Heading(elements.H1, RadixThemesComponent, MarkdownComponentMap):
@overload
@classmethod
def create( # type: ignore
@@ -163,22 +164,22 @@ class Heading(elements.H1, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Heading":
"""Create a new component instance.
diff --git a/reflex/components/radix/themes/typography/link.py b/reflex/components/radix/themes/typography/link.py
index e51209dce..1cc673536 100644
--- a/reflex/components/radix/themes/typography/link.py
+++ b/reflex/components/radix/themes/typography/link.py
@@ -12,26 +12,20 @@ from reflex.components.core.breakpoints import Responsive
from reflex.components.core.colors import color
from reflex.components.core.cond import cond
from reflex.components.el.elements.inline import A
+from reflex.components.markdown.markdown import MarkdownComponentMap
from reflex.components.next.link import NextLink
from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
-from .base import (
- LiteralTextSize,
- LiteralTextTrim,
- LiteralTextWeight,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
+from .base import LiteralTextSize, LiteralTextTrim, LiteralTextWeight
LiteralLinkUnderline = Literal["auto", "hover", "always", "none"]
next_link = NextLink.create()
-class Link(RadixThemesComponent, A, MemoizationLeaf):
+class Link(RadixThemesComponent, A, MemoizationLeaf, MarkdownComponentMap):
"""A semantic element for navigation between pages."""
tag = "Link"
diff --git a/reflex/components/radix/themes/typography/link.pyi b/reflex/components/radix/themes/typography/link.pyi
index 3e3eaf64b..db963c6df 100644
--- a/reflex/components/radix/themes/typography/link.pyi
+++ b/reflex/components/radix/themes/typography/link.pyi
@@ -8,8 +8,9 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import MemoizationLeaf
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el.elements.inline import A
+from reflex.components.markdown.markdown import MarkdownComponentMap
from reflex.components.next.link import NextLink
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
@@ -19,7 +20,7 @@ from ..base import RadixThemesComponent
LiteralLinkUnderline = Literal["auto", "hover", "always", "none"]
next_link = NextLink.create()
-class Link(RadixThemesComponent, A, MemoizationLeaf):
+class Link(RadixThemesComponent, A, MemoizationLeaf, MarkdownComponentMap):
def add_imports(self) -> ImportDict: ...
@overload
@classmethod
@@ -175,22 +176,22 @@ class Link(RadixThemesComponent, A, MemoizationLeaf):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Link":
"""Create a Link component.
diff --git a/reflex/components/radix/themes/typography/text.py b/reflex/components/radix/themes/typography/text.py
index 24b09c753..1663ddedf 100644
--- a/reflex/components/radix/themes/typography/text.py
+++ b/reflex/components/radix/themes/typography/text.py
@@ -10,18 +10,11 @@ from typing import Literal
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Responsive
from reflex.components.el import elements
+from reflex.components.markdown.markdown import MarkdownComponentMap
from reflex.vars.base import Var
-from ..base import (
- LiteralAccentColor,
- RadixThemesComponent,
-)
-from .base import (
- LiteralTextAlign,
- LiteralTextSize,
- LiteralTextTrim,
- LiteralTextWeight,
-)
+from ..base import LiteralAccentColor, RadixThemesComponent
+from .base import LiteralTextAlign, LiteralTextSize, LiteralTextTrim, LiteralTextWeight
LiteralType = Literal[
"p",
@@ -45,7 +38,7 @@ LiteralType = Literal[
]
-class Text(elements.Span, RadixThemesComponent):
+class Text(elements.Span, RadixThemesComponent, MarkdownComponentMap):
"""A foundational text primitive based on the element."""
tag = "Text"
diff --git a/reflex/components/radix/themes/typography/text.pyi b/reflex/components/radix/themes/typography/text.pyi
index b4ddc622c..824348b42 100644
--- a/reflex/components/radix/themes/typography/text.pyi
+++ b/reflex/components/radix/themes/typography/text.pyi
@@ -8,7 +8,8 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import ComponentNamespace
from reflex.components.core.breakpoints import Breakpoints
from reflex.components.el import elements
-from reflex.event import EventType
+from reflex.components.markdown.markdown import MarkdownComponentMap
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -35,7 +36,7 @@ LiteralType = Literal[
"sup",
]
-class Text(elements.Span, RadixThemesComponent):
+class Text(elements.Span, RadixThemesComponent, MarkdownComponentMap):
@overload
@classmethod
def create( # type: ignore
@@ -230,22 +231,22 @@ class Text(elements.Span, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Text":
"""Create a new component instance.
@@ -487,22 +488,22 @@ class Span(Text):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Span":
"""Create a new component instance.
@@ -584,22 +585,22 @@ class Em(elements.Em, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Em":
"""Create a new component instance.
@@ -679,22 +680,22 @@ class Kbd(elements.Kbd, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Kbd":
"""Create a new component instance.
@@ -770,22 +771,22 @@ class Quote(elements.Q, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Quote":
"""Create a new component instance.
@@ -860,22 +861,22 @@ class Strong(elements.Strong, RadixThemesComponent):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Strong":
"""Create a new component instance.
@@ -1113,22 +1114,22 @@ class TextNamespace(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Text":
"""Create a new component instance.
diff --git a/reflex/components/react_player/__init__.py b/reflex/components/react_player/__init__.py
index 8c4a4486f..3f807b1a0 100644
--- a/reflex/components/react_player/__init__.py
+++ b/reflex/components/react_player/__init__.py
@@ -1,5 +1,6 @@
"""React Player component for audio and video."""
+from . import react_player
from .audio import Audio
from .video import Video
diff --git a/reflex/components/react_player/audio.pyi b/reflex/components/react_player/audio.pyi
index d1f29f508..797d5ad8a 100644
--- a/reflex/components/react_player/audio.pyi
+++ b/reflex/components/react_player/audio.pyi
@@ -5,8 +5,9 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
+import reflex
from reflex.components.react_player.react_player import ReactPlayer
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -32,38 +33,49 @@ class Audio(ReactPlayer):
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[EventType[[]]] = None,
- on_buffer: Optional[EventType[[]]] = None,
- on_buffer_end: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_click_preview: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_disable_pip: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_duration: Optional[EventType] = None,
- on_enable_pip: Optional[EventType[[]]] = None,
- on_ended: Optional[EventType[[]]] = None,
- on_error: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pause: Optional[EventType[[]]] = None,
- on_play: Optional[EventType[[]]] = None,
- on_playback_quality_change: Optional[EventType[[]]] = None,
- on_playback_rate_change: Optional[EventType[[]]] = None,
- on_progress: Optional[EventType] = None,
- on_ready: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_seek: Optional[EventType] = None,
- on_start: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_buffer: Optional[EventType[[], BASE_STATE]] = None,
+ on_buffer_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_click_preview: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_disable_pip: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_duration: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[float], BASE_STATE]]
+ ] = None,
+ on_enable_pip: Optional[EventType[[], BASE_STATE]] = None,
+ on_ended: Optional[EventType[[], BASE_STATE]] = None,
+ on_error: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pause: Optional[EventType[[], BASE_STATE]] = None,
+ on_play: Optional[EventType[[], BASE_STATE]] = None,
+ on_playback_quality_change: Optional[EventType[[], BASE_STATE]] = None,
+ on_playback_rate_change: Optional[EventType[[], BASE_STATE]] = None,
+ on_progress: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[
+ [reflex.components.react_player.react_player.Progress], BASE_STATE
+ ],
+ ]
+ ] = None,
+ on_ready: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_seek: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[float], BASE_STATE]]
+ ] = None,
+ on_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Audio":
"""Create the component.
@@ -79,6 +91,22 @@ class Audio(ReactPlayer):
muted: Mutes the player
width: Set the width of the player: ex:640px
height: Set the height of the player: ex:640px
+ on_ready: Called when media is loaded and ready to play. If playing is set to true, media will play immediately.
+ on_start: Called when media starts playing.
+ on_play: Called when media starts or resumes playing after pausing or buffering.
+ on_progress: Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
+ on_duration: Callback containing duration of the media, in seconds.
+ on_pause: Called when media is paused.
+ on_buffer: Called when media starts buffering.
+ on_buffer_end: Called when media has finished buffering. Works for files, YouTube and Facebook.
+ on_seek: Called when media seeks with seconds parameter.
+ on_playback_rate_change: Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths.
+ on_playback_quality_change: Called when playback quality of the player changed. Only supported by YouTube (if enabled).
+ on_ended: Called when media finishes playing. Does not fire when loop is set to true.
+ on_error: Called when an error occurs whilst attempting to play media.
+ on_click_preview: Called when user clicks the light mode preview.
+ on_enable_pip: Called when picture-in-picture mode is enabled.
+ on_disable_pip: Called when picture-in-picture mode is disabled.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/react_player/react_player.py b/reflex/components/react_player/react_player.py
index 7ad45b093..fb0319ceb 100644
--- a/reflex/components/react_player/react_player.py
+++ b/reflex/components/react_player/react_player.py
@@ -2,11 +2,22 @@
from __future__ import annotations
+from typing_extensions import TypedDict
+
from reflex.components.component import NoSSRComponent
-from reflex.event import EventHandler, empty_event, identity_event
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.vars.base import Var
+class Progress(TypedDict):
+ """Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds."""
+
+ played: float
+ playedSeconds: float
+ loaded: float
+ loadedSeconds: float
+
+
class ReactPlayer(NoSSRComponent):
"""Using react-player and not implement all props and callback yet.
reference: https://github.com/cookpete/react-player.
@@ -46,49 +57,49 @@ class ReactPlayer(NoSSRComponent):
height: Var[str]
# Called when media is loaded and ready to play. If playing is set to true, media will play immediately.
- on_ready: EventHandler[empty_event]
+ on_ready: EventHandler[no_args_event_spec]
# Called when media starts playing.
- on_start: EventHandler[empty_event]
+ on_start: EventHandler[no_args_event_spec]
# Called when media starts or resumes playing after pausing or buffering.
- on_play: EventHandler[empty_event]
+ on_play: EventHandler[no_args_event_spec]
# Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
- on_progress: EventHandler[lambda progress: [progress]]
+ on_progress: EventHandler[passthrough_event_spec(Progress)]
# Callback containing duration of the media, in seconds.
- on_duration: EventHandler[identity_event(float)]
+ on_duration: EventHandler[passthrough_event_spec(float)]
# Called when media is paused.
- on_pause: EventHandler[empty_event]
+ on_pause: EventHandler[no_args_event_spec]
# Called when media starts buffering.
- on_buffer: EventHandler[empty_event]
+ on_buffer: EventHandler[no_args_event_spec]
# Called when media has finished buffering. Works for files, YouTube and Facebook.
- on_buffer_end: EventHandler[empty_event]
+ on_buffer_end: EventHandler[no_args_event_spec]
# Called when media seeks with seconds parameter.
- on_seek: EventHandler[identity_event(float)]
+ on_seek: EventHandler[passthrough_event_spec(float)]
# Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths.
- on_playback_rate_change: EventHandler[empty_event]
+ on_playback_rate_change: EventHandler[no_args_event_spec]
# Called when playback quality of the player changed. Only supported by YouTube (if enabled).
- on_playback_quality_change: EventHandler[empty_event]
+ on_playback_quality_change: EventHandler[no_args_event_spec]
# Called when media finishes playing. Does not fire when loop is set to true.
- on_ended: EventHandler[empty_event]
+ on_ended: EventHandler[no_args_event_spec]
# Called when an error occurs whilst attempting to play media.
- on_error: EventHandler[empty_event]
+ on_error: EventHandler[no_args_event_spec]
# Called when user clicks the light mode preview.
- on_click_preview: EventHandler[empty_event]
+ on_click_preview: EventHandler[no_args_event_spec]
# Called when picture-in-picture mode is enabled.
- on_enable_pip: EventHandler[empty_event]
+ on_enable_pip: EventHandler[no_args_event_spec]
# Called when picture-in-picture mode is disabled.
- on_disable_pip: EventHandler[empty_event]
+ on_disable_pip: EventHandler[no_args_event_spec]
diff --git a/reflex/components/react_player/react_player.pyi b/reflex/components/react_player/react_player.pyi
index 940b09e51..4e2a8a821 100644
--- a/reflex/components/react_player/react_player.pyi
+++ b/reflex/components/react_player/react_player.pyi
@@ -5,11 +5,19 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
+from typing_extensions import TypedDict
+
from reflex.components.component import NoSSRComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
+class Progress(TypedDict):
+ played: float
+ playedSeconds: float
+ loaded: float
+ loadedSeconds: float
+
class ReactPlayer(NoSSRComponent):
@overload
@classmethod
@@ -30,38 +38,44 @@ class ReactPlayer(NoSSRComponent):
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[EventType[[]]] = None,
- on_buffer: Optional[EventType[[]]] = None,
- on_buffer_end: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_click_preview: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_disable_pip: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_duration: Optional[EventType] = None,
- on_enable_pip: Optional[EventType[[]]] = None,
- on_ended: Optional[EventType[[]]] = None,
- on_error: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pause: Optional[EventType[[]]] = None,
- on_play: Optional[EventType[[]]] = None,
- on_playback_quality_change: Optional[EventType[[]]] = None,
- on_playback_rate_change: Optional[EventType[[]]] = None,
- on_progress: Optional[EventType] = None,
- on_ready: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_seek: Optional[EventType] = None,
- on_start: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_buffer: Optional[EventType[[], BASE_STATE]] = None,
+ on_buffer_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_click_preview: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_disable_pip: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_duration: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[float], BASE_STATE]]
+ ] = None,
+ on_enable_pip: Optional[EventType[[], BASE_STATE]] = None,
+ on_ended: Optional[EventType[[], BASE_STATE]] = None,
+ on_error: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pause: Optional[EventType[[], BASE_STATE]] = None,
+ on_play: Optional[EventType[[], BASE_STATE]] = None,
+ on_playback_quality_change: Optional[EventType[[], BASE_STATE]] = None,
+ on_playback_rate_change: Optional[EventType[[], BASE_STATE]] = None,
+ on_progress: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[Progress], BASE_STATE]]
+ ] = None,
+ on_ready: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_seek: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[float], BASE_STATE]]
+ ] = None,
+ on_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ReactPlayer":
"""Create the component.
@@ -77,6 +91,22 @@ class ReactPlayer(NoSSRComponent):
muted: Mutes the player
width: Set the width of the player: ex:640px
height: Set the height of the player: ex:640px
+ on_ready: Called when media is loaded and ready to play. If playing is set to true, media will play immediately.
+ on_start: Called when media starts playing.
+ on_play: Called when media starts or resumes playing after pausing or buffering.
+ on_progress: Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
+ on_duration: Callback containing duration of the media, in seconds.
+ on_pause: Called when media is paused.
+ on_buffer: Called when media starts buffering.
+ on_buffer_end: Called when media has finished buffering. Works for files, YouTube and Facebook.
+ on_seek: Called when media seeks with seconds parameter.
+ on_playback_rate_change: Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths.
+ on_playback_quality_change: Called when playback quality of the player changed. Only supported by YouTube (if enabled).
+ on_ended: Called when media finishes playing. Does not fire when loop is set to true.
+ on_error: Called when an error occurs whilst attempting to play media.
+ on_click_preview: Called when user clicks the light mode preview.
+ on_enable_pip: Called when picture-in-picture mode is enabled.
+ on_disable_pip: Called when picture-in-picture mode is disabled.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/react_player/video.pyi b/reflex/components/react_player/video.pyi
index a50ccf71f..3739d45c0 100644
--- a/reflex/components/react_player/video.pyi
+++ b/reflex/components/react_player/video.pyi
@@ -5,8 +5,9 @@
# ------------------------------------------------------
from typing import Any, Dict, Optional, Union, overload
+import reflex
from reflex.components.react_player.react_player import ReactPlayer
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
@@ -32,38 +33,49 @@ class Video(ReactPlayer):
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[EventType[[]]] = None,
- on_buffer: Optional[EventType[[]]] = None,
- on_buffer_end: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_click_preview: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_disable_pip: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_duration: Optional[EventType] = None,
- on_enable_pip: Optional[EventType[[]]] = None,
- on_ended: Optional[EventType[[]]] = None,
- on_error: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_pause: Optional[EventType[[]]] = None,
- on_play: Optional[EventType[[]]] = None,
- on_playback_quality_change: Optional[EventType[[]]] = None,
- on_playback_rate_change: Optional[EventType[[]]] = None,
- on_progress: Optional[EventType] = None,
- on_ready: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_seek: Optional[EventType] = None,
- on_start: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_buffer: Optional[EventType[[], BASE_STATE]] = None,
+ on_buffer_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_click_preview: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_disable_pip: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_duration: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[float], BASE_STATE]]
+ ] = None,
+ on_enable_pip: Optional[EventType[[], BASE_STATE]] = None,
+ on_ended: Optional[EventType[[], BASE_STATE]] = None,
+ on_error: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_pause: Optional[EventType[[], BASE_STATE]] = None,
+ on_play: Optional[EventType[[], BASE_STATE]] = None,
+ on_playback_quality_change: Optional[EventType[[], BASE_STATE]] = None,
+ on_playback_rate_change: Optional[EventType[[], BASE_STATE]] = None,
+ on_progress: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[
+ [reflex.components.react_player.react_player.Progress], BASE_STATE
+ ],
+ ]
+ ] = None,
+ on_ready: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_seek: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[float], BASE_STATE]]
+ ] = None,
+ on_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Video":
"""Create the component.
@@ -79,6 +91,22 @@ class Video(ReactPlayer):
muted: Mutes the player
width: Set the width of the player: ex:640px
height: Set the height of the player: ex:640px
+ on_ready: Called when media is loaded and ready to play. If playing is set to true, media will play immediately.
+ on_start: Called when media starts playing.
+ on_play: Called when media starts or resumes playing after pausing or buffering.
+ on_progress: Callback containing played and loaded progress as a fraction, and playedSeconds and loadedSeconds in seconds. eg { played: 0.12, playedSeconds: 11.3, loaded: 0.34, loadedSeconds: 16.7 }
+ on_duration: Callback containing duration of the media, in seconds.
+ on_pause: Called when media is paused.
+ on_buffer: Called when media starts buffering.
+ on_buffer_end: Called when media has finished buffering. Works for files, YouTube and Facebook.
+ on_seek: Called when media seeks with seconds parameter.
+ on_playback_rate_change: Called when playback rate of the player changed. Only supported by YouTube, Vimeo (if enabled), Wistia, and file paths.
+ on_playback_quality_change: Called when playback quality of the player changed. Only supported by YouTube (if enabled).
+ on_ended: Called when media finishes playing. Does not fire when loop is set to true.
+ on_error: Called when an error occurs whilst attempting to play media.
+ on_click_preview: Called when user clicks the light mode preview.
+ on_enable_pip: Called when picture-in-picture mode is enabled.
+ on_disable_pip: Called when picture-in-picture mode is disabled.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/recharts/cartesian.py b/reflex/components/recharts/cartesian.py
index 865b50a32..028bcb4e4 100644
--- a/reflex/components/recharts/cartesian.py
+++ b/reflex/components/recharts/cartesian.py
@@ -6,7 +6,7 @@ from typing import Any, Dict, List, Union
from reflex.constants import EventTriggers
from reflex.constants.colors import Color
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.vars.base import LiteralVar, Var
from .recharts import (
@@ -109,25 +109,25 @@ class Axis(Recharts):
text_anchor: Var[LiteralTextAnchor]
# The customized event handler of click on the ticks of this axis
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mousedown on the ticks of this axis
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the ticks of this axis
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the ticks of this axis
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the ticks of this axis
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
# The customized event handler of mouseenter on the ticks of this axis
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the ticks of this axis
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
class XAxis(Axis):
@@ -252,7 +252,7 @@ class Brush(Recharts):
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {
- EventTriggers.ON_CHANGE: empty_event,
+ EventTriggers.ON_CHANGE: no_args_event_spec,
}
@@ -293,34 +293,34 @@ class Cartesian(Recharts):
name: Var[Union[str, int]]
# The customized event handler of animation start
- on_animation_start: EventHandler[empty_event]
+ on_animation_start: EventHandler[no_args_event_spec]
# The customized event handler of animation end
- on_animation_end: EventHandler[empty_event]
+ on_animation_end: EventHandler[no_args_event_spec]
# The customized event handler of click on the component in this group
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mousedown on the component in this group
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the component in this group
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the component in this group
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseover on the component in this group
- on_mouse_over: EventHandler[empty_event]
+ on_mouse_over: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the component in this group
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
# The customized event handler of mouseenter on the component in this group
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the component in this group
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
class Area(Cartesian):
@@ -526,28 +526,28 @@ class Scatter(Recharts):
animation_easing: Var[LiteralAnimationEasing]
# The customized event handler of click on the component in this group
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mousedown on the component in this group
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the component in this group
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the component in this group
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseover on the component in this group
- on_mouse_over: EventHandler[empty_event]
+ on_mouse_over: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the component in this group
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
# The customized event handler of mouseenter on the component in this group
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the component in this group
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
class Funnel(Recharts):
@@ -591,34 +591,34 @@ class Funnel(Recharts):
_valid_children: List[str] = ["LabelList", "Cell"]
# The customized event handler of animation start
- on_animation_start: EventHandler[empty_event]
+ on_animation_start: EventHandler[no_args_event_spec]
# The customized event handler of animation end
- on_animation_end: EventHandler[empty_event]
+ on_animation_end: EventHandler[no_args_event_spec]
# The customized event handler of click on the component in this group
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mousedown on the component in this group
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the component in this group
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the component in this group
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseover on the component in this group
- on_mouse_over: EventHandler[empty_event]
+ on_mouse_over: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the component in this group
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
# The customized event handler of mouseenter on the component in this group
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the component in this group
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
class ErrorBar(Recharts):
@@ -715,28 +715,28 @@ class ReferenceDot(Reference):
_valid_children: List[str] = ["Label"]
# The customized event handler of click on the component in this chart
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mousedown on the component in this chart
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the component in this chart
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mouseover on the component in this chart
- on_mouse_over: EventHandler[empty_event]
+ on_mouse_over: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the component in this chart
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
# The customized event handler of mouseenter on the component in this chart
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the component in this chart
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the component in this chart
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
class ReferenceArea(Recharts):
diff --git a/reflex/components/recharts/cartesian.pyi b/reflex/components/recharts/cartesian.pyi
index 9772be792..84f16661d 100644
--- a/reflex/components/recharts/cartesian.pyi
+++ b/reflex/components/recharts/cartesian.pyi
@@ -6,13 +6,11 @@
from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.constants.colors import Color
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from .recharts import (
- Recharts,
-)
+from .recharts import Recharts
class Axis(Recharts):
@overload
@@ -121,22 +119,22 @@ class Axis(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Axis":
"""Create the component.
@@ -168,6 +166,13 @@ class Axis(Recharts):
min_tick_gap: The minimum gap between two adjacent labels. Default: 5
stroke: The stroke color of axis. Default: rx.color("gray", 9)
text_anchor: The text anchor of axis. Default: "middle"
+ on_click: The customized event handler of click on the ticks of this axis
+ on_mouse_down: The customized event handler of mousedown on the ticks of this axis
+ on_mouse_up: The customized event handler of mouseup on the ticks of this axis
+ on_mouse_move: The customized event handler of mousemove on the ticks of this axis
+ on_mouse_out: The customized event handler of mouseout on the ticks of this axis
+ on_mouse_enter: The customized event handler of mouseenter on the ticks of this axis
+ on_mouse_leave: The customized event handler of mouseleave on the ticks of this axis
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -295,22 +300,22 @@ class XAxis(Axis):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "XAxis":
"""Create the component.
@@ -347,6 +352,13 @@ class XAxis(Axis):
min_tick_gap: The minimum gap between two adjacent labels. Default: 5
stroke: The stroke color of axis. Default: rx.color("gray", 9)
text_anchor: The text anchor of axis. Default: "middle"
+ on_click: The customized event handler of click on the ticks of this axis
+ on_mouse_down: The customized event handler of mousedown on the ticks of this axis
+ on_mouse_up: The customized event handler of mouseup on the ticks of this axis
+ on_mouse_move: The customized event handler of mousemove on the ticks of this axis
+ on_mouse_out: The customized event handler of mouseout on the ticks of this axis
+ on_mouse_enter: The customized event handler of mouseenter on the ticks of this axis
+ on_mouse_leave: The customized event handler of mouseleave on the ticks of this axis
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -472,22 +484,22 @@ class YAxis(Axis):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "YAxis":
"""Create the component.
@@ -522,6 +534,13 @@ class YAxis(Axis):
min_tick_gap: The minimum gap between two adjacent labels. Default: 5
stroke: The stroke color of axis. Default: rx.color("gray", 9)
text_anchor: The text anchor of axis. Default: "middle"
+ on_click: The customized event handler of click on the ticks of this axis
+ on_mouse_down: The customized event handler of mousedown on the ticks of this axis
+ on_mouse_up: The customized event handler of mouseup on the ticks of this axis
+ on_mouse_move: The customized event handler of mousemove on the ticks of this axis
+ on_mouse_out: The customized event handler of mouseout on the ticks of this axis
+ on_mouse_enter: The customized event handler of mouseenter on the ticks of this axis
+ on_mouse_leave: The customized event handler of mouseleave on the ticks of this axis
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -591,22 +610,22 @@ class ZAxis(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ZAxis":
"""Create the component.
@@ -656,8 +675,8 @@ class Brush(Recharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_change: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_change: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Brush":
"""Create the component.
@@ -752,24 +771,24 @@ class Cartesian(Recharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_blur: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Cartesian":
"""Create the component.
@@ -787,6 +806,16 @@ class Cartesian(Recharts):
animation_easing: The type of easing function. Default: "ease"
unit: The unit of data. This option will be used in tooltip.
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
+ on_animation_start: The customized event handler of animation start
+ on_animation_end: The customized event handler of animation end
+ on_click: The customized event handler of click on the component in this group
+ on_mouse_down: The customized event handler of mousedown on the component in this group
+ on_mouse_up: The customized event handler of mouseup on the component in this group
+ on_mouse_move: The customized event handler of mousemove on the component in this group
+ on_mouse_over: The customized event handler of mouseover on the component in this group
+ on_mouse_out: The customized event handler of mouseout on the component in this group
+ on_mouse_enter: The customized event handler of mouseenter on the component in this group
+ on_mouse_leave: The customized event handler of mouseleave on the component in this group
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -919,24 +948,24 @@ class Area(Cartesian):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_blur: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Area":
"""Create the component.
@@ -965,6 +994,16 @@ class Area(Cartesian):
animation_easing: The type of easing function. Default: "ease"
unit: The unit of data. This option will be used in tooltip.
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
+ on_animation_start: The customized event handler of animation start
+ on_animation_end: The customized event handler of animation end
+ on_click: The customized event handler of click on the component in this group
+ on_mouse_down: The customized event handler of mousedown on the component in this group
+ on_mouse_up: The customized event handler of mouseup on the component in this group
+ on_mouse_move: The customized event handler of mousemove on the component in this group
+ on_mouse_over: The customized event handler of mouseover on the component in this group
+ on_mouse_out: The customized event handler of mouseout on the component in this group
+ on_mouse_enter: The customized event handler of mouseenter on the component in this group
+ on_mouse_leave: The customized event handler of mouseleave on the component in this group
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -1051,24 +1090,24 @@ class Bar(Cartesian):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_blur: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Bar":
"""Create the component.
@@ -1096,6 +1135,16 @@ class Bar(Cartesian):
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. Default: "ease"
+ on_animation_start: The customized event handler of animation start
+ on_animation_end: The customized event handler of animation end
+ on_click: The customized event handler of click on the component in this group
+ on_mouse_down: The customized event handler of mousedown on the component in this group
+ on_mouse_up: The customized event handler of mouseup on the component in this group
+ on_mouse_move: The customized event handler of mousemove on the component in this group
+ on_mouse_over: The customized event handler of mouseover on the component in this group
+ on_mouse_out: The customized event handler of mouseout on the component in this group
+ on_mouse_enter: The customized event handler of mouseenter on the component in this group
+ on_mouse_leave: The customized event handler of mouseleave on the component in this group
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -1225,24 +1274,24 @@ class Line(Cartesian):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_blur: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Line":
"""Create the component.
@@ -1270,6 +1319,16 @@ class Line(Cartesian):
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. Default: "ease"
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
+ on_animation_start: The customized event handler of animation start
+ on_animation_end: The customized event handler of animation end
+ on_click: The customized event handler of click on the component in this group
+ on_mouse_down: The customized event handler of mousedown on the component in this group
+ on_mouse_up: The customized event handler of mouseup on the component in this group
+ on_mouse_move: The customized event handler of mousemove on the component in this group
+ on_mouse_over: The customized event handler of mouseover on the component in this group
+ on_mouse_out: The customized event handler of mouseout on the component in this group
+ on_mouse_enter: The customized event handler of mouseenter on the component in this group
+ on_mouse_leave: The customized event handler of mouseleave on the component in this group
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -1362,22 +1421,22 @@ class Scatter(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Scatter":
"""Create the component.
@@ -1397,6 +1456,14 @@ class Scatter(Recharts):
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. Default: "ease"
+ on_click: The customized event handler of click on the component in this group
+ on_mouse_down: The customized event handler of mousedown on the component in this group
+ on_mouse_up: The customized event handler of mouseup on the component in this group
+ on_mouse_move: The customized event handler of mousemove on the component in this group
+ on_mouse_over: The customized event handler of mouseover on the component in this group
+ on_mouse_out: The customized event handler of mouseout on the component in this group
+ on_mouse_enter: The customized event handler of mouseenter on the component in this group
+ on_mouse_leave: The customized event handler of mouseleave on the component in this group
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -1469,24 +1536,24 @@ class Funnel(Recharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_blur: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Funnel":
"""Create the component.
@@ -1503,6 +1570,16 @@ class Funnel(Recharts):
animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default "ease"
stroke: Stroke color. Default: rx.color("gray", 3)
trapezoids: The coordinates of all the trapezoids in the funnel, usually calculated internally.
+ on_animation_start: The customized event handler of animation start
+ on_animation_end: The customized event handler of animation end
+ on_click: The customized event handler of click on the component in this group
+ on_mouse_down: The customized event handler of mousedown on the component in this group
+ on_mouse_up: The customized event handler of mouseup on the component in this group
+ on_mouse_move: The customized event handler of mousemove on the component in this group
+ on_mouse_over: The customized event handler of mouseover on the component in this group
+ on_mouse_out: The customized event handler of mouseout on the component in this group
+ on_mouse_enter: The customized event handler of mouseenter on the component in this group
+ on_mouse_leave: The customized event handler of mouseleave on the component in this group
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -1532,22 +1609,22 @@ class ErrorBar(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ErrorBar":
"""Create the component.
@@ -1593,22 +1670,22 @@ class Reference(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Reference":
"""Create the component.
@@ -1659,22 +1736,22 @@ class ReferenceLine(Reference):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ReferenceLine":
"""Create the component.
@@ -1730,22 +1807,22 @@ class ReferenceDot(Reference):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ReferenceDot":
"""Create the component.
@@ -1757,6 +1834,14 @@ class ReferenceDot(Reference):
r: The radius of dot.
fill: The color of the area fill.
stroke: The color of the line stroke.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_down: The customized event handler of mousedown on the component in this chart
+ on_mouse_up: The customized event handler of mouseup on the component in this chart
+ on_mouse_over: The customized event handler of mouseover on the component in this chart
+ on_mouse_out: The customized event handler of mouseout on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
if_overflow: Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas. Default: "discard"
@@ -1802,22 +1887,22 @@ class ReferenceArea(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ReferenceArea":
"""Create the component.
@@ -1863,22 +1948,22 @@ class Grid(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Grid":
"""Create the component.
@@ -1929,22 +2014,22 @@ class CartesianGrid(Grid):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CartesianGrid":
"""Create the component.
@@ -2011,22 +2096,22 @@ class CartesianAxis(Grid):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CartesianAxis":
"""Create the component.
diff --git a/reflex/components/recharts/charts.py b/reflex/components/recharts/charts.py
index d7e07b2d8..13f125213 100644
--- a/reflex/components/recharts/charts.py
+++ b/reflex/components/recharts/charts.py
@@ -8,7 +8,7 @@ from reflex.components.component import Component
from reflex.components.recharts.general import ResponsiveContainer
from reflex.constants import EventTriggers
from reflex.constants.colors import Color
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.vars.base import Var
from .recharts import (
@@ -31,16 +31,16 @@ class ChartBase(RechartsCharts):
height: Var[Union[str, int]] = "100%" # type: ignore
# The customized event handler of click on the component in this chart
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mouseenter on the component in this chart
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the component in this chart
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the component in this chart
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
@staticmethod
def _ensure_valid_dimension(name: str, value: Any) -> None:
@@ -270,16 +270,16 @@ class PieChart(ChartBase):
]
# The customized event handler of mousedown on the sectors in this group
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the sectors in this group
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mouseover on the sectors in this group
- on_mouse_over: EventHandler[empty_event]
+ on_mouse_over: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the sectors in this group
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
class RadarChart(ChartBase):
@@ -330,9 +330,9 @@ class RadarChart(ChartBase):
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {
- EventTriggers.ON_CLICK: empty_event,
- EventTriggers.ON_MOUSE_ENTER: empty_event,
- EventTriggers.ON_MOUSE_LEAVE: empty_event,
+ EventTriggers.ON_CLICK: no_args_event_spec,
+ EventTriggers.ON_MOUSE_ENTER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_LEAVE: no_args_event_spec,
}
@@ -419,14 +419,14 @@ class ScatterChart(ChartBase):
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {
- EventTriggers.ON_CLICK: empty_event,
- EventTriggers.ON_MOUSE_DOWN: empty_event,
- EventTriggers.ON_MOUSE_UP: empty_event,
- EventTriggers.ON_MOUSE_MOVE: empty_event,
- EventTriggers.ON_MOUSE_OVER: empty_event,
- EventTriggers.ON_MOUSE_OUT: empty_event,
- EventTriggers.ON_MOUSE_ENTER: empty_event,
- EventTriggers.ON_MOUSE_LEAVE: empty_event,
+ EventTriggers.ON_CLICK: no_args_event_spec,
+ EventTriggers.ON_MOUSE_DOWN: no_args_event_spec,
+ EventTriggers.ON_MOUSE_UP: no_args_event_spec,
+ EventTriggers.ON_MOUSE_MOVE: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OVER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OUT: no_args_event_spec,
+ EventTriggers.ON_MOUSE_ENTER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_LEAVE: no_args_event_spec,
}
@@ -488,10 +488,10 @@ class Treemap(RechartsCharts):
animation_easing: Var[LiteralAnimationEasing]
# The customized event handler of animation start
- on_animation_start: EventHandler[empty_event]
+ on_animation_start: EventHandler[no_args_event_spec]
# The customized event handler of animation end
- on_animation_end: EventHandler[empty_event]
+ on_animation_end: EventHandler[no_args_event_spec]
@classmethod
def create(cls, *children, **props) -> Component:
diff --git a/reflex/components/recharts/charts.pyi b/reflex/components/recharts/charts.pyi
index f0b494ff8..6bf9b6a60 100644
--- a/reflex/components/recharts/charts.pyi
+++ b/reflex/components/recharts/charts.pyi
@@ -6,13 +6,11 @@
from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.constants.colors import Color
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from .recharts import (
- RechartsCharts,
-)
+from .recharts import RechartsCharts
class ChartBase(RechartsCharts):
@overload
@@ -27,22 +25,22 @@ class ChartBase(RechartsCharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ChartBase":
"""Create a chart component.
@@ -51,6 +49,10 @@ class ChartBase(RechartsCharts):
*children: The children of the chart component.
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -95,22 +97,22 @@ class CategoricalChartBase(ChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "CategoricalChartBase":
"""Create a chart component.
@@ -125,6 +127,10 @@ class CategoricalChartBase(ChartBase):
stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette'
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -176,22 +182,22 @@ class AreaChart(CategoricalChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "AreaChart":
"""Create a chart component.
@@ -207,6 +213,10 @@ class AreaChart(CategoricalChartBase):
stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette'
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -256,22 +266,22 @@ class BarChart(CategoricalChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "BarChart":
"""Create a chart component.
@@ -291,6 +301,10 @@ class BarChart(CategoricalChartBase):
layout: The layout of area in the chart. 'horizontal' | 'vertical'. Default: "horizontal"
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -335,22 +349,22 @@ class LineChart(CategoricalChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "LineChart":
"""Create a chart component.
@@ -365,6 +379,10 @@ class LineChart(CategoricalChartBase):
stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette'
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -420,22 +438,22 @@ class ComposedChart(CategoricalChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ComposedChart":
"""Create a chart component.
@@ -455,6 +473,10 @@ class ComposedChart(CategoricalChartBase):
stack_offset: The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette'
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -482,22 +504,22 @@ class PieChart(ChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PieChart":
"""Create a chart component.
@@ -505,8 +527,16 @@ class PieChart(ChartBase):
Args:
*children: The children of the chart component.
margin: The sizes of whitespace around the chart, i.e. {"top": 50, "right": 30, "left": 20, "bottom": 5}.
+ on_mouse_down: The customized event handler of mousedown on the sectors in this group
+ on_mouse_up: The customized event handler of mouseup on the sectors in this group
+ on_mouse_over: The customized event handler of mouseover on the sectors in this group
+ on_mouse_out: The customized event handler of mouseout on the sectors in this group
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -542,10 +572,10 @@ class RadarChart(ChartBase):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadarChart":
"""Create a chart component.
@@ -562,6 +592,9 @@ class RadarChart(ChartBase):
outer_radius: The outer radius of last circle grid. If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy. Number | Percentage. Default: "80%"
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -599,22 +632,22 @@ class RadialBarChart(ChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadialBarChart":
"""Create a chart component.
@@ -634,6 +667,10 @@ class RadialBarChart(ChartBase):
bar_size: The size of each bar. If the barSize is not specified, the size of bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups.
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -662,15 +699,15 @@ class ScatterChart(ChartBase):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ScatterChart":
"""Create a chart component.
@@ -680,6 +717,10 @@ class ScatterChart(ChartBase):
margin: The sizes of whitespace around the chart. Default: {"top": 5, "right": 5, "bottom": 5, "left": 5}
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -709,22 +750,22 @@ class FunnelChart(ChartBase):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "FunnelChart":
"""Create a chart component.
@@ -736,6 +777,10 @@ class FunnelChart(ChartBase):
stroke: The stroke color of each bar. String | Object
width: The width of chart container. String or Integer
height: The height of chart container.
+ on_click: The customized event handler of click on the component in this chart
+ on_mouse_enter: The customized event handler of mouseenter on the component in this chart
+ on_mouse_move: The customized event handler of mousemove on the component in this chart
+ on_mouse_leave: The customized event handler of mouseleave on the component in this chart
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -775,24 +820,24 @@ class Treemap(RechartsCharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_blur: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Treemap":
"""Create a chart component.
@@ -809,6 +854,8 @@ class Treemap(RechartsCharts):
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease"
+ on_animation_start: The customized event handler of animation start
+ on_animation_end: The customized event handler of animation end
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/recharts/general.py b/reflex/components/recharts/general.py
index 641e1562a..1769ea125 100644
--- a/reflex/components/recharts/general.py
+++ b/reflex/components/recharts/general.py
@@ -6,7 +6,7 @@ from typing import Any, Dict, List, Union
from reflex.components.component import MemoizationLeaf
from reflex.constants.colors import Color
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.vars.base import LiteralVar, Var
from .recharts import (
@@ -46,7 +46,7 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
debounce: Var[int]
# If specified provides a callback providing the updated chart width and height values.
- on_resize: EventHandler[empty_event]
+ on_resize: EventHandler[no_args_event_spec]
# Valid children components
_valid_children: List[str] = [
@@ -104,28 +104,28 @@ class Legend(Recharts):
margin: Var[Dict[str, Any]]
# The customized event handler of click on the items in this group
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mousedown on the items in this group
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the items in this group
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the items in this group
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseover on the items in this group
- on_mouse_over: EventHandler[empty_event]
+ on_mouse_over: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the items in this group
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
# The customized event handler of mouseenter on the items in this group
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the items in this group
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
class GraphingTooltip(Recharts):
@@ -135,16 +135,16 @@ class GraphingTooltip(Recharts):
alias = "RechartsTooltip"
- # The separator between name and value.
+ # The separator between name and value. Default: ":"
separator: Var[str]
- # The offset size of tooltip. Number
+ # The offset size of tooltip. Number. Default: 10
offset: Var[int]
- # When an item of the payload has value null or undefined, this item won't be displayed.
+ # When an item of the payload has value null or undefined, this item won't be displayed. Default: True
filter_null: Var[bool]
- # If set false, no cursor will be drawn when tooltip is active.
+ # If set false, no cursor will be drawn when tooltip is active. Default: {"strokeWidth": 1, "fill": rx.color("gray", 3)}
cursor: Var[Union[Dict[str, Any], bool]] = LiteralVar.create(
{
"strokeWidth": 1,
@@ -155,16 +155,17 @@ class GraphingTooltip(Recharts):
# The box of viewing area, which has the shape of {x: someVal, y: someVal, width: someVal, height: someVal}, usually calculated internally.
view_box: Var[Dict[str, Any]]
- # The style of default tooltip content item which is a li element. DEFAULT: {}
+ # The style of default tooltip content item which is a li element. Default: {"color": rx.color("gray", 12)}
item_style: Var[Dict[str, Any]] = LiteralVar.create(
{
"color": Color("gray", 12),
}
)
- # The style of tooltip wrapper which is a dom element. DEFAULT: {}
+ # The style of tooltip wrapper which is a dom element. Default: {}
wrapper_style: Var[Dict[str, Any]]
- # The style of tooltip content which is a dom element. DEFAULT: {}
+
+ # The style of tooltip content which is a dom element. Default: {"background": rx.color("gray", 1), "borderColor": rx.color("gray", 4), "borderRadius": "8px"}
content_style: Var[Dict[str, Any]] = LiteralVar.create(
{
"background": Color("gray", 1),
@@ -173,30 +174,28 @@ class GraphingTooltip(Recharts):
}
)
- # The style of default tooltip label which is a p element. DEFAULT: {}
+ # The style of default tooltip label which is a p element. Default: {"color": rx.color("gray", 11)}
label_style: Var[Dict[str, Any]] = LiteralVar.create({"color": Color("gray", 11)})
- # This option allows the tooltip to extend beyond the viewBox of the chart itself. DEFAULT: { x: false, y: false }
- allow_escape_view_box: Var[Dict[str, bool]] = LiteralVar.create(
- {"x": False, "y": False}
- )
+ # This option allows the tooltip to extend beyond the viewBox of the chart itself. Default: {"x": False, "y": False}
+ allow_escape_view_box: Var[Dict[str, bool]]
- # If set true, the tooltip is displayed. If set false, the tooltip is hidden, usually calculated internally.
+ # If set true, the tooltip is displayed. If set false, the tooltip is hidden, usually calculated internally. Default: False
active: Var[bool]
# If this field is set, the tooltip position will be fixed and will not move anymore.
position: Var[Dict[str, Any]]
- # The coordinate of tooltip which is usually calculated internally.
+ # The coordinate of tooltip which is usually calculated internally. Default: {"x": 0, "y": 0}
coordinate: Var[Dict[str, Any]]
- # If set false, animation of tooltip will be disabled. DEFAULT: true in CSR, and false in SSR
+ # If set false, animation of tooltip will be disabled. Default: True
is_animation_active: Var[bool]
- # Specifies the duration of animation, the unit of this option is ms. DEFAULT: 1500
+ # Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_duration: Var[int]
- # The type of easing function. DEFAULT: 'ease'
+ # The type of easing function. Default: "ease"
animation_easing: Var[LiteralAnimationEasing]
diff --git a/reflex/components/recharts/general.pyi b/reflex/components/recharts/general.pyi
index 4a8f61c5e..823a50fce 100644
--- a/reflex/components/recharts/general.pyi
+++ b/reflex/components/recharts/general.pyi
@@ -7,13 +7,11 @@ from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.components.component import MemoizationLeaf
from reflex.constants.colors import Color
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from .recharts import (
- Recharts,
-)
+from .recharts import Recharts
class ResponsiveContainer(Recharts, MemoizationLeaf):
@overload
@@ -32,23 +30,23 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_resize: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_resize: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "ResponsiveContainer":
"""Create a new memoization leaf component.
@@ -61,6 +59,7 @@ class ResponsiveContainer(Recharts, MemoizationLeaf):
min_width: The minimum width of chart container. Number
min_height: The minimum height of chart container. Number
debounce: If specified a positive number, debounced function will be used to handle the resize event. Default: 0
+ on_resize: If specified provides a callback providing the updated chart width and height values.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -142,22 +141,22 @@ class Legend(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Legend":
"""Create the component.
@@ -175,6 +174,14 @@ class Legend(Recharts):
chart_width: The width of chart container, usually calculated internally.
chart_height: The height of chart container, usually calculated internally.
margin: The margin of chart container, usually calculated internally.
+ on_click: The customized event handler of click on the items in this group
+ on_mouse_down: The customized event handler of mousedown on the items in this group
+ on_mouse_up: The customized event handler of mouseup on the items in this group
+ on_mouse_move: The customized event handler of mousemove on the items in this group
+ on_mouse_over: The customized event handler of mouseover on the items in this group
+ on_mouse_out: The customized event handler of mouseout on the items in this group
+ on_mouse_enter: The customized event handler of mouseenter on the items in this group
+ on_mouse_leave: The customized event handler of mouseleave on the items in this group
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -224,44 +231,44 @@ class GraphingTooltip(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "GraphingTooltip":
"""Create the component.
Args:
*children: The children of the component.
- separator: The separator between name and value.
- offset: The offset size of tooltip. Number
- filter_null: When an item of the payload has value null or undefined, this item won't be displayed.
- cursor: If set false, no cursor will be drawn when tooltip is active.
+ separator: The separator between name and value. Default: ":"
+ offset: The offset size of tooltip. Number. Default: 10
+ filter_null: When an item of the payload has value null or undefined, this item won't be displayed. Default: True
+ cursor: If set false, no cursor will be drawn when tooltip is active. Default: {"strokeWidth": 1, "fill": rx.color("gray", 3)}
view_box: The box of viewing area, which has the shape of {x: someVal, y: someVal, width: someVal, height: someVal}, usually calculated internally.
- item_style: The style of default tooltip content item which is a li element. DEFAULT: {}
- wrapper_style: The style of tooltip wrapper which is a dom element. DEFAULT: {}
- content_style: The style of tooltip content which is a dom element. DEFAULT: {}
- label_style: The style of default tooltip label which is a p element. DEFAULT: {}
- allow_escape_view_box: This option allows the tooltip to extend beyond the viewBox of the chart itself. DEFAULT: { x: false, y: false }
- active: If set true, the tooltip is displayed. If set false, the tooltip is hidden, usually calculated internally.
+ item_style: The style of default tooltip content item which is a li element. Default: {"color": rx.color("gray", 12)}
+ wrapper_style: The style of tooltip wrapper which is a dom element. Default: {}
+ content_style: The style of tooltip content which is a dom element. Default: {"background": rx.color("gray", 1), "borderColor": rx.color("gray", 4), "borderRadius": "8px"}
+ label_style: The style of default tooltip label which is a p element. Default: {"color": rx.color("gray", 11)}
+ allow_escape_view_box: This option allows the tooltip to extend beyond the viewBox of the chart itself. Default: {"x": False, "y": False}
+ active: If set true, the tooltip is displayed. If set false, the tooltip is hidden, usually calculated internally. Default: False
position: If this field is set, the tooltip position will be fixed and will not move anymore.
- coordinate: The coordinate of tooltip which is usually calculated internally.
- is_animation_active: If set false, animation of tooltip will be disabled. DEFAULT: true in CSR, and false in SSR
- animation_duration: Specifies the duration of animation, the unit of this option is ms. DEFAULT: 1500
- animation_easing: The type of easing function. DEFAULT: 'ease'
+ coordinate: The coordinate of tooltip which is usually calculated internally. Default: {"x": 0, "y": 0}
+ is_animation_active: If set false, animation of tooltip will be disabled. Default: True
+ animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
+ animation_easing: The type of easing function. Default: "ease"
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -335,22 +342,22 @@ class Label(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Label":
"""Create the component.
@@ -435,22 +442,22 @@ class LabelList(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "LabelList":
"""Create the component.
diff --git a/reflex/components/recharts/polar.py b/reflex/components/recharts/polar.py
index ccb96f180..0aedf4893 100644
--- a/reflex/components/recharts/polar.py
+++ b/reflex/components/recharts/polar.py
@@ -6,7 +6,7 @@ from typing import Any, Dict, List, Union
from reflex.constants import EventTriggers
from reflex.constants.colors import Color
-from reflex.event import EventHandler, empty_event
+from reflex.event import EventHandler, no_args_event_spec
from reflex.vars.base import LiteralVar, Var
from .recharts import (
@@ -103,14 +103,14 @@ class Pie(Recharts):
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {
- EventTriggers.ON_ANIMATION_START: empty_event,
- EventTriggers.ON_ANIMATION_END: empty_event,
- EventTriggers.ON_CLICK: empty_event,
- EventTriggers.ON_MOUSE_MOVE: empty_event,
- EventTriggers.ON_MOUSE_OVER: empty_event,
- EventTriggers.ON_MOUSE_OUT: empty_event,
- EventTriggers.ON_MOUSE_ENTER: empty_event,
- EventTriggers.ON_MOUSE_LEAVE: empty_event,
+ EventTriggers.ON_ANIMATION_START: no_args_event_spec,
+ EventTriggers.ON_ANIMATION_END: no_args_event_spec,
+ EventTriggers.ON_CLICK: no_args_event_spec,
+ EventTriggers.ON_MOUSE_MOVE: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OVER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OUT: no_args_event_spec,
+ EventTriggers.ON_MOUSE_ENTER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_LEAVE: no_args_event_spec,
}
@@ -167,8 +167,8 @@ class Radar(Recharts):
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {
- EventTriggers.ON_ANIMATION_START: empty_event,
- EventTriggers.ON_ANIMATION_END: empty_event,
+ EventTriggers.ON_ANIMATION_START: no_args_event_spec,
+ EventTriggers.ON_ANIMATION_END: no_args_event_spec,
}
@@ -219,14 +219,14 @@ class RadialBar(Recharts):
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {
- EventTriggers.ON_CLICK: empty_event,
- EventTriggers.ON_MOUSE_MOVE: empty_event,
- EventTriggers.ON_MOUSE_OVER: empty_event,
- EventTriggers.ON_MOUSE_OUT: empty_event,
- EventTriggers.ON_MOUSE_ENTER: empty_event,
- EventTriggers.ON_MOUSE_LEAVE: empty_event,
- EventTriggers.ON_ANIMATION_START: empty_event,
- EventTriggers.ON_ANIMATION_END: empty_event,
+ EventTriggers.ON_CLICK: no_args_event_spec,
+ EventTriggers.ON_MOUSE_MOVE: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OVER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OUT: no_args_event_spec,
+ EventTriggers.ON_MOUSE_ENTER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_LEAVE: no_args_event_spec,
+ EventTriggers.ON_ANIMATION_START: no_args_event_spec,
+ EventTriggers.ON_ANIMATION_END: no_args_event_spec,
}
@@ -277,28 +277,28 @@ class PolarAngleAxis(Recharts):
_valid_children: List[str] = ["Label"]
# The customized event handler of click on the ticks of this axis.
- on_click: EventHandler[empty_event]
+ on_click: EventHandler[no_args_event_spec]
# The customized event handler of mousedown on the the ticks of this axis.
- on_mouse_down: EventHandler[empty_event]
+ on_mouse_down: EventHandler[no_args_event_spec]
# The customized event handler of mouseup on the ticks of this axis.
- on_mouse_up: EventHandler[empty_event]
+ on_mouse_up: EventHandler[no_args_event_spec]
# The customized event handler of mousemove on the ticks of this axis.
- on_mouse_move: EventHandler[empty_event]
+ on_mouse_move: EventHandler[no_args_event_spec]
# The customized event handler of mouseover on the ticks of this axis.
- on_mouse_over: EventHandler[empty_event]
+ on_mouse_over: EventHandler[no_args_event_spec]
# The customized event handler of mouseout on the ticks of this axis.
- on_mouse_out: EventHandler[empty_event]
+ on_mouse_out: EventHandler[no_args_event_spec]
# The customized event handler of moustenter on the ticks of this axis.
- on_mouse_enter: EventHandler[empty_event]
+ on_mouse_enter: EventHandler[no_args_event_spec]
# The customized event handler of mouseleave on the ticks of this axis.
- on_mouse_leave: EventHandler[empty_event]
+ on_mouse_leave: EventHandler[no_args_event_spec]
class PolarGrid(Recharts):
@@ -392,12 +392,12 @@ class PolarRadiusAxis(Recharts):
A dict mapping the event trigger to the var that is passed to the handler.
"""
return {
- EventTriggers.ON_CLICK: empty_event,
- EventTriggers.ON_MOUSE_MOVE: empty_event,
- EventTriggers.ON_MOUSE_OVER: empty_event,
- EventTriggers.ON_MOUSE_OUT: empty_event,
- EventTriggers.ON_MOUSE_ENTER: empty_event,
- EventTriggers.ON_MOUSE_LEAVE: empty_event,
+ EventTriggers.ON_CLICK: no_args_event_spec,
+ EventTriggers.ON_MOUSE_MOVE: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OVER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_OUT: no_args_event_spec,
+ EventTriggers.ON_MOUSE_ENTER: no_args_event_spec,
+ EventTriggers.ON_MOUSE_LEAVE: no_args_event_spec,
}
diff --git a/reflex/components/recharts/polar.pyi b/reflex/components/recharts/polar.pyi
index c02596006..5ca96acb6 100644
--- a/reflex/components/recharts/polar.pyi
+++ b/reflex/components/recharts/polar.pyi
@@ -6,13 +6,11 @@
from typing import Any, Dict, List, Literal, Optional, Union, overload
from reflex.constants.colors import Color
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
-from .recharts import (
- Recharts,
-)
+from .recharts import Recharts
class Pie(Recharts):
def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
@@ -83,15 +81,15 @@ class Pie(Recharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Pie":
"""Create the component.
@@ -192,9 +190,9 @@ class Radar(Recharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Radar":
"""Create the component.
@@ -288,15 +286,15 @@ class RadialBar(Recharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_animation_end: Optional[EventType[[]]] = None,
- on_animation_start: Optional[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[EventType[[], BASE_STATE]] = None,
+ on_animation_start: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RadialBar":
"""Create the component.
@@ -357,22 +355,22 @@ class PolarAngleAxis(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PolarAngleAxis":
"""Create the component.
@@ -391,6 +389,14 @@ class PolarAngleAxis(Recharts):
orientation: The orientation of axis text. Default: "outer"
stroke: The stroke color of axis. Default: rx.color("gray", 10)
allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category". Default: True
+ on_click: The customized event handler of click on the ticks of this axis.
+ on_mouse_down: The customized event handler of mousedown on the the ticks of this axis.
+ on_mouse_up: The customized event handler of mouseup on the ticks of this axis.
+ on_mouse_move: The customized event handler of mousemove on the ticks of this axis.
+ on_mouse_over: The customized event handler of mouseover on the ticks of this axis.
+ on_mouse_out: The customized event handler of mouseout on the ticks of this axis.
+ on_mouse_enter: The customized event handler of moustenter on the ticks of this axis.
+ on_mouse_leave: The customized event handler of mouseleave on the ticks of this axis.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
@@ -425,22 +431,22 @@ class PolarGrid(Recharts):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PolarGrid":
"""Create the component.
@@ -545,13 +551,13 @@ class PolarRadiusAxis(Recharts):
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "PolarRadiusAxis":
"""Create the component.
diff --git a/reflex/components/recharts/recharts.py b/reflex/components/recharts/recharts.py
index 9068cb396..b5a4ed113 100644
--- a/reflex/components/recharts/recharts.py
+++ b/reflex/components/recharts/recharts.py
@@ -3,33 +3,21 @@
from typing import Dict, Literal
from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent
-from reflex.utils import console
class Recharts(Component):
"""A component that wraps a recharts lib."""
- library = "recharts@2.12.7"
+ library = "recharts@2.13.0"
- def render(self) -> Dict:
- """Render the tag.
-
- Returns:
- The rendered tag.
- """
- tag = super().render()
- if any(p.startswith("css") for p in tag["props"]):
- console.warn(
- f"CSS props do not work for {self.__class__.__name__}. Consult docs to style it with its own prop."
- )
- tag["props"] = [p for p in tag["props"] if not p.startswith("css")]
- return tag
+ def _get_style(self) -> Dict:
+ return {"wrapperStyle": self.style}
class RechartsCharts(NoSSRComponent, MemoizationLeaf):
"""A component that wraps a recharts lib."""
- library = "recharts@2.12.7"
+ library = "recharts@2.13.0"
LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
diff --git a/reflex/components/recharts/recharts.pyi b/reflex/components/recharts/recharts.pyi
index c13519f05..65e65bce1 100644
--- a/reflex/components/recharts/recharts.pyi
+++ b/reflex/components/recharts/recharts.pyi
@@ -6,12 +6,11 @@
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.vars.base import Var
class Recharts(Component):
- def render(self) -> Dict: ...
@overload
@classmethod
def create( # type: ignore
@@ -22,22 +21,22 @@ class Recharts(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Recharts":
"""Create the component.
@@ -68,22 +67,22 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "RechartsCharts":
"""Create a new memoization leaf component.
diff --git a/reflex/components/sonner/toast.py b/reflex/components/sonner/toast.py
index 02c320ac6..8f5362dba 100644
--- a/reflex/components/sonner/toast.py
+++ b/reflex/components/sonner/toast.py
@@ -4,22 +4,19 @@ from __future__ import annotations
from typing import Any, ClassVar, Literal, Optional, Union
-from pydantic import ValidationError
-
from reflex.base import Base
from reflex.components.component import Component, ComponentNamespace
from reflex.components.lucide.icon import Icon
-from reflex.components.props import PropsBase
-from reflex.event import (
- EventSpec,
- call_script,
-)
+from reflex.components.props import NoExtrasAllowedProps, PropsBase
+from reflex.event import EventSpec, run_script
from reflex.style import Style, resolved_color_mode
from reflex.utils import format
from reflex.utils.imports import ImportVar
from reflex.utils.serializers import serializer
from reflex.vars import VarData
from reflex.vars.base import LiteralVar, Var
+from reflex.vars.function import FunctionVar
+from reflex.vars.object import ObjectVar
LiteralPosition = Literal[
"top-left",
@@ -72,7 +69,7 @@ def _toast_callback_signature(toast: Var) -> list[Var]:
]
-class ToastProps(PropsBase):
+class ToastProps(PropsBase, NoExtrasAllowedProps):
"""Props for the toast component."""
# Toast's title, renders above the description.
@@ -119,6 +116,9 @@ class ToastProps(PropsBase):
# Custom style for the toast.
style: Optional[Style]
+ # Class name for the toast.
+ class_name: Optional[str]
+
# XXX: These still do not seem to work
# Custom style for the toast primary button.
action_button_styles: Optional[Style]
@@ -132,24 +132,6 @@ class ToastProps(PropsBase):
# Function that gets called when the toast disappears automatically after it's timeout (duration` prop).
on_auto_close: Optional[Any]
- def __init__(self, **kwargs):
- """Initialize the props.
-
- Args:
- kwargs: Kwargs to initialize the props.
-
- Raises:
- ValueError: If invalid props are passed on instantiation.
- """
- try:
- super().__init__(**kwargs)
- except ValidationError as e:
- invalid_fields = ", ".join([error["loc"][0] for error in e.errors()]) # type: ignore
- supported_props_str = ", ".join(f'"{field}"' for field in self.get_fields())
- raise ValueError(
- f"Invalid prop(s) {invalid_fields} for rx.toast. Supported props are {supported_props_str}"
- ) from None
-
def dict(self, *args, **kwargs) -> dict[str, Any]:
"""Convert the object to a dictionary.
@@ -181,13 +163,6 @@ class ToastProps(PropsBase):
)
return d
- class Config:
- """Pydantic config."""
-
- arbitrary_types_allowed = True
- use_enum_values = True
- extra = "forbid"
-
class Toaster(Component):
"""A Toaster Component for displaying toast notifications."""
@@ -251,7 +226,7 @@ class Toaster(Component):
_js_expr=f"{toast_ref} = toast",
_var_data=VarData(
imports={
- "/utils/state": [ImportVar(tag="refs")],
+ "$/utils/state": [ImportVar(tag="refs")],
self.library: [ImportVar(tag="toast", install=False)],
}
),
@@ -259,7 +234,9 @@ class Toaster(Component):
return [hook]
@staticmethod
- def send_toast(message: str = "", level: str | None = None, **props) -> EventSpec:
+ def send_toast(
+ message: str | Var = "", level: str | None = None, **props
+ ) -> EventSpec:
"""Send a toast message.
Args:
@@ -277,20 +254,27 @@ class Toaster(Component):
raise ValueError(
"Toaster component must be created before sending a toast. (use `rx.toast.provider()`)"
)
- toast_command = f"{toast_ref}.{level}" if level is not None else toast_ref
- if message == "" and ("title" not in props or "description" not in props):
- raise ValueError("Toast message or title or description must be provided.")
- if props:
- args = LiteralVar.create(ToastProps(**props))
- toast = f"{toast_command}(`{message}`, {str(args)})"
- else:
- toast = f"{toast_command}(`{message}`)"
- toast_action = Var(_js_expr=toast)
- return call_script(toast_action)
+ toast_command = (
+ ObjectVar.__getattr__(toast_ref.to(dict), level) if level else toast_ref
+ ).to(FunctionVar)
+
+ if isinstance(message, Var):
+ props.setdefault("title", message)
+ message = ""
+ elif message == "" and "title" not in props and "description" not in props:
+ raise ValueError("Toast message or title or description must be provided.")
+
+ if props:
+ args = LiteralVar.create(ToastProps(component_name="rx.toast", **props)) # pyright: ignore [reportCallIssue, reportGeneralTypeIssues]
+ toast = toast_command.call(message, args)
+ else:
+ toast = toast_command.call(message)
+
+ return run_script(toast)
@staticmethod
- def toast_info(message: str = "", **kwargs):
+ def toast_info(message: str | Var = "", **kwargs):
"""Display an info toast message.
Args:
@@ -303,7 +287,7 @@ class Toaster(Component):
return Toaster.send_toast(message, level="info", **kwargs)
@staticmethod
- def toast_warning(message: str = "", **kwargs):
+ def toast_warning(message: str | Var = "", **kwargs):
"""Display a warning toast message.
Args:
@@ -316,7 +300,7 @@ class Toaster(Component):
return Toaster.send_toast(message, level="warning", **kwargs)
@staticmethod
- def toast_error(message: str = "", **kwargs):
+ def toast_error(message: str | Var = "", **kwargs):
"""Display an error toast message.
Args:
@@ -329,7 +313,7 @@ class Toaster(Component):
return Toaster.send_toast(message, level="error", **kwargs)
@staticmethod
- def toast_success(message: str = "", **kwargs):
+ def toast_success(message: str | Var = "", **kwargs):
"""Display a success toast message.
Args:
@@ -363,7 +347,7 @@ class Toaster(Component):
dismiss_action = Var(
_js_expr=dismiss, _var_data=VarData.merge(dismiss_var_data)
)
- return call_script(dismiss_action)
+ return run_script(dismiss_action)
@classmethod
def create(cls, *children, **props) -> Component:
diff --git a/reflex/components/sonner/toast.pyi b/reflex/components/sonner/toast.pyi
index 976f9f310..7fd9fdf54 100644
--- a/reflex/components/sonner/toast.pyi
+++ b/reflex/components/sonner/toast.pyi
@@ -8,8 +8,8 @@ from typing import Any, ClassVar, Dict, Literal, Optional, Union, overload
from reflex.base import Base
from reflex.components.component import Component, ComponentNamespace
from reflex.components.lucide.icon import Icon
-from reflex.components.props import PropsBase
-from reflex.event import EventSpec, EventType
+from reflex.components.props import NoExtrasAllowedProps, PropsBase
+from reflex.event import BASE_STATE, EventSpec, EventType
from reflex.style import Style
from reflex.utils.serializers import serializer
from reflex.vars.base import Var
@@ -31,7 +31,7 @@ class ToastAction(Base):
@serializer
def serialize_action(action: ToastAction) -> dict: ...
-class ToastProps(PropsBase):
+class ToastProps(PropsBase, NoExtrasAllowedProps):
title: Optional[Union[str, Var]]
description: Optional[Union[str, Var]]
close_button: Optional[bool]
@@ -45,6 +45,7 @@ class ToastProps(PropsBase):
id: Optional[Union[str, Var]]
unstyled: Optional[bool]
style: Optional[Style]
+ class_name: Optional[str]
action_button_styles: Optional[Style]
cancel_button_styles: Optional[Style]
on_dismiss: Optional[Any]
@@ -52,27 +53,22 @@ class ToastProps(PropsBase):
def dict(self, *args, **kwargs) -> dict[str, Any]: ...
- class Config:
- arbitrary_types_allowed = True
- use_enum_values = True
- extra = "forbid"
-
class Toaster(Component):
is_used: ClassVar[bool] = False
def add_hooks(self) -> list[Var | str]: ...
@staticmethod
def send_toast(
- message: str = "", level: str | None = None, **props
+ message: str | Var = "", level: str | None = None, **props
) -> EventSpec: ...
@staticmethod
- def toast_info(message: str = "", **kwargs): ...
+ def toast_info(message: str | Var = "", **kwargs): ...
@staticmethod
- def toast_warning(message: str = "", **kwargs): ...
+ def toast_warning(message: str | Var = "", **kwargs): ...
@staticmethod
- def toast_error(message: str = "", **kwargs): ...
+ def toast_error(message: str | Var = "", **kwargs): ...
@staticmethod
- def toast_success(message: str = "", **kwargs): ...
+ def toast_success(message: str | Var = "", **kwargs): ...
@staticmethod
def toast_dismiss(id: Var | str | None = None): ...
@overload
@@ -120,22 +116,22 @@ class Toaster(Component):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Toaster":
"""Create a toaster component.
@@ -180,7 +176,7 @@ class ToastNamespace(ComponentNamespace):
@staticmethod
def __call__(
- message: str = "", level: Optional[str] = None, **props
+ message: Union[str, Var] = "", level: Optional[str] = None, **props
) -> "Optional[EventSpec]":
"""Send a toast message.
diff --git a/reflex/components/suneditor/editor.py b/reflex/components/suneditor/editor.py
index 6f5b6e4b4..16d5689e2 100644
--- a/reflex/components/suneditor/editor.py
+++ b/reflex/components/suneditor/editor.py
@@ -3,11 +3,11 @@
from __future__ import annotations
import enum
-from typing import Dict, List, Literal, Optional, Union
+from typing import Dict, List, Literal, Optional, Tuple, Union
from reflex.base import Base
from reflex.components.component import Component, NoSSRComponent
-from reflex.event import EventHandler
+from reflex.event import EventHandler, no_args_event_spec, passthrough_event_spec
from reflex.utils.format import to_camel_case
from reflex.utils.imports import ImportDict, ImportVar
from reflex.vars.base import Var
@@ -68,6 +68,35 @@ class EditorOptions(Base):
button_list: Optional[List[Union[List[str], str]]]
+def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]:
+ """A helper function to specify the on_blur event handler.
+
+ Args:
+ e: The event.
+ content: The content of the editor.
+
+ Returns:
+ A tuple containing the content of the editor.
+ """
+ return (content,)
+
+
+def on_paste_spec(
+ e: Var, clean_data: Var[str], max_char_count: Var[bool]
+) -> Tuple[Var[str], Var[bool]]:
+ """A helper function to specify the on_paste event handler.
+
+ Args:
+ e: The event.
+ clean_data: The clean data.
+ max_char_count: The maximum character count.
+
+ Returns:
+ A tuple containing the clean data and the maximum character count.
+ """
+ return (clean_data, max_char_count)
+
+
class Editor(NoSSRComponent):
"""A Rich Text Editor component based on SunEditor.
Not every JS prop is listed here (some are not easily usable from python),
@@ -178,36 +207,31 @@ class Editor(NoSSRComponent):
disable_toolbar: Var[bool]
# Fired when the editor content changes.
- on_change: EventHandler[lambda content: [content]]
+ on_change: EventHandler[passthrough_event_spec(str)]
# Fired when the something is inputted in the editor.
- on_input: EventHandler[lambda e: [e]]
+ on_input: EventHandler[no_args_event_spec]
# Fired when the editor loses focus.
- on_blur: EventHandler[lambda e, content: [content]]
+ on_blur: EventHandler[on_blur_spec]
# Fired when the editor is loaded.
- on_load: EventHandler[lambda reload: [reload]]
-
- # Fired when the editor is resized.
- on_resize_editor: EventHandler[lambda height, prev_height: [height, prev_height]]
+ on_load: EventHandler[passthrough_event_spec(bool)]
# Fired when the editor content is copied.
- on_copy: EventHandler[lambda e, clipboard_data: [clipboard_data]]
+ on_copy: EventHandler[no_args_event_spec]
# Fired when the editor content is cut.
- on_cut: EventHandler[lambda e, clipboard_data: [clipboard_data]]
+ on_cut: EventHandler[no_args_event_spec]
# Fired when the editor content is pasted.
- on_paste: EventHandler[
- lambda e, clean_data, max_char_count: [clean_data, max_char_count]
- ]
+ on_paste: EventHandler[on_paste_spec]
# Fired when the code view is toggled.
- toggle_code_view: EventHandler[lambda is_code_view: [is_code_view]]
+ toggle_code_view: EventHandler[passthrough_event_spec(bool)]
# Fired when the full screen mode is toggled.
- toggle_full_screen: EventHandler[lambda is_full_screen: [is_full_screen]]
+ toggle_full_screen: EventHandler[passthrough_event_spec(bool)]
def add_imports(self) -> ImportDict:
"""Add imports for the Editor component.
diff --git a/reflex/components/suneditor/editor.pyi b/reflex/components/suneditor/editor.pyi
index f7149a02c..66ab4863e 100644
--- a/reflex/components/suneditor/editor.pyi
+++ b/reflex/components/suneditor/editor.pyi
@@ -4,11 +4,11 @@
# This file was generated by `reflex/utils/pyi_generator.py`!
# ------------------------------------------------------
import enum
-from typing import Any, Dict, List, Literal, Optional, Union, overload
+from typing import Any, Dict, List, Literal, Optional, Tuple, Union, overload
from reflex.base import Base
from reflex.components.component import NoSSRComponent
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.style import Style
from reflex.utils.imports import ImportDict
from reflex.vars.base import Var
@@ -44,6 +44,11 @@ class EditorOptions(Base):
rtl: Optional[bool]
button_list: Optional[List[Union[List[str], str]]]
+def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]: ...
+def on_paste_spec(
+ e: Var, clean_data: Var[str], max_char_count: Var[bool]
+) -> Tuple[Var[str], Var[bool]]: ...
+
class Editor(NoSSRComponent):
def add_imports(self) -> ImportDict: ...
@overload
@@ -121,31 +126,46 @@ class Editor(NoSSRComponent):
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[EventType] = None,
- on_change: Optional[EventType] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_copy: Optional[EventType] = None,
- on_cut: Optional[EventType] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_input: Optional[EventType] = None,
- on_load: Optional[EventType] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_paste: Optional[EventType] = None,
- on_resize_editor: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
- toggle_code_view: Optional[EventType] = None,
- toggle_full_screen: Optional[EventType] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[str], BASE_STATE]]
+ ] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_copy: Optional[EventType[[], BASE_STATE]] = None,
+ on_cut: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_input: Optional[EventType[[], BASE_STATE]] = None,
+ on_load: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_paste: Optional[
+ Union[
+ EventType[[], BASE_STATE],
+ EventType[[str], BASE_STATE],
+ EventType[[str, bool], BASE_STATE],
+ ]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
+ toggle_code_view: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ toggle_full_screen: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
**props,
) -> "Editor":
"""Create an instance of Editor. No children allowed.
@@ -168,6 +188,15 @@ class Editor(NoSSRComponent):
hide: Hide the editor default: False
hide_toolbar: Hide the editor toolbar default: False
disable_toolbar: Disable the editor toolbar default: False
+ on_change: Fired when the editor content changes.
+ on_input: Fired when the something is inputted in the editor.
+ on_blur: Fired when the editor loses focus.
+ on_load: Fired when the editor is loaded.
+ on_copy: Fired when the editor content is copied.
+ on_cut: Fired when the editor content is cut.
+ on_paste: Fired when the editor content is pasted.
+ toggle_code_view: Fired when the code view is toggled.
+ toggle_full_screen: Fired when the full screen mode is toggled.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
diff --git a/reflex/components/tags/iter_tag.py b/reflex/components/tags/iter_tag.py
index fec27f3d9..38ecaf81c 100644
--- a/reflex/components/tags/iter_tag.py
+++ b/reflex/components/tags/iter_tag.py
@@ -4,16 +4,7 @@ from __future__ import annotations
import dataclasses
import inspect
-from typing import (
- TYPE_CHECKING,
- Any,
- Callable,
- Iterable,
- Tuple,
- Type,
- Union,
- get_args,
-)
+from typing import TYPE_CHECKING, Any, Callable, Iterable, Tuple, Type, Union, get_args
from reflex.components.tags.tag import Tag
from reflex.vars import LiteralArrayVar, Var, get_unique_variable_name
diff --git a/reflex/components/tags/tag.py b/reflex/components/tags/tag.py
index d577abc6e..0587c61ed 100644
--- a/reflex/components/tags/tag.py
+++ b/reflex/components/tags/tag.py
@@ -3,7 +3,7 @@
from __future__ import annotations
import dataclasses
-from typing import Any, Dict, List, Optional, Tuple, Union
+from typing import Any, Dict, List, Optional, Union
from reflex.event import EventChain
from reflex.utils import format, types
@@ -23,9 +23,6 @@ class Tag:
# The inner contents of the tag.
contents: str = ""
- # Args to pass to the tag.
- args: Optional[Tuple[str, ...]] = None
-
# Special props that aren't key value pairs.
special_props: List[Var] = dataclasses.field(default_factory=list)
diff --git a/reflex/config.py b/reflex/config.py
index 719d5c21f..1d952f4f0 100644
--- a/reflex/config.py
+++ b/reflex/config.py
@@ -2,14 +2,32 @@
from __future__ import annotations
+import dataclasses
+import enum
import importlib
+import inspect
import os
import sys
+import threading
import urllib.parse
+from importlib.util import find_spec
from pathlib import Path
-from typing import Any, Dict, List, Optional, Set, Union
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ Dict,
+ Generic,
+ List,
+ Optional,
+ Set,
+ TypeVar,
+ get_args,
+)
-from reflex.utils.exceptions import ConfigError
+from typing_extensions import Annotated, get_type_hints
+
+from reflex.utils.exceptions import ConfigError, EnvironmentVarValueError
+from reflex.utils.types import GenericType, is_union, value_inside_optional
try:
import pydantic.v1 as pydantic
@@ -131,6 +149,425 @@ class DBConfig(Base):
return f"{self.engine}://{path}/{self.database}"
+def get_default_value_for_field(field: dataclasses.Field) -> Any:
+ """Get the default value for a field.
+
+ Args:
+ field: The field.
+
+ Returns:
+ The default value.
+
+ Raises:
+ ValueError: If no default value is found.
+ """
+ if field.default != dataclasses.MISSING:
+ return field.default
+ elif field.default_factory != dataclasses.MISSING:
+ return field.default_factory()
+ else:
+ raise ValueError(
+ f"Missing value for environment variable {field.name} and no default value found"
+ )
+
+
+# TODO: Change all interpret_.* signatures to value: str, field: dataclasses.Field once we migrate rx.Config to dataclasses
+def interpret_boolean_env(value: str, field_name: str) -> bool:
+ """Interpret a boolean environment variable value.
+
+ Args:
+ value: The environment variable value.
+ field_name: The field name.
+
+ Returns:
+ The interpreted value.
+
+ Raises:
+ EnvironmentVarValueError: If the value is invalid.
+ """
+ true_values = ["true", "1", "yes", "y"]
+ false_values = ["false", "0", "no", "n"]
+
+ if value.lower() in true_values:
+ return True
+ elif value.lower() in false_values:
+ return False
+ raise EnvironmentVarValueError(f"Invalid boolean value: {value} for {field_name}")
+
+
+def interpret_int_env(value: str, field_name: str) -> int:
+ """Interpret an integer environment variable value.
+
+ Args:
+ value: The environment variable value.
+ field_name: The field name.
+
+ Returns:
+ The interpreted value.
+
+ Raises:
+ EnvironmentVarValueError: If the value is invalid.
+ """
+ try:
+ return int(value)
+ except ValueError as ve:
+ raise EnvironmentVarValueError(
+ f"Invalid integer value: {value} for {field_name}"
+ ) from ve
+
+
+def interpret_existing_path_env(value: str, field_name: str) -> ExistingPath:
+ """Interpret a path environment variable value as an existing path.
+
+ Args:
+ value: The environment variable value.
+ field_name: The field name.
+
+ Returns:
+ The interpreted value.
+
+ Raises:
+ EnvironmentVarValueError: If the path does not exist.
+ """
+ path = Path(value)
+ if not path.exists():
+ raise EnvironmentVarValueError(f"Path does not exist: {path} for {field_name}")
+ return path
+
+
+def interpret_path_env(value: str, field_name: str) -> Path:
+ """Interpret a path environment variable value.
+
+ Args:
+ value: The environment variable value.
+ field_name: The field name.
+
+ Returns:
+ The interpreted value.
+ """
+ return Path(value)
+
+
+def interpret_enum_env(value: str, field_type: GenericType, field_name: str) -> Any:
+ """Interpret an enum environment variable value.
+
+ Args:
+ value: The environment variable value.
+ field_type: The field type.
+ field_name: The field name.
+
+ Returns:
+ The interpreted value.
+
+ Raises:
+ EnvironmentVarValueError: If the value is invalid.
+ """
+ try:
+ return field_type(value)
+ except ValueError as ve:
+ raise EnvironmentVarValueError(
+ f"Invalid enum value: {value} for {field_name}"
+ ) from ve
+
+
+def interpret_env_var_value(
+ value: str, field_type: GenericType, field_name: str
+) -> Any:
+ """Interpret an environment variable value based on the field type.
+
+ Args:
+ value: The environment variable value.
+ field_type: The field type.
+ field_name: The field name.
+
+ Returns:
+ The interpreted value.
+
+ Raises:
+ ValueError: If the value is invalid.
+ """
+ field_type = value_inside_optional(field_type)
+
+ if is_union(field_type):
+ raise ValueError(
+ f"Union types are not supported for environment variables: {field_name}."
+ )
+
+ if field_type is bool:
+ return interpret_boolean_env(value, field_name)
+ elif field_type is str:
+ return value
+ elif field_type is int:
+ return interpret_int_env(value, field_name)
+ elif field_type is Path:
+ return interpret_path_env(value, field_name)
+ elif field_type is ExistingPath:
+ return interpret_existing_path_env(value, field_name)
+ elif inspect.isclass(field_type) and issubclass(field_type, enum.Enum):
+ return interpret_enum_env(value, field_type, field_name)
+
+ else:
+ raise ValueError(
+ f"Invalid type for environment variable {field_name}: {field_type}. This is probably an issue in Reflex."
+ )
+
+
+T = TypeVar("T")
+
+
+class EnvVar(Generic[T]):
+ """Environment variable."""
+
+ name: str
+ default: Any
+ type_: T
+
+ def __init__(self, name: str, default: Any, type_: T) -> None:
+ """Initialize the environment variable.
+
+ Args:
+ name: The environment variable name.
+ default: The default value.
+ type_: The type of the value.
+ """
+ self.name = name
+ self.default = default
+ self.type_ = type_
+
+ def interpret(self, value: str) -> T:
+ """Interpret the environment variable value.
+
+ Args:
+ value: The environment variable value.
+
+ Returns:
+ The interpreted value.
+ """
+ return interpret_env_var_value(value, self.type_, self.name)
+
+ def getenv(self) -> Optional[T]:
+ """Get the interpreted environment variable value.
+
+ Returns:
+ The environment variable value.
+ """
+ env_value = os.getenv(self.name, None)
+ if env_value is not None:
+ return self.interpret(env_value)
+ return None
+
+ def is_set(self) -> bool:
+ """Check if the environment variable is set.
+
+ Returns:
+ True if the environment variable is set.
+ """
+ return self.name in os.environ
+
+ def get(self) -> T:
+ """Get the interpreted environment variable value or the default value if not set.
+
+ Returns:
+ The interpreted value.
+ """
+ env_value = self.getenv()
+ if env_value is not None:
+ return env_value
+ return self.default
+
+ def set(self, value: T | None) -> None:
+ """Set the environment variable. None unsets the variable.
+
+ Args:
+ value: The value to set.
+ """
+ if value is None:
+ _ = os.environ.pop(self.name, None)
+ else:
+ if isinstance(value, enum.Enum):
+ value = value.value
+ os.environ[self.name] = str(value)
+
+
+class env_var: # type: ignore
+ """Descriptor for environment variables."""
+
+ name: str
+ default: Any
+ internal: bool = False
+
+ def __init__(self, default: Any, internal: bool = False) -> None:
+ """Initialize the descriptor.
+
+ Args:
+ default: The default value.
+ internal: Whether the environment variable is reflex internal.
+ """
+ self.default = default
+ self.internal = internal
+
+ def __set_name__(self, owner, name):
+ """Set the name of the descriptor.
+
+ Args:
+ owner: The owner class.
+ name: The name of the descriptor.
+ """
+ self.name = name
+
+ def __get__(self, instance, owner):
+ """Get the EnvVar instance.
+
+ Args:
+ instance: The instance.
+ owner: The owner class.
+
+ Returns:
+ The EnvVar instance.
+ """
+ type_ = get_args(get_type_hints(owner)[self.name])[0]
+ env_name = self.name
+ if self.internal:
+ env_name = f"__{env_name}"
+ return EnvVar(name=env_name, default=self.default, type_=type_)
+
+
+if TYPE_CHECKING:
+
+ def env_var(default, internal=False) -> EnvVar:
+ """Typing helper for the env_var descriptor.
+
+ Args:
+ default: The default value.
+ internal: Whether the environment variable is reflex internal.
+
+ Returns:
+ The EnvVar instance.
+ """
+ return default
+
+
+class PathExistsFlag:
+ """Flag to indicate that a path must exist."""
+
+
+ExistingPath = Annotated[Path, PathExistsFlag]
+
+
+class PerformanceMode(enum.Enum):
+ """Performance mode for the app."""
+
+ WARN = "warn"
+ RAISE = "raise"
+ OFF = "off"
+
+
+class EnvironmentVariables:
+ """Environment variables class to instantiate environment variables."""
+
+ # Whether to use npm over bun to install frontend packages.
+ REFLEX_USE_NPM: EnvVar[bool] = env_var(False)
+
+ # The npm registry to use.
+ NPM_CONFIG_REGISTRY: EnvVar[Optional[str]] = env_var(None)
+
+ # Whether to use Granian for the backend. Otherwise, use Uvicorn.
+ REFLEX_USE_GRANIAN: EnvVar[bool] = env_var(False)
+
+ # The username to use for authentication on python package repository. Username and password must both be provided.
+ TWINE_USERNAME: EnvVar[Optional[str]] = env_var(None)
+
+ # The password to use for authentication on python package repository. Username and password must both be provided.
+ TWINE_PASSWORD: EnvVar[Optional[str]] = env_var(None)
+
+ # Whether to use the system installed bun. If set to false, bun will be bundled with the app.
+ REFLEX_USE_SYSTEM_BUN: EnvVar[bool] = env_var(False)
+
+ # Whether to use the system installed node and npm. If set to false, node and npm will be bundled with the app.
+ REFLEX_USE_SYSTEM_NODE: EnvVar[bool] = env_var(False)
+
+ # The working directory for the next.js commands.
+ REFLEX_WEB_WORKDIR: EnvVar[Path] = env_var(Path(constants.Dirs.WEB))
+
+ # Path to the alembic config file
+ ALEMBIC_CONFIG: EnvVar[ExistingPath] = env_var(Path(constants.ALEMBIC_CONFIG))
+
+ # Disable SSL verification for HTTPX requests.
+ SSL_NO_VERIFY: EnvVar[bool] = env_var(False)
+
+ # The directory to store uploaded files.
+ REFLEX_UPLOADED_FILES_DIR: EnvVar[Path] = env_var(
+ Path(constants.Dirs.UPLOADED_FILES)
+ )
+
+ # Whether to use separate processes to compile the frontend and how many. If not set, defaults to thread executor.
+ REFLEX_COMPILE_PROCESSES: EnvVar[Optional[int]] = env_var(None)
+
+ # Whether to use separate threads to compile the frontend and how many. Defaults to `min(32, os.cpu_count() + 4)`.
+ REFLEX_COMPILE_THREADS: EnvVar[Optional[int]] = env_var(None)
+
+ # The directory to store reflex dependencies.
+ REFLEX_DIR: EnvVar[Path] = env_var(Path(constants.Reflex.DIR))
+
+ # Whether to print the SQL queries if the log level is INFO or lower.
+ SQLALCHEMY_ECHO: EnvVar[bool] = env_var(False)
+
+ # Whether to ignore the redis config error. Some redis servers only allow out-of-band configuration.
+ REFLEX_IGNORE_REDIS_CONFIG_ERROR: EnvVar[bool] = env_var(False)
+
+ # Whether to skip purging the web directory in dev mode.
+ REFLEX_PERSIST_WEB_DIR: EnvVar[bool] = env_var(False)
+
+ # The reflex.build frontend host.
+ REFLEX_BUILD_FRONTEND: EnvVar[str] = env_var(
+ constants.Templates.REFLEX_BUILD_FRONTEND
+ )
+
+ # The reflex.build backend host.
+ REFLEX_BUILD_BACKEND: EnvVar[str] = env_var(
+ constants.Templates.REFLEX_BUILD_BACKEND
+ )
+
+ # This env var stores the execution mode of the app
+ REFLEX_ENV_MODE: EnvVar[constants.Env] = env_var(constants.Env.DEV)
+
+ # Whether to run the backend only. Exclusive with REFLEX_FRONTEND_ONLY.
+ REFLEX_BACKEND_ONLY: EnvVar[bool] = env_var(False)
+
+ # Whether to run the frontend only. Exclusive with REFLEX_BACKEND_ONLY.
+ REFLEX_FRONTEND_ONLY: EnvVar[bool] = env_var(False)
+
+ # Reflex internal env to reload the config.
+ RELOAD_CONFIG: EnvVar[bool] = env_var(False, internal=True)
+
+ # If this env var is set to "yes", App.compile will be a no-op
+ REFLEX_SKIP_COMPILE: EnvVar[bool] = env_var(False, internal=True)
+
+ # Whether to run app harness tests in headless mode.
+ APP_HARNESS_HEADLESS: EnvVar[bool] = env_var(False)
+
+ # Which app harness driver to use.
+ APP_HARNESS_DRIVER: EnvVar[str] = env_var("Chrome")
+
+ # Arguments to pass to the app harness driver.
+ APP_HARNESS_DRIVER_ARGS: EnvVar[str] = env_var("")
+
+ # Where to save screenshots when tests fail.
+ SCREENSHOT_DIR: EnvVar[Optional[Path]] = env_var(None)
+
+ # Whether to check for outdated package versions.
+ REFLEX_CHECK_LATEST_VERSION: EnvVar[bool] = env_var(True)
+
+ # In which performance mode to run the app.
+ REFLEX_PERF_MODE: EnvVar[Optional[PerformanceMode]] = env_var(PerformanceMode.WARN)
+
+ # The maximum size of the reflex state in kilobytes.
+ REFLEX_STATE_SIZE_LIMIT: EnvVar[int] = env_var(1000)
+
+
+environment = EnvironmentVariables()
+
+
class Config(Base):
"""The config defines runtime settings for the app.
@@ -191,7 +628,10 @@ class Config(Base):
telemetry_enabled: bool = True
# The bun path
- bun_path: Union[str, Path] = constants.Bun.DEFAULT_PATH
+ bun_path: ExistingPath = constants.Bun.DEFAULT_PATH
+
+ # Timeout to do a production build of a frontend page.
+ static_page_generation_timeout: int = 60
# List of origins that are allowed to connect to the backend API.
cors_allowed_origins: List[str] = ["*"]
@@ -212,9 +652,9 @@ class Config(Base):
frontend_packages: List[str] = []
# The hosting service backend URL.
- cp_backend_url: str = Hosting.CP_BACKEND_URL
+ cp_backend_url: str = Hosting.HOSTING_SERVICE
# The hosting service frontend URL.
- cp_web_url: str = Hosting.CP_WEB_URL
+ cp_web_url: str = Hosting.HOSTING_SERVICE_UI
# The worker class used in production mode
gunicorn_worker_class: str = "uvicorn.workers.UvicornH11Worker"
@@ -222,6 +662,12 @@ class Config(Base):
# Number of gunicorn workers from user
gunicorn_workers: Optional[int] = None
+ # Number of requests before a worker is restarted
+ gunicorn_max_requests: int = 100
+
+ # Variance limit for max requests; gunicorn only
+ gunicorn_max_requests_jitter: int = 25
+
# Indicate which type of state manager to use
state_manager_mode: constants.StateManagerMode = constants.StateManagerMode.DISK
@@ -234,6 +680,9 @@ class Config(Base):
# Attributes that were explicitly set by the user.
_non_default_attributes: Set[str] = pydantic.PrivateAttr(set())
+ # Path to file containing key-values pairs to override in the environment; Dotenv format.
+ env_file: Optional[str] = None
+
def __init__(self, *args, **kwargs):
"""Initialize the config values.
@@ -275,14 +724,21 @@ class Config(Base):
def update_from_env(self) -> dict[str, Any]:
"""Update the config values based on set environment variables.
+ If there is a set env_file, it is loaded first.
Returns:
The updated config values.
-
- Raises:
- EnvVarValueError: If an environment variable is set to an invalid type.
"""
- from reflex.utils.exceptions import EnvVarValueError
+ if self.env_file:
+ try:
+ from dotenv import load_dotenv # type: ignore
+
+ # load env file if exists
+ load_dotenv(self.env_file, override=True)
+ except ImportError:
+ console.error(
+ """The `python-dotenv` package is required to load environment variables from a file. Run `pip install "python-dotenv>=1.0.1"`."""
+ )
updated_values = {}
# Iterate over the fields.
@@ -298,21 +754,11 @@ class Config(Base):
dedupe=True,
)
- # Convert the env var to the expected type.
- try:
- if issubclass(field.type_, bool):
- # special handling for bool values
- env_var = env_var.lower() in ["true", "1", "yes"]
- else:
- env_var = field.type_(env_var)
- except ValueError as ve:
- console.error(
- f"Could not convert {key.upper()}={env_var} to type {field.type_}"
- )
- raise EnvVarValueError from ve
+ # Interpret the value.
+ value = interpret_env_var_value(env_var, field.outer_type_, field.name)
# Set the value.
- updated_values[key] = env_var
+ updated_values[key] = value
return updated_values
@@ -371,6 +817,27 @@ class Config(Base):
self._replace_defaults(**kwargs)
+def _get_config() -> Config:
+ """Get the app config.
+
+ Returns:
+ The app config.
+ """
+ # only import the module if it exists. If a module spec exists then
+ # the module exists.
+ spec = find_spec(constants.Config.MODULE)
+ if not spec:
+ # we need this condition to ensure that a ModuleNotFound error is not thrown when
+ # running unit/integration tests or during `reflex init`.
+ return Config(app_name="")
+ rxconfig = importlib.import_module(constants.Config.MODULE)
+ return rxconfig.config
+
+
+# Protect sys.path from concurrent modification
+_config_lock = threading.RLock()
+
+
def get_config(reload: bool = False) -> Config:
"""Get the app config.
@@ -380,15 +847,26 @@ def get_config(reload: bool = False) -> Config:
Returns:
The app config.
"""
- sys.path.insert(0, os.getcwd())
- # only import the module if it exists. If a module spec exists then
- # the module exists.
- spec = importlib.util.find_spec(constants.Config.MODULE) # type: ignore
- if not spec:
- # we need this condition to ensure that a ModuleNotFound error is not thrown when
- # running unit/integration tests.
- return Config(app_name="")
- rxconfig = importlib.import_module(constants.Config.MODULE)
- if reload:
- importlib.reload(rxconfig)
- return rxconfig.config
+ cached_rxconfig = sys.modules.get(constants.Config.MODULE, None)
+ if cached_rxconfig is not None:
+ if reload:
+ # Remove any cached module when `reload` is requested.
+ del sys.modules[constants.Config.MODULE]
+ else:
+ return cached_rxconfig.config
+
+ with _config_lock:
+ sys_path = sys.path.copy()
+ sys.path.clear()
+ sys.path.append(os.getcwd())
+ try:
+ # Try to import the module with only the current directory in the path.
+ return _get_config()
+ except Exception:
+ # If the module import fails, try to import with the original sys.path.
+ sys.path.extend(sys_path)
+ return _get_config()
+ finally:
+ # Restore the original sys.path.
+ sys.path.clear()
+ sys.path.extend(sys_path)
diff --git a/reflex/constants/__init__.py b/reflex/constants/__init__.py
index 8e61a3717..e816da0f7 100644
--- a/reflex/constants/__init__.py
+++ b/reflex/constants/__init__.py
@@ -2,16 +2,15 @@
from .base import (
COOKIES,
- ENV_MODE_ENV_VAR,
+ IS_LINUX,
+ IS_MACOS,
IS_WINDOWS,
LOCAL_STORAGE,
POLLING_MAX_HTTP_BUFFER_SIZE,
PYTEST_CURRENT_TEST,
REFLEX_VAR_CLOSING_TAG,
REFLEX_VAR_OPENING_TAG,
- RELOAD_CONFIG,
SESSION_STORAGE,
- SKIP_COMPILE_ENV_VAR,
ColorMode,
Dirs,
Env,
@@ -42,16 +41,9 @@ from .config import (
GitIgnore,
RequirementsTxt,
)
-from .custom_components import (
- CustomComponents,
-)
+from .custom_components import CustomComponents
from .event import Endpoint, EventTriggers, SocketEvent
-from .installer import (
- Bun,
- Fnm,
- Node,
- PackageJson,
-)
+from .installer import Bun, Fnm, Node, PackageJson
from .route import (
ROUTE_NOT_FOUND,
ROUTER,
@@ -104,7 +96,6 @@ __ALL__ = [
POLLING_MAX_HTTP_BUFFER_SIZE,
PYTEST_CURRENT_TEST,
Reflex,
- RELOAD_CONFIG,
RequirementsTxt,
RouteArgType,
RouteRegex,
@@ -114,7 +105,6 @@ __ALL__ = [
ROUTER_DATA_INCLUDE,
ROUTE_NOT_FOUND,
SETTER_PREFIX,
- SKIP_COMPILE_ENV_VAR,
SocketEvent,
StateManagerMode,
Tailwind,
diff --git a/reflex/constants/base.py b/reflex/constants/base.py
index b86f083cc..3266043c5 100644
--- a/reflex/constants/base.py
+++ b/reflex/constants/base.py
@@ -2,7 +2,6 @@
from __future__ import annotations
-import os
import platform
from enum import Enum
from importlib import metadata
@@ -11,7 +10,11 @@ from types import SimpleNamespace
from platformdirs import PlatformDirs
+from .utils import classproperty
+
IS_WINDOWS = platform.system() == "Windows"
+IS_MACOS = platform.system() == "Darwin"
+IS_LINUX = platform.system() == "Linux"
class Dirs(SimpleNamespace):
@@ -20,6 +23,8 @@ class Dirs(SimpleNamespace):
# The frontend directories in a project.
# The web folder where the NextJS app is compiled to.
WEB = ".web"
+ # The directory where uploaded files are stored.
+ UPLOADED_FILES = "uploaded_files"
# The name of the assets directory.
APP_ASSETS = "assets"
# The name of the assets directory for external ressource (a subfolder of APP_ASSETS).
@@ -64,24 +69,16 @@ class Reflex(SimpleNamespace):
# Files and directories used to init a new project.
# The directory to store reflex dependencies.
- # Get directory value from enviroment variables if it exists.
- _dir = os.environ.get("REFLEX_DIR", "")
+ # on windows, we use C:/Users//AppData/Local/reflex.
+ # on macOS, we use ~/Library/Application Support/reflex.
+ # on linux, we use ~/.local/share/reflex.
+ # If user sets REFLEX_DIR envroment variable use that instead.
+ DIR = PlatformDirs(MODULE_NAME, False).user_data_path
- DIR = Path(
- _dir
- or (
- # on windows, we use C:/Users//AppData/Local/reflex.
- # on macOS, we use ~/Library/Application Support/reflex.
- # on linux, we use ~/.local/share/reflex.
- # If user sets REFLEX_DIR envroment variable use that instead.
- PlatformDirs(MODULE_NAME, False).user_data_dir
- )
- )
# The root directory of the reflex library.
-
ROOT_DIR = Path(__file__).parents[2]
- RELEASES_URL = f"https://api.github.com/repos/reflex-dev/templates/releases"
+ RELEASES_URL = "https://api.github.com/repos/reflex-dev/templates/releases"
class ReflexHostingCLI(SimpleNamespace):
@@ -100,28 +97,65 @@ class Templates(SimpleNamespace):
# The default template
DEFAULT = "blank"
+ # The AI template
+ AI = "ai"
+
+ # The option for the user to choose a remote template.
+ CHOOSE_TEMPLATES = "choose-templates"
+
+ # The URL to find reflex templates.
+ REFLEX_TEMPLATES_URL = "https://reflex.dev/templates"
+
+ # Demo url for the default template.
+ DEFAULT_TEMPLATE_URL = "https://blank-template.reflex.run"
+
# The reflex.build frontend host
- REFLEX_BUILD_FRONTEND = os.environ.get(
- "REFLEX_BUILD_FRONTEND", "https://flexgen.reflex.run"
- )
+ REFLEX_BUILD_FRONTEND = "https://flexgen.reflex.run"
# The reflex.build backend host
- REFLEX_BUILD_BACKEND = os.environ.get(
- "REFLEX_BUILD_BACKEND", "https://flexgen-prod-flexgen.fly.dev"
- )
+ REFLEX_BUILD_BACKEND = "https://flexgen-prod-flexgen.fly.dev"
- # The URL to redirect to reflex.build
- REFLEX_BUILD_URL = (
- REFLEX_BUILD_FRONTEND + "/gen?reflex_init_token={reflex_init_token}"
- )
+ @classproperty
+ @classmethod
+ def REFLEX_BUILD_URL(cls):
+ """The URL to redirect to reflex.build.
- # The URL to poll waiting for the user to select a generation.
- REFLEX_BUILD_POLL_URL = REFLEX_BUILD_BACKEND + "/api/init/{reflex_init_token}"
+ Returns:
+ The URL to redirect to reflex.build.
+ """
+ from reflex.config import environment
- # The URL to fetch the generation's reflex code
- REFLEX_BUILD_CODE_URL = (
- REFLEX_BUILD_BACKEND + "/api/gen/{generation_hash}/refactored"
- )
+ return (
+ environment.REFLEX_BUILD_FRONTEND.get()
+ + "/gen?reflex_init_token={reflex_init_token}"
+ )
+
+ @classproperty
+ @classmethod
+ def REFLEX_BUILD_POLL_URL(cls):
+ """The URL to poll waiting for the user to select a generation.
+
+ Returns:
+ The URL to poll waiting for the user to select a generation.
+ """
+ from reflex.config import environment
+
+ return environment.REFLEX_BUILD_BACKEND.get() + "/api/init/{reflex_init_token}"
+
+ @classproperty
+ @classmethod
+ def REFLEX_BUILD_CODE_URL(cls):
+ """The URL to fetch the generation's reflex code.
+
+ Returns:
+ The URL to fetch the generation's reflex code.
+ """
+ from reflex.config import environment
+
+ return (
+ environment.REFLEX_BUILD_BACKEND.get()
+ + "/api/gen/{generation_hash}/refactored"
+ )
class Dirs(SimpleNamespace):
"""Folders used by the template system of Reflex."""
@@ -220,16 +254,9 @@ COOKIES = "cookies"
LOCAL_STORAGE = "local_storage"
SESSION_STORAGE = "session_storage"
-# If this env var is set to "yes", App.compile will be a no-op
-SKIP_COMPILE_ENV_VAR = "__REFLEX_SKIP_COMPILE"
-
-# This env var stores the execution mode of the app
-ENV_MODE_ENV_VAR = "REFLEX_ENV_MODE"
-
# Testing variables.
# Testing os env set by pytest when running a test case.
PYTEST_CURRENT_TEST = "PYTEST_CURRENT_TEST"
-RELOAD_CONFIG = "__REFLEX_RELOAD_CONFIG"
REFLEX_VAR_OPENING_TAG = ""
REFLEX_VAR_CLOSING_TAG = ""
diff --git a/reflex/constants/colors.py b/reflex/constants/colors.py
index ddd093f25..60942c775 100644
--- a/reflex/constants/colors.py
+++ b/reflex/constants/colors.py
@@ -35,7 +35,6 @@ ColorType = Literal[
"amber",
"gold",
"bronze",
- "gray",
"accent",
"black",
"white",
diff --git a/reflex/constants/compiler.py b/reflex/constants/compiler.py
index 557a92092..b7ffef161 100644
--- a/reflex/constants/compiler.py
+++ b/reflex/constants/compiler.py
@@ -114,8 +114,8 @@ class Imports(SimpleNamespace):
EVENTS = {
"react": [ImportVar(tag="useContext")],
- f"/{Dirs.CONTEXTS_PATH}": [ImportVar(tag="EventLoopContext")],
- f"/{Dirs.STATE_PATH}": [ImportVar(tag=CompileVars.TO_EVENT)],
+ f"$/{Dirs.CONTEXTS_PATH}": [ImportVar(tag="EventLoopContext")],
+ f"$/{Dirs.STATE_PATH}": [ImportVar(tag=CompileVars.TO_EVENT)],
}
@@ -132,16 +132,6 @@ class Hooks(SimpleNamespace):
}
})"""
- FRONTEND_ERRORS = f"""
- const logFrontendError = (error, info) => {{
- if (process.env.NODE_ENV === "production") {{
- addEvents([Event("{CompileVars.FRONTEND_EXCEPTION_STATE_FULL}.handle_frontend_exception", {{
- stack: error.stack,
- }})])
- }}
- }}
- """
-
class MemoizationDisposition(enum.Enum):
"""The conditions under which a component should be memoized."""
diff --git a/reflex/constants/config.py b/reflex/constants/config.py
index 3ff7aade5..970e67844 100644
--- a/reflex/constants/config.py
+++ b/reflex/constants/config.py
@@ -1,6 +1,5 @@
"""Config constants."""
-import os
from pathlib import Path
from types import SimpleNamespace
@@ -9,7 +8,7 @@ from reflex.constants.base import Dirs, Reflex
from .compiler import Ext
# Alembic migrations
-ALEMBIC_CONFIG = os.environ.get("ALEMBIC_CONFIG", "alembic.ini")
+ALEMBIC_CONFIG = "alembic.ini"
class Config(SimpleNamespace):
diff --git a/reflex/constants/installer.py b/reflex/constants/installer.py
index b12d56c78..0b45586dd 100644
--- a/reflex/constants/installer.py
+++ b/reflex/constants/installer.py
@@ -3,9 +3,11 @@
from __future__ import annotations
import platform
+from pathlib import Path
from types import SimpleNamespace
-from .base import IS_WINDOWS, Reflex
+from .base import IS_WINDOWS
+from .utils import classproperty
def get_fnm_name() -> str | None:
@@ -36,12 +38,9 @@ class Bun(SimpleNamespace):
# The Bun version.
VERSION = "1.1.29"
+
# Min Bun Version
MIN_VERSION = "0.7.0"
- # The directory to store the bun.
- ROOT_PATH = Reflex.DIR / "bun"
- # Default bun path.
- DEFAULT_PATH = ROOT_PATH / "bin" / ("bun" if not IS_WINDOWS else "bun.exe")
# URL to bun install script.
INSTALL_URL = "https://raw.githubusercontent.com/reflex-dev/reflex/main/scripts/bun_install.sh"
@@ -50,11 +49,36 @@ class Bun(SimpleNamespace):
WINDOWS_INSTALL_URL = (
"https://raw.githubusercontent.com/reflex-dev/reflex/main/scripts/install.ps1"
)
+
# Path of the bunfig file
CONFIG_PATH = "bunfig.toml"
- # The environment variable to use the system installed bun.
- USE_SYSTEM_VAR = "REFLEX_USE_SYSTEM_BUN"
+ @classproperty
+ @classmethod
+ def ROOT_PATH(cls):
+ """The directory to store the bun.
+
+ Returns:
+ The directory to store the bun.
+ """
+ from reflex.config import environment
+
+ return environment.REFLEX_DIR.get() / "bun"
+
+ @classproperty
+ @classmethod
+ def DEFAULT_PATH(cls):
+ """Default bun path.
+
+ Returns:
+ The default bun path.
+ """
+ return cls.ROOT_PATH / "bin" / ("bun" if not IS_WINDOWS else "bun.exe")
+
+ DEFAULT_CONFIG = """
+[install]
+registry = "{registry}"
+"""
# FNM config.
@@ -63,44 +87,81 @@ class Fnm(SimpleNamespace):
# The FNM version.
VERSION = "1.35.1"
- # The directory to store fnm.
- DIR = Reflex.DIR / "fnm"
+
FILENAME = get_fnm_name()
- # The fnm executable binary.
- EXE = DIR / ("fnm.exe" if IS_WINDOWS else "fnm")
# The URL to the fnm release binary
INSTALL_URL = (
f"https://github.com/Schniz/fnm/releases/download/v{VERSION}/{FILENAME}.zip"
)
+ @classproperty
+ @classmethod
+ def DIR(cls) -> Path:
+ """The directory to store fnm.
+
+ Returns:
+ The directory to store fnm.
+ """
+ from reflex.config import environment
+
+ return environment.REFLEX_DIR.get() / "fnm"
+
+ @classproperty
+ @classmethod
+ def EXE(cls):
+ """The fnm executable binary.
+
+ Returns:
+ The fnm executable binary.
+ """
+ return cls.DIR / ("fnm.exe" if IS_WINDOWS else "fnm")
+
# Node / NPM config
class Node(SimpleNamespace):
"""Node/ NPM constants."""
# The Node version.
- VERSION = "20.18.0"
+ VERSION = "22.11.0"
# The minimum required node version.
- MIN_VERSION = "18.17.0"
+ MIN_VERSION = "18.18.0"
- # The node bin path.
- BIN_PATH = (
- Fnm.DIR
- / "node-versions"
- / f"v{VERSION}"
- / "installation"
- / ("bin" if not IS_WINDOWS else "")
- )
+ @classproperty
+ @classmethod
+ def BIN_PATH(cls):
+ """The node bin path.
- # The default path where node is installed.
- PATH = BIN_PATH / ("node.exe" if IS_WINDOWS else "node")
+ Returns:
+ The node bin path.
+ """
+ return (
+ Fnm.DIR
+ / "node-versions"
+ / f"v{cls.VERSION}"
+ / "installation"
+ / ("bin" if not IS_WINDOWS else "")
+ )
- # The default path where npm is installed.
- NPM_PATH = BIN_PATH / "npm"
+ @classproperty
+ @classmethod
+ def PATH(cls):
+ """The default path where node is installed.
- # The environment variable to use the system installed node.
- USE_SYSTEM_VAR = "REFLEX_USE_SYSTEM_NODE"
+ Returns:
+ The default path where node is installed.
+ """
+ return cls.BIN_PATH / ("node.exe" if IS_WINDOWS else "node")
+
+ @classproperty
+ @classmethod
+ def NPM_PATH(cls):
+ """The default path where npm is installed.
+
+ Returns:
+ The default path where npm is installed.
+ """
+ return cls.BIN_PATH / "npm"
class PackageJson(SimpleNamespace):
@@ -117,21 +178,21 @@ class PackageJson(SimpleNamespace):
PATH = "package.json"
DEPENDENCIES = {
- "@babel/standalone": "7.25.7",
+ "@babel/standalone": "7.26.0",
"@emotion/react": "11.13.3",
"axios": "1.7.7",
"json5": "2.2.3",
- "next": "14.2.14",
+ "next": "14.2.16",
"next-sitemap": "4.2.3",
- "next-themes": "0.3.0",
+ "next-themes": "0.4.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-focus-lock": "2.13.2",
- "socket.io-client": "4.8.0",
- "universal-cookie": "7.2.0",
+ "socket.io-client": "4.8.1",
+ "universal-cookie": "7.2.2",
}
DEV_DEPENDENCIES = {
"autoprefixer": "10.4.20",
- "postcss": "8.4.47",
+ "postcss": "8.4.49",
"postcss-import": "16.1.0",
}
diff --git a/reflex/constants/state.py b/reflex/constants/state.py
index aa0e2f97f..5ce7cd62a 100644
--- a/reflex/constants/state.py
+++ b/reflex/constants/state.py
@@ -9,3 +9,7 @@ class StateManagerMode(str, Enum):
DISK = "disk"
MEMORY = "memory"
REDIS = "redis"
+
+
+# Used for things like console_log, etc.
+FRONTEND_EVENT_STATE = "__reflex_internal_frontend_event_state"
diff --git a/reflex/constants/style.py b/reflex/constants/style.py
index 9cd51da79..a1d30bcca 100644
--- a/reflex/constants/style.py
+++ b/reflex/constants/style.py
@@ -7,7 +7,7 @@ class Tailwind(SimpleNamespace):
"""Tailwind constants."""
# The Tailwindcss version
- VERSION = "tailwindcss@3.4.13"
+ VERSION = "tailwindcss@3.4.15"
# The Tailwind config.
CONFIG = "tailwind.config.js"
# Default Tailwind content paths
diff --git a/reflex/constants/utils.py b/reflex/constants/utils.py
new file mode 100644
index 000000000..48797afbf
--- /dev/null
+++ b/reflex/constants/utils.py
@@ -0,0 +1,32 @@
+"""Utility functions for constants."""
+
+from typing import Any, Callable, Generic, Type
+
+from typing_extensions import TypeVar
+
+T = TypeVar("T")
+V = TypeVar("V")
+
+
+class classproperty(Generic[T, V]):
+ """A class property decorator."""
+
+ def __init__(self, getter: Callable[[Type[T]], V]) -> None:
+ """Initialize the class property.
+
+ Args:
+ getter: The getter function.
+ """
+ self.getter = getattr(getter, "__func__", getter)
+
+ def __get__(self, instance: Any, owner: Type[T]) -> V:
+ """Get the value of the class property.
+
+ Args:
+ instance: The instance of the class.
+ owner: The class itself.
+
+ Returns:
+ The value of the class property.
+ """
+ return self.getter(owner)
diff --git a/reflex/custom_components/custom_components.py b/reflex/custom_components/custom_components.py
index ee24a7cd0..41808d60a 100644
--- a/reflex/custom_components/custom_components.py
+++ b/reflex/custom_components/custom_components.py
@@ -17,7 +17,7 @@ import typer
from tomlkit.exceptions import TOMLKitError
from reflex import constants
-from reflex.config import get_config
+from reflex.config import environment, get_config
from reflex.constants import CustomComponents
from reflex.utils import console
@@ -609,14 +609,14 @@ def publish(
help="The API token to use for authentication on python package repository. If token is provided, no username/password should be provided at the same time",
),
username: Optional[str] = typer.Option(
- os.getenv("TWINE_USERNAME"),
+ environment.TWINE_USERNAME.get(),
"-u",
"--username",
show_default="TWINE_USERNAME environment variable value if set",
help="The username to use for authentication on python package repository. Username and password must both be provided.",
),
password: Optional[str] = typer.Option(
- os.getenv("TWINE_PASSWORD"),
+ environment.TWINE_PASSWORD.get(),
"-p",
"--password",
show_default="TWINE_PASSWORD environment variable value if set",
@@ -779,8 +779,8 @@ def _validate_project_info():
)
# PyPI only shows the first author.
author = project.get("authors", [{}])[0]
- author["name"] = console.ask(f"Author Name", default=author.get("name", ""))
- author["email"] = console.ask(f"Author Email", default=author.get("email", ""))
+ author["name"] = console.ask("Author Name", default=author.get("name", ""))
+ author["email"] = console.ask("Author Email", default=author.get("email", ""))
console.print(f'Current keywords are: {project.get("keywords") or []}')
keyword_action = console.ask(
@@ -827,11 +827,11 @@ def _collect_details_for_gallery():
Raises:
Exit: If pyproject.toml file is ill-formed or the request to the backend services fails.
"""
- from reflex.reflex import _login
+ from reflex_cli.utils import hosting
console.rule("[bold]Authentication with Reflex Services")
console.print("First let's log in to Reflex backend services.")
- access_token = _login()
+ access_token, _ = hosting.authenticated_token()
console.rule("[bold]Custom Component Information")
params = {}
@@ -923,7 +923,7 @@ def _get_file_from_prompt_in_loop() -> Tuple[bytes, str] | None:
image_file = file_extension = None
while image_file is None:
image_filepath = console.ask(
- f"Upload a preview image of your demo app (enter to skip)"
+ "Upload a preview image of your demo app (enter to skip)"
)
if not image_filepath:
break
@@ -973,6 +973,6 @@ def install(
console.set_log_level(loglevel)
if _pip_install_on_demand(package_name=".", install_args=["-e"]):
- console.info(f"Package installed successfully!")
+ console.info("Package installed successfully!")
else:
raise typer.Exit(code=1)
diff --git a/reflex/event.py b/reflex/event.py
index f93bc63d2..624bc1728 100644
--- a/reflex/event.py
+++ b/reflex/event.py
@@ -10,36 +10,44 @@ import urllib.parse
from base64 import b64encode
from functools import partial
from typing import (
+ TYPE_CHECKING,
Any,
Callable,
- ClassVar,
Dict,
Generic,
List,
Optional,
+ Sequence,
Tuple,
Type,
- TypeVar,
Union,
get_type_hints,
overload,
)
-from typing_extensions import ParamSpec, get_args, get_origin
+from typing_extensions import (
+ Concatenate,
+ ParamSpec,
+ Protocol,
+ TypeAliasType,
+ TypedDict,
+ TypeVar,
+ get_args,
+ get_origin,
+)
from reflex import constants
+from reflex.constants.state import FRONTEND_EVENT_STATE
from reflex.utils import console, format
-from reflex.utils.exceptions import EventFnArgMismatch, EventHandlerArgMismatch
-from reflex.utils.types import ArgsSpec, GenericType
+from reflex.utils.exceptions import EventFnArgMismatch, EventHandlerArgTypeMismatch
+from reflex.utils.types import ArgsSpec, GenericType, typehint_issubclass
from reflex.vars import VarData
-from reflex.vars.base import (
- LiteralNoneVar,
- LiteralVar,
- ToOperation,
- Var,
-)
+from reflex.vars.base import LiteralVar, Var
from reflex.vars.function import (
ArgsFunctionOperation,
+ ArgsFunctionOperationBuilder,
+ BuilderFunctionVar,
+ FunctionArgs,
FunctionStringVar,
FunctionVar,
VarOperationCall,
@@ -85,7 +93,7 @@ class Event:
BACKGROUND_TASK_MARKER = "_reflex_background_task"
-def background(fn):
+def background(fn, *, __internal_reflex_call: bool = False):
"""Decorator to mark event handler as running in the background.
Args:
@@ -98,6 +106,13 @@ def background(fn):
Raises:
TypeError: If the function is not a coroutine function or async generator.
"""
+ if not __internal_reflex_call:
+ console.deprecate(
+ "background-decorator",
+ "Use `rx.event(background=True)` instead.",
+ "0.6.5",
+ "0.7.0",
+ )
if not inspect.iscoroutinefunction(fn) and not inspect.isasyncgenfunction(fn):
raise TypeError("Background task must be async function or generator.")
setattr(fn, BACKGROUND_TASK_MARKER, True)
@@ -166,6 +181,18 @@ class EventActionsMixin:
event_actions={"debounce": delay_ms, **self.event_actions},
)
+ @property
+ def temporal(self):
+ """Do not queue the event if the backend is down.
+
+ Returns:
+ New EventHandler-like with temporal set to True.
+ """
+ return dataclasses.replace(
+ self,
+ event_actions={"temporal": True, **self.event_actions},
+ )
+
@dataclasses.dataclass(
init=True,
@@ -392,9 +419,13 @@ class CallableEventSpec(EventSpec):
class EventChain(EventActionsMixin):
"""Container for a chain of events that will be executed in order."""
- events: List[Union[EventSpec, EventVar]] = dataclasses.field(default_factory=list)
+ events: Sequence[Union[EventSpec, EventVar, EventCallback]] = dataclasses.field(
+ default_factory=list
+ )
- args_spec: Optional[Callable] = dataclasses.field(default=None)
+ args_spec: Optional[Union[Callable, Sequence[Callable]]] = dataclasses.field(
+ default=None
+ )
invocation: Optional[Var] = dataclasses.field(default=None)
@@ -427,6 +458,10 @@ class JavasciptKeyboardEvent:
"""Interface for a Javascript KeyboardEvent https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent."""
key: str = ""
+ altKey: bool = False
+ ctrlKey: bool = False
+ metaKey: bool = False
+ shiftKey: bool = False
def input_event(e: Var[JavascriptInputEvent]) -> Tuple[Var[str]]:
@@ -441,7 +476,16 @@ def input_event(e: Var[JavascriptInputEvent]) -> Tuple[Var[str]]:
return (e.target.value,)
-def key_event(e: Var[JavasciptKeyboardEvent]) -> Tuple[Var[str]]:
+class KeyInputInfo(TypedDict):
+ """Information about a key input event."""
+
+ alt_key: bool
+ ctrl_key: bool
+ meta_key: bool
+ shift_key: bool
+
+
+def key_event(e: Var[JavasciptKeyboardEvent]) -> Tuple[Var[str], Var[KeyInputInfo]]:
"""Get the key from a keyboard event.
Args:
@@ -450,10 +494,20 @@ def key_event(e: Var[JavasciptKeyboardEvent]) -> Tuple[Var[str]]:
Returns:
The key from the keyboard event.
"""
- return (e.key,)
+ return (
+ e.key,
+ Var.create(
+ {
+ "alt_key": e.altKey,
+ "ctrl_key": e.ctrlKey,
+ "meta_key": e.metaKey,
+ "shift_key": e.shiftKey,
+ },
+ ),
+ )
-def empty_event() -> Tuple[()]:
+def no_args_event_spec() -> Tuple[()]:
"""Empty event handler.
Returns:
@@ -463,38 +517,75 @@ def empty_event() -> Tuple[()]:
# These chains can be used for their side effects when no other events are desired.
-stop_propagation = EventChain(events=[], args_spec=empty_event).stop_propagation
-prevent_default = EventChain(events=[], args_spec=empty_event).prevent_default
+stop_propagation = EventChain(events=[], args_spec=no_args_event_spec).stop_propagation
+prevent_default = EventChain(events=[], args_spec=no_args_event_spec).prevent_default
T = TypeVar("T")
+U = TypeVar("U")
-def identity_event(event_type: Type[T]) -> Callable[[Var[T]], Tuple[Var[T]]]:
+class IdentityEventReturn(Generic[T], Protocol):
+ """Protocol for an identity event return."""
+
+ def __call__(self, *values: Var[T]) -> Tuple[Var[T], ...]:
+ """Return the input values.
+
+ Args:
+ *values: The values to return.
+
+ Returns:
+ The input values.
+ """
+ return values
+
+
+@overload
+def passthrough_event_spec(
+ event_type: Type[T], /
+) -> Callable[[Var[T]], Tuple[Var[T]]]: ... # type: ignore
+
+
+@overload
+def passthrough_event_spec(
+ event_type_1: Type[T], event_type2: Type[U], /
+) -> Callable[[Var[T], Var[U]], Tuple[Var[T], Var[U]]]: ...
+
+
+@overload
+def passthrough_event_spec(*event_types: Type[T]) -> IdentityEventReturn[T]: ...
+
+
+def passthrough_event_spec(*event_types: Type[T]) -> IdentityEventReturn[T]: # type: ignore
"""A helper function that returns the input event as output.
Args:
- event_type: The type of the event.
+ *event_types: The types of the events.
Returns:
A function that returns the input event as output.
"""
- def inner(ev: Var[T]) -> Tuple[Var[T]]:
- return (ev,)
+ def inner(*values: Var[T]) -> Tuple[Var[T], ...]:
+ return values
+
+ inner_type = tuple(Var[event_type] for event_type in event_types)
+ return_annotation = Tuple[inner_type] # type: ignore
inner.__signature__ = inspect.signature(inner).replace( # type: ignore
parameters=[
inspect.Parameter(
- "ev",
+ f"ev_{i}",
kind=inspect.Parameter.POSITIONAL_OR_KEYWORD,
annotation=Var[event_type],
)
+ for i, event_type in enumerate(event_types)
],
- return_annotation=Tuple[Var[event_type]],
+ return_annotation=return_annotation,
)
- inner.__annotations__["ev"] = Var[event_type]
- inner.__annotations__["return"] = Tuple[Var[event_type]]
+ for i, event_type in enumerate(event_types):
+ inner.__annotations__[f"ev_{i}"] = Var[event_type]
+ inner.__annotations__["return"] = return_annotation
return inner
@@ -612,7 +703,7 @@ def server_side(name: str, sig: inspect.Signature, **kwargs) -> EventSpec:
fn.__qualname__ = name
fn.__signature__ = sig
return EventSpec(
- handler=EventHandler(fn=fn),
+ handler=EventHandler(fn=fn, state_full_name=FRONTEND_EVENT_STATE),
args=tuple(
(
Var(_js_expr=k),
@@ -656,7 +747,16 @@ def console_log(message: str | Var[str]) -> EventSpec:
Returns:
An event to log the message.
"""
- return server_side("_console", get_fn_signature(console_log), message=message)
+ return run_script(Var("console").to(dict).log.to(FunctionVar).call(message))
+
+
+def noop() -> EventSpec:
+ """Do nothing.
+
+ Returns:
+ An event to do nothing.
+ """
+ return run_script(Var.create(None))
def back() -> EventSpec:
@@ -665,7 +765,9 @@ def back() -> EventSpec:
Returns:
An event to go back one page.
"""
- return call_script("window.history.back()")
+ return run_script(
+ Var("window").to(dict).history.to(dict).back.to(FunctionVar).call()
+ )
def window_alert(message: str | Var[str]) -> EventSpec:
@@ -677,7 +779,7 @@ def window_alert(message: str | Var[str]) -> EventSpec:
Returns:
An event to alert the message.
"""
- return server_side("_alert", get_fn_signature(window_alert), message=message)
+ return run_script(Var("window").to(dict).alert.to(FunctionVar).call(message))
def set_focus(ref: str) -> EventSpec:
@@ -696,18 +798,24 @@ def set_focus(ref: str) -> EventSpec:
)
-def scroll_to(elem_id: str) -> EventSpec:
+def scroll_to(elem_id: str, align_to_top: bool | Var[bool] = True) -> EventSpec:
"""Select the id of a html element for scrolling into view.
Args:
- elem_id: the id of the element
+ elem_id: The id of the element to scroll to.
+ align_to_top: Whether to scroll to the top (True) or bottom (False) of the element.
Returns:
An EventSpec to scroll the page to the selected element.
"""
- js_code = f"document.getElementById('{elem_id}').scrollIntoView();"
+ get_element_by_id = FunctionStringVar.create("document.getElementById")
- return call_script(js_code)
+ return run_script(
+ get_element_by_id.call(elem_id)
+ .to(ObjectVar)
+ .scrollIntoView.to(FunctionVar)
+ .call(align_to_top),
+ )
def set_value(ref: str, value: Any) -> EventSpec:
@@ -804,7 +912,7 @@ def remove_session_storage(key: str) -> EventSpec:
)
-def set_clipboard(content: str) -> EventSpec:
+def set_clipboard(content: Union[str, Var[str]]) -> EventSpec:
"""Set the text in content in the clipboard.
Args:
@@ -813,10 +921,12 @@ def set_clipboard(content: str) -> EventSpec:
Returns:
EventSpec: An event to set some content in the clipboard.
"""
- return server_side(
- "_set_clipboard",
- get_fn_signature(set_clipboard),
- content=content,
+ return run_script(
+ Var("navigator")
+ .to(dict)
+ .clipboard.to(dict)
+ .writeText.to(FunctionVar)
+ .call(content)
)
@@ -903,13 +1013,7 @@ def _callback_arg_spec(eval_result):
def call_script(
javascript_code: str | Var[str],
- callback: (
- EventSpec
- | EventHandler
- | Callable
- | List[EventSpec | EventHandler | Callable]
- | None
- ) = None,
+ callback: EventType | None = None,
) -> EventSpec:
"""Create an event handler that executes arbitrary javascript code.
@@ -923,12 +1027,10 @@ def call_script(
callback_kwargs = {}
if callback is not None:
callback_kwargs = {
- "callback": str(
- format.format_queue_events(
- callback,
- args_spec=lambda result: [result],
- ),
- ),
+ "callback": format.format_queue_events(
+ callback,
+ args_spec=lambda result: [result],
+ )._js_expr,
}
if isinstance(javascript_code, str):
# When there is VarData, include it and eval the JS code inline on the client.
@@ -948,6 +1050,62 @@ def call_script(
)
+def call_function(
+ javascript_code: str | Var,
+ callback: EventType | None = None,
+) -> EventSpec:
+ """Create an event handler that executes arbitrary javascript code.
+
+ Args:
+ javascript_code: The code to execute.
+ callback: EventHandler that will receive the result of evaluating the javascript code.
+
+ Returns:
+ EventSpec: An event that will execute the client side javascript.
+ """
+ callback_kwargs = {}
+ if callback is not None:
+ callback_kwargs = {
+ "callback": format.format_queue_events(
+ callback,
+ args_spec=lambda result: [result],
+ ),
+ }
+
+ javascript_code = (
+ Var(javascript_code) if isinstance(javascript_code, str) else javascript_code
+ )
+
+ return server_side(
+ "_call_function",
+ get_fn_signature(call_function),
+ function=javascript_code,
+ **callback_kwargs,
+ )
+
+
+def run_script(
+ javascript_code: str | Var,
+ callback: EventType | None = None,
+) -> EventSpec:
+ """Create an event handler that executes arbitrary javascript code.
+
+ Args:
+ javascript_code: The code to execute.
+ callback: EventHandler that will receive the result of evaluating the javascript code.
+
+ Returns:
+ EventSpec: An event that will execute the client side javascript.
+ """
+ javascript_code = (
+ Var(javascript_code) if isinstance(javascript_code, str) else javascript_code
+ )
+
+ return call_function(
+ ArgsFunctionOperation.create(tuple(), javascript_code), callback
+ )
+
+
def get_event(state, event):
"""Get the event from the given state.
@@ -974,8 +1132,9 @@ def get_hydrate_event(state) -> str:
def call_event_handler(
- event_handler: EventHandler | EventSpec,
- arg_spec: ArgsSpec,
+ event_callback: EventHandler | EventSpec,
+ event_spec: ArgsSpec | Sequence[ArgsSpec],
+ key: Optional[str] = None,
) -> EventSpec:
"""Call an event handler to get the event spec.
@@ -984,33 +1143,135 @@ def call_event_handler(
Otherwise, the event handler will be called with no args.
Args:
- event_handler: The event handler.
- arg_spec: The lambda that define the argument(s) to pass to the event handler.
-
- Raises:
- EventHandlerArgMismatch: if number of arguments expected by event_handler doesn't match the spec.
+ event_callback: The event handler.
+ event_spec: The lambda that define the argument(s) to pass to the event handler.
+ key: The key to pass to the event handler.
Returns:
The event spec from calling the event handler.
+
+ # noqa: DAR401 failure
+
"""
- parsed_args = parse_args_spec(arg_spec) # type: ignore
+ event_spec_args = parse_args_spec(event_spec) # type: ignore
- if isinstance(event_handler, EventSpec):
- # Handle partial application of EventSpec args
- return event_handler.add_args(*parsed_args)
-
- args = inspect.getfullargspec(event_handler.fn).args
- n_args = len(args) - 1 # subtract 1 for bound self arg
- if n_args == len(parsed_args):
- return event_handler(*parsed_args) # type: ignore
- else:
- raise EventHandlerArgMismatch(
- "The number of arguments accepted by "
- f"{event_handler.fn.__qualname__} ({n_args}) "
- "does not match the arguments passed by the event trigger: "
- f"{[str(v) for v in parsed_args]}\n"
- "See https://reflex.dev/docs/events/event-arguments/"
+ if isinstance(event_callback, EventSpec):
+ check_fn_match_arg_spec(
+ event_callback.handler.fn,
+ event_spec,
+ key,
+ bool(event_callback.handler.state_full_name) + len(event_callback.args),
+ event_callback.handler.fn.__qualname__,
)
+ # Handle partial application of EventSpec args
+ return event_callback.add_args(*event_spec_args)
+
+ check_fn_match_arg_spec(
+ event_callback.fn,
+ event_spec,
+ key,
+ bool(event_callback.state_full_name),
+ event_callback.fn.__qualname__,
+ )
+
+ all_acceptable_specs = (
+ [event_spec] if not isinstance(event_spec, Sequence) else event_spec
+ )
+
+ event_spec_return_types = list(
+ filter(
+ lambda event_spec_return_type: event_spec_return_type is not None
+ and get_origin(event_spec_return_type) is tuple,
+ (
+ get_type_hints(arg_spec).get("return", None)
+ for arg_spec in all_acceptable_specs
+ ),
+ )
+ )
+
+ if event_spec_return_types:
+ failures = []
+
+ event_callback_spec = inspect.getfullargspec(event_callback.fn)
+
+ for event_spec_index, event_spec_return_type in enumerate(
+ event_spec_return_types
+ ):
+ args = get_args(event_spec_return_type)
+
+ args_types_without_vars = [
+ arg if get_origin(arg) is not Var else get_args(arg)[0] for arg in args
+ ]
+
+ try:
+ type_hints_of_provided_callback = get_type_hints(event_callback.fn)
+ except NameError:
+ type_hints_of_provided_callback = {}
+
+ failed_type_check = False
+
+ # check that args of event handler are matching the spec if type hints are provided
+ for i, arg in enumerate(event_callback_spec.args[1:]):
+ if arg not in type_hints_of_provided_callback:
+ continue
+
+ try:
+ compare_result = typehint_issubclass(
+ args_types_without_vars[i], type_hints_of_provided_callback[arg]
+ )
+ except TypeError:
+ # TODO: In 0.7.0, remove this block and raise the exception
+ # raise TypeError(
+ # f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_handler.fn.__qualname__} provided for {key}."
+ # ) from e
+ console.warn(
+ f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_callback.fn.__qualname__} provided for {key}."
+ )
+ compare_result = False
+
+ if compare_result:
+ continue
+ else:
+ failure = EventHandlerArgTypeMismatch(
+ f"Event handler {key} expects {args_types_without_vars[i]} for argument {arg} but got {type_hints_of_provided_callback[arg]} as annotated in {event_callback.fn.__qualname__} instead."
+ )
+ failures.append(failure)
+ failed_type_check = True
+ break
+
+ if not failed_type_check:
+ if event_spec_index:
+ args = get_args(event_spec_return_types[0])
+
+ args_types_without_vars = [
+ arg if get_origin(arg) is not Var else get_args(arg)[0]
+ for arg in args
+ ]
+
+ expect_string = ", ".join(
+ repr(arg) for arg in args_types_without_vars
+ ).replace("[", "\\[")
+
+ given_string = ", ".join(
+ repr(type_hints_of_provided_callback.get(arg, Any))
+ for arg in event_callback_spec.args[1:]
+ ).replace("[", "\\[")
+
+ console.warn(
+ f"Event handler {key} expects ({expect_string}) -> () but got ({given_string}) -> () as annotated in {event_callback.fn.__qualname__} instead. "
+ f"This may lead to unexpected behavior but is intentionally ignored for {key}."
+ )
+ return event_callback(*event_spec_args)
+
+ if failures:
+ console.deprecate(
+ "Mismatched event handler argument types",
+ "\n".join([str(f) for f in failures]),
+ "0.6.5",
+ "0.7.0",
+ )
+
+ return event_callback(*event_spec_args) # type: ignore
def unwrap_var_annotation(annotation: GenericType):
@@ -1050,7 +1311,7 @@ def resolve_annotation(annotations: dict[str, Any], arg_name: str):
return annotation
-def parse_args_spec(arg_spec: ArgsSpec):
+def parse_args_spec(arg_spec: ArgsSpec | Sequence[ArgsSpec]):
"""Parse the args provided in the ArgsSpec of an event trigger.
Args:
@@ -1059,6 +1320,8 @@ def parse_args_spec(arg_spec: ArgsSpec):
Returns:
The parsed args.
"""
+ # if there's multiple, the first is the default
+ arg_spec = arg_spec[0] if isinstance(arg_spec, Sequence) else arg_spec
spec = inspect.getfullargspec(arg_spec)
annotations = get_type_hints(arg_spec)
@@ -1074,39 +1337,53 @@ def parse_args_spec(arg_spec: ArgsSpec):
)
-def check_fn_match_arg_spec(fn: Callable, arg_spec: ArgsSpec) -> List[Var]:
+def check_fn_match_arg_spec(
+ user_func: Callable,
+ arg_spec: ArgsSpec | Sequence[ArgsSpec],
+ key: str | None = None,
+ number_of_bound_args: int = 0,
+ func_name: str | None = None,
+):
"""Ensures that the function signature matches the passed argument specification
or raises an EventFnArgMismatch if they do not.
Args:
- fn: The function to be validated.
+ user_func: The function to be validated.
arg_spec: The argument specification for the event trigger.
-
- Returns:
- The parsed arguments from the argument specification.
+ key: The key of the event trigger.
+ number_of_bound_args: The number of bound arguments to the function.
+ func_name: The name of the function to be validated.
Raises:
EventFnArgMismatch: Raised if the number of mandatory arguments do not match
"""
- fn_args = inspect.getfullargspec(fn).args
- fn_defaults_args = inspect.getfullargspec(fn).defaults
- n_fn_args = len(fn_args)
- n_fn_defaults_args = len(fn_defaults_args) if fn_defaults_args else 0
- if isinstance(fn, types.MethodType):
- n_fn_args -= 1 # subtract 1 for bound self arg
- parsed_args = parse_args_spec(arg_spec)
- if not (n_fn_args - n_fn_defaults_args <= len(parsed_args) <= n_fn_args):
+ user_args = inspect.getfullargspec(user_func).args
+ # Drop the first argument if it's a bound method
+ if inspect.ismethod(user_func) and user_func.__self__ is not None:
+ user_args = user_args[1:]
+
+ user_default_args = inspect.getfullargspec(user_func).defaults
+ number_of_user_args = len(user_args) - number_of_bound_args
+ number_of_user_default_args = len(user_default_args) if user_default_args else 0
+
+ parsed_event_args = parse_args_spec(arg_spec)
+
+ number_of_event_args = len(parsed_event_args)
+
+ if number_of_user_args - number_of_user_default_args > number_of_event_args:
raise EventFnArgMismatch(
- "The number of mandatory arguments accepted by "
- f"{fn} ({n_fn_args - n_fn_defaults_args}) "
- "does not match the arguments passed by the event trigger: "
- f"{[str(v) for v in parsed_args]}\n"
+ f"Event {key} only provides {number_of_event_args} arguments, but "
+ f"{func_name or user_func} requires at least {number_of_user_args - number_of_user_default_args} "
+ "arguments to be passed to the event handler.\n"
"See https://reflex.dev/docs/events/event-arguments/"
)
- return parsed_args
-def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var:
+def call_event_fn(
+ fn: Callable,
+ arg_spec: ArgsSpec | Sequence[ArgsSpec],
+ key: Optional[str] = None,
+) -> list[EventSpec] | Var:
"""Call a function to a list of event specs.
The function should return a single EventSpec, a list of EventSpecs, or a
@@ -1115,6 +1392,7 @@ def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var:
Args:
fn: The function to call.
arg_spec: The argument spec for the event trigger.
+ key: The key to pass to the event handler.
Returns:
The event specs from calling the function or a Var.
@@ -1127,10 +1405,14 @@ def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var:
from reflex.utils.exceptions import EventHandlerValueError
# Check that fn signature matches arg_spec
- parsed_args = check_fn_match_arg_spec(fn, arg_spec)
+ check_fn_match_arg_spec(fn, arg_spec, key=key)
+
+ parsed_args = parse_args_spec(arg_spec)
+
+ number_of_fn_args = len(inspect.getfullargspec(fn).args)
# Call the function with the parsed args.
- out = fn(*parsed_args)
+ out = fn(*[*parsed_args][:number_of_fn_args])
# If the function returns a Var, assume it's an EventChain and render it directly.
if isinstance(out, Var):
@@ -1145,7 +1427,7 @@ def call_event_fn(fn: Callable, arg_spec: ArgsSpec) -> list[EventSpec] | Var:
for e in out:
if isinstance(e, EventHandler):
# An un-called EventHandler gets all of the args of the event trigger.
- e = call_event_handler(e, arg_spec)
+ e = call_event_handler(e, arg_spec, key=key)
# Make sure the event spec is valid.
if not isinstance(e, EventSpec):
@@ -1249,12 +1531,12 @@ def get_fn_signature(fn: Callable) -> inspect.Signature:
"""
signature = inspect.signature(fn)
new_param = inspect.Parameter(
- "state", inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=Any
+ FRONTEND_EVENT_STATE, inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=Any
)
return signature.replace(parameters=(new_param, *signature.parameters.values()))
-class EventVar(ObjectVar):
+class EventVar(ObjectVar, python_types=EventSpec):
"""Base class for event vars."""
@@ -1315,7 +1597,7 @@ class LiteralEventVar(VarOperationCall, LiteralVar, EventVar):
)
-class EventChainVar(FunctionVar):
+class EventChainVar(BuilderFunctionVar, python_types=EventChain):
"""Base class for event chain vars."""
@@ -1327,7 +1609,7 @@ class EventChainVar(FunctionVar):
# Note: LiteralVar is second in the inheritance list allowing it act like a
# CachedVarOperation (ArgsFunctionOperation) and get the _js_expr from the
# _cached_var_name property.
-class LiteralEventChainVar(ArgsFunctionOperation, LiteralVar, EventChainVar):
+class LiteralEventChainVar(ArgsFunctionOperationBuilder, LiteralVar, EventChainVar):
"""A literal event chain var."""
_var_value: EventChain = dataclasses.field(default=None) # type: ignore
@@ -1355,7 +1637,12 @@ class LiteralEventChainVar(ArgsFunctionOperation, LiteralVar, EventChainVar):
Returns:
The created LiteralEventChainVar instance.
"""
- sig = inspect.signature(value.args_spec) # type: ignore
+ arg_spec = (
+ value.args_spec[0]
+ if isinstance(value.args_spec, Sequence)
+ else value.args_spec
+ )
+ sig = inspect.signature(arg_spec) # type: ignore
if sig.parameters:
arg_def = tuple((f"_{p}" for p in sig.parameters))
arg_def_expr = LiteralVar.create([Var(_js_expr=arg) for arg in arg_def])
@@ -1374,7 +1661,7 @@ class LiteralEventChainVar(ArgsFunctionOperation, LiteralVar, EventChainVar):
_js_expr="",
_var_type=EventChain,
_var_data=_var_data,
- _args_names=arg_def,
+ _args=FunctionArgs(arg_def),
_return_expr=invocation.call(
LiteralVar.create([LiteralVar.create(event) for event in value.events]),
arg_def_expr,
@@ -1384,39 +1671,8 @@ class LiteralEventChainVar(ArgsFunctionOperation, LiteralVar, EventChainVar):
)
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToEventVarOperation(ToOperation, EventVar):
- """Result of a cast to an event var."""
-
- _original: Var = dataclasses.field(default_factory=lambda: LiteralNoneVar.create())
-
- _default_var_type: ClassVar[Type] = EventSpec
-
-
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToEventChainVarOperation(ToOperation, EventChainVar):
- """Result of a cast to an event chain var."""
-
- _original: Var = dataclasses.field(default_factory=lambda: LiteralNoneVar.create())
-
- _default_var_type: ClassVar[Type] = EventChain
-
-
-G = ParamSpec("G")
-
-IndividualEventType = Union[EventSpec, EventHandler, Callable[G, Any], Var]
-
-EventType = Union[IndividualEventType[G], List[IndividualEventType[G]]]
-
P = ParamSpec("P")
+Q = ParamSpec("Q")
T = TypeVar("T")
V = TypeVar("V")
V2 = TypeVar("V2")
@@ -1424,105 +1680,134 @@ V3 = TypeVar("V3")
V4 = TypeVar("V4")
V5 = TypeVar("V5")
-if sys.version_info >= (3, 10):
- from typing import Concatenate
+background_event_decorator = background
- class EventCallback(Generic[P, T]):
- """A descriptor that wraps a function to be used as an event."""
- def __init__(self, func: Callable[Concatenate[Any, P], T]):
- """Initialize the descriptor with the function to be wrapped.
+class EventCallback(Generic[P, T]):
+ """A descriptor that wraps a function to be used as an event."""
- Args:
- func: The function to be wrapped.
- """
- self.func = func
-
- @overload
- def __get__(
- self: EventCallback[[V], T], instance: None, owner
- ) -> Callable[[Union[Var[V], V]], EventSpec]: ...
-
- @overload
- def __get__(
- self: EventCallback[[V, V2], T], instance: None, owner
- ) -> Callable[[Union[Var[V], V], Union[Var[V2], V2]], EventSpec]: ...
-
- @overload
- def __get__(
- self: EventCallback[[V, V2, V3], T], instance: None, owner
- ) -> Callable[
- [Union[Var[V], V], Union[Var[V2], V2], Union[Var[V3], V3]],
- EventSpec,
- ]: ...
-
- @overload
- def __get__(
- self: EventCallback[[V, V2, V3, V4], T], instance: None, owner
- ) -> Callable[
- [
- Union[Var[V], V],
- Union[Var[V2], V2],
- Union[Var[V3], V3],
- Union[Var[V4], V4],
- ],
- EventSpec,
- ]: ...
-
- @overload
- def __get__(
- self: EventCallback[[V, V2, V3, V4, V5], T], instance: None, owner
- ) -> Callable[
- [
- Union[Var[V], V],
- Union[Var[V2], V2],
- Union[Var[V3], V3],
- Union[Var[V4], V4],
- Union[Var[V5], V5],
- ],
- EventSpec,
- ]: ...
-
- @overload
- def __get__(self, instance, owner) -> Callable[P, T]: ...
-
- def __get__(self, instance, owner) -> Callable:
- """Get the function with the instance bound to it.
-
- Args:
- instance: The instance to bind to the function.
- owner: The owner of the function.
-
- Returns:
- The function with the instance bound to it
- """
- if instance is None:
- return self.func # type: ignore
-
- return partial(self.func, instance) # type: ignore
-
- def event_handler(func: Callable[Concatenate[Any, P], T]) -> EventCallback[P, T]:
- """Wrap a function to be used as an event.
+ def __init__(self, func: Callable[Concatenate[Any, P], T]):
+ """Initialize the descriptor with the function to be wrapped.
Args:
- func: The function to wrap.
+ func: The function to be wrapped.
+ """
+ self.func = func
+
+ @property
+ def prevent_default(self):
+ """Prevent default behavior.
Returns:
- The wrapped function.
+ The event callback with prevent default behavior.
"""
- return func # type: ignore
+ return self
+
+ @property
+ def stop_propagation(self):
+ """Stop event propagation.
+
+ Returns:
+ The event callback with stop propagation behavior.
+ """
+ return self
+
+ @overload
+ def __call__(
+ self: EventCallback[Q, T],
+ ) -> EventCallback[Q, T]: ...
+
+ @overload
+ def __call__(
+ self: EventCallback[Concatenate[V, Q], T], value: V | Var[V]
+ ) -> EventCallback[Q, T]: ...
+
+ @overload
+ def __call__(
+ self: EventCallback[Concatenate[V, V2, Q], T],
+ value: V | Var[V],
+ value2: V2 | Var[V2],
+ ) -> EventCallback[Q, T]: ...
+
+ @overload
+ def __call__(
+ self: EventCallback[Concatenate[V, V2, V3, Q], T],
+ value: V | Var[V],
+ value2: V2 | Var[V2],
+ value3: V3 | Var[V3],
+ ) -> EventCallback[Q, T]: ...
+
+ @overload
+ def __call__(
+ self: EventCallback[Concatenate[V, V2, V3, V4, Q], T],
+ value: V | Var[V],
+ value2: V2 | Var[V2],
+ value3: V3 | Var[V3],
+ value4: V4 | Var[V4],
+ ) -> EventCallback[Q, T]: ...
+
+ def __call__(self, *values) -> EventCallback: # type: ignore
+ """Call the function with the values.
+
+ Args:
+ *values: The values to call the function with.
+
+ Returns:
+ The function with the values.
+ """
+ return self.func(*values) # type: ignore
+
+ @overload
+ def __get__(
+ self: EventCallback[P, T], instance: None, owner
+ ) -> EventCallback[P, T]: ...
+
+ @overload
+ def __get__(self, instance, owner) -> Callable[P, T]: ...
+
+ def __get__(self, instance, owner) -> Callable: # type: ignore
+ """Get the function with the instance bound to it.
+
+ Args:
+ instance: The instance to bind to the function.
+ owner: The owner of the function.
+
+ Returns:
+ The function with the instance bound to it
+ """
+ if instance is None:
+ return self.func # type: ignore
+
+ return partial(self.func, instance) # type: ignore
+
+
+G = ParamSpec("G")
+
+if TYPE_CHECKING:
+ from reflex.state import BaseState
+
+ BASE_STATE = TypeVar("BASE_STATE", bound=BaseState)
else:
+ BASE_STATE = TypeVar("BASE_STATE")
- def event_handler(func: Callable[P, T]) -> Callable[P, T]:
- """Wrap a function to be used as an event.
+StateCallable = TypeAliasType(
+ "StateCallable",
+ Callable[Concatenate[BASE_STATE, G], Any],
+ type_params=(G, BASE_STATE),
+)
- Args:
- func: The function to wrap.
+IndividualEventType = Union[
+ EventSpec,
+ EventHandler,
+ Callable[G, Any],
+ StateCallable[G, BASE_STATE],
+ EventCallback[G, Any],
+ Var[Any],
+]
- Returns:
- The wrapped function.
- """
- return func
+ItemOrList = Union[V, List[V]]
+
+EventType = ItemOrList[IndividualEventType[G, BASE_STATE]]
class EventNamespace(types.SimpleNamespace):
@@ -1537,11 +1822,53 @@ class EventNamespace(types.SimpleNamespace):
LiteralEventVar = LiteralEventVar
EventChainVar = EventChainVar
LiteralEventChainVar = LiteralEventChainVar
- ToEventVarOperation = ToEventVarOperation
- ToEventChainVarOperation = ToEventChainVarOperation
EventType = EventType
+ EventCallback = EventCallback
+
+ @overload
+ @staticmethod
+ def __call__(
+ func: None = None, *, background: bool | None = None
+ ) -> Callable[[Callable[Concatenate[BASE_STATE, P], T]], EventCallback[P, T]]: ...
+
+ @overload
+ @staticmethod
+ def __call__(
+ func: Callable[Concatenate[BASE_STATE, P], T],
+ *,
+ background: bool | None = None,
+ ) -> EventCallback[P, T]: ...
+
+ @staticmethod
+ def __call__(
+ func: Callable[Concatenate[BASE_STATE, P], T] | None = None,
+ *,
+ background: bool | None = None,
+ ) -> Union[
+ EventCallback[P, T],
+ Callable[[Callable[Concatenate[BASE_STATE, P], T]], EventCallback[P, T]],
+ ]:
+ """Wrap a function to be used as an event.
+
+ Args:
+ func: The function to wrap.
+ background: Whether the event should be run in the background. Defaults to False.
+
+ Returns:
+ The wrapped function.
+ """
+
+ def wrapper(
+ func: Callable[Concatenate[BASE_STATE, P], T],
+ ) -> EventCallback[P, T]:
+ if background is True:
+ return background_event_decorator(func, __internal_reflex_call=True) # type: ignore
+ return func # type: ignore
+
+ if func is not None:
+ return wrapper(func)
+ return wrapper
- __call__ = staticmethod(event_handler)
get_event = staticmethod(get_event)
get_hydrate_event = staticmethod(get_hydrate_event)
fix_events = staticmethod(fix_events)
@@ -1551,13 +1878,14 @@ class EventNamespace(types.SimpleNamespace):
check_fn_match_arg_spec = staticmethod(check_fn_match_arg_spec)
resolve_annotation = staticmethod(resolve_annotation)
parse_args_spec = staticmethod(parse_args_spec)
- identity_event = staticmethod(identity_event)
+ passthrough_event_spec = staticmethod(passthrough_event_spec)
input_event = staticmethod(input_event)
key_event = staticmethod(key_event)
- empty_event = staticmethod(empty_event)
+ no_args_event_spec = staticmethod(no_args_event_spec)
server_side = staticmethod(server_side)
redirect = staticmethod(redirect)
console_log = staticmethod(console_log)
+ noop = staticmethod(noop)
back = staticmethod(back)
window_alert = staticmethod(window_alert)
set_focus = staticmethod(set_focus)
@@ -1571,6 +1899,8 @@ class EventNamespace(types.SimpleNamespace):
set_clipboard = staticmethod(set_clipboard)
download = staticmethod(download)
call_script = staticmethod(call_script)
+ call_function = staticmethod(call_function)
+ run_script = staticmethod(run_script)
event = EventNamespace()
diff --git a/reflex/experimental/__init__.py b/reflex/experimental/__init__.py
index 0c11deb85..164790fe5 100644
--- a/reflex/experimental/__init__.py
+++ b/reflex/experimental/__init__.py
@@ -2,6 +2,7 @@
from types import SimpleNamespace
+from reflex.components.datadisplay.shiki_code_block import code_block as code_block
from reflex.components.props import PropsBase
from reflex.components.radix.themes.components.progress import progress as progress
from reflex.components.sonner.toast import toast as toast
@@ -67,4 +68,5 @@ _x = ExperimentalNamespace(
layout=layout,
PropsBase=PropsBase,
run_in_thread=run_in_thread,
+ code_block=code_block,
)
diff --git a/reflex/experimental/assets.py b/reflex/experimental/assets.py
index dcf386d8d..e9be19aaf 100644
--- a/reflex/experimental/assets.py
+++ b/reflex/experimental/assets.py
@@ -1,14 +1,15 @@
"""Helper functions for adding assets to the app."""
-import inspect
-from pathlib import Path
from typing import Optional
-from reflex import constants
+from reflex import assets
+from reflex.utils import console
def asset(relative_filename: str, subfolder: Optional[str] = None) -> str:
- """Add an asset to the app.
+ """DEPRECATED: use `rx.asset` with `shared=True` instead.
+
+ Add an asset to the app.
Place the file next to your including python file.
Copies the file to the app's external assets directory.
@@ -22,38 +23,15 @@ def asset(relative_filename: str, subfolder: Optional[str] = None) -> str:
relative_filename: The relative filename of the asset.
subfolder: The directory to place the asset in.
- Raises:
- FileNotFoundError: If the file does not exist.
- ValueError: If the module is None.
-
Returns:
The relative URL to the copied asset.
"""
- # Determine the file by which the asset is exposed.
- calling_file = inspect.stack()[1].filename
- module = inspect.getmodule(inspect.stack()[1][0])
- if module is None:
- raise ValueError("Module is None")
- caller_module_path = module.__name__.replace(".", "/")
-
- subfolder = f"{caller_module_path}/{subfolder}" if subfolder else caller_module_path
-
- src_file = Path(calling_file).parent / relative_filename
-
- assets = constants.Dirs.APP_ASSETS
- external = constants.Dirs.EXTERNAL_APP_ASSETS
-
- if not src_file.exists():
- raise FileNotFoundError(f"File not found: {src_file}")
-
- # Create the asset folder in the currently compiling app.
- asset_folder = Path.cwd() / assets / external / subfolder
- asset_folder.mkdir(parents=True, exist_ok=True)
-
- dst_file = asset_folder / relative_filename
-
- if not dst_file.exists():
- dst_file.symlink_to(src_file)
-
- asset_url = f"/{external}/{subfolder}/{relative_filename}"
- return asset_url
+ console.deprecate(
+ feature_name="rx._x.asset",
+ reason="Use `rx.asset` with `shared=True` instead of `rx._x.asset`.",
+ deprecation_version="0.6.6",
+ removal_version="0.7.0",
+ )
+ return assets.asset(
+ relative_filename, shared=True, subfolder=subfolder, _stack_level=2
+ )
diff --git a/reflex/experimental/client_state.py b/reflex/experimental/client_state.py
index c7b2260a1..a1abce3ea 100644
--- a/reflex/experimental/client_state.py
+++ b/reflex/experimental/client_state.py
@@ -8,12 +8,9 @@ import sys
from typing import Any, Callable, Union
from reflex import constants
-from reflex.event import EventChain, EventHandler, EventSpec, call_script
+from reflex.event import EventChain, EventHandler, EventSpec, run_script
from reflex.utils.imports import ImportVar
-from reflex.vars import (
- VarData,
- get_unique_variable_name,
-)
+from reflex.vars import VarData, get_unique_variable_name
from reflex.vars.base import LiteralVar, Var
from reflex.vars.function import FunctionVar
@@ -21,7 +18,7 @@ NoValue = object()
_refs_import = {
- f"/{constants.Dirs.STATE_PATH}": [ImportVar(tag="refs")],
+ f"$/{constants.Dirs.STATE_PATH}": [ImportVar(tag="refs")],
}
@@ -178,9 +175,12 @@ class ClientStateVar(Var):
if self._global_ref
else self._setter_name
)
+ _var_data = VarData(imports=_refs_import if self._global_ref else {})
if value is not NoValue:
# This is a hack to make it work like an EventSpec taking an arg
- value_str = str(LiteralVar.create(value))
+ value_var = LiteralVar.create(value)
+ _var_data = VarData.merge(_var_data, value_var._get_all_var_data())
+ value_str = str(value_var)
if value_str.startswith("_"):
# remove patterns of ["*"] from the value_str using regex
@@ -190,7 +190,7 @@ class ClientStateVar(Var):
setter = f"(() => {setter}({value_str}))"
return Var(
_js_expr=setter,
- _var_data=VarData(imports=_refs_import if self._global_ref else {}),
+ _var_data=_var_data,
).to(FunctionVar, EventChain)
@property
@@ -224,7 +224,7 @@ class ClientStateVar(Var):
"""
if not self._global_ref:
raise ValueError("ClientStateVar must be global to retrieve the value.")
- return call_script(_client_state_ref(self._getter_name), callback=callback)
+ return run_script(_client_state_ref(self._getter_name), callback=callback)
def push(self, value: Any) -> EventSpec:
"""Push a value to the client state variable from the backend.
@@ -242,4 +242,4 @@ class ClientStateVar(Var):
"""
if not self._global_ref:
raise ValueError("ClientStateVar must be global to push the value.")
- return call_script(f"{_client_state_ref(self._setter_name)}({value})")
+ return run_script(f"{_client_state_ref(self._setter_name)}({value})")
diff --git a/reflex/experimental/layout.py b/reflex/experimental/layout.py
index a3b76581a..d203ce714 100644
--- a/reflex/experimental/layout.py
+++ b/reflex/experimental/layout.py
@@ -12,7 +12,7 @@ from reflex.components.radix.themes.components.icon_button import IconButton
from reflex.components.radix.themes.layout.box import Box
from reflex.components.radix.themes.layout.container import Container
from reflex.components.radix.themes.layout.stack import HStack
-from reflex.event import call_script
+from reflex.event import run_script
from reflex.experimental import hooks
from reflex.state import ComponentState
from reflex.style import Style
@@ -173,7 +173,7 @@ class SidebarTrigger(Fragment):
else:
open, toggle = (
Var(_js_expr="open"),
- call_script(Var(_js_expr="setOpen(!open)")),
+ run_script("setOpen(!open)"),
)
trigger_props["left"] = cond(open, f"calc({sidebar_width} - 32px)", "0")
diff --git a/reflex/experimental/layout.pyi b/reflex/experimental/layout.pyi
index e4c82b351..4c7fc8d47 100644
--- a/reflex/experimental/layout.pyi
+++ b/reflex/experimental/layout.pyi
@@ -10,7 +10,7 @@ from reflex.components.base.fragment import Fragment
from reflex.components.component import Component, ComponentNamespace, MemoizationLeaf
from reflex.components.radix.primitives.drawer import DrawerRoot
from reflex.components.radix.themes.layout.box import Box
-from reflex.event import EventType
+from reflex.event import BASE_STATE, EventType
from reflex.state import ComponentState
from reflex.style import Style
from reflex.vars.base import Var
@@ -50,22 +50,22 @@ class Sidebar(Box, MemoizationLeaf):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Sidebar":
"""Create the sidebar component.
@@ -95,12 +95,8 @@ class DrawerSidebar(DrawerRoot):
def create( # type: ignore
cls,
*children,
+ default_open: Optional[Union[Var[bool], bool]] = None,
open: Optional[Union[Var[bool], bool]] = None,
- should_scale_background: Optional[Union[Var[bool], bool]] = None,
- close_threshold: Optional[Union[Var[float], float]] = None,
- snap_points: Optional[List[Union[float, str]]] = None,
- fade_from_index: Optional[Union[Var[int], int]] = None,
- scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
modal: Optional[Union[Var[bool], bool]] = None,
direction: Optional[
Union[
@@ -108,30 +104,42 @@ class DrawerSidebar(DrawerRoot):
Var[Literal["bottom", "left", "right", "top"]],
]
] = None,
+ dismissible: Optional[Union[Var[bool], bool]] = None,
+ handle_only: Optional[Union[Var[bool], bool]] = None,
+ snap_points: Optional[List[Union[float, str]]] = None,
+ fade_from_index: Optional[Union[Var[int], int]] = None,
+ scroll_lock_timeout: Optional[Union[Var[int], int]] = None,
preventScrollRestoration: Optional[Union[Var[bool], bool]] = None,
+ should_scale_background: Optional[Union[Var[bool], bool]] = None,
+ close_threshold: Optional[Union[Var[float], float]] = None,
as_child: 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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_open_change: Optional[EventType] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_animation_end: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_open_change: Optional[
+ Union[EventType[[], BASE_STATE], EventType[[bool], BASE_STATE]]
+ ] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "DrawerSidebar":
"""Create the sidebar component.
@@ -164,22 +172,22 @@ class SidebarTrigger(Fragment):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "SidebarTrigger":
"""Create the sidebar trigger component.
@@ -229,22 +237,22 @@ class Layout(Box):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Layout":
"""Create the layout component.
@@ -297,22 +305,22 @@ class LayoutNamespace(ComponentNamespace):
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[EventType[[]]] = None,
- on_click: Optional[EventType[[]]] = None,
- on_context_menu: Optional[EventType[[]]] = None,
- on_double_click: Optional[EventType[[]]] = None,
- on_focus: Optional[EventType[[]]] = None,
- on_mount: Optional[EventType[[]]] = None,
- on_mouse_down: Optional[EventType[[]]] = None,
- on_mouse_enter: Optional[EventType[[]]] = None,
- on_mouse_leave: Optional[EventType[[]]] = None,
- on_mouse_move: Optional[EventType[[]]] = None,
- on_mouse_out: Optional[EventType[[]]] = None,
- on_mouse_over: Optional[EventType[[]]] = None,
- on_mouse_up: Optional[EventType[[]]] = None,
- on_scroll: Optional[EventType[[]]] = None,
- on_unmount: Optional[EventType[[]]] = None,
+ custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
+ on_blur: Optional[EventType[[], BASE_STATE]] = None,
+ on_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
+ on_double_click: Optional[EventType[[], BASE_STATE]] = None,
+ on_focus: Optional[EventType[[], BASE_STATE]] = None,
+ on_mount: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
+ on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
+ on_scroll: Optional[EventType[[], BASE_STATE]] = None,
+ on_unmount: Optional[EventType[[], BASE_STATE]] = None,
**props,
) -> "Layout":
"""Create the layout component.
diff --git a/reflex/experimental/misc.py b/reflex/experimental/misc.py
index e3d237153..a2a5a0615 100644
--- a/reflex/experimental/misc.py
+++ b/reflex/experimental/misc.py
@@ -7,7 +7,7 @@ from typing import Any
async def run_in_thread(func) -> Any:
"""Run a function in a separate thread.
- To not block the UI event queue, run_in_thread must be inside inside a rx.background() decorated method.
+ To not block the UI event queue, run_in_thread must be inside inside a rx.event(background=True) decorated method.
Args:
func (callable): The non-async function to run.
diff --git a/reflex/istate/__init__.py b/reflex/istate/__init__.py
new file mode 100644
index 000000000..d71d038f8
--- /dev/null
+++ b/reflex/istate/__init__.py
@@ -0,0 +1 @@
+"""This module will provide interfaces for the state."""
diff --git a/reflex/istate/proxy.py b/reflex/istate/proxy.py
new file mode 100644
index 000000000..8d6051cf2
--- /dev/null
+++ b/reflex/istate/proxy.py
@@ -0,0 +1,33 @@
+"""A module to hold state proxy classes."""
+
+from typing import Any
+
+from reflex.state import StateProxy
+
+
+class ReadOnlyStateProxy(StateProxy):
+ """A read-only proxy for a state."""
+
+ def __setattr__(self, name: str, value: Any) -> None:
+ """Prevent setting attributes on the state for read-only proxy.
+
+ Args:
+ name: The attribute name.
+ value: The attribute value.
+
+ Raises:
+ NotImplementedError: Always raised when trying to set an attribute on proxied state.
+ """
+ if name.startswith("_self_"):
+ # Special case attributes of the proxy itself, not applied to the wrapped object.
+ super().__setattr__(name, value)
+ return
+ raise NotImplementedError("This is a read-only state proxy.")
+
+ def mark_dirty(self):
+ """Mark the state as dirty.
+
+ Raises:
+ NotImplementedError: Always raised when trying to mark the proxied state as dirty.
+ """
+ raise NotImplementedError("This is a read-only state proxy.")
diff --git a/reflex/istate/storage.py b/reflex/istate/storage.py
new file mode 100644
index 000000000..85e21ffa7
--- /dev/null
+++ b/reflex/istate/storage.py
@@ -0,0 +1,144 @@
+"""Client-side storage classes for reflex state variables."""
+
+from __future__ import annotations
+
+from typing import Any
+
+from reflex.utils import format
+
+
+class ClientStorageBase:
+ """Base class for client-side storage."""
+
+ def options(self) -> dict[str, Any]:
+ """Get the options for the storage.
+
+ Returns:
+ All set options for the storage (not None).
+ """
+ return {
+ format.to_camel_case(k): v for k, v in vars(self).items() if v is not None
+ }
+
+
+class Cookie(ClientStorageBase, str):
+ """Represents a state Var that is stored as a cookie in the browser."""
+
+ name: str | None
+ path: str
+ max_age: int | None
+ domain: str | None
+ secure: bool | None
+ same_site: str
+
+ def __new__(
+ cls,
+ object: Any = "",
+ encoding: str | None = None,
+ errors: str | None = None,
+ /,
+ name: str | None = None,
+ path: str = "/",
+ max_age: int | None = None,
+ domain: str | None = None,
+ secure: bool | None = None,
+ same_site: str = "lax",
+ ):
+ """Create a client-side Cookie (str).
+
+ Args:
+ object: The initial object.
+ encoding: The encoding to use.
+ errors: The error handling scheme to use.
+ name: The name of the cookie on the client side.
+ path: Cookie path. Use / as the path if the cookie should be accessible on all pages.
+ max_age: Relative max age of the cookie in seconds from when the client receives it.
+ domain: Domain for the cookie (sub.domain.com or .allsubdomains.com).
+ secure: Is the cookie only accessible through HTTPS?
+ same_site: Whether the cookie is sent with third party requests.
+ One of (true|false|none|lax|strict)
+
+ Returns:
+ The client-side Cookie object.
+
+ Note: expires (absolute Date) is not supported at this time.
+ """
+ if encoding or errors:
+ inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict")
+ else:
+ inst = super().__new__(cls, object)
+ inst.name = name
+ inst.path = path
+ inst.max_age = max_age
+ inst.domain = domain
+ inst.secure = secure
+ inst.same_site = same_site
+ return inst
+
+
+class LocalStorage(ClientStorageBase, str):
+ """Represents a state Var that is stored in localStorage in the browser."""
+
+ name: str | None
+ sync: bool = False
+
+ def __new__(
+ cls,
+ object: Any = "",
+ encoding: str | None = None,
+ errors: str | None = None,
+ /,
+ name: str | None = None,
+ sync: bool = False,
+ ) -> "LocalStorage":
+ """Create a client-side localStorage (str).
+
+ Args:
+ object: The initial object.
+ encoding: The encoding to use.
+ errors: The error handling scheme to use.
+ name: The name of the storage key on the client side.
+ sync: Whether changes should be propagated to other tabs.
+
+ Returns:
+ The client-side localStorage object.
+ """
+ if encoding or errors:
+ inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict")
+ else:
+ inst = super().__new__(cls, object)
+ inst.name = name
+ inst.sync = sync
+ return inst
+
+
+class SessionStorage(ClientStorageBase, str):
+ """Represents a state Var that is stored in sessionStorage in the browser."""
+
+ name: str | None
+
+ def __new__(
+ cls,
+ object: Any = "",
+ encoding: str | None = None,
+ errors: str | None = None,
+ /,
+ name: str | None = None,
+ ) -> "SessionStorage":
+ """Create a client-side sessionStorage (str).
+
+ Args:
+ object: The initial object.
+ encoding: The encoding to use.
+ errors: The error handling scheme to use
+ name: The name of the storage on the client side
+
+ Returns:
+ The client-side sessionStorage object.
+ """
+ if encoding or errors:
+ inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict")
+ else:
+ inst = super().__new__(cls, object)
+ inst.name = name
+ return inst
diff --git a/reflex/istate/wrappers.py b/reflex/istate/wrappers.py
new file mode 100644
index 000000000..d4e74cf8a
--- /dev/null
+++ b/reflex/istate/wrappers.py
@@ -0,0 +1,27 @@
+"""Wrappers for the state manager."""
+
+from typing import Any
+
+from reflex.istate.proxy import ReadOnlyStateProxy
+from reflex.state import _split_substate_key, _substate_key, get_state_manager
+
+
+async def get_state(token, state_cls: Any | None = None) -> ReadOnlyStateProxy:
+ """Get the instance of a state for a token.
+
+ Args:
+ token: The token for the state.
+ state_cls: The class of the state.
+
+ Returns:
+ A read-only proxy of the state instance.
+ """
+ mng = get_state_manager()
+ if state_cls is not None:
+ root_state = await mng.get_state(_substate_key(token, state_cls))
+ else:
+ root_state = await mng.get_state(token)
+ _, state_path = _split_substate_key(token)
+ state_cls = root_state.get_class_substate(tuple(state_path.split(".")))
+ instance = await root_state.get_state(state_cls)
+ return ReadOnlyStateProxy(instance)
diff --git a/reflex/model.py b/reflex/model.py
index 0e8d62e90..4b070ec67 100644
--- a/reflex/model.py
+++ b/reflex/model.py
@@ -2,9 +2,7 @@
from __future__ import annotations
-import os
from collections import defaultdict
-from pathlib import Path
from typing import Any, ClassVar, Optional, Type, Union
import alembic.autogenerate
@@ -18,9 +16,8 @@ import sqlalchemy
import sqlalchemy.exc
import sqlalchemy.orm
-from reflex import constants
from reflex.base import Base
-from reflex.config import get_config
+from reflex.config import environment, get_config
from reflex.utils import console
from reflex.utils.compat import sqlmodel, sqlmodel_field_has_primary_key
@@ -41,12 +38,12 @@ def get_engine(url: str | None = None) -> sqlalchemy.engine.Engine:
url = url or conf.db_url
if url is None:
raise ValueError("No database url configured")
- if not Path(constants.ALEMBIC_CONFIG).exists():
+ if not environment.ALEMBIC_CONFIG.get().exists():
console.warn(
"Database is not initialized, run [bold]reflex db init[/bold] first."
)
# Print the SQL queries if the log level is INFO or lower.
- echo_db_query = os.environ.get("SQLALCHEMY_ECHO") == "True"
+ echo_db_query = environment.SQLALCHEMY_ECHO.get()
# Needed for the admin dash on sqlite.
connect_args = {"check_same_thread": False} if url.startswith("sqlite") else {}
return sqlmodel.create_engine(url, echo=echo_db_query, connect_args=connect_args)
@@ -234,7 +231,7 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue
Returns:
tuple of (config, script_directory)
"""
- config = alembic.config.Config(constants.ALEMBIC_CONFIG)
+ config = alembic.config.Config(environment.ALEMBIC_CONFIG.get())
return config, alembic.script.ScriptDirectory(
config.get_main_option("script_location", default="version"),
)
@@ -269,8 +266,8 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue
def alembic_init(cls):
"""Initialize alembic for the project."""
alembic.command.init(
- config=alembic.config.Config(constants.ALEMBIC_CONFIG),
- directory=str(Path(constants.ALEMBIC_CONFIG).parent / "alembic"),
+ config=alembic.config.Config(environment.ALEMBIC_CONFIG.get()),
+ directory=str(environment.ALEMBIC_CONFIG.get().parent / "alembic"),
)
@classmethod
@@ -290,7 +287,7 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue
Returns:
True when changes have been detected.
"""
- if not Path(constants.ALEMBIC_CONFIG).exists():
+ if not environment.ALEMBIC_CONFIG.get().exists():
return False
config, script_directory = cls._alembic_config()
@@ -391,7 +388,7 @@ class Model(Base, sqlmodel.SQLModel): # pyright: ignore [reportGeneralTypeIssue
True - indicating the process was successful.
None - indicating the process was skipped.
"""
- if not Path(constants.ALEMBIC_CONFIG).exists():
+ if not environment.ALEMBIC_CONFIG.get().exists():
return
with cls.get_db_engine().connect() as connection:
diff --git a/reflex/page.py b/reflex/page.py
index 52f0c8efc..8cc031757 100644
--- a/reflex/page.py
+++ b/reflex/page.py
@@ -6,6 +6,7 @@ from collections import defaultdict
from typing import Any, Dict, List
from reflex.config import get_config
+from reflex.event import BASE_STATE, EventType
DECORATED_PAGES: Dict[str, List] = defaultdict(list)
@@ -17,7 +18,7 @@ def page(
description: str | None = None,
meta: list[Any] | None = None,
script_tags: list[Any] | None = None,
- on_load: Any | list[Any] | None = None,
+ on_load: EventType[[], BASE_STATE] | None = None,
):
"""Decorate a function as a page.
diff --git a/reflex/reflex.py b/reflex/reflex.py
index bd6904d06..bad2ecb28 100644
--- a/reflex/reflex.py
+++ b/reflex/reflex.py
@@ -9,17 +9,16 @@ from typing import List, Optional
import typer
import typer.core
-from reflex_cli.deployments import deployments_cli
-from reflex_cli.utils import dependency
+from reflex_cli.v2.deployments import check_version, hosting_cli
from reflex import constants
-from reflex.config import get_config
+from reflex.config import environment, get_config
from reflex.custom_components.custom_components import custom_components_cli
from reflex.state import reset_disk_state_manager
-from reflex.utils import console, redir, telemetry
+from reflex.utils import console, telemetry
# Disable typer+rich integration for help panels
-typer.core.rich = False # type: ignore
+typer.core.rich = None # type: ignore
# Create the app.
try:
@@ -88,30 +87,8 @@ def _init(
# Set up the web project.
prerequisites.initialize_frontend_dependencies()
- # Integrate with reflex.build.
- generation_hash = None
- if ai:
- if template is None:
- # If AI is requested and no template specified, redirect the user to reflex.build.
- generation_hash = redir.reflex_build_redirect()
- elif prerequisites.is_generation_hash(template):
- # Otherwise treat the template as a generation hash.
- generation_hash = template
- else:
- console.error(
- "Cannot use `--template` option with `--ai` option. Please remove `--template` option."
- )
- raise typer.Exit(2)
- template = constants.Templates.DEFAULT
-
# Initialize the app.
- prerequisites.initialize_app(app_name, template)
-
- # If a reflex.build generation hash is available, download the code and apply it to the main module.
- if generation_hash:
- prerequisites.initialize_main_module_index_from_generation(
- app_name, generation_hash=generation_hash
- )
+ template = prerequisites.initialize_app(app_name, template, ai)
# Initialize the .gitignore.
prerequisites.initialize_gitignore()
@@ -119,8 +96,9 @@ def _init(
# Initialize the requirements.txt.
prerequisites.initialize_requirements_txt()
+ template_msg = f" using the {template} template" if template else ""
# Finish initializing the app.
- console.success(f"Initialized {app_name}")
+ console.success(f"Initialized {app_name}{template_msg}")
@cli.command()
@@ -160,7 +138,7 @@ def _run(
console.set_log_level(loglevel)
# Set env mode in the environment
- os.environ[constants.ENV_MODE_ENV_VAR] = env.value
+ environment.REFLEX_ENV_MODE.set(env)
# Show system info
exec.output_system_info()
@@ -274,9 +252,17 @@ def run(
constants.Env.DEV, help="The environment to run the app in."
),
frontend: bool = typer.Option(
- False, "--frontend-only", help="Execute only frontend."
+ False,
+ "--frontend-only",
+ help="Execute only frontend.",
+ envvar=environment.REFLEX_FRONTEND_ONLY.name,
+ ),
+ backend: bool = typer.Option(
+ False,
+ "--backend-only",
+ help="Execute only backend.",
+ envvar=environment.REFLEX_BACKEND_ONLY.name,
),
- backend: bool = typer.Option(False, "--backend-only", help="Execute only backend."),
frontend_port: str = typer.Option(
config.frontend_port, help="Specify a different frontend port."
),
@@ -291,6 +277,12 @@ def run(
),
):
"""Run the app in the current directory."""
+ if frontend and backend:
+ console.error("Cannot use both --frontend-only and --backend-only options.")
+ raise typer.Exit(1)
+ environment.REFLEX_BACKEND_ONLY.set(backend)
+ environment.REFLEX_FRONTEND_ONLY.set(frontend)
+
_run(env, frontend, backend, frontend_port, backend_port, backend_host, loglevel)
@@ -336,37 +328,16 @@ def export(
)
-def _login() -> str:
- """Helper function to authenticate with Reflex hosting service."""
- from reflex_cli.utils import hosting
-
- access_token, invitation_code = hosting.authenticated_token()
- if access_token:
- console.print("You already logged in.")
- return access_token
-
- # If not already logged in, open a browser window/tab to the login page.
- access_token = hosting.authenticate_on_browser(invitation_code)
-
- if not access_token:
- console.error(f"Unable to authenticate. Please try again or contact support.")
- raise typer.Exit(1)
-
- console.print("Successfully logged in.")
- return access_token
-
-
@cli.command()
-def login(
- loglevel: constants.LogLevel = typer.Option(
- config.loglevel, help="The log level to use."
- ),
-):
- """Authenticate with Reflex hosting service."""
- # Set the log level.
- console.set_log_level(loglevel)
+def login(loglevel: constants.LogLevel = typer.Option(config.loglevel)):
+ """Authenicate with experimental Reflex hosting service."""
+ from reflex_cli.v2 import cli as hosting_cli
- _login()
+ check_version()
+
+ validated_info = hosting_cli.login()
+ if validated_info is not None:
+ telemetry.send("login", user_uuid=validated_info.get("user_id"))
@cli.command()
@@ -376,13 +347,11 @@ def logout(
),
):
"""Log out of access to Reflex hosting service."""
- from reflex_cli.utils import hosting
+ from reflex_cli.v2.cli import logout
- console.set_log_level(loglevel)
+ check_version()
- hosting.log_out_on_browser()
- console.debug("Deleting access token from config locally")
- hosting.delete_token_from_config(include_invitation_code=True)
+ logout(loglevel) # type: ignore
db_cli = typer.Typer()
@@ -391,7 +360,7 @@ script_cli = typer.Typer()
def _skip_compile():
"""Skip the compile step."""
- os.environ[constants.SKIP_COMPILE_ENV_VAR] = "yes"
+ environment.REFLEX_SKIP_COMPILE.set(True)
@db_cli.command(name="init")
@@ -406,7 +375,7 @@ def db_init():
return
# Check the alembic config.
- if Path(constants.ALEMBIC_CONFIG).exists():
+ if environment.ALEMBIC_CONFIG.get().exists():
console.error(
"Database is already initialized. Use "
"[bold]reflex db makemigrations[/bold] to create schema change "
@@ -467,12 +436,6 @@ def makemigrations(
@cli.command()
def deploy(
- key: Optional[str] = typer.Option(
- None,
- "-k",
- "--deployment-key",
- help="The name of the deployment. Domain name safe characters only.",
- ),
app_name: str = typer.Option(
config.app_name,
"--app-name",
@@ -483,68 +446,67 @@ def deploy(
list(),
"-r",
"--region",
- help="The regions to deploy to.",
+ help="The regions to deploy to. `reflex apps regions` For multiple envs, repeat this option, e.g. --region sjc --region iad",
),
envs: List[str] = typer.Option(
list(),
"--env",
help="The environment variables to set: =. For multiple envs, repeat this option, e.g. --env k1=v2 --env k2=v2.",
),
- cpus: Optional[int] = typer.Option(
- None, help="The number of CPUs to allocate.", hidden=True
- ),
- memory_mb: Optional[int] = typer.Option(
- None, help="The amount of memory to allocate.", hidden=True
- ),
- auto_start: Optional[bool] = typer.Option(
+ vmtype: Optional[str] = typer.Option(
None,
- help="Whether to auto start the instance.",
- hidden=True,
+ "--vmtype",
+ help="Vm type id. Run `reflex apps vmtypes` to get options.",
),
- auto_stop: Optional[bool] = typer.Option(
+ hostname: Optional[str] = typer.Option(
None,
- help="Whether to auto stop the instance.",
- hidden=True,
- ),
- frontend_hostname: Optional[str] = typer.Option(
- None,
- "--frontend-hostname",
+ "--hostname",
help="The hostname of the frontend.",
- hidden=True,
),
interactive: bool = typer.Option(
True,
help="Whether to list configuration options and ask for confirmation.",
),
- with_metrics: Optional[str] = typer.Option(
+ envfile: Optional[str] = typer.Option(
None,
- help="Setting for metrics scraping for the deployment. Setup required in user code.",
- hidden=True,
- ),
- with_tracing: Optional[str] = typer.Option(
- None,
- help="Setting to export tracing for the deployment. Setup required in user code.",
- hidden=True,
- ),
- upload_db_file: bool = typer.Option(
- False,
- help="Whether to include local sqlite db files when uploading to hosting service.",
- hidden=True,
+ "--envfile",
+ help="The path to an env file to use. Will override any envs set manually.",
),
loglevel: constants.LogLevel = typer.Option(
config.loglevel, help="The log level to use."
),
+ project: Optional[str] = typer.Option(
+ None,
+ "--project",
+ help="project id to deploy to",
+ ),
+ token: Optional[str] = typer.Option(
+ None,
+ "--token",
+ help="token to use for auth",
+ ),
):
"""Deploy the app to the Reflex hosting service."""
- from reflex_cli import cli as hosting_cli
+ from reflex_cli.utils import dependency
+ from reflex_cli.v2 import cli as hosting_cli
from reflex.utils import export as export_utils
from reflex.utils import prerequisites
+ check_version()
+
# Set the log level.
console.set_log_level(loglevel)
- # Only check requirements if interactive. There is user interaction for requirements update.
+ if not token:
+ # make sure user is logged in.
+ if interactive:
+ hosting_cli.login()
+ else:
+ raise SystemExit("Token is required for non-interactive mode.")
+
+ # Only check requirements if interactive.
+ # There is user interaction for requirements update.
if interactive:
dependency.check_requirements()
@@ -568,29 +530,25 @@ def deploy(
backend=backend,
zipping=zipping,
loglevel=loglevel.subprocess_level(),
- upload_db_file=upload_db_file,
),
- key=key,
regions=regions,
envs=envs,
- cpus=cpus,
- memory_mb=memory_mb,
- auto_start=auto_start,
- auto_stop=auto_stop,
- frontend_hostname=frontend_hostname,
+ vmtype=vmtype,
+ envfile=envfile,
+ hostname=hostname,
interactive=interactive,
- with_metrics=with_metrics,
- with_tracing=with_tracing,
- loglevel=loglevel.subprocess_level(),
+ loglevel=type(loglevel).INFO, # type: ignore
+ token=token,
+ project=project,
)
cli.add_typer(db_cli, name="db", help="Subcommands for managing the database schema.")
cli.add_typer(script_cli, name="script", help="Subcommands running helper scripts.")
cli.add_typer(
- deployments_cli,
- name="deployments",
- help="Subcommands for managing the Deployments.",
+ hosting_cli,
+ name="cloud",
+ help="Subcommands for managing the reflex cloud.",
)
cli.add_typer(
custom_components_cli,
diff --git a/reflex/state.py b/reflex/state.py
index c5257d2f6..816938e36 100644
--- a/reflex/state.py
+++ b/reflex/state.py
@@ -8,9 +8,10 @@ import copy
import dataclasses
import functools
import inspect
-import os
+import json
import pickle
import sys
+import typing
import uuid
from abc import ABC, abstractmethod
from collections import defaultdict
@@ -31,6 +32,7 @@ from typing import (
Set,
Tuple,
Type,
+ TypeVar,
Union,
cast,
get_args,
@@ -40,8 +42,11 @@ from typing import (
from sqlalchemy.orm import DeclarativeBase
from typing_extensions import Self
-from reflex.config import get_config
+from reflex import event
+from reflex.config import PerformanceMode, get_config
from reflex.istate.data import RouterData
+from reflex.istate.storage import ClientStorageBase
+from reflex.model import Model
from reflex.vars.base import (
ComputedVar,
DynamicRouteVar,
@@ -57,6 +62,13 @@ try:
except ModuleNotFoundError:
import pydantic
+from pydantic import BaseModel as BaseModelV2
+
+try:
+ from pydantic.v1 import BaseModel as BaseModelV1
+except ModuleNotFoundError:
+ BaseModelV1 = BaseModelV2
+
import wrapt
from redis.asyncio import Redis
from redis.exceptions import ResponseError
@@ -64,6 +76,7 @@ from redis.exceptions import ResponseError
import reflex.istate.dynamic
from reflex import constants
from reflex.base import Base
+from reflex.config import environment
from reflex.event import (
BACKGROUND_TASK_MARKER,
Event,
@@ -75,17 +88,26 @@ from reflex.utils import console, format, path_ops, prerequisites, types
from reflex.utils.exceptions import (
ComputedVarShadowsBaseVars,
ComputedVarShadowsStateVar,
+ DynamicComponentInvalidSignature,
DynamicRouteArgShadowsStateVar,
EventHandlerShadowsBuiltInStateMethod,
ImmutableStateError,
InvalidStateManagerMode,
LockExpiredError,
+ ReflexRuntimeError,
SetUndefinedStateVarError,
StateSchemaMismatchError,
+ StateTooLargeError,
)
from reflex.utils.exec import is_testing_env
from reflex.utils.serializers import serializer
-from reflex.utils.types import get_origin, override
+from reflex.utils.types import (
+ _isinstance,
+ get_origin,
+ is_union,
+ override,
+ value_inside_optional,
+)
from reflex.vars import VarData
if TYPE_CHECKING:
@@ -96,8 +118,20 @@ Delta = Dict[str, Any]
var = computed_var
-# If the state is this large, it's considered a performance issue.
-TOO_LARGE_SERIALIZED_STATE = 100 * 1024 # 100kb
+if environment.REFLEX_PERF_MODE.get() != PerformanceMode.OFF:
+ # If the state is this large, it's considered a performance issue.
+ TOO_LARGE_SERIALIZED_STATE = environment.REFLEX_STATE_SIZE_LIMIT.get() * 1024
+ # Only warn about each state class size once.
+ _WARNED_ABOUT_STATE_SIZE: Set[str] = set()
+
+# Errors caught during pickling of state
+HANDLED_PICKLE_ERRORS = (
+ pickle.PicklingError,
+ AttributeError,
+ IndexError,
+ TypeError,
+ ValueError,
+)
def _no_chain_background_task(
@@ -214,6 +248,7 @@ class EventHandlerSetVar(EventHandler):
Raises:
AttributeError: If the given Var name does not exist on the state.
EventHandlerValueError: If the given Var name is not a str
+ NotImplementedError: If the setter for the given Var is async
"""
from reflex.utils.exceptions import EventHandlerValueError
@@ -222,11 +257,20 @@ class EventHandlerSetVar(EventHandler):
raise EventHandlerValueError(
f"Var name must be passed as a string, got {args[0]!r}"
)
+
+ handler = getattr(self.state_cls, constants.SETTER_PREFIX + args[0], None)
+
# Check that the requested Var setter exists on the State at compile time.
- if getattr(self.state_cls, constants.SETTER_PREFIX + args[0], None) is None:
+ if handler is None:
raise AttributeError(
f"Variable `{args[0]}` cannot be set on `{self.state_cls.get_full_name()}`"
)
+
+ if asyncio.iscoroutinefunction(handler.fn):
+ raise NotImplementedError(
+ f"Setter for {args[0]} is async, which is not supported."
+ )
+
return super().__call__(*args)
@@ -328,7 +372,6 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
def __init__(
self,
- *args,
parent_state: BaseState | None = None,
init_substates: bool = True,
_reflex_internal_init: bool = False,
@@ -339,11 +382,10 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
DO NOT INSTANTIATE STATE CLASSES DIRECTLY! Use StateManager.get_state() instead.
Args:
- *args: The args to pass to the Pydantic init method.
parent_state: The parent state.
init_substates: Whether to initialize the substates in this instance.
_reflex_internal_init: A flag to indicate that the state is being initialized by the framework.
- **kwargs: The kwargs to pass to the Pydantic init method.
+ **kwargs: The kwargs to set as attributes on the state.
Raises:
ReflexRuntimeError: If the state is instantiated directly by end user.
@@ -355,8 +397,14 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
"State classes should not be instantiated directly in a Reflex app. "
"See https://reflex.dev/docs/state/ for further information."
)
+ if type(self)._mixin:
+ raise ReflexRuntimeError(
+ f"{type(self).__name__} is a state mixin and cannot be instantiated directly."
+ )
kwargs["parent_state"] = parent_state
- super().__init__(*args, **kwargs)
+ super().__init__()
+ for name, value in kwargs.items():
+ setattr(self, name, value)
# Setup the substates (for memory state manager only).
if init_substates:
@@ -620,7 +668,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
def computed_var_func(state: Self):
result = f(state)
- if not isinstance(result, of_type):
+ if not _isinstance(result, of_type):
console.warn(
f"Inline ComputedVar {f} expected type {of_type}, got {type(result)}. "
"You can specify expected type with `of_type` argument."
@@ -1010,9 +1058,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
Args:
prop: The var to create a setter for.
"""
- setter_name = prop.get_setter_name(include_state=False)
+ setter_name = prop._get_setter_name(include_state=False)
if setter_name not in cls.__dict__:
- event_handler = cls._create_event_handler(prop.get_setter())
+ event_handler = cls._create_event_handler(prop._get_setter())
cls.event_handlers[setter_name] = event_handler
setattr(cls, setter_name, event_handler)
@@ -1026,7 +1074,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
# Get the pydantic field for the var.
field = cls.get_fields()[prop._var_field_name]
if field.required:
- default_value = prop.get_default_value()
+ default_value = prop._get_default_value()
if default_value is not None:
field.required = False
field.default = default_value
@@ -1053,7 +1101,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
return getattr(cls, name)
except AttributeError:
try:
- return Var("", _var_type=annotation_value).get_default_value()
+ return Var("", _var_type=annotation_value)._get_default_value()
except TypeError:
pass
return None
@@ -1208,7 +1256,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
if parent_state is not None:
return getattr(parent_state, name)
- if isinstance(value, MutableProxy.__mutable_types__) and (
+ if MutableProxy._is_mutable_type(value) and (
name in super().__getattribute__("base_vars") or name in backend_vars
):
# track changes in mutable containers (list, dict, set, etc)
@@ -1239,6 +1287,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
return
if name in self.backend_vars:
+ # abort if unchanged
+ if self._backend_vars.get(name) == value:
+ return
self._backend_vars.__setitem__(name, value)
self.dirty_vars.add(name)
self._mark_dirty()
@@ -1257,6 +1308,22 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
f"All state variables must be declared before they can be set."
)
+ fields = self.get_fields()
+
+ if name in fields:
+ field = fields[name]
+ field_type = field.outer_type_
+ if field.allow_none:
+ field_type = Union[field_type, None]
+ if not _isinstance(value, field_type):
+ console.deprecate(
+ "mismatched-type-assignment",
+ f"Tried to assign value {value} of type {type(value)} to field {type(self).__name__}.{name} of type {field_type}."
+ " This might lead to unexpected behavior.",
+ "0.6.5",
+ "0.7.0",
+ )
+
# Set the attribute.
super().__setattr__(name, value)
@@ -1670,6 +1737,44 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
# Get the function to process the event.
fn = functools.partial(handler.fn, state)
+ try:
+ type_hints = typing.get_type_hints(handler.fn)
+ except Exception:
+ type_hints = {}
+
+ for arg, value in list(payload.items()):
+ hinted_args = type_hints.get(arg, Any)
+ if hinted_args is Any:
+ continue
+ if is_union(hinted_args):
+ if value is None:
+ continue
+ hinted_args = value_inside_optional(hinted_args)
+ if (
+ isinstance(value, dict)
+ and inspect.isclass(hinted_args)
+ and not types.is_generic_alias(hinted_args) # py3.9-py3.10
+ ):
+ if issubclass(hinted_args, Model):
+ # Remove non-fields from the payload
+ payload[arg] = hinted_args(
+ **{
+ key: value
+ for key, value in value.items()
+ if key in hinted_args.__fields__
+ }
+ )
+ elif dataclasses.is_dataclass(hinted_args) or issubclass(
+ hinted_args, (Base, BaseModelV1, BaseModelV2)
+ ):
+ payload[arg] = hinted_args(**value)
+ if isinstance(value, list) and (hinted_args is set or hinted_args is Set):
+ payload[arg] = set(value)
+ if isinstance(value, list) and (
+ hinted_args is tuple or hinted_args is Tuple
+ ):
+ payload[arg] = tuple(value)
+
# Wrap the function in a try/except block.
try:
# Handle async functions.
@@ -1805,7 +1910,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
)
subdelta: Dict[str, Any] = {
- prop: self.get_value(getattr(self, prop))
+ prop: self.get_value(prop)
for prop in delta_vars
if not types.is_backend_base_variable(prop, type(self))
}
@@ -1856,6 +1961,9 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
if var in self.base_vars or var in self._backend_vars:
self._was_touched = True
break
+ if var == constants.ROUTER_DATA and self.parent_state is None:
+ self._was_touched = True
+ break
def _get_was_touched(self) -> bool:
"""Check current dirty_vars and flag to determine if state instance was modified.
@@ -1897,9 +2005,10 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
Returns:
The value of the field.
"""
- if isinstance(key, MutableProxy):
- return super().get_value(key.__wrapped__)
- return super().get_value(key)
+ value = super().get_value(key)
+ if isinstance(value, MutableProxy):
+ return value.__wrapped__
+ return value
def dict(
self, include_computed: bool = True, initial: bool = False, **kwargs
@@ -1921,8 +2030,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
self._mark_dirty()
base_vars = {
- prop_name: self.get_value(getattr(self, prop_name))
- for prop_name in self.base_vars
+ prop_name: self.get_value(prop_name) for prop_name in self.base_vars
}
if initial and include_computed:
computed_vars = {
@@ -1931,7 +2039,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
cv._initial_value
if is_computed_var(cv)
and not isinstance(cv._initial_value, types.Unset)
- else self.get_value(getattr(self, prop_name))
+ else self.get_value(prop_name)
)
for prop_name, cv in self.computed_vars.items()
if not cv._backend
@@ -1939,7 +2047,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
elif include_computed:
computed_vars = {
# Include the computed vars.
- prop_name: self.get_value(getattr(self, prop_name))
+ prop_name: self.get_value(prop_name)
for prop_name, cv in self.computed_vars.items()
if not cv._backend
}
@@ -2007,6 +2115,34 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
state["__dict__"].pop(inherited_var_name, None)
return state
+ def _check_state_size(
+ self,
+ pickle_state_size: int,
+ ):
+ """Print a warning when the state is too large.
+
+ Args:
+ pickle_state_size: The size of the pickled state.
+
+ Raises:
+ StateTooLargeError: If the state is too large.
+ """
+ state_full_name = self.get_full_name()
+ if (
+ state_full_name not in _WARNED_ABOUT_STATE_SIZE
+ and pickle_state_size > TOO_LARGE_SERIALIZED_STATE
+ and self.substates
+ ):
+ msg = (
+ f"State {state_full_name} serializes to {pickle_state_size} bytes "
+ + "which may present performance issues. Consider reducing the size of this state."
+ )
+ if environment.REFLEX_PERF_MODE.get() == PerformanceMode.WARN:
+ console.warn(msg)
+ elif environment.REFLEX_PERF_MODE.get() == PerformanceMode.RAISE:
+ raise StateTooLargeError(msg)
+ _WARNED_ABOUT_STATE_SIZE.add(state_full_name)
+
@classmethod
@functools.lru_cache()
def _to_schema(cls) -> str:
@@ -2044,14 +2180,29 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
Returns:
The serialized state.
"""
+ payload = b""
try:
- return pickle.dumps((self._to_schema(), self))
- except pickle.PicklingError:
- console.warn(
+ payload = pickle.dumps((self._to_schema(), self))
+ except HANDLED_PICKLE_ERRORS as og_pickle_error:
+ error = (
f"Failed to serialize state {self.get_full_name()} due to unpicklable object. "
- "This state will not be persisted."
+ "This state will not be persisted. "
)
- return b""
+ try:
+ import dill
+
+ payload = dill.dumps((self._to_schema(), self))
+ except ImportError:
+ error += (
+ f"Pickle error: {og_pickle_error}. "
+ "Consider `pip install 'dill>=0.3.8'` for more exotic serialization support."
+ )
+ except HANDLED_PICKLE_ERRORS as ex:
+ error += f"Dill was also unable to pickle the state: {ex}"
+ console.warn(error)
+ if environment.REFLEX_PERF_MODE.get() != PerformanceMode.OFF:
+ self._check_state_size(len(payload))
+ return payload
@classmethod
def _deserialize(
@@ -2090,10 +2241,56 @@ class State(BaseState):
is_hydrated: bool = False
+T = TypeVar("T", bound=BaseState)
+
+
+def dynamic(func: Callable[[T], Component]):
+ """Create a dynamically generated components from a state class.
+
+ Args:
+ func: The function to generate the component.
+
+ Returns:
+ The dynamically generated component.
+
+ Raises:
+ DynamicComponentInvalidSignature: If the function does not have exactly one parameter.
+ DynamicComponentInvalidSignature: If the function does not have a type hint for the state class.
+ """
+ number_of_parameters = len(inspect.signature(func).parameters)
+
+ func_signature = get_type_hints(func)
+
+ if "return" in func_signature:
+ func_signature.pop("return")
+
+ values = list(func_signature.values())
+
+ if number_of_parameters != 1:
+ raise DynamicComponentInvalidSignature(
+ "The function must have exactly one parameter, which is the state class."
+ )
+
+ if len(values) != 1:
+ raise DynamicComponentInvalidSignature(
+ "You must provide a type hint for the state class in the function."
+ )
+
+ state_class: Type[T] = values[0]
+
+ def wrapper() -> Component:
+ from reflex.components.base.fragment import fragment
+
+ return fragment(state_class._evaluate(lambda state: func(state)))
+
+ return wrapper
+
+
class FrontendEventExceptionState(State):
"""Substate for handling frontend exceptions."""
- def handle_frontend_exception(self, stack: str) -> None:
+ @event
+ def handle_frontend_exception(self, stack: str, component_stack: str) -> None:
"""Handle frontend exceptions.
If a frontend exception handler is provided, it will be called.
@@ -2101,6 +2298,7 @@ class FrontendEventExceptionState(State):
Args:
stack: The stack trace of the exception.
+ component_stack: The stack trace of the component where the exception occurred.
"""
app_instance = getattr(prerequisites.get_app(), constants.CompileVars.APP)
@@ -2200,6 +2398,23 @@ class ComponentState(State, mixin=True):
# The number of components created from this class.
_per_component_state_instance_count: ClassVar[int] = 0
+ def __init__(self, *args, **kwargs):
+ """Do not allow direct initialization of the ComponentState.
+
+ Args:
+ *args: The args to pass to the State init method.
+ **kwargs: The kwargs to pass to the State init method.
+
+ Raises:
+ ReflexRuntimeError: If the ComponentState is initialized directly.
+ """
+ if type(self)._mixin:
+ raise ReflexRuntimeError(
+ f"{ComponentState.__name__} {type(self).__name__} is not meant to be initialized directly. "
+ + "Use the `create` method to create a new instance and access the state via the `State` attribute."
+ )
+ super().__init__(*args, **kwargs)
+
@classmethod
def __init_subclass__(cls, mixin: bool = True, **kwargs):
"""Overwrite mixin default to True.
@@ -2270,7 +2485,7 @@ class StateProxy(wrapt.ObjectProxy):
class State(rx.State):
counter: int = 0
- @rx.background
+ @rx.event(background=True)
async def bg_increment(self):
await asyncio.sleep(1)
async with self:
@@ -2565,6 +2780,8 @@ class StateManager(Base, ABC):
The state manager (either disk, memory or redis).
"""
config = get_config()
+ if prerequisites.parse_redis_url() is not None:
+ config.state_manager_mode = constants.StateManagerMode.REDIS
if config.state_manager_mode == constants.StateManagerMode.MEMORY:
return StateManagerMemory(state=state)
if config.state_manager_mode == constants.StateManagerMode.DISK:
@@ -2839,9 +3056,13 @@ class StateManagerDisk(StateManager):
for substate in state.get_substates():
substate_token = _substate_key(client_token, substate)
+ fresh_instance = await root_state.get_state(substate)
instance = await self.load_state(substate_token)
- if instance is None:
- instance = await root_state.get_state(substate)
+ if instance is not None:
+ # Ensure all substates exist, even if they weren't serialized previously.
+ instance.substates = fresh_instance.substates
+ else:
+ instance = fresh_instance
state.substates[substate.get_name()] = instance
instance.parent_state = state
@@ -2971,9 +3192,6 @@ class StateManagerRedis(StateManager):
b"evicted",
}
- # Only warn about each state class size once.
- _warned_about_state_size: ClassVar[Set[str]] = set()
-
async def _get_parent_state(
self, token: str, state: BaseState | None = None
) -> BaseState | None:
@@ -3117,29 +3335,6 @@ class StateManagerRedis(StateManager):
return state._get_root_state()
return state
- def _warn_if_too_large(
- self,
- state: BaseState,
- pickle_state_size: int,
- ):
- """Print a warning when the state is too large.
-
- Args:
- state: The state to check.
- pickle_state_size: The size of the pickled state.
- """
- state_full_name = state.get_full_name()
- if (
- state_full_name not in self._warned_about_state_size
- and pickle_state_size > TOO_LARGE_SERIALIZED_STATE
- and state.substates
- ):
- console.warn(
- f"State {state_full_name} serializes to {pickle_state_size} bytes "
- "which may present performance issues. Consider reducing the size of this state."
- )
- self._warned_about_state_size.add(state_full_name)
-
@override
async def set_state(
self,
@@ -3166,7 +3361,7 @@ class StateManagerRedis(StateManager):
raise LockExpiredError(
f"Lock expired for token {token} while processing. Consider increasing "
f"`app.state_manager.lock_expiration` (currently {self.lock_expiration}) "
- "or use `@rx.background` decorator for long-running tasks."
+ "or use `@rx.event(background=True)` decorator for long-running tasks."
)
client_token, substate_name = _split_substate_key(token)
# If the substate name on the token doesn't match the instance name, it cannot have a parent.
@@ -3190,7 +3385,6 @@ class StateManagerRedis(StateManager):
# Persist only the given state (parents or substates are excluded by BaseState.__getstate__).
if state._get_was_touched():
pickle_state = state._serialize()
- self._warn_if_too_large(state, len(pickle_state))
if pickle_state:
await self.redis.set(
_substate_key(client_token, state),
@@ -3271,11 +3465,7 @@ class StateManagerRedis(StateManager):
)
except ResponseError:
# Some redis servers only allow out-of-band configuration, so ignore errors here.
- ignore_config_error = os.environ.get(
- "REFLEX_IGNORE_REDIS_CONFIG_ERROR",
- None,
- )
- if not ignore_config_error:
+ if not environment.REFLEX_IGNORE_REDIS_CONFIG_ERROR.get():
raise
async with self.redis.pubsub() as pubsub:
await pubsub.psubscribe(lock_key_channel)
@@ -3347,143 +3537,6 @@ def get_state_manager() -> StateManager:
return app.state_manager
-class ClientStorageBase:
- """Base class for client-side storage."""
-
- def options(self) -> dict[str, Any]:
- """Get the options for the storage.
-
- Returns:
- All set options for the storage (not None).
- """
- return {
- format.to_camel_case(k): v for k, v in vars(self).items() if v is not None
- }
-
-
-class Cookie(ClientStorageBase, str):
- """Represents a state Var that is stored as a cookie in the browser."""
-
- name: str | None
- path: str
- max_age: int | None
- domain: str | None
- secure: bool | None
- same_site: str
-
- def __new__(
- cls,
- object: Any = "",
- encoding: str | None = None,
- errors: str | None = None,
- /,
- name: str | None = None,
- path: str = "/",
- max_age: int | None = None,
- domain: str | None = None,
- secure: bool | None = None,
- same_site: str = "lax",
- ):
- """Create a client-side Cookie (str).
-
- Args:
- object: The initial object.
- encoding: The encoding to use.
- errors: The error handling scheme to use.
- name: The name of the cookie on the client side.
- path: Cookie path. Use / as the path if the cookie should be accessible on all pages.
- max_age: Relative max age of the cookie in seconds from when the client receives it.
- domain: Domain for the cookie (sub.domain.com or .allsubdomains.com).
- secure: Is the cookie only accessible through HTTPS?
- same_site: Whether the cookie is sent with third party requests.
- One of (true|false|none|lax|strict)
-
- Returns:
- The client-side Cookie object.
-
- Note: expires (absolute Date) is not supported at this time.
- """
- if encoding or errors:
- inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict")
- else:
- inst = super().__new__(cls, object)
- inst.name = name
- inst.path = path
- inst.max_age = max_age
- inst.domain = domain
- inst.secure = secure
- inst.same_site = same_site
- return inst
-
-
-class LocalStorage(ClientStorageBase, str):
- """Represents a state Var that is stored in localStorage in the browser."""
-
- name: str | None
- sync: bool = False
-
- def __new__(
- cls,
- object: Any = "",
- encoding: str | None = None,
- errors: str | None = None,
- /,
- name: str | None = None,
- sync: bool = False,
- ) -> "LocalStorage":
- """Create a client-side localStorage (str).
-
- Args:
- object: The initial object.
- encoding: The encoding to use.
- errors: The error handling scheme to use.
- name: The name of the storage key on the client side.
- sync: Whether changes should be propagated to other tabs.
-
- Returns:
- The client-side localStorage object.
- """
- if encoding or errors:
- inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict")
- else:
- inst = super().__new__(cls, object)
- inst.name = name
- inst.sync = sync
- return inst
-
-
-class SessionStorage(ClientStorageBase, str):
- """Represents a state Var that is stored in sessionStorage in the browser."""
-
- name: str | None
-
- def __new__(
- cls,
- object: Any = "",
- encoding: str | None = None,
- errors: str | None = None,
- /,
- name: str | None = None,
- ) -> "SessionStorage":
- """Create a client-side sessionStorage (str).
-
- Args:
- object: The initial object.
- encoding: The encoding to use.
- errors: The error handling scheme to use
- name: The name of the storage on the client side
-
- Returns:
- The client-side sessionStorage object.
- """
- if encoding or errors:
- inst = super().__new__(cls, object, encoding or "utf-8", errors or "strict")
- else:
- inst = super().__new__(cls, object)
- inst.name = name
- return inst
-
-
class MutableProxy(wrapt.ObjectProxy):
"""A proxy for a mutable object that tracks changes."""
@@ -3521,7 +3574,16 @@ class MutableProxy(wrapt.ObjectProxy):
pydantic.BaseModel.__dict__
)
- __mutable_types__ = (list, dict, set, Base, DeclarativeBase)
+ # These types will be wrapped in MutableProxy
+ __mutable_types__ = (
+ list,
+ dict,
+ set,
+ Base,
+ DeclarativeBase,
+ BaseModelV2,
+ BaseModelV1,
+ )
def __init__(self, wrapped: Any, state: BaseState, field_name: str):
"""Create a proxy for a mutable object that tracks changes.
@@ -3561,6 +3623,18 @@ class MutableProxy(wrapt.ObjectProxy):
if wrapped is not None:
return wrapped(*args, **(kwargs or {}))
+ @classmethod
+ def _is_mutable_type(cls, value: Any) -> bool:
+ """Check if a value is of a mutable type and should be wrapped.
+
+ Args:
+ value: The value to check.
+
+ Returns:
+ Whether the value is of a mutable type.
+ """
+ return isinstance(value, cls.__mutable_types__)
+
def _wrap_recursive(self, value: Any) -> Any:
"""Wrap a value recursively if it is mutable.
@@ -3571,9 +3645,7 @@ class MutableProxy(wrapt.ObjectProxy):
The wrapped value.
"""
# Recursively wrap mutable types, but do not re-wrap MutableProxy instances.
- if isinstance(value, self.__mutable_types__) and not isinstance(
- value, MutableProxy
- ):
+ if self._is_mutable_type(value) and not isinstance(value, MutableProxy):
return type(self)(
wrapped=value,
state=self._self_state,
@@ -3631,7 +3703,7 @@ class MutableProxy(wrapt.ObjectProxy):
self._wrap_recursive_decorator,
)
- if isinstance(value, self.__mutable_types__) and __name not in (
+ if self._is_mutable_type(value) and __name not in (
"__wrapped__",
"_self_state",
):
@@ -3752,6 +3824,29 @@ def serialize_mutable_proxy(mp: MutableProxy):
return mp.__wrapped__
+_orig_json_JSONEncoder_default = json.JSONEncoder.default
+
+
+def _json_JSONEncoder_default_wrapper(self: json.JSONEncoder, o: Any) -> Any:
+ """Wrap JSONEncoder.default to handle MutableProxy objects.
+
+ Args:
+ self: the JSONEncoder instance.
+ o: the object to serialize.
+
+ Returns:
+ A JSON-able object.
+ """
+ try:
+ return o.__wrapped__
+ except AttributeError:
+ pass
+ return _orig_json_JSONEncoder_default(self, o)
+
+
+json.JSONEncoder.default = _json_JSONEncoder_default_wrapper
+
+
class ImmutableMutableProxy(MutableProxy):
"""A proxy for a mutable object that tracks changes.
diff --git a/reflex/style.py b/reflex/style.py
index 8e24e9b6b..f0ee8c6a7 100644
--- a/reflex/style.py
+++ b/reflex/style.py
@@ -23,7 +23,7 @@ LiteralColorMode = Literal["system", "light", "dark"]
# Reference the global ColorModeContext
color_mode_imports = {
- f"/{constants.Dirs.CONTEXTS_PATH}": [ImportVar(tag="ColorModeContext")],
+ f"$/{constants.Dirs.CONTEXTS_PATH}": [ImportVar(tag="ColorModeContext")],
"react": [ImportVar(tag="useContext")],
}
diff --git a/reflex/testing.py b/reflex/testing.py
index 6a45c51eb..9ddb03504 100644
--- a/reflex/testing.py
+++ b/reflex/testing.py
@@ -43,6 +43,7 @@ import reflex.utils.exec
import reflex.utils.format
import reflex.utils.prerequisites
import reflex.utils.processes
+from reflex.config import environment
from reflex.state import (
BaseState,
StateManager,
@@ -117,7 +118,7 @@ class AppHarness:
app_name: str
app_source: Optional[
- types.FunctionType | types.ModuleType | str | functools.partial[Any]
+ Callable[[], None] | types.ModuleType | str | functools.partial[Any]
]
app_path: pathlib.Path
app_module_path: pathlib.Path
@@ -137,7 +138,7 @@ class AppHarness:
cls,
root: pathlib.Path,
app_source: Optional[
- types.FunctionType | types.ModuleType | str | functools.partial[Any]
+ Callable[[], None] | types.ModuleType | str | functools.partial[Any]
] = None,
app_name: Optional[str] = None,
) -> "AppHarness":
@@ -249,7 +250,9 @@ class AppHarness:
return textwrap.dedent(source)
def _initialize_app(self):
- os.environ["TELEMETRY_ENABLED"] = "" # disable telemetry reporting for tests
+ # disable telemetry reporting for tests
+
+ os.environ["TELEMETRY_ENABLED"] = "false"
self.app_path.mkdir(parents=True, exist_ok=True)
if self.app_source is not None:
app_globals = self._get_globals_from_signature(self.app_source)
@@ -614,10 +617,10 @@ class AppHarness:
if self.frontend_url is None:
raise RuntimeError("Frontend is not running.")
want_headless = False
- if os.environ.get("APP_HARNESS_HEADLESS"):
+ if environment.APP_HARNESS_HEADLESS.get():
want_headless = True
if driver_clz is None:
- requested_driver = os.environ.get("APP_HARNESS_DRIVER", "Chrome")
+ requested_driver = environment.APP_HARNESS_DRIVER.get()
driver_clz = getattr(webdriver, requested_driver)
if driver_options is None:
driver_options = getattr(webdriver, f"{requested_driver}Options")()
@@ -639,7 +642,7 @@ class AppHarness:
driver_options.add_argument("headless")
if driver_options is None:
raise RuntimeError(f"Could not determine options for {driver_clz}")
- if args := os.environ.get("APP_HARNESS_DRIVER_ARGS"):
+ if args := environment.APP_HARNESS_DRIVER_ARGS.get():
for arg in args.split(","):
driver_options.add_argument(arg)
if driver_option_args is not None:
@@ -943,7 +946,7 @@ class AppHarnessProd(AppHarness):
def _start_backend(self):
if self.app_instance is None:
raise RuntimeError("App was not initialized.")
- os.environ[reflex.constants.SKIP_COMPILE_ENV_VAR] = "yes"
+ environment.REFLEX_SKIP_COMPILE.set(True)
self.backend = uvicorn.Server(
uvicorn.Config(
app=self.app_instance,
@@ -960,7 +963,7 @@ class AppHarnessProd(AppHarness):
try:
return super()._poll_for_servers(timeout)
finally:
- os.environ.pop(reflex.constants.SKIP_COMPILE_ENV_VAR, None)
+ environment.REFLEX_SKIP_COMPILE.set(None)
def stop(self):
"""Stop the frontend python webserver."""
diff --git a/reflex/utils/build.py b/reflex/utils/build.py
index 770809015..14709d99c 100644
--- a/reflex/utils/build.py
+++ b/reflex/utils/build.py
@@ -23,18 +23,6 @@ def set_env_json():
)
-def set_os_env(**kwargs):
- """Set os environment variables.
-
- Args:
- kwargs: env key word args.
- """
- for key, value in kwargs.items():
- if not value:
- continue
- os.environ[key.upper()] = value
-
-
def generate_sitemap_config(deploy_url: str, export=False):
"""Generate the sitemap config file.
diff --git a/reflex/utils/console.py b/reflex/utils/console.py
index 20c699e20..b3ba7163d 100644
--- a/reflex/utils/console.py
+++ b/reflex/utils/console.py
@@ -26,7 +26,22 @@ def set_log_level(log_level: LogLevel):
Args:
log_level: The log level to set.
+
+ Raises:
+ ValueError: If the log level is invalid.
"""
+ if not isinstance(log_level, LogLevel):
+ deprecate(
+ feature_name="Passing a string to set_log_level",
+ reason="use reflex.constants.LogLevel enum instead",
+ deprecation_version="0.6.6",
+ removal_version="0.7.0",
+ )
+ try:
+ log_level = getattr(LogLevel, log_level.upper())
+ except AttributeError as ae:
+ raise ValueError(f"Invalid log level: {log_level}") from ae
+
global _LOG_LEVEL
_LOG_LEVEL = log_level
@@ -191,7 +206,6 @@ def ask(
def progress():
"""Create a new progress bar.
-
Returns:
A new progress bar.
"""
diff --git a/reflex/utils/exceptions.py b/reflex/utils/exceptions.py
index 35f59a0e1..714dc912c 100644
--- a/reflex/utils/exceptions.py
+++ b/reflex/utils/exceptions.py
@@ -1,5 +1,7 @@
"""Custom Exceptions."""
+from typing import NoReturn
+
class ReflexError(Exception):
"""Base exception for all Reflex exceptions."""
@@ -89,12 +91,12 @@ class MatchTypeError(ReflexError, TypeError):
"""Raised when the return types of match cases are different."""
-class EventHandlerArgMismatch(ReflexError, TypeError):
- """Raised when the number of args accepted by an EventHandler is differs from that provided by the event trigger."""
+class EventHandlerArgTypeMismatch(ReflexError, TypeError):
+ """Raised when the annotations of args accepted by an EventHandler differs from the spec of the event trigger."""
class EventFnArgMismatch(ReflexError, TypeError):
- """Raised when the number of args accepted by a lambda differs from that provided by the event trigger."""
+ """Raised when the number of args required by an event handler is more than provided by the event trigger."""
class DynamicRouteArgShadowsStateVar(ReflexError, NameError):
@@ -135,3 +137,41 @@ class SetUndefinedStateVarError(ReflexError, AttributeError):
class StateSchemaMismatchError(ReflexError, TypeError):
"""Raised when the serialized schema of a state class does not match the current schema."""
+
+
+class EnvironmentVarValueError(ReflexError, ValueError):
+ """Raised when an environment variable is set to an invalid value."""
+
+
+class DynamicComponentInvalidSignature(ReflexError, TypeError):
+ """Raised when a dynamic component has an invalid signature."""
+
+
+class InvalidPropValueError(ReflexError):
+ """Raised when a prop value is invalid."""
+
+
+class StateTooLargeError(ReflexError):
+ """Raised when the state is too large to be serialized."""
+
+
+class SystemPackageMissingError(ReflexError):
+ """Raised when a system package is missing."""
+
+
+def raise_system_package_missing_error(package: str) -> NoReturn:
+ """Raise a SystemPackageMissingError.
+
+ Args:
+ package: The name of the missing system package.
+
+ Raises:
+ SystemPackageMissingError: The raised exception.
+ """
+ from reflex.constants import IS_MACOS
+
+ raise SystemPackageMissingError(
+ f"System package '{package}' is missing."
+ " Please install it through your system package manager."
+ + (f" You can do so by running 'brew install {package}'." if IS_MACOS else "")
+ )
diff --git a/reflex/utils/exec.py b/reflex/utils/exec.py
index acb69ee19..5291de095 100644
--- a/reflex/utils/exec.py
+++ b/reflex/utils/exec.py
@@ -15,7 +15,7 @@ from urllib.parse import urljoin
import psutil
from reflex import constants
-from reflex.config import get_config
+from reflex.config import environment, get_config
from reflex.constants.base import LogLevel
from reflex.utils import console, path_ops
from reflex.utils.prerequisites import get_web_dir
@@ -184,7 +184,7 @@ def should_use_granian():
Returns:
True if Granian should be used.
"""
- return os.getenv("REFLEX_USE_GRANIAN", "0") == "1"
+ return environment.REFLEX_USE_GRANIAN.get()
def get_app_module():
@@ -337,8 +337,8 @@ def run_uvicorn_backend_prod(host, port, loglevel):
app_module = get_app_module()
- RUN_BACKEND_PROD = f"gunicorn --worker-class {config.gunicorn_worker_class} --preload --timeout {config.timeout} --log-level critical".split()
- RUN_BACKEND_PROD_WINDOWS = f"uvicorn --timeout-keep-alive {config.timeout}".split()
+ RUN_BACKEND_PROD = f"gunicorn --worker-class {config.gunicorn_worker_class} --max-requests {config.gunicorn_max_requests} --max-requests-jitter {config.gunicorn_max_requests_jitter} --preload --timeout {config.timeout} --log-level critical".split()
+ RUN_BACKEND_PROD_WINDOWS = f"uvicorn --limit-max-requests {config.gunicorn_max_requests} --timeout-keep-alive {config.timeout}".split()
command = (
[
*RUN_BACKEND_PROD_WINDOWS,
@@ -369,7 +369,9 @@ def run_uvicorn_backend_prod(host, port, loglevel):
command,
run=True,
show_logs=True,
- env={constants.SKIP_COMPILE_ENV_VAR: "yes"}, # skip compile for prod backend
+ env={
+ environment.REFLEX_SKIP_COMPILE.name: "true"
+ }, # skip compile for prod backend
)
@@ -405,7 +407,7 @@ def run_granian_backend_prod(host, port, loglevel):
run=True,
show_logs=True,
env={
- constants.SKIP_COMPILE_ENV_VAR: "yes"
+ environment.REFLEX_SKIP_COMPILE.name: "true"
}, # skip compile for prod backend
)
except ImportError:
@@ -427,7 +429,7 @@ def output_system_info():
except Exception:
config_file = None
- console.rule(f"System Info")
+ console.rule("System Info")
console.debug(f"Config file: {config_file!r}")
console.debug(f"Config: {config}")
@@ -467,9 +469,11 @@ def output_system_info():
console.debug(f"{dep}")
console.debug(
- f"Using package installer at: {prerequisites.get_install_package_manager()}" # type: ignore
+ f"Using package installer at: {prerequisites.get_install_package_manager(on_failure_return_none=True)}" # type: ignore
)
- console.debug(f"Using package executer at: {prerequisites.get_package_manager()}") # type: ignore
+ console.debug(
+ f"Using package executer at: {prerequisites.get_package_manager(on_failure_return_none=True)}"
+ ) # type: ignore
if system != "Windows":
console.debug(f"Unzip path: {path_ops.which('unzip')}")
@@ -489,11 +493,38 @@ def is_prod_mode() -> bool:
Returns:
True if the app is running in production mode or False if running in dev mode.
"""
- current_mode = os.environ.get(
- constants.ENV_MODE_ENV_VAR,
- constants.Env.DEV.value,
+ current_mode = environment.REFLEX_ENV_MODE.get()
+ return current_mode == constants.Env.PROD
+
+
+def is_frontend_only() -> bool:
+ """Check if the app is running in frontend-only mode.
+
+ Returns:
+ True if the app is running in frontend-only mode.
+ """
+ console.deprecate(
+ "is_frontend_only() is deprecated and will be removed in a future release.",
+ reason="Use `environment.REFLEX_FRONTEND_ONLY.get()` instead.",
+ deprecation_version="0.6.5",
+ removal_version="0.7.0",
)
- return current_mode == constants.Env.PROD.value
+ return environment.REFLEX_FRONTEND_ONLY.get()
+
+
+def is_backend_only() -> bool:
+ """Check if the app is running in backend-only mode.
+
+ Returns:
+ True if the app is running in backend-only mode.
+ """
+ console.deprecate(
+ "is_backend_only() is deprecated and will be removed in a future release.",
+ reason="Use `environment.REFLEX_BACKEND_ONLY.get()` instead.",
+ deprecation_version="0.6.5",
+ removal_version="0.7.0",
+ )
+ return environment.REFLEX_BACKEND_ONLY.get()
def should_skip_compile() -> bool:
@@ -502,4 +533,10 @@ def should_skip_compile() -> bool:
Returns:
True if the app should skip compile.
"""
- return os.environ.get(constants.SKIP_COMPILE_ENV_VAR) == "yes"
+ console.deprecate(
+ "should_skip_compile() is deprecated and will be removed in a future release.",
+ reason="Use `environment.REFLEX_SKIP_COMPILE.get()` instead.",
+ deprecation_version="0.6.5",
+ removal_version="0.7.0",
+ )
+ return environment.REFLEX_SKIP_COMPILE.get()
diff --git a/reflex/utils/format.py b/reflex/utils/format.py
index 65c0f049b..1b3d1740f 100644
--- a/reflex/utils/format.py
+++ b/reflex/utils/format.py
@@ -6,15 +6,16 @@ import inspect
import json
import os
import re
-from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union
+from typing import TYPE_CHECKING, Any, List, Optional, Union
from reflex import constants
+from reflex.constants.state import FRONTEND_EVENT_STATE
from reflex.utils import exceptions
from reflex.utils.console import deprecate
if TYPE_CHECKING:
from reflex.components.component import ComponentStyle
- from reflex.event import ArgsSpec, EventChain, EventHandler, EventSpec
+ from reflex.event import ArgsSpec, EventChain, EventHandler, EventSpec, EventType
WRAP_MAP = {
"{": "}",
@@ -197,8 +198,16 @@ def make_default_page_title(app_name: str, route: str) -> str:
Returns:
The default page title.
"""
- title = constants.DefaultPage.TITLE.format(app_name, route)
- return to_title_case(title, " ")
+ route_parts = [
+ part
+ for part in route.split("/")
+ if part and not (part.startswith("[") and part.endswith("]"))
+ ]
+
+ title = constants.DefaultPage.TITLE.format(
+ app_name, route_parts[-1] if route_parts else constants.PageNames.INDEX_ROUTE
+ )
+ return to_title_case(title)
def _escape_js_string(string: str) -> str:
@@ -431,7 +440,7 @@ def get_event_handler_parts(handler: EventHandler) -> tuple[str, str]:
from reflex.state import State
- if state_full_name == "state" and name not in State.__dict__:
+ if state_full_name == FRONTEND_EVENT_STATE and name not in State.__dict__:
return ("", to_snake_case(handler.fn.__qualname__))
return (state_full_name, name)
@@ -525,13 +534,7 @@ def format_event_chain(
def format_queue_events(
- events: (
- EventSpec
- | EventHandler
- | Callable
- | List[EventSpec | EventHandler | Callable]
- | None
- ) = None,
+ events: EventType | None = None,
args_spec: Optional[ArgsSpec] = None,
) -> Var[EventChain]:
"""Format a list of event handler / event spec as a javascript callback.
diff --git a/reflex/utils/imports.py b/reflex/utils/imports.py
index 8f53ed07a..bd422ecc0 100644
--- a/reflex/utils/imports.py
+++ b/reflex/utils/imports.py
@@ -23,6 +23,12 @@ def merge_imports(
for lib, fields in (
import_dict if isinstance(import_dict, tuple) else import_dict.items()
):
+ # If the lib is an absolute path, we need to prefix it with a $
+ lib = (
+ "$" + lib
+ if lib.startswith(("/utils/", "/components/", "/styles/", "/public/"))
+ else lib
+ )
if isinstance(fields, (list, tuple, set)):
all_imports[lib].extend(
(
diff --git a/reflex/utils/net.py b/reflex/utils/net.py
index 83e25559c..acc202912 100644
--- a/reflex/utils/net.py
+++ b/reflex/utils/net.py
@@ -1,9 +1,8 @@
"""Helpers for downloading files from the network."""
-import os
-
import httpx
+from ..config import environment
from . import console
@@ -13,8 +12,7 @@ def _httpx_verify_kwarg() -> bool:
Returns:
True if SSL verification is enabled, False otherwise
"""
- ssl_no_verify = os.environ.get("SSL_NO_VERIFY", "").lower() in ["true", "1", "yes"]
- return not ssl_no_verify
+ return not environment.SSL_NO_VERIFY.get()
def get(url: str, **kwargs) -> httpx.Response:
diff --git a/reflex/utils/path_ops.py b/reflex/utils/path_ops.py
index f795e1aa4..a2ba2b151 100644
--- a/reflex/utils/path_ops.py
+++ b/reflex/utils/path_ops.py
@@ -9,6 +9,7 @@ import shutil
from pathlib import Path
from reflex import constants
+from reflex.config import environment
# Shorthand for join.
join = os.linesep.join
@@ -129,30 +130,13 @@ def which(program: str | Path) -> str | Path | None:
return shutil.which(str(program))
-def use_system_install(var_name: str) -> bool:
- """Check if the system install should be used.
-
- Args:
- var_name: The name of the environment variable.
-
- Raises:
- ValueError: If the variable name is invalid.
-
- Returns:
- Whether the associated env var should use the system install.
- """
- if not var_name.startswith("REFLEX_USE_SYSTEM_"):
- raise ValueError("Invalid system install variable name.")
- return os.getenv(var_name, "").lower() in ["true", "1", "yes"]
-
-
def use_system_node() -> bool:
"""Check if the system node should be used.
Returns:
Whether the system node should be used.
"""
- return use_system_install(constants.Node.USE_SYSTEM_VAR)
+ return environment.REFLEX_USE_SYSTEM_NODE.get()
def use_system_bun() -> bool:
@@ -161,7 +145,7 @@ def use_system_bun() -> bool:
Returns:
Whether the system bun should be used.
"""
- return use_system_install(constants.Bun.USE_SYSTEM_VAR)
+ return environment.REFLEX_USE_SYSTEM_BUN.get()
def get_node_bin_path() -> Path | None:
diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py
index 44d1f6acc..cc56bdf88 100644
--- a/reflex/utils/prerequisites.py
+++ b/reflex/utils/prerequisites.py
@@ -33,9 +33,12 @@ from redis.asyncio import Redis
from reflex import constants, model
from reflex.compiler import templates
-from reflex.config import Config, get_config
-from reflex.utils import console, net, path_ops, processes
-from reflex.utils.exceptions import GeneratedCodeHasNoFunctionDefs
+from reflex.config import Config, environment, get_config
+from reflex.utils import console, net, path_ops, processes, redir
+from reflex.utils.exceptions import (
+ GeneratedCodeHasNoFunctionDefs,
+ raise_system_package_missing_error,
+)
from reflex.utils.format import format_library_name
from reflex.utils.registry import _get_npm_registry
@@ -69,8 +72,7 @@ def get_web_dir() -> Path:
Returns:
The working directory.
"""
- workdir = Path(os.getenv("REFLEX_WEB_WORKDIR", constants.Dirs.WEB))
- return workdir
+ return environment.REFLEX_WEB_WORKDIR.get()
def _python_version_check():
@@ -91,6 +93,8 @@ def check_latest_package_version(package_name: str):
Args:
package_name: The name of the package.
"""
+ if environment.REFLEX_CHECK_LATEST_VERSION.get() is False:
+ return
try:
# Get the latest version from PyPI
current_version = importlib.metadata.version(package_name)
@@ -205,10 +209,13 @@ def get_bun_version() -> version.Version | None:
return None
-def get_install_package_manager() -> str | None:
+def get_install_package_manager(on_failure_return_none: bool = False) -> str | None:
"""Get the package manager executable for installation.
Currently, bun is used for installation only.
+ Args:
+ on_failure_return_none: Whether to return None on failure.
+
Returns:
The path to the package manager.
"""
@@ -218,21 +225,29 @@ def get_install_package_manager() -> str | None:
or windows_check_onedrive_in_path()
or windows_npm_escape_hatch()
):
- return get_package_manager()
+ return get_package_manager(on_failure_return_none)
return str(get_config().bun_path)
-def get_package_manager() -> str | None:
+def get_package_manager(on_failure_return_none: bool = False) -> str | None:
"""Get the package manager executable for running app.
Currently on unix systems, npm is used for running the app only.
+ Args:
+ on_failure_return_none: Whether to return None on failure.
+
Returns:
The path to the package manager.
+
+ Raises:
+ FileNotFoundError: If the package manager is not found.
"""
npm_path = path_ops.get_npm_path()
if npm_path is not None:
- npm_path = str(Path(npm_path).resolve())
- return npm_path
+ return str(Path(npm_path).resolve())
+ if on_failure_return_none:
+ return None
+ raise FileNotFoundError("NPM not found. You may need to run `reflex init`.")
def windows_check_onedrive_in_path() -> bool:
@@ -250,7 +265,7 @@ def windows_npm_escape_hatch() -> bool:
Returns:
If the user has set REFLEX_USE_NPM.
"""
- return os.environ.get("REFLEX_USE_NPM", "").lower() in ["true", "1", "yes"]
+ return environment.REFLEX_USE_NPM.get()
def get_app(reload: bool = False) -> ModuleType:
@@ -268,7 +283,7 @@ def get_app(reload: bool = False) -> ModuleType:
from reflex.utils import telemetry
try:
- os.environ[constants.RELOAD_CONFIG] = str(reload)
+ environment.RELOAD_CONFIG.set(reload)
config = get_config()
if not config.app_name:
raise RuntimeError(
@@ -431,7 +446,7 @@ def create_config(app_name: str):
def initialize_gitignore(
gitignore_file: Path = constants.GitIgnore.FILE,
- files_to_ignore: set[str] = constants.GitIgnore.DEFAULTS,
+ files_to_ignore: set[str] | list[str] = constants.GitIgnore.DEFAULTS,
):
"""Initialize the template .gitignore file.
@@ -440,23 +455,20 @@ def initialize_gitignore(
files_to_ignore: The files to add to the .gitignore file.
"""
# Combine with the current ignored files.
- current_ignore: set[str] = set()
+ current_ignore: list[str] = []
if gitignore_file.exists():
- current_ignore |= set(
- line.strip() for line in gitignore_file.read_text().splitlines()
- )
+ current_ignore = [ln.strip() for ln in gitignore_file.read_text().splitlines()]
if files_to_ignore == current_ignore:
console.debug(f"{gitignore_file} already up to date.")
return
- files_to_ignore |= current_ignore
+ files_to_ignore = [ln for ln in files_to_ignore if ln not in current_ignore]
+ files_to_ignore += current_ignore
# Write files to the .gitignore file.
gitignore_file.touch(exist_ok=True)
console.debug(f"Creating {gitignore_file}")
- gitignore_file.write_text(
- "\n".join(sorted(files_to_ignore)) + "\n",
- )
+ gitignore_file.write_text("\n".join(files_to_ignore) + "\n")
def initialize_requirements_txt():
@@ -588,6 +600,8 @@ def initialize_web_directory():
initialize_package_json()
+ initialize_bun_config()
+
path_ops.mkdir(get_web_dir() / constants.Dirs.PUBLIC)
update_next_config()
@@ -612,17 +626,21 @@ def _compile_package_json():
def initialize_package_json():
"""Render and write in .web the package.json file."""
output_path = get_web_dir() / constants.PackageJson.PATH
- code = _compile_package_json()
- output_path.write_text(code)
+ output_path.write_text(_compile_package_json())
- best_registry = _get_npm_registry()
+
+def initialize_bun_config():
+ """Initialize the bun config file."""
bun_config_path = get_web_dir() / constants.Bun.CONFIG_PATH
- bun_config_path.write_text(
- f"""
-[install]
-registry = "{best_registry}"
-"""
- )
+
+ if (custom_bunfig := Path(constants.Bun.CONFIG_PATH)).exists():
+ bunfig_content = custom_bunfig.read_text()
+ console.info(f"Copying custom bunfig.toml inside {get_web_dir()} folder")
+ else:
+ best_registry = _get_npm_registry()
+ bunfig_content = constants.Bun.DEFAULT_CONFIG.format(registry=best_registry)
+
+ bun_config_path.write_text(bunfig_content)
def init_reflex_json(project_hash: int | None):
@@ -678,6 +696,7 @@ def _update_next_config(
"compress": config.next_compression,
"reactStrictMode": config.react_strict_mode,
"trailingSlash": True,
+ "staticPageGenerationTimeout": config.static_page_generation_timeout,
}
if transpile_packages:
next_config["transpilePackages"] = list(
@@ -812,11 +831,7 @@ def install_node():
def install_bun():
- """Install bun onto the user's system.
-
- Raises:
- FileNotFoundError: If required packages are not found.
- """
+ """Install bun onto the user's system."""
win_supported = is_windows_bun_supported()
one_drive_in_path = windows_check_onedrive_in_path()
if constants.IS_WINDOWS and not win_supported or one_drive_in_path:
@@ -855,7 +870,7 @@ def install_bun():
else:
unzip_path = path_ops.which("unzip")
if unzip_path is None:
- raise FileNotFoundError("Reflex requires unzip to be installed.")
+ raise_system_package_missing_error("unzip")
# Run the bun install script.
download_and_run(
@@ -920,20 +935,39 @@ def install_frontend_packages(packages: set[str], config: Config):
packages: A list of package names to be installed.
config: The config object.
+ Raises:
+ FileNotFoundError: If the package manager is not found.
+
Example:
>>> install_frontend_packages(["react", "react-dom"], get_config())
"""
# unsupported archs(arm and 32bit machines) will use npm anyway. so we dont have to run npm twice
fallback_command = (
- get_package_manager()
- if not constants.IS_WINDOWS
- or constants.IS_WINDOWS
- and is_windows_bun_supported()
- and not windows_check_onedrive_in_path()
+ get_package_manager(on_failure_return_none=True)
+ if (
+ not constants.IS_WINDOWS
+ or constants.IS_WINDOWS
+ and is_windows_bun_supported()
+ and not windows_check_onedrive_in_path()
+ )
else None
)
+
+ install_package_manager = (
+ get_install_package_manager(on_failure_return_none=True) or fallback_command
+ )
+
+ if install_package_manager is None:
+ raise FileNotFoundError(
+ "Could not find a package manager to install frontend packages. You may need to run `reflex init`."
+ )
+
+ fallback_command = (
+ fallback_command if fallback_command is not install_package_manager else None
+ )
+
processes.run_process_with_fallback(
- [get_install_package_manager(), "install"], # type: ignore
+ [install_package_manager, "install"], # type: ignore
fallback=fallback_command,
analytics_enabled=True,
show_status_message="Installing base frontend packages",
@@ -944,7 +978,7 @@ def install_frontend_packages(packages: set[str], config: Config):
if config.tailwind is not None:
processes.run_process_with_fallback(
[
- get_install_package_manager(),
+ install_package_manager,
"add",
"-d",
constants.Tailwind.VERSION,
@@ -960,7 +994,7 @@ def install_frontend_packages(packages: set[str], config: Config):
# Install custom packages defined in frontend_packages
if len(packages) > 0:
processes.run_process_with_fallback(
- [get_install_package_manager(), "add", *packages],
+ [install_package_manager, "add", *packages],
fallback=fallback_command,
analytics_enabled=True,
show_status_message="Installing frontend packages from config and components",
@@ -992,7 +1026,7 @@ def needs_reinit(frontend: bool = True) -> bool:
return False
# Make sure the .reflex directory exists.
- if not constants.Reflex.DIR.exists():
+ if not environment.REFLEX_DIR.get().exists():
return True
# Make sure the .web directory exists in frontend mode.
@@ -1097,7 +1131,7 @@ def ensure_reflex_installation_id() -> Optional[int]:
"""
try:
initialize_reflex_user_directory()
- installation_id_file = constants.Reflex.DIR / "installation_id"
+ installation_id_file = environment.REFLEX_DIR.get() / "installation_id"
installation_id = None
if installation_id_file.exists():
@@ -1122,7 +1156,7 @@ def ensure_reflex_installation_id() -> Optional[int]:
def initialize_reflex_user_directory():
"""Initialize the reflex user directory."""
# Create the reflex directory.
- path_ops.mkdir(constants.Reflex.DIR)
+ path_ops.mkdir(environment.REFLEX_DIR.get())
def initialize_frontend_dependencies():
@@ -1145,7 +1179,10 @@ def check_db_initialized() -> bool:
Returns:
True if alembic is initialized (or if database is not used).
"""
- if get_config().db_url is not None and not Path(constants.ALEMBIC_CONFIG).exists():
+ if (
+ get_config().db_url is not None
+ and not environment.ALEMBIC_CONFIG.get().exists()
+ ):
console.error(
"Database is not initialized. Run [bold]reflex db init[/bold] first."
)
@@ -1155,7 +1192,7 @@ def check_db_initialized() -> bool:
def check_schema_up_to_date():
"""Check if the sqlmodel metadata matches the current database schema."""
- if get_config().db_url is None or not Path(constants.ALEMBIC_CONFIG).exists():
+ if get_config().db_url is None or not environment.ALEMBIC_CONFIG.get().exists():
return
with model.Model.get_db_engine().connect() as connection:
try:
@@ -1174,7 +1211,7 @@ def check_schema_up_to_date():
)
-def prompt_for_template(templates: list[Template]) -> str:
+def prompt_for_template_options(templates: list[Template]) -> str:
"""Prompt the user to specify a template.
Args:
@@ -1186,9 +1223,14 @@ def prompt_for_template(templates: list[Template]) -> str:
# Show the user the URLs of each template to preview.
console.print("\nGet started with a template:")
+ def format_demo_url_str(url: str) -> str:
+ return f" ({url})" if url else ""
+
# Prompt the user to select a template.
id_to_name = {
- str(idx): f"{template.name} ({template.demo_url}) - {template.description}"
+ str(
+ idx
+ ): f"{template.name.replace('_', ' ').replace('-', ' ')}{format_demo_url_str(template.demo_url)} - {template.description}"
for idx, template in enumerate(templates)
}
for id in range(len(id_to_name)):
@@ -1343,15 +1385,119 @@ def create_config_init_app_from_remote_template(app_name: str, template_url: str
shutil.rmtree(unzip_dir)
-def initialize_app(app_name: str, template: str | None = None):
+def initialize_default_app(app_name: str):
+ """Initialize the default app.
+
+ Args:
+ app_name: The name of the app.
+ """
+ create_config(app_name)
+ initialize_app_directory(app_name)
+
+
+def validate_and_create_app_using_remote_template(app_name, template, templates):
+ """Validate and create an app using a remote template.
+
+ Args:
+ app_name: The name of the app.
+ template: The name of the template.
+ templates: The available templates.
+
+ Raises:
+ Exit: If the template is not found.
+ """
+ # If user selects a template, it needs to exist.
+ if template in templates:
+ from reflex_cli.v2.utils import hosting
+
+ authenticated_token = hosting.authenticated_token()
+ if not authenticated_token or not authenticated_token[0]:
+ console.print(
+ f"Please use `reflex login` to access the '{template}' template."
+ )
+ raise typer.Exit(3)
+
+ template_url = templates[template].code_url
+ else:
+ # Check if the template is a github repo.
+ if template.startswith("https://github.com"):
+ template_url = f"{template.strip('/').replace('.git', '')}/archive/main.zip"
+ else:
+ console.error(f"Template `{template}` not found or invalid.")
+ raise typer.Exit(1)
+
+ if template_url is None:
+ return
+
+ create_config_init_app_from_remote_template(
+ app_name=app_name, template_url=template_url
+ )
+
+
+def generate_template_using_ai(template: str | None = None) -> str:
+ """Generate a template using AI(Flexgen).
+
+ Args:
+ template: The name of the template.
+
+ Returns:
+ The generation hash.
+
+ Raises:
+ Exit: If the template and ai flags are used.
+ """
+ if template is None:
+ # If AI is requested and no template specified, redirect the user to reflex.build.
+ return redir.reflex_build_redirect()
+ elif is_generation_hash(template):
+ # Otherwise treat the template as a generation hash.
+ return template
+ else:
+ console.error(
+ "Cannot use `--template` option with `--ai` option. Please remove `--template` option."
+ )
+ raise typer.Exit(2)
+
+
+def fetch_remote_templates(
+ template: str,
+) -> tuple[str, dict[str, Template]]:
+ """Fetch the available remote templates.
+
+ Args:
+ template: The name of the template.
+
+ Returns:
+ The selected template and the available templates.
+ """
+ available_templates = {}
+
+ try:
+ # Get the available templates
+ available_templates = fetch_app_templates(constants.Reflex.VERSION)
+ except Exception as e:
+ console.warn("Failed to fetch templates. Falling back to default template.")
+ console.debug(f"Error while fetching templates: {e}")
+ template = constants.Templates.DEFAULT
+
+ return template, available_templates
+
+
+def initialize_app(
+ app_name: str, template: str | None = None, ai: bool = False
+) -> str | None:
"""Initialize the app either from a remote template or a blank app. If the config file exists, it is considered as reinit.
Args:
app_name: The name of the app.
template: The name of the template to use.
+ ai: Whether to use AI to generate the template.
+
+ Returns:
+ The name of the template.
Raises:
- Exit: If template is directly provided in the command flag and is invalid.
+ Exit: If the template is not valid or unspecified.
"""
# Local imports to avoid circular imports.
from reflex.utils import telemetry
@@ -1361,52 +1507,75 @@ def initialize_app(app_name: str, template: str | None = None):
telemetry.send("reinit")
return
+ generation_hash = None
+ if ai:
+ generation_hash = generate_template_using_ai(template)
+ template = constants.Templates.DEFAULT
+
templates: dict[str, Template] = {}
# Don't fetch app templates if the user directly asked for DEFAULT.
- if template is None or (template != constants.Templates.DEFAULT):
- try:
- # Get the available templates
- templates = fetch_app_templates(constants.Reflex.VERSION)
- if template is None and len(templates) > 0:
- template = prompt_for_template(list(templates.values()))
- except Exception as e:
- console.warn("Failed to fetch templates. Falling back to default template.")
- console.debug(f"Error while fetching templates: {e}")
- finally:
- template = template or constants.Templates.DEFAULT
+ if template is not None and (template not in (constants.Templates.DEFAULT,)):
+ template, templates = fetch_remote_templates(template)
+
+ if template is None:
+ template = prompt_for_template_options(get_init_cli_prompt_options())
+ if template == constants.Templates.AI:
+ generation_hash = generate_template_using_ai()
+ # change to the default to allow creation of default app
+ template = constants.Templates.DEFAULT
+ elif template == constants.Templates.CHOOSE_TEMPLATES:
+ console.print(
+ f"Go to the templates page ({constants.Templates.REFLEX_TEMPLATES_URL}) and copy the command to init with a template."
+ )
+ raise typer.Exit(0)
# If the blank template is selected, create a blank app.
- if template == constants.Templates.DEFAULT:
+ if template in (constants.Templates.DEFAULT,):
# Default app creation behavior: a blank app.
- create_config(app_name)
- initialize_app_directory(app_name)
+ initialize_default_app(app_name)
else:
- # Fetch App templates from the backend server.
- console.debug(f"Available templates: {templates}")
-
- # If user selects a template, it needs to exist.
- if template in templates:
- template_url = templates[template].code_url
- else:
- # Check if the template is a github repo.
- if template.startswith("https://github.com"):
- template_url = (
- f"{template.strip('/').replace('.git', '')}/archive/main.zip"
- )
- else:
- console.error(f"Template `{template}` not found.")
- raise typer.Exit(1)
-
- if template_url is None:
- return
-
- create_config_init_app_from_remote_template(
- app_name=app_name, template_url=template_url
+ validate_and_create_app_using_remote_template(
+ app_name=app_name, template=template, templates=templates
)
+ # If a reflex.build generation hash is available, download the code and apply it to the main module.
+ if generation_hash:
+ initialize_main_module_index_from_generation(
+ app_name, generation_hash=generation_hash
+ )
telemetry.send("init", template=template)
+ return template
+
+
+def get_init_cli_prompt_options() -> list[Template]:
+ """Get the CLI options for initializing a Reflex app.
+
+ Returns:
+ The CLI options.
+ """
+ return [
+ Template(
+ name=constants.Templates.DEFAULT,
+ description="A blank Reflex app.",
+ demo_url=constants.Templates.DEFAULT_TEMPLATE_URL,
+ code_url="",
+ ),
+ Template(
+ name=constants.Templates.AI,
+ description="Generate a template using AI [Experimental]",
+ demo_url="",
+ code_url="",
+ ),
+ Template(
+ name=constants.Templates.CHOOSE_TEMPLATES,
+ description="Choose an existing template.",
+ demo_url="",
+ code_url="",
+ ),
+ ]
+
def initialize_main_module_index_from_generation(app_name: str, generation_hash: str):
"""Overwrite the `index` function in the main module with reflex.build generated code.
diff --git a/reflex/utils/pyi_generator.py b/reflex/utils/pyi_generator.py
index fd76576b9..fb0a8f8c5 100644
--- a/reflex/utils/pyi_generator.py
+++ b/reflex/utils/pyi_generator.py
@@ -16,7 +16,7 @@ from itertools import chain
from multiprocessing import Pool, cpu_count
from pathlib import Path
from types import ModuleType, SimpleNamespace
-from typing import Any, Callable, Iterable, Type, get_args
+from typing import Any, Callable, Iterable, Sequence, Type, get_args, get_origin
from reflex.components.component import Component
from reflex.utils import types as rx_types
@@ -70,7 +70,14 @@ DEFAULT_TYPING_IMPORTS = {
DEFAULT_IMPORTS = {
"typing": sorted(DEFAULT_TYPING_IMPORTS),
"reflex.components.core.breakpoints": ["Breakpoints"],
- "reflex.event": ["EventChain", "EventHandler", "EventSpec", "EventType"],
+ "reflex.event": [
+ "EventChain",
+ "EventHandler",
+ "EventSpec",
+ "EventType",
+ "BASE_STATE",
+ "KeyInputInfo",
+ ],
"reflex.style": ["Style"],
"reflex.vars.base": ["Var"],
}
@@ -214,7 +221,9 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str:
return res
-def _generate_imports(typing_imports: Iterable[str]) -> list[ast.ImportFrom]:
+def _generate_imports(
+ typing_imports: Iterable[str],
+) -> list[ast.ImportFrom | ast.Import]:
"""Generate the import statements for the stub file.
Args:
@@ -228,6 +237,7 @@ def _generate_imports(typing_imports: Iterable[str]) -> list[ast.ImportFrom]:
ast.ImportFrom(module=name, names=[ast.alias(name=val) for val in values])
for name, values in DEFAULT_IMPORTS.items()
],
+ ast.Import([ast.alias("reflex")]),
]
@@ -372,6 +382,64 @@ def _extract_class_props_as_ast_nodes(
return kwargs
+def type_to_ast(typ, cls: type) -> ast.AST:
+ """Converts any type annotation into its AST representation.
+ Handles nested generic types, unions, etc.
+
+ Args:
+ typ: The type annotation to convert.
+ cls: The class where the type annotation is used.
+
+ Returns:
+ The AST representation of the type annotation.
+ """
+ if typ is type(None):
+ return ast.Name(id="None")
+
+ origin = get_origin(typ)
+
+ # Handle plain types (int, str, custom classes, etc.)
+ if origin is None:
+ if hasattr(typ, "__name__"):
+ if typ.__module__.startswith("reflex."):
+ typ_parts = typ.__module__.split(".")
+ cls_parts = cls.__module__.split(".")
+
+ zipped = list(zip(typ_parts, cls_parts, strict=False))
+
+ if all(a == b for a, b in zipped) and len(typ_parts) == len(cls_parts):
+ return ast.Name(id=typ.__name__)
+
+ return ast.Name(id=typ.__module__ + "." + typ.__name__)
+ return ast.Name(id=typ.__name__)
+ elif hasattr(typ, "_name"):
+ return ast.Name(id=typ._name)
+ return ast.Name(id=str(typ))
+
+ # Get the base type name (List, Dict, Optional, etc.)
+ base_name = origin._name if hasattr(origin, "_name") else origin.__name__
+
+ # Get type arguments
+ args = get_args(typ)
+
+ # Handle empty type arguments
+ if not args:
+ return ast.Name(id=base_name)
+
+ # Convert all type arguments recursively
+ arg_nodes = [type_to_ast(arg, cls) for arg in args]
+
+ # Special case for single-argument types (like List[T] or Optional[T])
+ if len(arg_nodes) == 1:
+ slice_value = arg_nodes[0]
+ else:
+ slice_value = ast.Tuple(elts=arg_nodes, ctx=ast.Load())
+
+ return ast.Subscript(
+ value=ast.Name(id=base_name), slice=ast.Index(value=slice_value), ctx=ast.Load()
+ )
+
+
def _get_parent_imports(func):
_imports = {"reflex.vars": ["Var"]}
for type_hint in inspect.get_annotations(func).values():
@@ -429,14 +497,39 @@ def _generate_component_create_functiondef(
def figure_out_return_type(annotation: Any):
if inspect.isclass(annotation) and issubclass(annotation, inspect._empty):
- return ast.Name(id="Optional[EventType]")
+ return ast.Name(id="EventType[..., BASE_STATE]")
+
+ if not isinstance(annotation, str) and get_origin(annotation) is tuple:
+ arguments = get_args(annotation)
+
+ arguments_without_var = [
+ get_args(argument)[0] if get_origin(argument) == Var else argument
+ for argument in arguments
+ ]
+
+ # Convert each argument type to its AST representation
+ type_args = [type_to_ast(arg, cls=clz) for arg in arguments_without_var]
+
+ # Get all prefixes of the type arguments
+ all_count_args_type = [
+ ast.Name(
+ f"EventType[[{', '.join([ast.unparse(arg) for arg in type_args[:i]])}], BASE_STATE]"
+ )
+ for i in range(len(type_args) + 1)
+ ]
+
+ # Create EventType using the joined string
+ return ast.Name(
+ id=f"Union[{', '.join(map(ast.unparse, all_count_args_type))}]"
+ )
+
if isinstance(annotation, str) and annotation.startswith("Tuple["):
inside_of_tuple = annotation.removeprefix("Tuple[").removesuffix("]")
if inside_of_tuple == "()":
- return ast.Name(id="Optional[EventType[[]]]")
+ return ast.Name(id="EventType[[], BASE_STATE]")
- arguments: list[str] = [""]
+ arguments = [""]
bracket_count = 0
@@ -460,10 +553,17 @@ def _generate_component_create_functiondef(
for argument in arguments
]
+ all_count_args_type = [
+ ast.Name(
+ f"EventType[[{', '.join(arguments_without_var[:i])}], BASE_STATE]"
+ )
+ for i in range(len(arguments) + 1)
+ ]
+
return ast.Name(
- id=f"Optional[EventType[{', '.join(arguments_without_var)}]]"
+ id=f"Union[{', '.join(map(ast.unparse, all_count_args_type))}]"
)
- return ast.Name(id="Optional[EventType]")
+ return ast.Name(id="EventType[..., BASE_STATE]")
event_triggers = clz().get_event_triggers()
@@ -472,14 +572,40 @@ def _generate_component_create_functiondef(
(
ast.arg(
arg=trigger,
- annotation=figure_out_return_type(
- inspect.signature(event_triggers[trigger]).return_annotation
+ annotation=ast.Subscript(
+ ast.Name("Optional"),
+ ast.Index( # type: ignore
+ value=ast.Name(
+ id=ast.unparse(
+ figure_out_return_type(
+ inspect.signature(event_specs).return_annotation
+ )
+ if not isinstance(
+ event_specs := event_triggers[trigger], Sequence
+ )
+ else ast.Subscript(
+ ast.Name("Union"),
+ ast.Tuple(
+ [
+ figure_out_return_type(
+ inspect.signature(
+ event_spec
+ ).return_annotation
+ )
+ for event_spec in event_specs
+ ]
+ ),
+ )
+ )
+ )
+ ),
),
),
ast.Constant(value=None),
)
for trigger in sorted(event_triggers)
)
+
logger.debug(f"Generated {clz.__name__}.create method with {len(kwargs)} kwargs")
create_args = ast.arguments(
args=[ast.arg(arg="cls")],
@@ -490,12 +616,17 @@ def _generate_component_create_functiondef(
kwarg=ast.arg(arg="props"),
defaults=[],
)
+
definition = ast.FunctionDef(
name="create",
args=create_args,
body=[
ast.Expr(
- value=ast.Constant(value=_generate_docstrings(all_classes, all_props))
+ value=ast.Constant(
+ value=_generate_docstrings(
+ all_classes, [*all_props, *event_triggers]
+ )
+ ),
),
ast.Expr(
value=ast.Ellipsis(),
diff --git a/reflex/utils/redir.py b/reflex/utils/redir.py
index 1dbd989e9..b35cbe26e 100644
--- a/reflex/utils/redir.py
+++ b/reflex/utils/redir.py
@@ -10,6 +10,18 @@ from .. import constants
from . import console
+def open_browser(target_url: str) -> None:
+ """Open a browser window to target_url.
+
+ Args:
+ target_url: The URL to open in the browser.
+ """
+ if not webbrowser.open(target_url):
+ console.warn(
+ f"Unable to automatically open the browser. Please navigate to {target_url} in your browser."
+ )
+
+
def open_browser_and_wait(
target_url: str, poll_url: str, interval: int = 2
) -> httpx.Response:
@@ -23,10 +35,7 @@ def open_browser_and_wait(
Returns:
The response from the poll_url.
"""
- if not webbrowser.open(target_url):
- console.warn(
- f"Unable to automatically open the browser. Please navigate to {target_url} in your browser."
- )
+ open_browser(target_url)
console.info("[b]Complete the workflow in the browser to continue.[/b]")
while True:
try:
diff --git a/reflex/utils/registry.py b/reflex/utils/registry.py
index 6b87c163d..d98178c61 100644
--- a/reflex/utils/registry.py
+++ b/reflex/utils/registry.py
@@ -1,9 +1,8 @@
"""Utilities for working with registries."""
-import os
-
import httpx
+from reflex.config import environment
from reflex.utils import console, net
@@ -56,7 +55,4 @@ def _get_npm_registry() -> str:
Returns:
str:
"""
- if npm_registry := os.environ.get("NPM_CONFIG_REGISTRY", ""):
- return npm_registry
- else:
- return get_best_registry()
+ return environment.NPM_CONFIG_REGISTRY.get() or get_best_registry()
diff --git a/reflex/utils/serializers.py b/reflex/utils/serializers.py
index 614257181..4bb8dea92 100644
--- a/reflex/utils/serializers.py
+++ b/reflex/utils/serializers.py
@@ -18,6 +18,7 @@ from typing import (
Set,
Tuple,
Type,
+ TypeVar,
Union,
get_type_hints,
overload,
@@ -32,17 +33,33 @@ from reflex.utils import types
SerializedType = Union[str, bool, int, float, list, dict, None]
-Serializer = Callable[[Type], SerializedType]
+Serializer = Callable[[Any], SerializedType]
SERIALIZERS: dict[Type, Serializer] = {}
SERIALIZER_TYPES: dict[Type, Type] = {}
+SERIALIZED_FUNCTION = TypeVar("SERIALIZED_FUNCTION", bound=Serializer)
+
+
+@overload
+def serializer(
+ fn: None = None,
+ to: Type[SerializedType] | None = None,
+) -> Callable[[SERIALIZED_FUNCTION], SERIALIZED_FUNCTION]: ...
+
+
+@overload
+def serializer(
+ fn: SERIALIZED_FUNCTION,
+ to: Type[SerializedType] | None = None,
+) -> SERIALIZED_FUNCTION: ...
+
def serializer(
- fn: Serializer | None = None,
- to: Type | None = None,
-) -> Serializer:
+ fn: SERIALIZED_FUNCTION | None = None,
+ to: Any = None,
+) -> SERIALIZED_FUNCTION | Callable[[SERIALIZED_FUNCTION], SERIALIZED_FUNCTION]:
"""Decorator to add a serializer for a given type.
Args:
@@ -51,43 +68,44 @@ def serializer(
Returns:
The decorated function.
-
- Raises:
- ValueError: If the function does not take a single argument.
"""
- if fn is None:
- # If the function is not provided, return a partial that acts as a decorator.
- return functools.partial(serializer, to=to) # type: ignore
- # Check the type hints to get the type of the argument.
- type_hints = get_type_hints(fn)
- args = [arg for arg in type_hints if arg != "return"]
+ def wrapper(fn: SERIALIZED_FUNCTION) -> SERIALIZED_FUNCTION:
+ # Check the type hints to get the type of the argument.
+ type_hints = get_type_hints(fn)
+ args = [arg for arg in type_hints if arg != "return"]
- # Make sure the function takes a single argument.
- if len(args) != 1:
- raise ValueError("Serializer must take a single argument.")
+ # Make sure the function takes a single argument.
+ if len(args) != 1:
+ raise ValueError("Serializer must take a single argument.")
- # Get the type of the argument.
- type_ = type_hints[args[0]]
+ # Get the type of the argument.
+ type_ = type_hints[args[0]]
- # Make sure the type is not already registered.
- registered_fn = SERIALIZERS.get(type_)
- if registered_fn is not None and registered_fn != fn:
- raise ValueError(
- f"Serializer for type {type_} is already registered as {registered_fn.__qualname__}."
- )
+ # Make sure the type is not already registered.
+ registered_fn = SERIALIZERS.get(type_)
+ if registered_fn is not None and registered_fn != fn:
+ raise ValueError(
+ f"Serializer for type {type_} is already registered as {registered_fn.__qualname__}."
+ )
- # Apply type transformation if requested
- if to is not None:
- SERIALIZER_TYPES[type_] = to
- get_serializer_type.cache_clear()
+ to_type = to or type_hints.get("return")
- # Register the serializer.
- SERIALIZERS[type_] = fn
- get_serializer.cache_clear()
+ # Apply type transformation if requested
+ if to_type:
+ SERIALIZER_TYPES[type_] = to_type
+ get_serializer_type.cache_clear()
- # Return the function.
- return fn
+ # Register the serializer.
+ SERIALIZERS[type_] = fn
+ get_serializer.cache_clear()
+
+ # Return the function.
+ return fn
+
+ if fn is not None:
+ return wrapper(fn)
+ return wrapper
@overload
@@ -189,16 +207,37 @@ def get_serializer_type(type_: Type) -> Optional[Type]:
return None
-def has_serializer(type_: Type) -> bool:
+def has_serializer(type_: Type, into_type: Type | None = None) -> bool:
"""Check if there is a serializer for the type.
Args:
type_: The type to check.
+ into_type: The type to serialize into.
Returns:
Whether there is a serializer for the type.
"""
- return get_serializer(type_) is not None
+ serializer_for_type = get_serializer(type_)
+ return serializer_for_type is not None and (
+ into_type is None or get_serializer_type(type_) == into_type
+ )
+
+
+def can_serialize(type_: Type, into_type: Type | None = None) -> bool:
+ """Check if there is a serializer for the type.
+
+ Args:
+ type_: The type to check.
+ into_type: The type to serialize into.
+
+ Returns:
+ Whether there is a serializer for the type.
+ """
+ return has_serializer(type_, into_type) or (
+ isinstance(type_, type)
+ and dataclasses.is_dataclass(type_)
+ and (into_type is None or into_type is dict)
+ )
@serializer(to=str)
@@ -214,7 +253,7 @@ def serialize_type(value: type) -> str:
return value.__name__
-@serializer
+@serializer(to=dict)
def serialize_base(value: Base) -> dict:
"""Serialize a Base instance.
@@ -224,7 +263,58 @@ def serialize_base(value: Base) -> dict:
Returns:
The serialized Base.
"""
- return {k: v for k, v in value.dict().items() if not callable(v)}
+ from reflex.vars.base import Var
+
+ return {
+ k: v for k, v in value.dict().items() if isinstance(v, Var) or not callable(v)
+ }
+
+
+try:
+ from pydantic.v1 import BaseModel as BaseModelV1
+
+ @serializer(to=dict)
+ def serialize_base_model_v1(model: BaseModelV1) -> dict:
+ """Serialize a pydantic v1 BaseModel instance.
+
+ Args:
+ model: The BaseModel to serialize.
+
+ Returns:
+ The serialized BaseModel.
+ """
+ return model.dict()
+
+ from pydantic import BaseModel as BaseModelV2
+
+ if BaseModelV1 is not BaseModelV2:
+
+ @serializer(to=dict)
+ def serialize_base_model_v2(model: BaseModelV2) -> dict:
+ """Serialize a pydantic v2 BaseModel instance.
+
+ Args:
+ model: The BaseModel to serialize.
+
+ Returns:
+ The serialized BaseModel.
+ """
+ return model.model_dump()
+except ImportError:
+ # Older pydantic v1 import
+ from pydantic import BaseModel as BaseModelV1
+
+ @serializer(to=dict)
+ def serialize_base_model_v1(model: BaseModelV1) -> dict:
+ """Serialize a pydantic v1 BaseModel instance.
+
+ Args:
+ model: The BaseModel to serialize.
+
+ Returns:
+ The serialized BaseModel.
+ """
+ return model.dict()
@serializer
diff --git a/reflex/utils/telemetry.py b/reflex/utils/telemetry.py
index 9ae165ea2..b24b4d3bf 100644
--- a/reflex/utils/telemetry.py
+++ b/reflex/utils/telemetry.py
@@ -8,6 +8,8 @@ import multiprocessing
import platform
import warnings
+from reflex.config import environment
+
try:
from datetime import UTC, datetime
except ImportError:
@@ -20,7 +22,6 @@ import psutil
from reflex import constants
from reflex.utils import console
-from reflex.utils.exec import should_skip_compile
from reflex.utils.prerequisites import ensure_reflex_installation_id, get_project_hash
POSTHOG_API_URL: str = "https://app.posthog.com/capture/"
@@ -50,7 +51,8 @@ def get_python_version() -> str:
Returns:
The Python version.
"""
- return platform.python_version()
+ # Remove the "+" from the version string in case user is using a pre-release version.
+ return platform.python_version().rstrip("+")
def get_reflex_version() -> str:
@@ -94,7 +96,7 @@ def _raise_on_missing_project_hash() -> bool:
False when compilation should be skipped (i.e. no .web directory is required).
Otherwise return True.
"""
- return not should_skip_compile()
+ return not environment.REFLEX_SKIP_COMPILE.get()
def _prepare_event(event: str, **kwargs) -> dict:
@@ -127,7 +129,7 @@ def _prepare_event(event: str, **kwargs) -> dict:
cpuinfo = get_cpu_info()
- additional_keys = ["template", "context", "detail"]
+ additional_keys = ["template", "context", "detail", "user_uuid"]
additional_fields = {
key: value for key in additional_keys if (value := kwargs.get(key)) is not None
}
diff --git a/reflex/utils/types.py b/reflex/utils/types.py
index 0a3aed110..0c39eacc4 100644
--- a/reflex/utils/types.py
+++ b/reflex/utils/types.py
@@ -14,9 +14,11 @@ from typing import (
Callable,
ClassVar,
Dict,
+ FrozenSet,
Iterable,
List,
Literal,
+ Mapping,
Optional,
Sequence,
Tuple,
@@ -26,11 +28,10 @@ from typing import (
get_args,
get_type_hints,
)
-from typing import (
- get_origin as get_origin_og,
-)
+from typing import get_origin as get_origin_og
import sqlalchemy
+from typing_extensions import is_typeddict
import reflex
from reflex.components.core.breakpoints import Breakpoints
@@ -42,12 +43,7 @@ except ModuleNotFoundError:
from sqlalchemy.ext.associationproxy import AssociationProxyInstance
from sqlalchemy.ext.hybrid import hybrid_property
-from sqlalchemy.orm import (
- DeclarativeBase,
- Mapped,
- QueryableAttribute,
- Relationship,
-)
+from sqlalchemy.orm import DeclarativeBase, Mapped, QueryableAttribute, Relationship
from reflex import constants
from reflex.base import Base
@@ -274,6 +270,20 @@ def is_optional(cls: GenericType) -> bool:
return is_union(cls) and type(None) in get_args(cls)
+def value_inside_optional(cls: GenericType) -> GenericType:
+ """Get the value inside an Optional type or the original type.
+
+ Args:
+ cls: The class to check.
+
+ Returns:
+ The value inside the Optional type or the original type.
+ """
+ if is_union(cls) and len(args := get_args(cls)) >= 2 and type(None) in args:
+ return unionize(*[arg for arg in args if arg is not type(None)])
+ return cls
+
+
def get_property_hint(attr: Any | None) -> GenericType | None:
"""Check if an attribute is a property and return its type hint.
@@ -487,6 +497,14 @@ def _issubclass(cls: GenericType, cls_check: GenericType, instance: Any = None)
if isinstance(instance, Breakpoints):
return _breakpoints_satisfies_typing(cls_check, instance)
+ if isinstance(cls_check_base, tuple):
+ cls_check_base = tuple(
+ cls_check_one if not is_typeddict(cls_check_one) else dict
+ for cls_check_one in cls_check_base
+ )
+ if is_typeddict(cls_check_base):
+ cls_check_base = dict
+
# Check if the types match.
try:
return cls_check_base == Any or issubclass(cls_base, cls_check_base)
@@ -496,16 +514,112 @@ def _issubclass(cls: GenericType, cls_check: GenericType, instance: Any = None)
raise TypeError(f"Invalid type for issubclass: {cls_base}") from te
-def _isinstance(obj: Any, cls: GenericType) -> bool:
+def does_obj_satisfy_typed_dict(obj: Any, cls: GenericType) -> bool:
+ """Check if an object satisfies a typed dict.
+
+ Args:
+ obj: The object to check.
+ cls: The typed dict to check against.
+
+ Returns:
+ Whether the object satisfies the typed dict.
+ """
+ if not isinstance(obj, Mapping):
+ return False
+
+ key_names_to_values = get_type_hints(cls)
+ required_keys: FrozenSet[str] = getattr(cls, "__required_keys__", frozenset())
+
+ if not all(
+ isinstance(key, str)
+ and key in key_names_to_values
+ and _isinstance(value, key_names_to_values[key])
+ for key, value in obj.items()
+ ):
+ return False
+
+ # TODO in 3.14: Implement https://peps.python.org/pep-0728/ if it's approved
+
+ # required keys are all present
+ return required_keys.issubset(required_keys)
+
+
+def _isinstance(obj: Any, cls: GenericType, nested: bool = False) -> bool:
"""Check if an object is an instance of a class.
Args:
obj: The object to check.
cls: The class to check against.
+ nested: Whether the check is nested.
Returns:
Whether the object is an instance of the class.
"""
+ if cls is Any:
+ return True
+
+ if cls is None or cls is type(None):
+ return obj is None
+
+ if is_literal(cls):
+ return obj in get_args(cls)
+
+ if is_union(cls):
+ return any(_isinstance(obj, arg) for arg in get_args(cls))
+
+ origin = get_origin(cls)
+
+ if origin is None:
+ # cls is a typed dict
+ if is_typeddict(cls):
+ if nested:
+ return does_obj_satisfy_typed_dict(obj, cls)
+ return isinstance(obj, dict)
+
+ # cls is a float
+ if cls is float:
+ return isinstance(obj, (float, int))
+
+ # cls is a simple class
+ return isinstance(obj, cls)
+
+ args = get_args(cls)
+
+ if not args:
+ # cls is a simple generic class
+ return isinstance(obj, origin)
+
+ if nested and args:
+ if origin is list:
+ return isinstance(obj, list) and all(
+ _isinstance(item, args[0]) for item in obj
+ )
+ if origin is tuple:
+ if args[-1] is Ellipsis:
+ return isinstance(obj, tuple) and all(
+ _isinstance(item, args[0]) for item in obj
+ )
+ return (
+ isinstance(obj, tuple)
+ and len(obj) == len(args)
+ and all(_isinstance(item, arg) for item, arg in zip(obj, args))
+ )
+ if origin in (dict, Breakpoints):
+ return isinstance(obj, dict) and all(
+ _isinstance(key, args[0]) and _isinstance(value, args[1])
+ for key, value in obj.items()
+ )
+ if origin is set:
+ return isinstance(obj, set) and all(
+ _isinstance(item, args[0]) for item in obj
+ )
+
+ if args:
+ from reflex.vars import Field
+
+ if origin is Field:
+ return _isinstance(obj, args[0])
+
return isinstance(obj, get_base_class(cls))
@@ -710,3 +824,69 @@ def validate_parameter_literals(func):
# Store this here for performance.
StateBases = get_base_class(StateVar)
StateIterBases = get_base_class(StateIterVar)
+
+
+def typehint_issubclass(possible_subclass: Any, possible_superclass: Any) -> bool:
+ """Check if a type hint is a subclass of another type hint.
+
+ Args:
+ possible_subclass: The type hint to check.
+ possible_superclass: The type hint to check against.
+
+ Returns:
+ Whether the type hint is a subclass of the other type hint.
+ """
+ if possible_superclass is Any:
+ return True
+ if possible_subclass is Any:
+ return False
+
+ provided_type_origin = get_origin(possible_subclass)
+ accepted_type_origin = get_origin(possible_superclass)
+
+ if provided_type_origin is None and accepted_type_origin is None:
+ # In this case, we are dealing with a non-generic type, so we can use issubclass
+ return issubclass(possible_subclass, possible_superclass)
+
+ # Remove this check when Python 3.10 is the minimum supported version
+ if hasattr(types, "UnionType"):
+ provided_type_origin = (
+ Union if provided_type_origin is types.UnionType else provided_type_origin
+ )
+ accepted_type_origin = (
+ Union if accepted_type_origin is types.UnionType else accepted_type_origin
+ )
+
+ # Get type arguments (e.g., [float, int] for Dict[float, int])
+ provided_args = get_args(possible_subclass)
+ accepted_args = get_args(possible_superclass)
+
+ if accepted_type_origin is Union:
+ if provided_type_origin is not Union:
+ return any(
+ typehint_issubclass(possible_subclass, accepted_arg)
+ for accepted_arg in accepted_args
+ )
+ return all(
+ any(
+ typehint_issubclass(provided_arg, accepted_arg)
+ for accepted_arg in accepted_args
+ )
+ for provided_arg in provided_args
+ )
+
+ # Check if the origin of both types is the same (e.g., list for List[int])
+ # This probably should be issubclass instead of ==
+ if (provided_type_origin or possible_subclass) != (
+ accepted_type_origin or possible_superclass
+ ):
+ return False
+
+ # Ensure all specific types are compatible with accepted types
+ # Note this is not necessarily correct, as it doesn't check against contravariance and covariance
+ # It also ignores when the length of the arguments is different
+ return all(
+ typehint_issubclass(provided_arg, accepted_arg)
+ for provided_arg, accepted_arg in zip(provided_args, accepted_args)
+ if accepted_arg is not Any
+ )
diff --git a/reflex/vars/base.py b/reflex/vars/base.py
index b7861c424..4b8f400fc 100644
--- a/reflex/vars/base.py
+++ b/reflex/vars/base.py
@@ -19,6 +19,7 @@ from typing import (
TYPE_CHECKING,
Any,
Callable,
+ ClassVar,
Dict,
FrozenSet,
Generic,
@@ -56,20 +57,21 @@ from reflex.utils.imports import (
ParsedImportDict,
parse_imports,
)
-from reflex.utils.types import GenericType, Self, get_origin, has_args, unionize
+from reflex.utils.types import (
+ GenericType,
+ Self,
+ _isinstance,
+ get_origin,
+ has_args,
+ unionize,
+)
if TYPE_CHECKING:
from reflex.state import BaseState
- from .function import FunctionVar, ToFunctionOperation
- from .number import (
- BooleanVar,
- NumberVar,
- ToBooleanVarOperation,
- ToNumberVarOperation,
- )
- from .object import ObjectVar, ToObjectOperation
- from .sequence import ArrayVar, StringVar, ToArrayOperation, ToStringOperation
+ from .number import BooleanVar, NumberVar
+ from .object import ObjectVar
+ from .sequence import ArrayVar, StringVar
VAR_TYPE = TypeVar("VAR_TYPE", covariant=True)
@@ -78,6 +80,213 @@ OTHER_VAR_TYPE = TypeVar("OTHER_VAR_TYPE")
warnings.filterwarnings("ignore", message="fields may not start with an underscore")
+@dataclasses.dataclass(
+ eq=False,
+ frozen=True,
+)
+class VarSubclassEntry:
+ """Entry for a Var subclass."""
+
+ var_subclass: Type[Var]
+ to_var_subclass: Type[ToOperation]
+ python_types: Tuple[GenericType, ...]
+
+
+_var_subclasses: List[VarSubclassEntry] = []
+_var_literal_subclasses: List[Tuple[Type[LiteralVar], VarSubclassEntry]] = []
+
+
+@dataclasses.dataclass(
+ eq=True,
+ frozen=True,
+)
+class VarData:
+ """Metadata associated with a x."""
+
+ # The name of the enclosing state.
+ state: str = dataclasses.field(default="")
+
+ # The name of the field in the state.
+ field_name: str = dataclasses.field(default="")
+
+ # Imports needed to render this var
+ imports: ImmutableParsedImportDict = dataclasses.field(default_factory=tuple)
+
+ # Hooks that need to be present in the component to render this var
+ hooks: Tuple[str, ...] = dataclasses.field(default_factory=tuple)
+
+ def __init__(
+ self,
+ state: str = "",
+ field_name: str = "",
+ imports: ImportDict | ParsedImportDict | None = None,
+ hooks: dict[str, None] | None = None,
+ ):
+ """Initialize the var data.
+
+ Args:
+ state: The name of the enclosing state.
+ field_name: The name of the field in the state.
+ imports: Imports needed to render this var.
+ hooks: Hooks that need to be present in the component to render this var.
+ """
+ immutable_imports: ImmutableParsedImportDict = tuple(
+ sorted(
+ ((k, tuple(sorted(v))) for k, v in parse_imports(imports or {}).items())
+ )
+ )
+ object.__setattr__(self, "state", state)
+ object.__setattr__(self, "field_name", field_name)
+ object.__setattr__(self, "imports", immutable_imports)
+ object.__setattr__(self, "hooks", tuple(hooks or {}))
+
+ def old_school_imports(self) -> ImportDict:
+ """Return the imports as a mutable dict.
+
+ Returns:
+ The imports as a mutable dict.
+ """
+ return dict((k, list(v)) for k, v in self.imports)
+
+ def merge(*all: VarData | None) -> VarData | None:
+ """Merge multiple var data objects.
+
+ Args:
+ *all: The var data objects to merge.
+
+ Returns:
+ The merged var data object.
+
+ # noqa: DAR102 *all
+ """
+ all_var_datas = list(filter(None, all))
+
+ if not all_var_datas:
+ return None
+
+ if len(all_var_datas) == 1:
+ return all_var_datas[0]
+
+ # Get the first non-empty field name or default to empty string.
+ field_name = next(
+ (var_data.field_name for var_data in all_var_datas if var_data.field_name),
+ "",
+ )
+
+ # Get the first non-empty state or default to empty string.
+ state = next(
+ (var_data.state for var_data in all_var_datas if var_data.state), ""
+ )
+
+ hooks = {hook: None for var_data in all_var_datas for hook in var_data.hooks}
+
+ _imports = imports.merge_imports(
+ *(var_data.imports for var_data in all_var_datas)
+ )
+
+ if state or _imports or hooks or field_name:
+ return VarData(
+ state=state,
+ field_name=field_name,
+ imports=_imports,
+ hooks=hooks,
+ )
+
+ return None
+
+ def __bool__(self) -> bool:
+ """Check if the var data is non-empty.
+
+ Returns:
+ True if any field is set to a non-default value.
+ """
+ return bool(self.state or self.imports or self.hooks or self.field_name)
+
+ @classmethod
+ def from_state(cls, state: Type[BaseState] | str, field_name: str = "") -> VarData:
+ """Set the state of the var.
+
+ Args:
+ state: The state to set or the full name of the state.
+ field_name: The name of the field in the state. Optional.
+
+ Returns:
+ The var with the set state.
+ """
+ from reflex.utils import format
+
+ state_name = state if isinstance(state, str) else state.get_full_name()
+ return VarData(
+ state=state_name,
+ field_name=field_name,
+ hooks={
+ "const {0} = useContext(StateContexts.{0})".format(
+ format.format_state_name(state_name)
+ ): None
+ },
+ imports={
+ f"$/{constants.Dirs.CONTEXTS_PATH}": [ImportVar(tag="StateContexts")],
+ "react": [ImportVar(tag="useContext")],
+ },
+ )
+
+
+def _decode_var_immutable(value: str) -> tuple[VarData | None, str]:
+ """Decode the state name from a formatted var.
+
+ Args:
+ value: The value to extract the state name from.
+
+ Returns:
+ The extracted state name and the value without the state name.
+ """
+ var_datas = []
+ if isinstance(value, str):
+ # fast path if there is no encoded VarData
+ if constants.REFLEX_VAR_OPENING_TAG not in value:
+ return None, value
+
+ offset = 0
+
+ # Find all tags.
+ while m := _decode_var_pattern.search(value):
+ start, end = m.span()
+ value = value[:start] + value[end:]
+
+ serialized_data = m.group(1)
+
+ if serialized_data.isnumeric() or (
+ serialized_data[0] == "-" and serialized_data[1:].isnumeric()
+ ):
+ # This is a global immutable var.
+ var = _global_vars[int(serialized_data)]
+ var_data = var._get_all_var_data()
+
+ if var_data is not None:
+ var_datas.append(var_data)
+ offset += end - start
+
+ return VarData.merge(*var_datas) if var_datas else None, value
+
+
+def can_use_in_object_var(cls: GenericType) -> bool:
+ """Check if the class can be used in an ObjectVar.
+
+ Args:
+ cls: The class to check.
+
+ Returns:
+ Whether the class can be used in an ObjectVar.
+ """
+ if types.is_union(cls):
+ return all(can_use_in_object_var(t) for t in types.get_args(cls))
+ return (
+ inspect.isclass(cls)
+ and not issubclass(cls, Var)
+ and serializers.can_serialize(cls, dict)
+ )
+
+
@dataclasses.dataclass(
eq=False,
frozen=True,
@@ -151,6 +360,48 @@ class Var(Generic[VAR_TYPE]):
"""
return False
+ def __init_subclass__(
+ cls,
+ python_types: Tuple[GenericType, ...] | GenericType = types.Unset(),
+ default_type: GenericType = types.Unset(),
+ **kwargs,
+ ):
+ """Initialize the subclass.
+
+ Args:
+ python_types: The python types that the var represents.
+ default_type: The default type of the var. Defaults to the first python type.
+ **kwargs: Additional keyword arguments.
+ """
+ super().__init_subclass__(**kwargs)
+
+ if python_types or default_type:
+ python_types = (
+ (python_types if isinstance(python_types, tuple) else (python_types,))
+ if python_types
+ else ()
+ )
+
+ default_type = default_type or (python_types[0] if python_types else Any)
+
+ @dataclasses.dataclass(
+ eq=False,
+ frozen=True,
+ **{"slots": True} if sys.version_info >= (3, 10) else {},
+ )
+ class ToVarOperation(ToOperation, cls):
+ """Base class of converting a var to another var type."""
+
+ _original: Var = dataclasses.field(
+ default=Var(_js_expr="null", _var_type=None),
+ )
+
+ _default_var_type: ClassVar[GenericType] = default_type
+
+ ToVarOperation.__name__ = f'To{cls.__name__.removesuffix("Var")}Operation'
+
+ _var_subclasses.append(VarSubclassEntry(cls, ToVarOperation, python_types))
+
def __post_init__(self):
"""Post-initialize the var."""
# Decode any inline Var markup and apply it to the instance
@@ -331,35 +582,38 @@ class Var(Generic[VAR_TYPE]):
return f"{constants.REFLEX_VAR_OPENING_TAG}{hashed_var}{constants.REFLEX_VAR_CLOSING_TAG}{self._js_expr}"
@overload
- def to(self, output: Type[StringVar]) -> ToStringOperation: ...
+ def to(self, output: Type[str]) -> StringVar: ...
@overload
- def to(self, output: Type[str]) -> ToStringOperation: ...
+ def to(self, output: Type[bool]) -> BooleanVar: ...
@overload
- def to(self, output: Type[BooleanVar]) -> ToBooleanVarOperation: ...
-
- @overload
- def to(
- self, output: Type[NumberVar], var_type: type[int] | type[float] = float
- ) -> ToNumberVarOperation: ...
+ def to(self, output: type[int] | type[float]) -> NumberVar: ...
@overload
def to(
self,
- output: Type[ArrayVar],
- var_type: type[list] | type[tuple] | type[set] = list,
- ) -> ToArrayOperation: ...
+ output: type[list] | type[tuple] | type[set],
+ ) -> ArrayVar: ...
@overload
def to(
- self, output: Type[ObjectVar], var_type: types.GenericType = dict
- ) -> ToObjectOperation: ...
+ self,
+ output: type[dict],
+ ) -> ObjectVar[dict]: ...
@overload
def to(
- self, output: Type[FunctionVar], var_type: Type[Callable] = Callable
- ) -> ToFunctionOperation: ...
+ self, output: Type[ObjectVar], var_type: Type[VAR_INSIDE]
+ ) -> ObjectVar[VAR_INSIDE]: ...
+
+ @overload
+ def to(
+ self, output: Type[ObjectVar], var_type: None = None
+ ) -> ObjectVar[VAR_TYPE]: ...
+
+ @overload
+ def to(self, output: VAR_SUBCLASS, var_type: None = None) -> VAR_SUBCLASS: ...
@overload
def to(
@@ -379,118 +633,37 @@ class Var(Generic[VAR_TYPE]):
output: The output type.
var_type: The type of the var.
- Raises:
- TypeError: If the var_type is not a supported type for the output.
-
Returns:
The converted var.
"""
- from reflex.event import (
- EventChain,
- EventChainVar,
- EventSpec,
- EventVar,
- ToEventChainVarOperation,
- ToEventVarOperation,
- )
-
- from .function import FunctionVar, ToFunctionOperation
- from .number import (
- BooleanVar,
- NumberVar,
- ToBooleanVarOperation,
- ToNumberVarOperation,
- )
- from .object import ObjectVar, ToObjectOperation
- from .sequence import ArrayVar, StringVar, ToArrayOperation, ToStringOperation
-
- base_type = var_type
- if types.is_optional(base_type):
- base_type = types.get_args(base_type)[0]
-
- fixed_type = get_origin(base_type) or base_type
+ from .object import ObjectVar
fixed_output_type = get_origin(output) or output
# If the first argument is a python type, we map it to the corresponding Var type.
- if fixed_output_type is dict:
- return self.to(ObjectVar, output)
- if fixed_output_type in (list, tuple, set):
- return self.to(ArrayVar, output)
- if fixed_output_type in (int, float):
- return self.to(NumberVar, output)
- if fixed_output_type is str:
- return self.to(StringVar, output)
- if fixed_output_type is bool:
- return self.to(BooleanVar, output)
+ for var_subclass in _var_subclasses[::-1]:
+ if fixed_output_type in var_subclass.python_types:
+ return self.to(var_subclass.var_subclass, output)
+
if fixed_output_type is None:
- return ToNoneOperation.create(self)
- if fixed_output_type is EventSpec:
- return self.to(EventVar, output)
- if fixed_output_type is EventChain:
- return self.to(EventChainVar, output)
- try:
- if issubclass(fixed_output_type, Base):
- return self.to(ObjectVar, output)
- except TypeError:
- pass
- if dataclasses.is_dataclass(fixed_output_type) and not issubclass(
- fixed_output_type, Var
- ):
+ return get_to_operation(NoneVar).create(self) # type: ignore
+
+ # Handle fixed_output_type being Base or a dataclass.
+ if can_use_in_object_var(fixed_output_type):
return self.to(ObjectVar, output)
if inspect.isclass(output):
- if issubclass(output, BooleanVar):
- return ToBooleanVarOperation.create(self)
-
- if issubclass(output, NumberVar):
- if fixed_type is not None:
- if fixed_type in types.UnionTypes:
- inner_types = get_args(base_type)
- if not all(issubclass(t, (int, float)) for t in inner_types):
- raise TypeError(
- f"Unsupported type {var_type} for NumberVar. Must be int or float."
- )
-
- elif not issubclass(fixed_type, (int, float)):
- raise TypeError(
- f"Unsupported type {var_type} for NumberVar. Must be int or float."
- )
- return ToNumberVarOperation.create(self, var_type or float)
-
- if issubclass(output, ArrayVar):
- if fixed_type is not None and not issubclass(
- fixed_type, (list, tuple, set)
- ):
- raise TypeError(
- f"Unsupported type {var_type} for ArrayVar. Must be list, tuple, or set."
+ for var_subclass in _var_subclasses[::-1]:
+ if issubclass(output, var_subclass.var_subclass):
+ current_var_type = self._var_type
+ if current_var_type is Any:
+ new_var_type = var_type
+ else:
+ new_var_type = var_type or current_var_type
+ to_operation_return = var_subclass.to_var_subclass.create(
+ value=self, _var_type=new_var_type
)
- return ToArrayOperation.create(self, var_type or list)
-
- if issubclass(output, StringVar):
- return ToStringOperation.create(self, var_type or str)
-
- if issubclass(output, EventVar):
- return ToEventVarOperation.create(self, var_type or EventSpec)
-
- if issubclass(output, EventChainVar):
- return ToEventChainVarOperation.create(self, var_type or EventChain)
-
- if issubclass(output, (ObjectVar, Base)):
- return ToObjectOperation.create(self, var_type or dict)
-
- if issubclass(output, FunctionVar):
- # if fixed_type is not None and not issubclass(fixed_type, Callable):
- # raise TypeError(
- # f"Unsupported type {var_type} for FunctionVar. Must be Callable."
- # )
- return ToFunctionOperation.create(self, var_type or Callable)
-
- if issubclass(output, NoneVar):
- return ToNoneOperation.create(self)
-
- if dataclasses.is_dataclass(output):
- return ToObjectOperation.create(self, var_type or dict)
+ return to_operation_return # type: ignore
# If we can't determine the first argument, we just replace the _var_type.
if not issubclass(output, Var) or var_type is None:
@@ -508,6 +681,18 @@ class Var(Generic[VAR_TYPE]):
return self
+ @overload
+ def guess_type(self: Var[str]) -> StringVar: ...
+
+ @overload
+ def guess_type(self: Var[bool]) -> BooleanVar: ...
+
+ @overload
+ def guess_type(self: Var[int] | Var[float] | Var[int | float]) -> NumberVar: ...
+
+ @overload
+ def guess_type(self) -> Self: ...
+
def guess_type(self) -> Var:
"""Guesses the type of the variable based on its `_var_type` attribute.
@@ -517,11 +702,8 @@ class Var(Generic[VAR_TYPE]):
Raises:
TypeError: If the type is not supported for guessing.
"""
- from reflex.event import EventChain, EventChainVar, EventSpec, EventVar
-
- from .number import BooleanVar, NumberVar
+ from .number import NumberVar
from .object import ObjectVar
- from .sequence import ArrayVar, StringVar
var_type = self._var_type
if var_type is None:
@@ -542,11 +724,7 @@ class Var(Generic[VAR_TYPE]):
):
return self.to(NumberVar, self._var_type)
- if all(
- inspect.isclass(t)
- and (issubclass(t, Base) or dataclasses.is_dataclass(t))
- for t in inner_types
- ):
+ if can_use_in_object_var(var_type):
return self.to(ObjectVar, self._var_type)
return self
@@ -558,30 +736,19 @@ class Var(Generic[VAR_TYPE]):
if not inspect.isclass(fixed_type):
raise TypeError(f"Unsupported type {var_type} for guess_type.")
- if issubclass(fixed_type, bool):
- return self.to(BooleanVar, self._var_type)
- if issubclass(fixed_type, (int, float)):
- return self.to(NumberVar, self._var_type)
- if issubclass(fixed_type, dict):
- return self.to(ObjectVar, self._var_type)
- if issubclass(fixed_type, (list, tuple, set)):
- return self.to(ArrayVar, self._var_type)
- if issubclass(fixed_type, str):
- return self.to(StringVar, self._var_type)
- if issubclass(fixed_type, EventSpec):
- return self.to(EventVar, self._var_type)
- if issubclass(fixed_type, EventChain):
- return self.to(EventChainVar, self._var_type)
- try:
- if issubclass(fixed_type, Base):
- return self.to(ObjectVar, self._var_type)
- except TypeError:
- pass
- if dataclasses.is_dataclass(fixed_type):
+ if fixed_type is None:
+ return self.to(None)
+
+ for var_subclass in _var_subclasses[::-1]:
+ if issubclass(fixed_type, var_subclass.python_types):
+ return self.to(var_subclass.var_subclass, self._var_type)
+
+ if can_use_in_object_var(fixed_type):
return self.to(ObjectVar, self._var_type)
+
return self
- def get_default_value(self) -> Any:
+ def _get_default_value(self) -> Any:
"""Get the default value of the var.
Returns:
@@ -624,7 +791,7 @@ class Var(Generic[VAR_TYPE]):
) from e
return set() if issubclass(type_, set) else None
- def get_setter_name(self, include_state: bool = True) -> str:
+ def _get_setter_name(self, include_state: bool = True) -> str:
"""Get the name of the var's generated setter function.
Args:
@@ -641,7 +808,7 @@ class Var(Generic[VAR_TYPE]):
return setter
return ".".join((var_data.state, setter))
- def get_setter(self) -> Callable[[BaseState, Any], None]:
+ def _get_setter(self) -> Callable[[BaseState, Any], None]:
"""Get the var's setter function.
Returns:
@@ -667,7 +834,7 @@ class Var(Generic[VAR_TYPE]):
else:
setattr(state, actual_name, value)
- setter.__qualname__ = self.get_setter_name()
+ setter.__qualname__ = self._get_setter_name()
return setter
@@ -782,18 +949,25 @@ class Var(Generic[VAR_TYPE]):
"""
return ~self.bool()
- def to_string(self):
+ def to_string(self, use_json: bool = True) -> StringVar:
"""Convert the var to a string.
+ Args:
+ use_json: Whether to use JSON stringify. If False, uses Object.prototype.toString.
+
Returns:
The string var.
"""
- from .function import JSON_STRINGIFY
+ from .function import JSON_STRINGIFY, PROTOTYPE_TO_STRING
from .sequence import StringVar
- return JSON_STRINGIFY.call(self).to(StringVar)
+ return (
+ JSON_STRINGIFY.call(self).to(StringVar)
+ if use_json
+ else PROTOTYPE_TO_STRING.call(self).to(StringVar)
+ )
- def as_ref(self) -> Var:
+ def _as_ref(self) -> Var:
"""Get a reference to the var.
Returns:
@@ -805,7 +979,7 @@ class Var(Generic[VAR_TYPE]):
_js_expr="refs",
_var_data=VarData(
imports={
- f"/{constants.Dirs.STATE_PATH}": [imports.ImportVar(tag="refs")]
+ f"$/{constants.Dirs.STATE_PATH}": [imports.ImportVar(tag="refs")]
}
),
).to(ObjectVar, Dict[str, str])
@@ -838,7 +1012,7 @@ class Var(Generic[VAR_TYPE]):
type_of = FunctionStringVar("typeof")
return type_of.call(self).to(StringVar)
- def without_data(self):
+ def _without_data(self):
"""Create a copy of the var without the data.
Returns:
@@ -846,20 +1020,6 @@ class Var(Generic[VAR_TYPE]):
"""
return dataclasses.replace(self, _var_data=None)
- def contains(self, value: Any = None, field: Any = None):
- """Get an attribute of the var.
-
- Args:
- value: The value to check for.
- field: The field to check for.
-
- Raises:
- TypeError: If the var does not support contains check.
- """
- raise TypeError(
- f"Var of type {self._var_type} does not support contains check."
- )
-
def __get__(self, instance: Any, owner: Any):
"""Get the var.
@@ -872,14 +1032,6 @@ class Var(Generic[VAR_TYPE]):
"""
return self
- def reverse(self):
- """Reverse the var.
-
- Raises:
- TypeError: If the var does not support reverse.
- """
- raise TypeError("Cannot reverse non-list var.")
-
def __getattr__(self, name: str):
"""Get an attribute of the var.
@@ -896,6 +1048,13 @@ class Var(Generic[VAR_TYPE]):
if name.startswith("_"):
return self.__getattribute__(name)
+ if name == "contains":
+ raise TypeError(
+ f"Var of type {self._var_type} does not support contains check."
+ )
+ if name == "reverse":
+ raise TypeError("Cannot reverse non-list var.")
+
if self._var_type is Any:
raise TypeError(
f"You must provide an annotation for the state var `{str(self)}`. Annotation cannot be `{self._var_type}`."
@@ -924,10 +1083,7 @@ class Var(Generic[VAR_TYPE]):
try:
return json.loads(str(self))
except ValueError:
- try:
- return json.loads(self.json())
- except (ValueError, NotImplementedError):
- return str(self)
+ return str(self)
@property
def _var_state(self) -> str:
@@ -1005,21 +1161,136 @@ class Var(Generic[VAR_TYPE]):
"'in' operator not supported for Var types, use Var.contains() instead."
)
- def json(self) -> str:
- """Serialize the var to a JSON string.
-
- Raises:
- NotImplementedError: If the method is not implemented.
- """
- raise NotImplementedError("Var subclasses must implement the json method.")
-
OUTPUT = TypeVar("OUTPUT", bound=Var)
+VAR_SUBCLASS = TypeVar("VAR_SUBCLASS", bound=Var)
+VAR_INSIDE = TypeVar("VAR_INSIDE")
+
+
+class ToOperation:
+ """A var operation that converts a var to another type."""
+
+ def __getattr__(self, name: str) -> Any:
+ """Get an attribute of the var.
+
+ Args:
+ name: The name of the attribute.
+
+ Returns:
+ The attribute of the var.
+ """
+ from .object import ObjectVar
+
+ if isinstance(self, ObjectVar) and name != "_js_expr":
+ return ObjectVar.__getattr__(self, name)
+ return getattr(self._original, name)
+
+ def __post_init__(self):
+ """Post initialization."""
+ object.__delattr__(self, "_js_expr")
+
+ def __hash__(self) -> int:
+ """Calculate the hash value of the object.
+
+ Returns:
+ int: The hash value of the object.
+ """
+ return hash(self._original)
+
+ def _get_all_var_data(self) -> VarData | None:
+ """Get all the var data.
+
+ Returns:
+ The var data.
+ """
+ return VarData.merge(
+ self._original._get_all_var_data(),
+ self._var_data, # type: ignore
+ )
+
+ @classmethod
+ def create(
+ cls,
+ value: Var,
+ _var_type: GenericType | None = None,
+ _var_data: VarData | None = None,
+ ):
+ """Create a ToOperation.
+
+ Args:
+ value: The value of the var.
+ _var_type: The type of the Var.
+ _var_data: Additional hooks and imports associated with the Var.
+
+ Returns:
+ The ToOperation.
+ """
+ return cls(
+ _js_expr="", # type: ignore
+ _var_data=_var_data, # type: ignore
+ _var_type=_var_type or cls._default_var_type, # type: ignore
+ _original=value, # type: ignore
+ )
+
class LiteralVar(Var):
"""Base class for immutable literal vars."""
+ def __init_subclass__(cls, **kwargs):
+ """Initialize the subclass.
+
+ Args:
+ **kwargs: Additional keyword arguments.
+
+ Raises:
+ TypeError: If the LiteralVar subclass does not have a corresponding Var subclass.
+ """
+ super().__init_subclass__(**kwargs)
+
+ bases = cls.__bases__
+
+ bases_normalized = [
+ base if inspect.isclass(base) else get_origin(base) for base in bases
+ ]
+
+ possible_bases = [
+ base
+ for base in bases_normalized
+ if issubclass(base, Var) and base != LiteralVar
+ ]
+
+ if not possible_bases:
+ raise TypeError(
+ f"LiteralVar subclass {cls} must have a base class that is a subclass of Var and not LiteralVar."
+ )
+
+ var_subclasses = [
+ var_subclass
+ for var_subclass in _var_subclasses
+ if var_subclass.var_subclass in possible_bases
+ ]
+
+ if not var_subclasses:
+ raise TypeError(
+ f"LiteralVar {cls} must have a base class annotated with `python_types`."
+ )
+
+ if len(var_subclasses) != 1:
+ raise TypeError(
+ f"LiteralVar {cls} must have exactly one base class annotated with `python_types`."
+ )
+
+ var_subclass = var_subclasses[0]
+
+ # Remove the old subclass, happens because __init_subclass__ is called twice
+ # for each subclass. This is because of __slots__ in dataclasses.
+ for var_literal_subclass in list(_var_literal_subclasses):
+ if var_literal_subclass[1] is var_subclass:
+ _var_literal_subclasses.remove(var_literal_subclass)
+
+ _var_literal_subclasses.append((cls, var_subclass))
+
@classmethod
def create(
cls,
@@ -1038,50 +1309,21 @@ class LiteralVar(Var):
Raises:
TypeError: If the value is not a supported type for LiteralVar.
"""
- from .number import LiteralBooleanVar, LiteralNumberVar
from .object import LiteralObjectVar
- from .sequence import LiteralArrayVar, LiteralStringVar
+ from .sequence import LiteralStringVar
if isinstance(value, Var):
if _var_data is None:
return value
return value._replace(merge_var_data=_var_data)
- if isinstance(value, str):
- return LiteralStringVar.create(value, _var_data=_var_data)
+ for literal_subclass, var_subclass in _var_literal_subclasses[::-1]:
+ if isinstance(value, var_subclass.python_types):
+ return literal_subclass.create(value, _var_data=_var_data)
- if isinstance(value, bool):
- return LiteralBooleanVar.create(value, _var_data=_var_data)
-
- if isinstance(value, (int, float)):
- return LiteralNumberVar.create(value, _var_data=_var_data)
-
- if isinstance(value, dict):
- return LiteralObjectVar.create(value, _var_data=_var_data)
-
- if isinstance(value, (list, tuple, set)):
- return LiteralArrayVar.create(value, _var_data=_var_data)
-
- if value is None:
- return LiteralNoneVar.create(_var_data=_var_data)
-
- from reflex.event import (
- EventChain,
- EventHandler,
- EventSpec,
- LiteralEventChainVar,
- LiteralEventVar,
- )
+ from reflex.event import EventHandler
from reflex.utils.format import get_event_handler_parts
- from .object import LiteralObjectVar
-
- if isinstance(value, EventSpec):
- return LiteralEventVar.create(value, _var_data=_var_data)
-
- if isinstance(value, EventChain):
- return LiteralEventChainVar.create(value, _var_data=_var_data)
-
if isinstance(value, EventHandler):
return Var(_js_expr=".".join(filter(None, get_event_handler_parts(value))))
@@ -1155,6 +1397,22 @@ def serialize_literal(value: LiteralVar):
return value._var_value
+def get_python_literal(value: Union[LiteralVar, Any]) -> Any | None:
+ """Get the Python literal value.
+
+ Args:
+ value: The value to get the Python literal value of.
+
+ Returns:
+ The Python literal value.
+ """
+ if isinstance(value, LiteralVar):
+ return value._var_value
+ if isinstance(value, Var):
+ return None
+ return value
+
+
P = ParamSpec("P")
T = TypeVar("T")
@@ -1205,6 +1463,12 @@ def var_operation(
) -> Callable[P, ObjectVar[OBJECT_TYPE]]: ...
+@overload
+def var_operation(
+ func: Callable[P, CustomVarOperationReturn[T]],
+) -> Callable[P, Var[T]]: ...
+
+
def var_operation(
func: Callable[P, CustomVarOperationReturn[T]],
) -> Callable[P, Var[T]]:
@@ -1237,6 +1501,7 @@ def var_operation(
}
return CustomVarOperation.create(
+ name=func.__name__,
args=tuple(list(args_vars.items()) + list(kwargs_vars.items())),
return_var=func(*args_vars.values(), **kwargs_vars), # type: ignore
).guess_type()
@@ -1557,8 +1822,16 @@ class ComputedVar(Var[RETURN_TYPE]):
"return", Any
)
- kwargs["_js_expr"] = kwargs.pop("_js_expr", fget.__name__)
- kwargs["_var_type"] = kwargs.pop("_var_type", hint)
+ if hint is Any:
+ console.deprecate(
+ "untyped-computed-var",
+ "ComputedVar should have a return type annotation.",
+ "0.6.5",
+ "0.7.0",
+ )
+
+ kwargs.setdefault("_js_expr", fget.__name__)
+ kwargs.setdefault("_var_type", hint)
Var.__init__(
self,
@@ -1567,6 +1840,9 @@ class ComputedVar(Var[RETURN_TYPE]):
_var_data=kwargs.pop("_var_data", None),
)
+ if kwargs:
+ raise TypeError(f"Unexpected keyword arguments: {tuple(kwargs)}")
+
if backend is None:
backend = fget.__name__.startswith("_")
@@ -1747,17 +2023,28 @@ class ComputedVar(Var[RETURN_TYPE]):
)
if not self._cache:
- return self.fget(instance)
+ value = self.fget(instance)
+ else:
+ # handle caching
+ if not hasattr(instance, self._cache_attr) or self.needs_update(instance):
+ # Set cache attr on state instance.
+ setattr(instance, self._cache_attr, self.fget(instance))
+ # Ensure the computed var gets serialized to redis.
+ instance._was_touched = True
+ # Set the last updated timestamp on the state instance.
+ setattr(instance, self._last_updated_attr, datetime.datetime.now())
+ value = getattr(instance, self._cache_attr)
- # handle caching
- if not hasattr(instance, self._cache_attr) or self.needs_update(instance):
- # Set cache attr on state instance.
- setattr(instance, self._cache_attr, self.fget(instance))
- # Ensure the computed var gets serialized to redis.
- instance._was_touched = True
- # Set the last updated timestamp on the state instance.
- setattr(instance, self._last_updated_attr, datetime.datetime.now())
- return getattr(instance, self._cache_attr)
+ if not _isinstance(value, self._var_type):
+ console.deprecate(
+ "mismatched-computed-var-return",
+ f"Computed var {type(instance).__name__}.{self._js_expr} returned value of type {type(value)}, "
+ f"expected {self._var_type}. This might cause unexpected behavior.",
+ "0.6.5",
+ "0.7.0",
+ )
+
+ return value
def _deps(
self,
@@ -2059,6 +2346,8 @@ def var_operation_return(
class CustomVarOperation(CachedVarOperation, Var[T]):
"""Base class for custom var operations."""
+ _name: str = dataclasses.field(default="")
+
_args: Tuple[Tuple[str, Var], ...] = dataclasses.field(default_factory=tuple)
_return: CustomVarOperationReturn[T] = dataclasses.field(
@@ -2093,6 +2382,7 @@ class CustomVarOperation(CachedVarOperation, Var[T]):
@classmethod
def create(
cls,
+ name: str,
args: Tuple[Tuple[str, Var], ...],
return_var: CustomVarOperationReturn[T],
_var_data: VarData | None = None,
@@ -2100,6 +2390,7 @@ class CustomVarOperation(CachedVarOperation, Var[T]):
"""Create a CustomVarOperation.
Args:
+ name: The name of the operation.
args: The arguments to the operation.
return_var: The return var.
_var_data: Additional hooks and imports associated with the Var.
@@ -2111,12 +2402,13 @@ class CustomVarOperation(CachedVarOperation, Var[T]):
_js_expr="",
_var_type=return_var._var_type,
_var_data=_var_data,
+ _name=name,
_args=args,
_return=return_var,
)
-class NoneVar(Var[None]):
+class NoneVar(Var[None], python_types=type(None)):
"""A var representing None."""
@@ -2141,11 +2433,13 @@ class LiteralNoneVar(LiteralVar, NoneVar):
@classmethod
def create(
cls,
+ value: None = None,
_var_data: VarData | None = None,
) -> LiteralNoneVar:
"""Create a var from a value.
Args:
+ value: The value of the var. Must be None. Existed for compatibility with LiteralVar.
_var_data: Additional hooks and imports associated with the Var.
Returns:
@@ -2158,48 +2452,26 @@ class LiteralNoneVar(LiteralVar, NoneVar):
)
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToNoneOperation(CachedVarOperation, NoneVar):
- """A var operation that converts a var to None."""
+def get_to_operation(var_subclass: Type[Var]) -> Type[ToOperation]:
+ """Get the ToOperation class for a given Var subclass.
- _original_var: Var = dataclasses.field(
- default_factory=lambda: LiteralNoneVar.create()
- )
+ Args:
+ var_subclass: The Var subclass.
- @cached_property_no_lock
- def _cached_var_name(self) -> str:
- """Get the cached var name.
+ Returns:
+ The ToOperation class.
- Returns:
- The cached var name.
- """
- return str(self._original_var)
-
- @classmethod
- def create(
- cls,
- var: Var,
- _var_data: VarData | None = None,
- ) -> ToNoneOperation:
- """Create a ToNoneOperation.
-
- Args:
- var: The var to convert to None.
- _var_data: Additional hooks and imports associated with the Var.
-
- Returns:
- The ToNoneOperation.
- """
- return ToNoneOperation(
- _js_expr="",
- _var_type=None,
- _var_data=_var_data,
- _original_var=var,
- )
+ Raises:
+ ValueError: If the ToOperation class cannot be found.
+ """
+ possible_classes = [
+ saved_var_subclass.to_var_subclass
+ for saved_var_subclass in _var_subclasses
+ if saved_var_subclass.var_subclass is var_subclass
+ ]
+ if not possible_classes:
+ raise ValueError(f"Could not find ToOperation for {var_subclass}.")
+ return possible_classes[0]
@dataclasses.dataclass(
@@ -2262,68 +2534,6 @@ class StateOperation(CachedVarOperation, Var):
)
-class ToOperation:
- """A var operation that converts a var to another type."""
-
- def __getattr__(self, name: str) -> Any:
- """Get an attribute of the var.
-
- Args:
- name: The name of the attribute.
-
- Returns:
- The attribute of the var.
- """
- return getattr(object.__getattribute__(self, "_original"), name)
-
- def __post_init__(self):
- """Post initialization."""
- object.__delattr__(self, "_js_expr")
-
- def __hash__(self) -> int:
- """Calculate the hash value of the object.
-
- Returns:
- int: The hash value of the object.
- """
- return hash(object.__getattribute__(self, "_original"))
-
- def _get_all_var_data(self) -> VarData | None:
- """Get all the var data.
-
- Returns:
- The var data.
- """
- return VarData.merge(
- object.__getattribute__(self, "_original")._get_all_var_data(),
- self._var_data, # type: ignore
- )
-
- @classmethod
- def create(
- cls,
- value: Var,
- _var_type: GenericType | None = None,
- _var_data: VarData | None = None,
- ):
- """Create a ToOperation.
-
- Args:
- value: The value of the var.
- _var_type: The type of the Var.
- _var_data: Additional hooks and imports associated with the Var.
-
- Returns:
- The ToOperation.
- """
- return cls(
- _js_expr="", # type: ignore
- _var_data=_var_data, # type: ignore
- _var_type=_var_type or cls._default_var_type, # type: ignore
- _original=value, # type: ignore
- )
-
-
def get_uuid_string_var() -> Var:
"""Return a Var that generates a single memoized UUID via .web/utils/state.js.
@@ -2339,7 +2549,7 @@ def get_uuid_string_var() -> Var:
unique_uuid_var = get_unique_variable_name()
unique_uuid_var_data = VarData(
imports={
- f"/{constants.Dirs.STATE_PATH}": {ImportVar(tag="generateUUID")}, # type: ignore
+ f"$/{constants.Dirs.STATE_PATH}": {ImportVar(tag="generateUUID")}, # type: ignore
"react": "useMemo",
},
hooks={f"const {unique_uuid_var} = useMemo(generateUUID, [])": None},
@@ -2369,168 +2579,6 @@ def get_unique_variable_name() -> str:
return get_unique_variable_name()
-@dataclasses.dataclass(
- eq=True,
- frozen=True,
-)
-class VarData:
- """Metadata associated with a x."""
-
- # The name of the enclosing state.
- state: str = dataclasses.field(default="")
-
- # The name of the field in the state.
- field_name: str = dataclasses.field(default="")
-
- # Imports needed to render this var
- imports: ImmutableParsedImportDict = dataclasses.field(default_factory=tuple)
-
- # Hooks that need to be present in the component to render this var
- hooks: Tuple[str, ...] = dataclasses.field(default_factory=tuple)
-
- def __init__(
- self,
- state: str = "",
- field_name: str = "",
- imports: ImportDict | ParsedImportDict | None = None,
- hooks: dict[str, None] | None = None,
- ):
- """Initialize the var data.
-
- Args:
- state: The name of the enclosing state.
- field_name: The name of the field in the state.
- imports: Imports needed to render this var.
- hooks: Hooks that need to be present in the component to render this var.
- """
- immutable_imports: ImmutableParsedImportDict = tuple(
- sorted(
- ((k, tuple(sorted(v))) for k, v in parse_imports(imports or {}).items())
- )
- )
- object.__setattr__(self, "state", state)
- object.__setattr__(self, "field_name", field_name)
- object.__setattr__(self, "imports", immutable_imports)
- object.__setattr__(self, "hooks", tuple(hooks or {}))
-
- def old_school_imports(self) -> ImportDict:
- """Return the imports as a mutable dict.
-
- Returns:
- The imports as a mutable dict.
- """
- return dict((k, list(v)) for k, v in self.imports)
-
- @classmethod
- def merge(cls, *others: VarData | None) -> VarData | None:
- """Merge multiple var data objects.
-
- Args:
- *others: The var data objects to merge.
-
- Returns:
- The merged var data object.
- """
- state = ""
- field_name = ""
- _imports = {}
- hooks = {}
- for var_data in others:
- if var_data is None:
- continue
- state = state or var_data.state
- field_name = field_name or var_data.field_name
- _imports = imports.merge_imports(_imports, var_data.imports)
- hooks.update(
- var_data.hooks
- if isinstance(var_data.hooks, dict)
- else {k: None for k in var_data.hooks}
- )
-
- if state or _imports or hooks or field_name:
- return VarData(
- state=state,
- field_name=field_name,
- imports=_imports,
- hooks=hooks,
- )
- return None
-
- def __bool__(self) -> bool:
- """Check if the var data is non-empty.
-
- Returns:
- True if any field is set to a non-default value.
- """
- return bool(self.state or self.imports or self.hooks or self.field_name)
-
- @classmethod
- def from_state(cls, state: Type[BaseState] | str, field_name: str = "") -> VarData:
- """Set the state of the var.
-
- Args:
- state: The state to set or the full name of the state.
- field_name: The name of the field in the state. Optional.
-
- Returns:
- The var with the set state.
- """
- from reflex.utils import format
-
- state_name = state if isinstance(state, str) else state.get_full_name()
- return VarData(
- state=state_name,
- field_name=field_name,
- hooks={
- "const {0} = useContext(StateContexts.{0})".format(
- format.format_state_name(state_name)
- ): None
- },
- imports={
- f"/{constants.Dirs.CONTEXTS_PATH}": [ImportVar(tag="StateContexts")],
- "react": [ImportVar(tag="useContext")],
- },
- )
-
-
-def _decode_var_immutable(value: str) -> tuple[VarData | None, str]:
- """Decode the state name from a formatted var.
-
- Args:
- value: The value to extract the state name from.
-
- Returns:
- The extracted state name and the value without the state name.
- """
- var_datas = []
- if isinstance(value, str):
- # fast path if there is no encoded VarData
- if constants.REFLEX_VAR_OPENING_TAG not in value:
- return None, value
-
- offset = 0
-
- # Find all tags.
- while m := _decode_var_pattern.search(value):
- start, end = m.span()
- value = value[:start] + value[end:]
-
- serialized_data = m.group(1)
-
- if serialized_data.isnumeric() or (
- serialized_data[0] == "-" and serialized_data[1:].isnumeric()
- ):
- # This is a global immutable var.
- var = _global_vars[int(serialized_data)]
- var_data = var._get_all_var_data()
-
- if var_data is not None:
- var_datas.append(var_data)
- offset += end - start
-
- return VarData.merge(*var_datas) if var_datas else None, value
-
-
# Compile regex for finding reflex var tags.
_decode_var_pattern_re = (
rf"{constants.REFLEX_VAR_OPENING_TAG}(.*?){constants.REFLEX_VAR_CLOSING_TAG}"
@@ -2826,6 +2874,8 @@ def dispatch(
V = TypeVar("V")
+BASE_TYPE = TypeVar("BASE_TYPE", bound=Base)
+
class Field(Generic[T]):
"""Shadow class for Var to allow for type hinting in the IDE."""
@@ -2862,6 +2912,11 @@ class Field(Generic[T]):
self: Field[Dict[str, V]], instance: None, owner
) -> ObjectVar[Dict[str, V]]: ...
+ @overload
+ def __get__(
+ self: Field[BASE_TYPE], instance: None, owner
+ ) -> ObjectVar[BASE_TYPE]: ...
+
@overload
def __get__(self, instance: None, owner) -> Var[T]: ...
diff --git a/reflex/vars/function.py b/reflex/vars/function.py
index a512432b9..c65b38f70 100644
--- a/reflex/vars/function.py
+++ b/reflex/vars/function.py
@@ -4,38 +4,177 @@ from __future__ import annotations
import dataclasses
import sys
-from typing import Any, Callable, ClassVar, Optional, Tuple, Type, Union
+from typing import Any, Callable, Optional, Sequence, Tuple, Type, Union, overload
+from typing_extensions import Concatenate, Generic, ParamSpec, Protocol, TypeVar
+
+from reflex.utils import format
from reflex.utils.types import GenericType
-from .base import (
- CachedVarOperation,
- LiteralVar,
- ToOperation,
- Var,
- VarData,
- cached_property_no_lock,
+from .base import CachedVarOperation, LiteralVar, Var, VarData, cached_property_no_lock
+
+P = ParamSpec("P")
+V1 = TypeVar("V1")
+V2 = TypeVar("V2")
+V3 = TypeVar("V3")
+V4 = TypeVar("V4")
+V5 = TypeVar("V5")
+V6 = TypeVar("V6")
+R = TypeVar("R")
+
+
+class ReflexCallable(Protocol[P, R]):
+ """Protocol for a callable."""
+
+ __call__: Callable[P, R]
+
+
+CALLABLE_TYPE = TypeVar("CALLABLE_TYPE", bound=ReflexCallable, infer_variance=True)
+OTHER_CALLABLE_TYPE = TypeVar(
+ "OTHER_CALLABLE_TYPE", bound=ReflexCallable, infer_variance=True
)
-class FunctionVar(Var[Callable]):
+class FunctionVar(Var[CALLABLE_TYPE], default_type=ReflexCallable[Any, Any]):
"""Base class for immutable function vars."""
- def __call__(self, *args: Var | Any) -> ArgsFunctionOperation:
- """Call the function with the given arguments.
+ @overload
+ def partial(self) -> FunctionVar[CALLABLE_TYPE]: ...
+
+ @overload
+ def partial(
+ self: FunctionVar[ReflexCallable[Concatenate[V1, P], R]],
+ arg1: Union[V1, Var[V1]],
+ ) -> FunctionVar[ReflexCallable[P, R]]: ...
+
+ @overload
+ def partial(
+ self: FunctionVar[ReflexCallable[Concatenate[V1, V2, P], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ ) -> FunctionVar[ReflexCallable[P, R]]: ...
+
+ @overload
+ def partial(
+ self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, P], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ ) -> FunctionVar[ReflexCallable[P, R]]: ...
+
+ @overload
+ def partial(
+ self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, V4, P], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ arg4: Union[V4, Var[V4]],
+ ) -> FunctionVar[ReflexCallable[P, R]]: ...
+
+ @overload
+ def partial(
+ self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, V4, V5, P], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ arg4: Union[V4, Var[V4]],
+ arg5: Union[V5, Var[V5]],
+ ) -> FunctionVar[ReflexCallable[P, R]]: ...
+
+ @overload
+ def partial(
+ self: FunctionVar[ReflexCallable[Concatenate[V1, V2, V3, V4, V5, V6, P], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ arg4: Union[V4, Var[V4]],
+ arg5: Union[V5, Var[V5]],
+ arg6: Union[V6, Var[V6]],
+ ) -> FunctionVar[ReflexCallable[P, R]]: ...
+
+ @overload
+ def partial(
+ self: FunctionVar[ReflexCallable[P, R]], *args: Var | Any
+ ) -> FunctionVar[ReflexCallable[P, R]]: ...
+
+ @overload
+ def partial(self, *args: Var | Any) -> FunctionVar: ...
+
+ def partial(self, *args: Var | Any) -> FunctionVar: # type: ignore
+ """Partially apply the function with the given arguments.
Args:
- *args: The arguments to call the function with.
+ *args: The arguments to partially apply the function with.
Returns:
- The function call operation.
+ The partially applied function.
"""
+ if not args:
+ return ArgsFunctionOperation.create((), self)
return ArgsFunctionOperation.create(
("...args",),
VarOperationCall.create(self, *args, Var(_js_expr="...args")),
)
- def call(self, *args: Var | Any) -> VarOperationCall:
+ @overload
+ def call(
+ self: FunctionVar[ReflexCallable[[V1], R]], arg1: Union[V1, Var[V1]]
+ ) -> VarOperationCall[[V1], R]: ...
+
+ @overload
+ def call(
+ self: FunctionVar[ReflexCallable[[V1, V2], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ ) -> VarOperationCall[[V1, V2], R]: ...
+
+ @overload
+ def call(
+ self: FunctionVar[ReflexCallable[[V1, V2, V3], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ ) -> VarOperationCall[[V1, V2, V3], R]: ...
+
+ @overload
+ def call(
+ self: FunctionVar[ReflexCallable[[V1, V2, V3, V4], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ arg4: Union[V4, Var[V4]],
+ ) -> VarOperationCall[[V1, V2, V3, V4], R]: ...
+
+ @overload
+ def call(
+ self: FunctionVar[ReflexCallable[[V1, V2, V3, V4, V5], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ arg4: Union[V4, Var[V4]],
+ arg5: Union[V5, Var[V5]],
+ ) -> VarOperationCall[[V1, V2, V3, V4, V5], R]: ...
+
+ @overload
+ def call(
+ self: FunctionVar[ReflexCallable[[V1, V2, V3, V4, V5, V6], R]],
+ arg1: Union[V1, Var[V1]],
+ arg2: Union[V2, Var[V2]],
+ arg3: Union[V3, Var[V3]],
+ arg4: Union[V4, Var[V4]],
+ arg5: Union[V5, Var[V5]],
+ arg6: Union[V6, Var[V6]],
+ ) -> VarOperationCall[[V1, V2, V3, V4, V5, V6], R]: ...
+
+ @overload
+ def call(
+ self: FunctionVar[ReflexCallable[P, R]], *args: Var | Any
+ ) -> VarOperationCall[P, R]: ...
+
+ @overload
+ def call(self, *args: Var | Any) -> Var: ...
+
+ def call(self, *args: Var | Any) -> Var: # type: ignore
"""Call the function with the given arguments.
Args:
@@ -44,19 +183,29 @@ class FunctionVar(Var[Callable]):
Returns:
The function call operation.
"""
- return VarOperationCall.create(self, *args)
+ return VarOperationCall.create(self, *args).guess_type()
+
+ __call__ = call
-class FunctionStringVar(FunctionVar):
+class BuilderFunctionVar(
+ FunctionVar[CALLABLE_TYPE], default_type=ReflexCallable[Any, Any]
+):
+ """Base class for immutable function vars with the builder pattern."""
+
+ __call__ = FunctionVar.partial
+
+
+class FunctionStringVar(FunctionVar[CALLABLE_TYPE]):
"""Base class for immutable function vars from a string."""
@classmethod
def create(
cls,
func: str,
- _var_type: Type[Callable] = Callable,
+ _var_type: Type[OTHER_CALLABLE_TYPE] = ReflexCallable[Any, Any],
_var_data: VarData | None = None,
- ) -> FunctionStringVar:
+ ) -> FunctionStringVar[OTHER_CALLABLE_TYPE]:
"""Create a new function var from a string.
Args:
@@ -66,7 +215,7 @@ class FunctionStringVar(FunctionVar):
Returns:
The function var.
"""
- return cls(
+ return FunctionStringVar(
_js_expr=func,
_var_type=_var_type,
_var_data=_var_data,
@@ -78,10 +227,10 @@ class FunctionStringVar(FunctionVar):
frozen=True,
**{"slots": True} if sys.version_info >= (3, 10) else {},
)
-class VarOperationCall(CachedVarOperation, Var):
+class VarOperationCall(Generic[P, R], CachedVarOperation, Var[R]):
"""Base class for immutable vars that are the result of a function call."""
- _func: Optional[FunctionVar] = dataclasses.field(default=None)
+ _func: Optional[FunctionVar[ReflexCallable[P, R]]] = dataclasses.field(default=None)
_args: Tuple[Union[Var, Any], ...] = dataclasses.field(default_factory=tuple)
@cached_property_no_lock
@@ -109,7 +258,7 @@ class VarOperationCall(CachedVarOperation, Var):
@classmethod
def create(
cls,
- func: FunctionVar,
+ func: FunctionVar[ReflexCallable[P, R]],
*args: Var | Any,
_var_type: GenericType = Any,
_var_data: VarData | None = None,
@@ -124,15 +273,78 @@ class VarOperationCall(CachedVarOperation, Var):
Returns:
The function call var.
"""
+ function_return_type = (
+ func._var_type.__args__[1]
+ if getattr(func._var_type, "__args__", None)
+ else Any
+ )
+ var_type = _var_type if _var_type is not Any else function_return_type
return cls(
_js_expr="",
- _var_type=_var_type,
+ _var_type=var_type,
_var_data=_var_data,
_func=func,
_args=args,
)
+@dataclasses.dataclass(frozen=True)
+class DestructuredArg:
+ """Class for destructured arguments."""
+
+ fields: Tuple[str, ...] = tuple()
+ rest: Optional[str] = None
+
+ def to_javascript(self) -> str:
+ """Convert the destructured argument to JavaScript.
+
+ Returns:
+ The destructured argument in JavaScript.
+ """
+ return format.wrap(
+ ", ".join(self.fields) + (f", ...{self.rest}" if self.rest else ""),
+ "{",
+ "}",
+ )
+
+
+@dataclasses.dataclass(
+ frozen=True,
+)
+class FunctionArgs:
+ """Class for function arguments."""
+
+ args: Tuple[Union[str, DestructuredArg], ...] = tuple()
+ rest: Optional[str] = None
+
+
+def format_args_function_operation(
+ args: FunctionArgs, return_expr: Var | Any, explicit_return: bool
+) -> str:
+ """Format an args function operation.
+
+ Args:
+ args: The function arguments.
+ return_expr: The return expression.
+ explicit_return: Whether to use explicit return syntax.
+
+ Returns:
+ The formatted args function operation.
+ """
+ arg_names_str = ", ".join(
+ [arg if isinstance(arg, str) else arg.to_javascript() for arg in args.args]
+ ) + (f", ...{args.rest}" if args.rest else "")
+
+ return_expr_str = str(LiteralVar.create(return_expr))
+
+ # Wrap return expression in curly braces if explicit return syntax is used.
+ return_expr_str_wrapped = (
+ format.wrap(return_expr_str, "{", "}") if explicit_return else return_expr_str
+ )
+
+ return f"(({arg_names_str}) => {return_expr_str_wrapped})"
+
+
@dataclasses.dataclass(
eq=False,
frozen=True,
@@ -141,8 +353,9 @@ class VarOperationCall(CachedVarOperation, Var):
class ArgsFunctionOperation(CachedVarOperation, FunctionVar):
"""Base class for immutable function defined via arguments and return expression."""
- _args_names: Tuple[str, ...] = dataclasses.field(default_factory=tuple)
+ _args: FunctionArgs = dataclasses.field(default_factory=FunctionArgs)
_return_expr: Union[Var, Any] = dataclasses.field(default=None)
+ _explicit_return: bool = dataclasses.field(default=False)
@cached_property_no_lock
def _cached_var_name(self) -> str:
@@ -151,21 +364,27 @@ class ArgsFunctionOperation(CachedVarOperation, FunctionVar):
Returns:
The name of the var.
"""
- return f"(({', '.join(self._args_names)}) => ({str(LiteralVar.create(self._return_expr))}))"
+ return format_args_function_operation(
+ self._args, self._return_expr, self._explicit_return
+ )
@classmethod
def create(
cls,
- args_names: Tuple[str, ...],
+ args_names: Sequence[Union[str, DestructuredArg]],
return_expr: Var | Any,
+ rest: str | None = None,
+ explicit_return: bool = False,
_var_type: GenericType = Callable,
_var_data: VarData | None = None,
- ) -> ArgsFunctionOperation:
+ ):
"""Create a new function var.
Args:
args_names: The names of the arguments.
return_expr: The return expression of the function.
+ rest: The name of the rest argument.
+ explicit_return: Whether to use explicit return syntax.
_var_data: Additional hooks and imports associated with the Var.
Returns:
@@ -175,8 +394,9 @@ class ArgsFunctionOperation(CachedVarOperation, FunctionVar):
_js_expr="",
_var_type=_var_type,
_var_data=_var_data,
- _args_names=args_names,
+ _args=FunctionArgs(args=tuple(args_names), rest=rest),
_return_expr=return_expr,
+ _explicit_return=explicit_return,
)
@@ -185,12 +405,75 @@ class ArgsFunctionOperation(CachedVarOperation, FunctionVar):
frozen=True,
**{"slots": True} if sys.version_info >= (3, 10) else {},
)
-class ToFunctionOperation(ToOperation, FunctionVar):
- """Base class of converting a var to a function."""
+class ArgsFunctionOperationBuilder(CachedVarOperation, BuilderFunctionVar):
+ """Base class for immutable function defined via arguments and return expression with the builder pattern."""
- _original: Var = dataclasses.field(default_factory=lambda: LiteralVar.create(None))
+ _args: FunctionArgs = dataclasses.field(default_factory=FunctionArgs)
+ _return_expr: Union[Var, Any] = dataclasses.field(default=None)
+ _explicit_return: bool = dataclasses.field(default=False)
- _default_var_type: ClassVar[GenericType] = Callable
+ @cached_property_no_lock
+ def _cached_var_name(self) -> str:
+ """The name of the var.
+
+ Returns:
+ The name of the var.
+ """
+ return format_args_function_operation(
+ self._args, self._return_expr, self._explicit_return
+ )
+
+ @classmethod
+ def create(
+ cls,
+ args_names: Sequence[Union[str, DestructuredArg]],
+ return_expr: Var | Any,
+ rest: str | None = None,
+ explicit_return: bool = False,
+ _var_type: GenericType = Callable,
+ _var_data: VarData | None = None,
+ ):
+ """Create a new function var.
+
+ Args:
+ args_names: The names of the arguments.
+ return_expr: The return expression of the function.
+ rest: The name of the rest argument.
+ explicit_return: Whether to use explicit return syntax.
+ _var_data: Additional hooks and imports associated with the Var.
+
+ Returns:
+ The function var.
+ """
+ return cls(
+ _js_expr="",
+ _var_type=_var_type,
+ _var_data=_var_data,
+ _args=FunctionArgs(args=tuple(args_names), rest=rest),
+ _return_expr=return_expr,
+ _explicit_return=explicit_return,
+ )
-JSON_STRINGIFY = FunctionStringVar.create("JSON.stringify")
+if python_version := sys.version_info[:2] >= (3, 10):
+ JSON_STRINGIFY = FunctionStringVar.create(
+ "JSON.stringify", _var_type=ReflexCallable[[Any], str]
+ )
+ ARRAY_ISARRAY = FunctionStringVar.create(
+ "Array.isArray", _var_type=ReflexCallable[[Any], bool]
+ )
+ PROTOTYPE_TO_STRING = FunctionStringVar.create(
+ "((__to_string) => __to_string.toString())",
+ _var_type=ReflexCallable[[Any], str],
+ )
+else:
+ JSON_STRINGIFY = FunctionStringVar.create(
+ "JSON.stringify", _var_type=ReflexCallable[Any, str]
+ )
+ ARRAY_ISARRAY = FunctionStringVar.create(
+ "Array.isArray", _var_type=ReflexCallable[Any, bool]
+ )
+ PROTOTYPE_TO_STRING = FunctionStringVar.create(
+ "((__to_string) => __to_string.toString())",
+ _var_type=ReflexCallable[Any, str],
+ )
diff --git a/reflex/vars/number.py b/reflex/vars/number.py
index 0aaa7a068..a762796e2 100644
--- a/reflex/vars/number.py
+++ b/reflex/vars/number.py
@@ -10,7 +10,6 @@ from typing import (
TYPE_CHECKING,
Any,
Callable,
- ClassVar,
NoReturn,
Type,
TypeVar,
@@ -25,9 +24,7 @@ from reflex.utils.types import is_optional
from .base import (
CustomVarOperationReturn,
- LiteralNoneVar,
LiteralVar,
- ToOperation,
Var,
VarData,
unionize,
@@ -58,7 +55,7 @@ def raise_unsupported_operand_types(
)
-class NumberVar(Var[NUMBER_T]):
+class NumberVar(Var[NUMBER_T], python_types=(int, float)):
"""Base class for immutable number vars."""
@overload
@@ -760,7 +757,7 @@ def number_trunc_operation(value: NumberVar):
return var_operation_return(js_expression=f"Math.trunc({value})", var_type=int)
-class BooleanVar(NumberVar[bool]):
+class BooleanVar(NumberVar[bool], python_types=bool):
"""Base class for immutable boolean vars."""
def __invert__(self):
@@ -984,51 +981,6 @@ def boolean_not_operation(value: BooleanVar):
return var_operation_return(js_expression=f"!({value})", var_type=bool)
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class LiteralBooleanVar(LiteralVar, BooleanVar):
- """Base class for immutable literal boolean vars."""
-
- _var_value: bool = dataclasses.field(default=False)
-
- def json(self) -> str:
- """Get the JSON representation of the var.
-
- Returns:
- The JSON representation of the var.
- """
- return "true" if self._var_value else "false"
-
- def __hash__(self) -> int:
- """Calculate the hash value of the object.
-
- Returns:
- int: The hash value of the object.
- """
- return hash((self.__class__.__name__, self._var_value))
-
- @classmethod
- def create(cls, value: bool, _var_data: VarData | None = None):
- """Create the boolean var.
-
- Args:
- value: The value of the var.
- _var_data: Additional hooks and imports associated with the Var.
-
- Returns:
- The boolean var.
- """
- return cls(
- _js_expr="true" if value else "false",
- _var_type=bool,
- _var_data=_var_data,
- _var_value=value,
- )
-
-
@dataclasses.dataclass(
eq=False,
frozen=True,
@@ -1088,38 +1040,57 @@ class LiteralNumberVar(LiteralVar, NumberVar):
)
+@dataclasses.dataclass(
+ eq=False,
+ frozen=True,
+ **{"slots": True} if sys.version_info >= (3, 10) else {},
+)
+class LiteralBooleanVar(LiteralVar, BooleanVar):
+ """Base class for immutable literal boolean vars."""
+
+ _var_value: bool = dataclasses.field(default=False)
+
+ def json(self) -> str:
+ """Get the JSON representation of the var.
+
+ Returns:
+ The JSON representation of the var.
+ """
+ return "true" if self._var_value else "false"
+
+ def __hash__(self) -> int:
+ """Calculate the hash value of the object.
+
+ Returns:
+ int: The hash value of the object.
+ """
+ return hash((self.__class__.__name__, self._var_value))
+
+ @classmethod
+ def create(cls, value: bool, _var_data: VarData | None = None):
+ """Create the boolean var.
+
+ Args:
+ value: The value of the var.
+ _var_data: Additional hooks and imports associated with the Var.
+
+ Returns:
+ The boolean var.
+ """
+ return cls(
+ _js_expr="true" if value else "false",
+ _var_type=bool,
+ _var_data=_var_data,
+ _var_value=value,
+ )
+
+
number_types = Union[NumberVar, int, float]
boolean_types = Union[BooleanVar, bool]
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToNumberVarOperation(ToOperation, NumberVar):
- """Base class for immutable number vars that are the result of a number operation."""
-
- _original: Var = dataclasses.field(default_factory=lambda: LiteralNoneVar.create())
-
- _default_var_type: ClassVar[Type] = float
-
-
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToBooleanVarOperation(ToOperation, BooleanVar):
- """Base class for immutable boolean vars that are the result of a boolean operation."""
-
- _original: Var = dataclasses.field(default_factory=lambda: LiteralNoneVar.create())
-
- _default_var_type: ClassVar[Type] = bool
-
-
_IS_TRUE_IMPORT: ImportDict = {
- f"/{Dirs.STATE_PATH}": [ImportVar(tag="isTrue")],
+ f"$/{Dirs.STATE_PATH}": [ImportVar(tag="isTrue")],
}
@@ -1140,8 +1111,14 @@ def boolify(value: Var):
)
+T = TypeVar("T")
+U = TypeVar("U")
+
+
@var_operation
-def ternary_operation(condition: BooleanVar, if_true: Var, if_false: Var):
+def ternary_operation(
+ condition: BooleanVar, if_true: Var[T], if_false: Var[U]
+) -> CustomVarOperationReturn[Union[T, U]]:
"""Create a ternary operation.
Args:
@@ -1152,10 +1129,14 @@ def ternary_operation(condition: BooleanVar, if_true: Var, if_false: Var):
Returns:
The ternary operation.
"""
- return var_operation_return(
- js_expression=f"({condition} ? {if_true} : {if_false})",
- var_type=unionize(if_true._var_type, if_false._var_type),
+ type_value: Union[Type[T], Type[U]] = unionize(
+ if_true._var_type, if_false._var_type
)
+ value: CustomVarOperationReturn[Union[T, U]] = var_operation_return(
+ js_expression=f"({condition} ? {if_true} : {if_false})",
+ var_type=type_value,
+ )
+ return value
NUMBER_TYPES = (int, float, NumberVar)
diff --git a/reflex/vars/object.py b/reflex/vars/object.py
index 38add7779..e60ea09e3 100644
--- a/reflex/vars/object.py
+++ b/reflex/vars/object.py
@@ -8,7 +8,6 @@ import typing
from inspect import isclass
from typing import (
Any,
- ClassVar,
Dict,
List,
NoReturn,
@@ -27,7 +26,6 @@ from reflex.utils.types import GenericType, get_attribute_access_type, get_origi
from .base import (
CachedVarOperation,
LiteralVar,
- ToOperation,
Var,
VarData,
cached_property_no_lock,
@@ -38,7 +36,7 @@ from .base import (
from .number import BooleanVar, NumberVar, raise_unsupported_operand_types
from .sequence import ArrayVar, StringVar
-OBJECT_TYPE = TypeVar("OBJECT_TYPE", bound=Dict)
+OBJECT_TYPE = TypeVar("OBJECT_TYPE")
KEY_TYPE = TypeVar("KEY_TYPE")
VALUE_TYPE = TypeVar("VALUE_TYPE")
@@ -48,7 +46,7 @@ ARRAY_INNER_TYPE = TypeVar("ARRAY_INNER_TYPE")
OTHER_KEY_TYPE = TypeVar("OTHER_KEY_TYPE")
-class ObjectVar(Var[OBJECT_TYPE]):
+class ObjectVar(Var[OBJECT_TYPE], python_types=dict):
"""Base class for immutable object vars."""
def _key_type(self) -> Type:
@@ -61,7 +59,7 @@ class ObjectVar(Var[OBJECT_TYPE]):
@overload
def _value_type(
- self: ObjectVar[Dict[KEY_TYPE, VALUE_TYPE]],
+ self: ObjectVar[Dict[Any, VALUE_TYPE]],
) -> Type[VALUE_TYPE]: ...
@overload
@@ -89,7 +87,7 @@ class ObjectVar(Var[OBJECT_TYPE]):
@overload
def values(
- self: ObjectVar[Dict[KEY_TYPE, VALUE_TYPE]],
+ self: ObjectVar[Dict[Any, VALUE_TYPE]],
) -> ArrayVar[List[VALUE_TYPE]]: ...
@overload
@@ -105,7 +103,7 @@ class ObjectVar(Var[OBJECT_TYPE]):
@overload
def entries(
- self: ObjectVar[Dict[KEY_TYPE, VALUE_TYPE]],
+ self: ObjectVar[Dict[Any, VALUE_TYPE]],
) -> ArrayVar[List[Tuple[str, VALUE_TYPE]]]: ...
@overload
@@ -135,47 +133,47 @@ class ObjectVar(Var[OBJECT_TYPE]):
# NoReturn is used here to catch when key value is Any
@overload
def __getitem__(
- self: ObjectVar[Dict[KEY_TYPE, NoReturn]],
+ self: ObjectVar[Dict[Any, NoReturn]],
key: Var | Any,
) -> Var: ...
@overload
def __getitem__(
self: (
- ObjectVar[Dict[KEY_TYPE, int]]
- | ObjectVar[Dict[KEY_TYPE, float]]
- | ObjectVar[Dict[KEY_TYPE, int | float]]
+ ObjectVar[Dict[Any, int]]
+ | ObjectVar[Dict[Any, float]]
+ | ObjectVar[Dict[Any, int | float]]
),
key: Var | Any,
) -> NumberVar: ...
@overload
def __getitem__(
- self: ObjectVar[Dict[KEY_TYPE, str]],
+ self: ObjectVar[Dict[Any, str]],
key: Var | Any,
) -> StringVar: ...
@overload
def __getitem__(
- self: ObjectVar[Dict[KEY_TYPE, list[ARRAY_INNER_TYPE]]],
+ self: ObjectVar[Dict[Any, list[ARRAY_INNER_TYPE]]],
key: Var | Any,
) -> ArrayVar[list[ARRAY_INNER_TYPE]]: ...
@overload
def __getitem__(
- self: ObjectVar[Dict[KEY_TYPE, set[ARRAY_INNER_TYPE]]],
+ self: ObjectVar[Dict[Any, set[ARRAY_INNER_TYPE]]],
key: Var | Any,
) -> ArrayVar[set[ARRAY_INNER_TYPE]]: ...
@overload
def __getitem__(
- self: ObjectVar[Dict[KEY_TYPE, tuple[ARRAY_INNER_TYPE, ...]]],
+ self: ObjectVar[Dict[Any, tuple[ARRAY_INNER_TYPE, ...]]],
key: Var | Any,
) -> ArrayVar[tuple[ARRAY_INNER_TYPE, ...]]: ...
@overload
def __getitem__(
- self: ObjectVar[Dict[KEY_TYPE, dict[OTHER_KEY_TYPE, VALUE_TYPE]]],
+ self: ObjectVar[Dict[Any, dict[OTHER_KEY_TYPE, VALUE_TYPE]]],
key: Var | Any,
) -> ObjectVar[dict[OTHER_KEY_TYPE, VALUE_TYPE]]: ...
@@ -197,50 +195,56 @@ class ObjectVar(Var[OBJECT_TYPE]):
# NoReturn is used here to catch when key value is Any
@overload
def __getattr__(
- self: ObjectVar[Dict[KEY_TYPE, NoReturn]],
+ self: ObjectVar[Dict[Any, NoReturn]],
name: str,
) -> Var: ...
@overload
def __getattr__(
self: (
- ObjectVar[Dict[KEY_TYPE, int]]
- | ObjectVar[Dict[KEY_TYPE, float]]
- | ObjectVar[Dict[KEY_TYPE, int | float]]
+ ObjectVar[Dict[Any, int]]
+ | ObjectVar[Dict[Any, float]]
+ | ObjectVar[Dict[Any, int | float]]
),
name: str,
) -> NumberVar: ...
@overload
def __getattr__(
- self: ObjectVar[Dict[KEY_TYPE, str]],
+ self: ObjectVar[Dict[Any, str]],
name: str,
) -> StringVar: ...
@overload
def __getattr__(
- self: ObjectVar[Dict[KEY_TYPE, list[ARRAY_INNER_TYPE]]],
+ self: ObjectVar[Dict[Any, list[ARRAY_INNER_TYPE]]],
name: str,
) -> ArrayVar[list[ARRAY_INNER_TYPE]]: ...
@overload
def __getattr__(
- self: ObjectVar[Dict[KEY_TYPE, set[ARRAY_INNER_TYPE]]],
+ self: ObjectVar[Dict[Any, set[ARRAY_INNER_TYPE]]],
name: str,
) -> ArrayVar[set[ARRAY_INNER_TYPE]]: ...
@overload
def __getattr__(
- self: ObjectVar[Dict[KEY_TYPE, tuple[ARRAY_INNER_TYPE, ...]]],
+ self: ObjectVar[Dict[Any, tuple[ARRAY_INNER_TYPE, ...]]],
name: str,
) -> ArrayVar[tuple[ARRAY_INNER_TYPE, ...]]: ...
@overload
def __getattr__(
- self: ObjectVar[Dict[KEY_TYPE, dict[OTHER_KEY_TYPE, VALUE_TYPE]]],
+ self: ObjectVar[Dict[Any, dict[OTHER_KEY_TYPE, VALUE_TYPE]]],
name: str,
) -> ObjectVar[dict[OTHER_KEY_TYPE, VALUE_TYPE]]: ...
+ @overload
+ def __getattr__(
+ self: ObjectVar,
+ name: str,
+ ) -> ObjectItemOperation: ...
+
def __getattr__(self, name) -> Var:
"""Get an attribute of the var.
@@ -379,8 +383,8 @@ class LiteralObjectVar(CachedVarOperation, ObjectVar[OBJECT_TYPE], LiteralVar):
@classmethod
def create(
cls,
- _var_value: OBJECT_TYPE,
- _var_type: GenericType | None = None,
+ _var_value: dict,
+ _var_type: Type[OBJECT_TYPE] | None = None,
_var_data: VarData | None = None,
) -> LiteralObjectVar[OBJECT_TYPE]:
"""Create the literal object var.
@@ -521,34 +525,6 @@ class ObjectItemOperation(CachedVarOperation, Var):
)
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToObjectOperation(ToOperation, ObjectVar):
- """Operation to convert a var to an object."""
-
- _original: Var = dataclasses.field(
- default_factory=lambda: LiteralObjectVar.create({})
- )
-
- _default_var_type: ClassVar[GenericType] = dict
-
- def __getattr__(self, name: str) -> Any:
- """Get an attribute of the var.
-
- Args:
- name: The name of the attribute.
-
- Returns:
- The attribute of the var.
- """
- if name == "_js_expr":
- return self._original._js_expr
- return ObjectVar.__getattr__(self, name)
-
-
@var_operation
def object_has_own_property_operation(object: ObjectVar, key: Var):
"""Check if an object has a key.
diff --git a/reflex/vars/sequence.py b/reflex/vars/sequence.py
index 9b65507b7..08429883f 100644
--- a/reflex/vars/sequence.py
+++ b/reflex/vars/sequence.py
@@ -11,7 +11,6 @@ import typing
from typing import (
TYPE_CHECKING,
Any,
- ClassVar,
Dict,
List,
Literal,
@@ -19,27 +18,28 @@ from typing import (
Set,
Tuple,
Type,
- TypeVar,
Union,
overload,
)
+from typing_extensions import TypeVar
+
from reflex import constants
from reflex.constants.base import REFLEX_VAR_OPENING_TAG
+from reflex.constants.colors import Color
from reflex.utils.exceptions import VarTypeError
from reflex.utils.types import GenericType, get_origin
from .base import (
CachedVarOperation,
CustomVarOperationReturn,
- LiteralNoneVar,
LiteralVar,
- ToOperation,
Var,
VarData,
_global_vars,
cached_property_no_lock,
figure_out_type,
+ get_python_literal,
get_unique_variable_name,
unionize,
var_operation,
@@ -50,13 +50,16 @@ from .number import (
LiteralNumberVar,
NumberVar,
raise_unsupported_operand_types,
+ ternary_operation,
)
if TYPE_CHECKING:
from .object import ObjectVar
+STRING_TYPE = TypeVar("STRING_TYPE", default=str)
-class StringVar(Var[str]):
+
+class StringVar(Var[STRING_TYPE], python_types=str):
"""Base class for immutable string vars."""
@overload
@@ -350,7 +353,7 @@ class StringVar(Var[str]):
@var_operation
-def string_lt_operation(lhs: StringVar | str, rhs: StringVar | str):
+def string_lt_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is less than another string.
Args:
@@ -364,7 +367,7 @@ def string_lt_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation
-def string_gt_operation(lhs: StringVar | str, rhs: StringVar | str):
+def string_gt_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is greater than another string.
Args:
@@ -378,7 +381,7 @@ def string_gt_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation
-def string_le_operation(lhs: StringVar | str, rhs: StringVar | str):
+def string_le_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is less than or equal to another string.
Args:
@@ -392,7 +395,7 @@ def string_le_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation
-def string_ge_operation(lhs: StringVar | str, rhs: StringVar | str):
+def string_ge_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is greater than or equal to another string.
Args:
@@ -406,7 +409,7 @@ def string_ge_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation
-def string_lower_operation(string: StringVar):
+def string_lower_operation(string: StringVar[Any]):
"""Convert a string to lowercase.
Args:
@@ -419,7 +422,7 @@ def string_lower_operation(string: StringVar):
@var_operation
-def string_upper_operation(string: StringVar):
+def string_upper_operation(string: StringVar[Any]):
"""Convert a string to uppercase.
Args:
@@ -432,7 +435,7 @@ def string_upper_operation(string: StringVar):
@var_operation
-def string_strip_operation(string: StringVar):
+def string_strip_operation(string: StringVar[Any]):
"""Strip a string.
Args:
@@ -446,7 +449,7 @@ def string_strip_operation(string: StringVar):
@var_operation
def string_contains_field_operation(
- haystack: StringVar, needle: StringVar | str, field: StringVar | str
+ haystack: StringVar[Any], needle: StringVar[Any] | str, field: StringVar[Any] | str
):
"""Check if a string contains another string.
@@ -465,7 +468,7 @@ def string_contains_field_operation(
@var_operation
-def string_contains_operation(haystack: StringVar, needle: StringVar | str):
+def string_contains_operation(haystack: StringVar[Any], needle: StringVar[Any] | str):
"""Check if a string contains another string.
Args:
@@ -481,7 +484,9 @@ def string_contains_operation(haystack: StringVar, needle: StringVar | str):
@var_operation
-def string_starts_with_operation(full_string: StringVar, prefix: StringVar | str):
+def string_starts_with_operation(
+ full_string: StringVar[Any], prefix: StringVar[Any] | str
+):
"""Check if a string starts with a prefix.
Args:
@@ -497,7 +502,7 @@ def string_starts_with_operation(full_string: StringVar, prefix: StringVar | str
@var_operation
-def string_item_operation(string: StringVar, index: NumberVar | int):
+def string_item_operation(string: StringVar[Any], index: NumberVar | int):
"""Get an item from a string.
Args:
@@ -511,7 +516,7 @@ def string_item_operation(string: StringVar, index: NumberVar | int):
@var_operation
-def array_join_operation(array: ArrayVar, sep: StringVar | str = ""):
+def array_join_operation(array: ArrayVar, sep: StringVar[Any] | str = ""):
"""Join the elements of an array.
Args:
@@ -524,6 +529,26 @@ def array_join_operation(array: ArrayVar, sep: StringVar | str = ""):
return var_operation_return(js_expression=f"{array}.join({sep})", var_type=str)
+@var_operation
+def string_replace_operation(
+ string: StringVar, search_value: StringVar | str, new_value: StringVar | str
+):
+ """Replace a string with a value.
+
+ Args:
+ string: The string.
+ search_value: The string to search.
+ new_value: The value to be replaced with.
+
+ Returns:
+ The string replace operation.
+ """
+ return var_operation_return(
+ js_expression=f"{string}.replace({search_value}, {new_value})",
+ var_type=str,
+ )
+
+
# Compile regex for finding reflex var tags.
_decode_var_pattern_re = (
rf"{constants.REFLEX_VAR_OPENING_TAG}(.*?){constants.REFLEX_VAR_CLOSING_TAG}"
@@ -536,7 +561,7 @@ _decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL)
frozen=True,
**{"slots": True} if sys.version_info >= (3, 10) else {},
)
-class LiteralStringVar(LiteralVar, StringVar):
+class LiteralStringVar(LiteralVar, StringVar[str]):
"""Base class for immutable literal string vars."""
_var_value: str = dataclasses.field(default="")
@@ -658,7 +683,7 @@ class LiteralStringVar(LiteralVar, StringVar):
frozen=True,
**{"slots": True} if sys.version_info >= (3, 10) else {},
)
-class ConcatVarOperation(CachedVarOperation, StringVar):
+class ConcatVarOperation(CachedVarOperation, StringVar[str]):
"""Representing a concatenation of literal string vars."""
_var_value: Tuple[Var, ...] = dataclasses.field(default_factory=tuple)
@@ -742,7 +767,7 @@ KEY_TYPE = TypeVar("KEY_TYPE")
VALUE_TYPE = TypeVar("VALUE_TYPE")
-class ArrayVar(Var[ARRAY_VAR_TYPE]):
+class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
"""Base class for immutable array vars."""
@overload
@@ -828,31 +853,31 @@ class ArrayVar(Var[ARRAY_VAR_TYPE]):
@overload
def __getitem__(
self: (
- ArrayVar[Tuple[OTHER_TUPLE, int]]
- | ArrayVar[Tuple[OTHER_TUPLE, float]]
- | ArrayVar[Tuple[OTHER_TUPLE, int | float]]
+ ArrayVar[Tuple[Any, int]]
+ | ArrayVar[Tuple[Any, float]]
+ | ArrayVar[Tuple[Any, int | float]]
),
i: Literal[1, -1],
) -> NumberVar: ...
@overload
def __getitem__(
- self: ArrayVar[Tuple[str, OTHER_TUPLE]], i: Literal[0, -2]
+ self: ArrayVar[Tuple[str, Any]], i: Literal[0, -2]
) -> StringVar: ...
@overload
def __getitem__(
- self: ArrayVar[Tuple[OTHER_TUPLE, str]], i: Literal[1, -1]
+ self: ArrayVar[Tuple[Any, str]], i: Literal[1, -1]
) -> StringVar: ...
@overload
def __getitem__(
- self: ArrayVar[Tuple[bool, OTHER_TUPLE]], i: Literal[0, -2]
+ self: ArrayVar[Tuple[bool, Any]], i: Literal[0, -2]
) -> BooleanVar: ...
@overload
def __getitem__(
- self: ArrayVar[Tuple[OTHER_TUPLE, bool]], i: Literal[1, -1]
+ self: ArrayVar[Tuple[Any, bool]], i: Literal[1, -1]
) -> BooleanVar: ...
@overload
@@ -1155,7 +1180,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE]):
function_var = ArgsFunctionOperation.create(tuple(), return_value)
else:
# generic number var
- number_var = Var("").to(NumberVar)
+ number_var = Var("").to(NumberVar, int)
first_arg_type = self[number_var]._var_type
@@ -1167,7 +1192,10 @@ class ArrayVar(Var[ARRAY_VAR_TYPE]):
_var_type=first_arg_type,
).guess_type()
- function_var = ArgsFunctionOperation.create((arg_name,), fn(first_arg))
+ function_var = ArgsFunctionOperation.create(
+ (arg_name,),
+ Var.create(fn(first_arg)),
+ )
return map_array_operation(self, function_var)
@@ -1272,7 +1300,7 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
@var_operation
-def string_split_operation(string: StringVar, sep: StringVar | str = ""):
+def string_split_operation(string: StringVar[Any], sep: StringVar | str = ""):
"""Split a string.
Args:
@@ -1569,32 +1597,6 @@ def array_contains_operation(haystack: ArrayVar, needle: Any | Var):
)
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToStringOperation(ToOperation, StringVar):
- """Base class for immutable string vars that are the result of a to string operation."""
-
- _original: Var = dataclasses.field(default_factory=lambda: LiteralNoneVar.create())
-
- _default_var_type: ClassVar[Type] = str
-
-
-@dataclasses.dataclass(
- eq=False,
- frozen=True,
- **{"slots": True} if sys.version_info >= (3, 10) else {},
-)
-class ToArrayOperation(ToOperation, ArrayVar):
- """Base class for immutable array vars that are the result of a to array operation."""
-
- _original: Var = dataclasses.field(default_factory=lambda: LiteralNoneVar.create())
-
- _default_var_type: ClassVar[Type] = List[Any]
-
-
@var_operation
def repeat_array_operation(
array: ArrayVar[ARRAY_VAR_TYPE], count: NumberVar | int
@@ -1654,3 +1656,134 @@ def array_concat_operation(
js_expression=f"[...{lhs}, ...{rhs}]",
var_type=Union[lhs._var_type, rhs._var_type],
)
+
+
+class ColorVar(StringVar[Color], python_types=Color):
+ """Base class for immutable color vars."""
+
+
+@dataclasses.dataclass(
+ eq=False,
+ frozen=True,
+ **{"slots": True} if sys.version_info >= (3, 10) else {},
+)
+class LiteralColorVar(CachedVarOperation, LiteralVar, ColorVar):
+ """Base class for immutable literal color vars."""
+
+ _var_value: Color = dataclasses.field(default_factory=lambda: Color(color="black"))
+
+ @classmethod
+ def create(
+ cls,
+ value: Color,
+ _var_type: Type[Color] | None = None,
+ _var_data: VarData | None = None,
+ ) -> ColorVar:
+ """Create a var from a string value.
+
+ Args:
+ value: The value to create the var from.
+ _var_type: The type of the var.
+ _var_data: Additional hooks and imports associated with the Var.
+
+ Returns:
+ The var.
+ """
+ return cls(
+ _js_expr="",
+ _var_type=_var_type or Color,
+ _var_data=_var_data,
+ _var_value=value,
+ )
+
+ def __hash__(self) -> int:
+ """Get the hash of the var.
+
+ Returns:
+ The hash of the var.
+ """
+ return hash(
+ (
+ self.__class__.__name__,
+ self._var_value.color,
+ self._var_value.alpha,
+ self._var_value.shade,
+ )
+ )
+
+ @cached_property_no_lock
+ def _cached_var_name(self) -> str:
+ """The name of the var.
+
+ Returns:
+ The name of the var.
+ """
+ alpha = self._var_value.alpha
+ alpha = (
+ ternary_operation(
+ alpha,
+ LiteralStringVar.create("a"),
+ LiteralStringVar.create(""),
+ )
+ if isinstance(alpha, Var)
+ else LiteralStringVar.create("a" if alpha else "")
+ )
+
+ shade = self._var_value.shade
+ shade = (
+ shade.to_string(use_json=False)
+ if isinstance(shade, Var)
+ else LiteralStringVar.create(str(shade))
+ )
+ return str(
+ ConcatVarOperation.create(
+ LiteralStringVar.create("var(--"),
+ self._var_value.color,
+ LiteralStringVar.create("-"),
+ alpha,
+ shade,
+ LiteralStringVar.create(")"),
+ )
+ )
+
+ @cached_property_no_lock
+ def _cached_get_all_var_data(self) -> VarData | None:
+ """Get all the var data.
+
+ Returns:
+ The var data.
+ """
+ return VarData.merge(
+ *[
+ LiteralVar.create(var)._get_all_var_data()
+ for var in (
+ self._var_value.color,
+ self._var_value.alpha,
+ self._var_value.shade,
+ )
+ ],
+ self._var_data,
+ )
+
+ def json(self) -> str:
+ """Get the JSON representation of the var.
+
+ Returns:
+ The JSON representation of the var.
+
+ Raises:
+ TypeError: If the color is not a valid color.
+ """
+ color, alpha, shade = map(
+ get_python_literal,
+ (self._var_value.color, self._var_value.alpha, self._var_value.shade),
+ )
+ if color is None or alpha is None or shade is None:
+ raise TypeError("Cannot serialize color that contains non-literal vars.")
+ if (
+ not isinstance(color, str)
+ or not isinstance(alpha, bool)
+ or not isinstance(shade, int)
+ ):
+ raise TypeError("Color is not a valid color.")
+ return f"var(--{color}-{'a' if alpha else ''}{shade})"
diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py
index 212ac9981..f7b825f16 100644
--- a/tests/integration/conftest.py
+++ b/tests/integration/conftest.py
@@ -6,6 +6,7 @@ from pathlib import Path
import pytest
+from reflex.config import environment
from reflex.testing import AppHarness, AppHarnessProd
DISPLAY = None
@@ -21,7 +22,7 @@ def xvfb():
Yields:
the pyvirtualdisplay object that the browser will be open on
"""
- if os.environ.get("GITHUB_ACTIONS") and not os.environ.get("APP_HARNESS_HEADLESS"):
+ if os.environ.get("GITHUB_ACTIONS") and not environment.APP_HARNESS_HEADLESS.get():
from pyvirtualdisplay.smartdisplay import ( # pyright: ignore [reportMissingImports]
SmartDisplay,
)
@@ -42,7 +43,7 @@ def pytest_exception_interact(node, call, report):
call: The pytest call describing when/where the test was invoked.
report: The pytest log report object.
"""
- screenshot_dir = os.environ.get("SCREENSHOT_DIR")
+ screenshot_dir = environment.SCREENSHOT_DIR.get()
if DISPLAY is None or screenshot_dir is None:
return
diff --git a/tests/integration/test_background_task.py b/tests/integration/test_background_task.py
index a445112f3..d7fe20824 100644
--- a/tests/integration/test_background_task.py
+++ b/tests/integration/test_background_task.py
@@ -1,4 +1,4 @@
-"""Test @rx.background task functionality."""
+"""Test @rx.event(background=True) task functionality."""
from typing import Generator
@@ -22,8 +22,7 @@ def BackgroundTask():
_task_id: int = 0
iterations: int = 10
- @rx.background
- @rx.event
+ @rx.event(background=True)
async def handle_event(self):
async with self:
self._task_id += 1
@@ -32,8 +31,7 @@ def BackgroundTask():
self.counter += 1
await asyncio.sleep(0.005)
- @rx.background
- @rx.event
+ @rx.event(background=True)
async def handle_event_yield_only(self):
async with self:
self._task_id += 1
@@ -48,7 +46,7 @@ def BackgroundTask():
def increment(self):
self.counter += 1
- @rx.background
+ @rx.event(background=True)
async def increment_arbitrary(self, amount: int):
async with self:
self.counter += int(amount)
@@ -61,8 +59,7 @@ def BackgroundTask():
async def blocking_pause(self):
await asyncio.sleep(0.02)
- @rx.background
- @rx.event
+ @rx.event(background=True)
async def non_blocking_pause(self):
await asyncio.sleep(0.02)
@@ -74,15 +71,13 @@ def BackgroundTask():
self.counter += 1
await asyncio.sleep(0.005)
- @rx.background
- @rx.event
+ @rx.event(background=True)
async def handle_racy_event(self):
await asyncio.gather(
self.racy_task(), self.racy_task(), self.racy_task(), self.racy_task()
)
- @rx.background
- @rx.event
+ @rx.event(background=True)
async def nested_async_with_self(self):
async with self:
self.counter += 1
@@ -94,8 +89,7 @@ def BackgroundTask():
third_state = await self.get_state(ThirdState)
await third_state._triple_count()
- @rx.background
- @rx.event
+ @rx.event(background=True)
async def yield_in_async_with_self(self):
async with self:
self.counter += 1
@@ -103,8 +97,7 @@ def BackgroundTask():
self.counter += 1
class OtherState(rx.State):
- @rx.background
- @rx.event
+ @rx.event(background=True)
async def get_other_state(self):
async with self:
state = await self.get_state(State)
@@ -196,8 +189,8 @@ def background_task(
running AppHarness instance
"""
with AppHarness.create(
- root=tmp_path_factory.mktemp(f"background_task"),
- app_source=BackgroundTask, # type: ignore
+ root=tmp_path_factory.mktemp("background_task"),
+ app_source=BackgroundTask,
) as harness:
yield harness
diff --git a/tests/integration/test_call_script.py b/tests/integration/test_call_script.py
index a949dc451..71200221b 100644
--- a/tests/integration/test_call_script.py
+++ b/tests/integration/test_call_script.py
@@ -355,7 +355,7 @@ def call_script(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("call_script"),
- app_source=CallScript, # type: ignore
+ app_source=CallScript,
) as harness:
yield harness
diff --git a/tests/integration/test_client_storage.py b/tests/integration/test_client_storage.py
index ae66087e2..236d3e14e 100644
--- a/tests/integration/test_client_storage.py
+++ b/tests/integration/test_client_storage.py
@@ -10,6 +10,13 @@ from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver
+from reflex.state import (
+ State,
+ StateManagerDisk,
+ StateManagerMemory,
+ StateManagerRedis,
+ _substate_key,
+)
from reflex.testing import AppHarness
from . import utils
@@ -74,7 +81,7 @@ def ClientSide():
return rx.fragment(
rx.input(
value=ClientSideState.router.session.client_token,
- is_read_only=True,
+ read_only=True,
id="token",
),
rx.input(
@@ -137,7 +144,7 @@ def client_side(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("client_side"),
- app_source=ClientSide, # type: ignore
+ app_source=ClientSide,
) as harness:
yield harness
@@ -604,6 +611,110 @@ async def test_client_side_state(
assert s2.text == "s2 value"
assert s3.text == "s3 value"
+ # Simulate state expiration
+ if isinstance(client_side.state_manager, StateManagerRedis):
+ await client_side.state_manager.redis.delete(
+ _substate_key(token, State.get_full_name())
+ )
+ await client_side.state_manager.redis.delete(_substate_key(token, state_name))
+ await client_side.state_manager.redis.delete(
+ _substate_key(token, sub_state_name)
+ )
+ await client_side.state_manager.redis.delete(
+ _substate_key(token, sub_sub_state_name)
+ )
+ elif isinstance(client_side.state_manager, (StateManagerMemory, StateManagerDisk)):
+ del client_side.state_manager.states[token]
+ if isinstance(client_side.state_manager, StateManagerDisk):
+ client_side.state_manager.token_expiration = 0
+ client_side.state_manager._purge_expired_states()
+
+ # Ensure the state is gone (not hydrated)
+ async def poll_for_not_hydrated():
+ state = await client_side.get_state(_substate_key(token or "", state_name))
+ return not state.is_hydrated
+
+ assert await AppHarness._poll_for_async(poll_for_not_hydrated)
+
+ # Trigger event to get a new instance of the state since the old was expired.
+ state_var_input = driver.find_element(By.ID, "state_var")
+ state_var_input.send_keys("re-triggering")
+
+ # get new references to all cookie and local storage elements (again)
+ c1 = driver.find_element(By.ID, "c1")
+ c2 = driver.find_element(By.ID, "c2")
+ c3 = driver.find_element(By.ID, "c3")
+ c4 = driver.find_element(By.ID, "c4")
+ c5 = driver.find_element(By.ID, "c5")
+ c6 = driver.find_element(By.ID, "c6")
+ c7 = driver.find_element(By.ID, "c7")
+ l1 = driver.find_element(By.ID, "l1")
+ l2 = driver.find_element(By.ID, "l2")
+ l3 = driver.find_element(By.ID, "l3")
+ l4 = driver.find_element(By.ID, "l4")
+ s1 = driver.find_element(By.ID, "s1")
+ s2 = driver.find_element(By.ID, "s2")
+ s3 = driver.find_element(By.ID, "s3")
+ c1s = driver.find_element(By.ID, "c1s")
+ l1s = driver.find_element(By.ID, "l1s")
+ s1s = driver.find_element(By.ID, "s1s")
+
+ assert c1.text == "c1 value"
+ assert c2.text == "c2 value"
+ assert c3.text == "" # temporary cookie expired after reset state!
+ assert c4.text == "c4 value"
+ assert c5.text == "c5 value"
+ assert c6.text == "c6 value"
+ assert c7.text == "c7 value"
+ assert l1.text == "l1 value"
+ assert l2.text == "l2 value"
+ assert l3.text == "l3 value"
+ assert l4.text == "l4 value"
+ assert s1.text == "s1 value"
+ assert s2.text == "s2 value"
+ assert s3.text == "s3 value"
+ assert c1s.text == "c1s value"
+ assert l1s.text == "l1s value"
+ assert s1s.text == "s1s value"
+
+ # Get the backend state and ensure the values are still set
+ async def get_sub_state():
+ root_state = await client_side.get_state(
+ _substate_key(token or "", sub_state_name)
+ )
+ state = root_state.substates[client_side.get_state_name("_client_side_state")]
+ sub_state = state.substates[
+ client_side.get_state_name("_client_side_sub_state")
+ ]
+ return sub_state
+
+ async def poll_for_c1_set():
+ sub_state = await get_sub_state()
+ return sub_state.c1 == "c1 value"
+
+ assert await AppHarness._poll_for_async(poll_for_c1_set)
+ sub_state = await get_sub_state()
+ assert sub_state.c1 == "c1 value"
+ assert sub_state.c2 == "c2 value"
+ assert sub_state.c3 == ""
+ assert sub_state.c4 == "c4 value"
+ assert sub_state.c5 == "c5 value"
+ assert sub_state.c6 == "c6 value"
+ assert sub_state.c7 == "c7 value"
+ assert sub_state.l1 == "l1 value"
+ assert sub_state.l2 == "l2 value"
+ assert sub_state.l3 == "l3 value"
+ assert sub_state.l4 == "l4 value"
+ assert sub_state.s1 == "s1 value"
+ assert sub_state.s2 == "s2 value"
+ assert sub_state.s3 == "s3 value"
+ sub_sub_state = sub_state.substates[
+ client_side.get_state_name("_client_side_sub_sub_state")
+ ]
+ assert sub_sub_state.c1s == "c1s value"
+ assert sub_sub_state.l1s == "l1s value"
+ assert sub_sub_state.s1s == "s1s value"
+
# clear the cookie jar and local storage, ensure state reset to default
driver.delete_all_cookies()
local_storage.clear()
diff --git a/tests/integration/test_component_state.py b/tests/integration/test_component_state.py
index f4a295d07..97624e7c5 100644
--- a/tests/integration/test_component_state.py
+++ b/tests/integration/test_component_state.py
@@ -115,7 +115,7 @@ def component_state_app(tmp_path) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path,
- app_source=ComponentStateApp, # type: ignore
+ app_source=ComponentStateApp,
) as harness:
yield harness
diff --git a/tests/integration/test_computed_vars.py b/tests/integration/test_computed_vars.py
index 81954bb50..a85c9e955 100644
--- a/tests/integration/test_computed_vars.py
+++ b/tests/integration/test_computed_vars.py
@@ -127,8 +127,8 @@ def computed_vars(
running AppHarness instance
"""
with AppHarness.create(
- root=tmp_path_factory.mktemp(f"computed_vars"),
- app_source=ComputedVars, # type: ignore
+ root=tmp_path_factory.mktemp("computed_vars"),
+ app_source=ComputedVars,
) as harness:
yield harness
diff --git a/tests/integration/test_connection_banner.py b/tests/integration/test_connection_banner.py
index 6921444b0..44187c8ba 100644
--- a/tests/integration/test_connection_banner.py
+++ b/tests/integration/test_connection_banner.py
@@ -52,7 +52,7 @@ def connection_banner(tmp_path) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path,
- app_source=ConnectionBanner, # type: ignore
+ app_source=ConnectionBanner,
) as harness:
yield harness
diff --git a/tests/integration/test_deploy_url.py b/tests/integration/test_deploy_url.py
index f93e9db27..5c840d24d 100644
--- a/tests/integration/test_deploy_url.py
+++ b/tests/integration/test_deploy_url.py
@@ -44,7 +44,7 @@ def deploy_url_sample(
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("deploy_url_sample"),
- app_source=DeployUrlSample, # type: ignore
+ app_source=DeployUrlSample,
) as harness:
yield harness
diff --git a/tests/integration/test_dynamic_components.py b/tests/integration/test_dynamic_components.py
index aeebd10e9..6a68aa1a1 100644
--- a/tests/integration/test_dynamic_components.py
+++ b/tests/integration/test_dynamic_components.py
@@ -85,7 +85,7 @@ def dynamic_components(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("dynamic_components"),
- app_source=DynamicComponents, # type: ignore
+ app_source=DynamicComponents,
) as harness:
assert harness.app_instance is not None, "app is not running"
yield harness
diff --git a/tests/integration/test_dynamic_routes.py b/tests/integration/test_dynamic_routes.py
index ee2844a31..c210bde69 100644
--- a/tests/integration/test_dynamic_routes.py
+++ b/tests/integration/test_dynamic_routes.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+import time
from typing import Callable, Coroutine, Generator, Type
from urllib.parse import urlsplit
@@ -89,6 +90,11 @@ def DynamicRoute():
@rx.page(route="/arg/[arg_str]")
def arg() -> rx.Component:
return rx.vstack(
+ rx.input(
+ value=DynamicState.router.session.client_token,
+ read_only=True,
+ id="token",
+ ),
rx.data_list.root(
rx.data_list.item(
rx.data_list.label("rx.State.arg_str (dynamic)"),
@@ -153,9 +159,9 @@ def dynamic_route(
running AppHarness instance
"""
with app_harness_env.create(
- root=tmp_path_factory.mktemp(f"dynamic_route"),
+ root=tmp_path_factory.mktemp("dynamic_route"),
app_name=f"dynamicroute_{app_harness_env.__name__.lower()}",
- app_source=DynamicRoute, # type: ignore
+ app_source=DynamicRoute,
) as harness:
yield harness
@@ -172,6 +178,8 @@ def driver(dynamic_route: AppHarness) -> Generator[WebDriver, None, None]:
"""
assert dynamic_route.app_instance is not None, "app is not running"
driver = dynamic_route.frontend()
+ # TODO: drop after flakiness is resolved
+ driver.implicitly_wait(30)
try:
yield driver
finally:
@@ -373,17 +381,22 @@ async def test_on_load_navigate_non_dynamic(
async def test_render_dynamic_arg(
dynamic_route: AppHarness,
driver: WebDriver,
+ token: str,
):
"""Assert that dynamic arg var is rendered correctly in different contexts.
Args:
dynamic_route: harness for DynamicRoute app.
driver: WebDriver instance.
+ token: The token visible in the driver browser.
"""
assert dynamic_route.app_instance is not None
with poll_for_navigation(driver):
driver.get(f"{dynamic_route.frontend_url}/arg/0")
+ # TODO: drop after flakiness is resolved
+ time.sleep(3)
+
def assert_content(expected: str, expect_not: str):
ids = [
"state-arg_str",
@@ -398,7 +411,8 @@ async def test_render_dynamic_arg(
el = driver.find_element(By.ID, id)
assert el
assert (
- dynamic_route.poll_for_content(el, exp_not_equal=expect_not) == expected
+ dynamic_route.poll_for_content(el, timeout=30, exp_not_equal=expect_not)
+ == expected
)
assert_content("0", "")
diff --git a/tests/integration/test_event_actions.py b/tests/integration/test_event_actions.py
index 5d278835e..15f3c9877 100644
--- a/tests/integration/test_event_actions.py
+++ b/tests/integration/test_event_actions.py
@@ -171,8 +171,8 @@ def event_action(tmp_path_factory) -> Generator[AppHarness, None, None]:
running AppHarness instance
"""
with AppHarness.create(
- root=tmp_path_factory.mktemp(f"event_action"),
- app_source=TestEventAction, # type: ignore
+ root=tmp_path_factory.mktemp("event_action"),
+ app_source=TestEventAction,
) as harness:
yield harness
diff --git a/tests/integration/test_event_chain.py b/tests/integration/test_event_chain.py
index ea2d2191c..c4121ee94 100644
--- a/tests/integration/test_event_chain.py
+++ b/tests/integration/test_event_chain.py
@@ -277,7 +277,7 @@ def event_chain(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("event_chain"),
- app_source=EventChain, # type: ignore
+ app_source=EventChain,
) as harness:
yield harness
diff --git a/tests/integration/test_exception_handlers.py b/tests/integration/test_exception_handlers.py
index 00683c48b..406c21e5d 100644
--- a/tests/integration/test_exception_handlers.py
+++ b/tests/integration/test_exception_handlers.py
@@ -11,7 +11,7 @@ from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
-from reflex.testing import AppHarness
+from reflex.testing import AppHarness, AppHarnessProd
def TestApp():
@@ -26,6 +26,8 @@ def TestApp():
class TestAppState(rx.State):
"""State for the TestApp app."""
+ react_error: bool = False
+
def divide_by_number(self, number: int):
"""Divide by number and print the result.
@@ -50,6 +52,18 @@ def TestApp():
on_click=lambda: TestAppState.divide_by_number(0), # type: ignore
id="induce-backend-error-btn",
),
+ rx.button(
+ "induce_react_error",
+ on_click=TestAppState.set_react_error(True), # type: ignore
+ id="induce-react-error-btn",
+ ),
+ rx.box(
+ rx.cond(
+ TestAppState.react_error,
+ rx.Var.create({"invalid": "cannot have object as child"}),
+ "",
+ ),
+ ),
)
@@ -70,7 +84,7 @@ def test_app(
with app_harness_env.create(
root=tmp_path_factory.mktemp("test_app"),
app_name=f"testapp_{app_harness_env.__name__.lower()}",
- app_source=TestApp, # type: ignore
+ app_source=TestApp,
) as harness:
yield harness
@@ -152,3 +166,37 @@ def test_backend_exception_handler_during_runtime(
"divide_by_number" in captured_default_handler_output.out
and "ZeroDivisionError" in captured_default_handler_output.out
)
+
+
+def test_frontend_exception_handler_with_react(
+ test_app: AppHarness,
+ driver: WebDriver,
+ capsys,
+):
+ """Test calling frontend exception handler during runtime.
+
+ Render an object as a react child, which is invalid.
+
+ Args:
+ test_app: harness for TestApp app
+ driver: WebDriver instance.
+ capsys: pytest fixture for capturing stdout and stderr.
+
+ """
+ reset_button = WebDriverWait(driver, 20).until(
+ EC.element_to_be_clickable((By.ID, "induce-react-error-btn"))
+ )
+
+ reset_button.click()
+
+ # Wait for the error to be logged
+ time.sleep(2)
+
+ captured_default_handler_output = capsys.readouterr()
+ if isinstance(test_app, AppHarnessProd):
+ assert "Error: Minified React error #31" in captured_default_handler_output.out
+ else:
+ assert (
+ "Error: Objects are not valid as a React child (found: object with keys \n{invalid})"
+ in captured_default_handler_output.out
+ )
diff --git a/tests/integration/test_form_submit.py b/tests/integration/test_form_submit.py
index a020a7e15..ea8750595 100644
--- a/tests/integration/test_form_submit.py
+++ b/tests/integration/test_form_submit.py
@@ -121,7 +121,7 @@ def FormSubmitName(form_component):
on_change=rx.console_log,
),
rx.button("Submit", type_="submit"),
- rx.icon_button(FormState.val, icon=rx.icon(tag="plus")),
+ rx.icon_button(rx.icon(tag="plus")),
),
on_submit=FormState.form_submit,
custom_attrs={"action": "/invalid"},
@@ -159,7 +159,7 @@ def form_submit(request, tmp_path_factory) -> Generator[AppHarness, None, None]:
param_id = request._pyfuncitem.callspec.id.replace("-", "_")
with AppHarness.create(
root=tmp_path_factory.mktemp("form_submit"),
- app_source=request.param, # type: ignore
+ app_source=request.param,
app_name=request.param.func.__name__ + f"_{param_id}",
) as harness:
assert harness.app_instance is not None, "app is not running"
diff --git a/tests/integration/test_input.py b/tests/integration/test_input.py
index 4679104a4..c718749aa 100644
--- a/tests/integration/test_input.py
+++ b/tests/integration/test_input.py
@@ -63,7 +63,7 @@ def fully_controlled_input(tmp_path) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path,
- app_source=FullyControlledInput, # type: ignore
+ app_source=FullyControlledInput,
) as harness:
yield harness
diff --git a/tests/integration/test_large_state.py b/tests/integration/test_large_state.py
index 23a534a2b..a9a8ff2ec 100644
--- a/tests/integration/test_large_state.py
+++ b/tests/integration/test_large_state.py
@@ -58,7 +58,7 @@ def test_large_state(var_count: int, tmp_path_factory, benchmark):
large_state_rendered = template.render(var_count=var_count)
with AppHarness.create(
- root=tmp_path_factory.mktemp(f"large_state"),
+ root=tmp_path_factory.mktemp("large_state"),
app_source=large_state_rendered,
app_name="large_state",
) as large_state:
diff --git a/tests/integration/test_lifespan.py b/tests/integration/test_lifespan.py
index bfa9056ca..e24f4421d 100644
--- a/tests/integration/test_lifespan.py
+++ b/tests/integration/test_lifespan.py
@@ -51,6 +51,7 @@ def LifespanApp():
def context_global(self) -> int:
return lifespan_context_global
+ @rx.event
def tick(self, date):
pass
@@ -79,7 +80,7 @@ def lifespan_app(tmp_path) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path,
- app_source=LifespanApp, # type: ignore
+ app_source=LifespanApp,
) as harness:
yield harness
diff --git a/tests/integration/test_login_flow.py b/tests/integration/test_login_flow.py
index ecaade9cf..1938672a3 100644
--- a/tests/integration/test_login_flow.py
+++ b/tests/integration/test_login_flow.py
@@ -62,7 +62,7 @@ def login_sample(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("login_sample"),
- app_source=LoginSample, # type: ignore
+ app_source=LoginSample,
) as harness:
yield harness
diff --git a/tests/integration/test_media.py b/tests/integration/test_media.py
index 0c659beca..649038a7e 100644
--- a/tests/integration/test_media.py
+++ b/tests/integration/test_media.py
@@ -84,7 +84,7 @@ def media_app(tmp_path) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path,
- app_source=MediaApp, # type: ignore
+ app_source=MediaApp,
) as harness:
yield harness
diff --git a/tests/integration/test_navigation.py b/tests/integration/test_navigation.py
index 492ae4510..4e81e4155 100644
--- a/tests/integration/test_navigation.py
+++ b/tests/integration/test_navigation.py
@@ -52,7 +52,7 @@ def navigation_app(tmp_path) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path,
- app_source=NavigationApp, # type: ignore
+ app_source=NavigationApp,
) as harness:
yield harness
@@ -74,7 +74,7 @@ async def test_navigation_app(navigation_app: AppHarness):
with poll_for_navigation(driver):
internal_link.click()
- assert urlsplit(driver.current_url).path == f"/internal/"
+ assert urlsplit(driver.current_url).path == "/internal/"
with poll_for_navigation(driver):
driver.back()
diff --git a/tests/integration/test_server_side_event.py b/tests/integration/test_server_side_event.py
index cacf6e1c5..f04cc3beb 100644
--- a/tests/integration/test_server_side_event.py
+++ b/tests/integration/test_server_side_event.py
@@ -93,7 +93,7 @@ def server_side_event(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("server_side_event"),
- app_source=ServerSideEvent, # type: ignore
+ app_source=ServerSideEvent,
) as harness:
yield harness
@@ -102,7 +102,6 @@ def server_side_event(tmp_path_factory) -> Generator[AppHarness, None, None]:
def driver(server_side_event: AppHarness):
"""Get an instance of the browser open to the server_side_event app.
-
Args:
server_side_event: harness for ServerSideEvent app
diff --git a/tests/integration/test_shared_state.py b/tests/integration/test_shared_state.py
index 6f59c5142..410669381 100644
--- a/tests/integration/test_shared_state.py
+++ b/tests/integration/test_shared_state.py
@@ -39,7 +39,7 @@ def shared_state(
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("shared_state"),
- app_source=SharedStateApp, # type: ignore
+ app_source=SharedStateApp,
) as harness:
yield harness
diff --git a/tests/integration/test_state_inheritance.py b/tests/integration/test_state_inheritance.py
index 86ab625e1..81512a67a 100644
--- a/tests/integration/test_state_inheritance.py
+++ b/tests/integration/test_state_inheritance.py
@@ -216,8 +216,8 @@ def state_inheritance(
running AppHarness instance
"""
with AppHarness.create(
- root=tmp_path_factory.mktemp(f"state_inheritance"),
- app_source=StateInheritance, # type: ignore
+ root=tmp_path_factory.mktemp("state_inheritance"),
+ app_source=StateInheritance,
) as harness:
yield harness
diff --git a/tests/integration/test_tailwind.py b/tests/integration/test_tailwind.py
index bda664a1c..eb0fde759 100644
--- a/tests/integration/test_tailwind.py
+++ b/tests/integration/test_tailwind.py
@@ -78,7 +78,7 @@ def tailwind_app(tmp_path, tailwind_disabled) -> Generator[AppHarness, None, Non
"""
with AppHarness.create(
root=tmp_path,
- app_source=functools.partial(TailwindApp, tailwind_disabled=tailwind_disabled), # type: ignore
+ app_source=functools.partial(TailwindApp, tailwind_disabled=tailwind_disabled),
app_name="tailwind_disabled_app" if tailwind_disabled else "tailwind_app",
) as harness:
yield harness
diff --git a/tests/integration/test_upload.py b/tests/integration/test_upload.py
index 813313462..b7f14b03d 100644
--- a/tests/integration/test_upload.py
+++ b/tests/integration/test_upload.py
@@ -4,6 +4,7 @@ from __future__ import annotations
import asyncio
import time
+from pathlib import Path
from typing import Generator
import pytest
@@ -18,10 +19,14 @@ def UploadFile():
import reflex as rx
+ LARGE_DATA = "DUMMY" * 1024 * 512
+
class UploadState(rx.State):
_file_data: Dict[str, str] = {}
event_order: List[str] = []
progress_dicts: List[dict] = []
+ disabled: bool = False
+ large_data: str = ""
async def handle_upload(self, files: List[rx.UploadFile]):
for file in files:
@@ -32,6 +37,7 @@ def UploadFile():
for file in files:
upload_data = await file.read()
self._file_data[file.filename or ""] = upload_data.decode("utf-8")
+ self.large_data = LARGE_DATA
yield UploadState.chain_event
def upload_progress(self, progress):
@@ -40,13 +46,15 @@ def UploadFile():
self.progress_dicts.append(progress)
def chain_event(self):
+ assert self.large_data == LARGE_DATA
+ self.large_data = ""
self.event_order.append("chain_event")
def index():
return rx.vstack(
rx.input(
value=UploadState.router.session.client_token,
- is_read_only=True,
+ read_only=True,
id="token",
),
rx.heading("Default Upload"),
@@ -55,6 +63,7 @@ def UploadFile():
rx.button("Select File"),
rx.text("Drag and drop files here or click to select files"),
),
+ disabled=UploadState.disabled,
),
rx.button(
"Upload",
@@ -132,7 +141,7 @@ def upload_file(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("upload_file"),
- app_source=UploadFile, # type: ignore
+ app_source=UploadFile,
) as harness:
yield harness
@@ -205,11 +214,12 @@ async def test_upload_file(
file_data = await AppHarness._poll_for_async(get_file_data)
assert isinstance(file_data, dict)
- assert file_data[exp_name] == exp_contents
+ normalized_file_data = {Path(k).name: v for k, v in file_data.items()}
+ assert normalized_file_data[Path(exp_name).name] == exp_contents
# check that the selected files are displayed
selected_files = driver.find_element(By.ID, f"selected_files{suffix}")
- assert selected_files.text == exp_name
+ assert Path(selected_files.text).name == Path(exp_name).name
state = await upload_file.get_state(substate_token)
if secondary:
@@ -256,7 +266,9 @@ async def test_upload_file_multiple(tmp_path, upload_file: AppHarness, driver):
# check that the selected files are displayed
selected_files = driver.find_element(By.ID, "selected_files")
- assert selected_files.text == "\n".join(exp_files)
+ assert [Path(name).name for name in selected_files.text.split("\n")] == [
+ Path(name).name for name in exp_files
+ ]
# do the upload
upload_button.click()
@@ -271,8 +283,9 @@ async def test_upload_file_multiple(tmp_path, upload_file: AppHarness, driver):
file_data = await AppHarness._poll_for_async(get_file_data)
assert isinstance(file_data, dict)
+ normalized_file_data = {Path(k).name: v for k, v in file_data.items()}
for exp_name, exp_contents in exp_files.items():
- assert file_data[exp_name] == exp_contents
+ assert normalized_file_data[Path(exp_name).name] == exp_contents
@pytest.mark.parametrize("secondary", [False, True])
@@ -317,7 +330,9 @@ def test_clear_files(
# check that the selected files are displayed
selected_files = driver.find_element(By.ID, f"selected_files{suffix}")
- assert selected_files.text == "\n".join(exp_files)
+ assert [Path(name).name for name in selected_files.text.split("\n")] == [
+ Path(name).name for name in exp_files
+ ]
clear_button = driver.find_element(By.ID, f"clear_button{suffix}")
assert clear_button
@@ -352,8 +367,8 @@ async def test_cancel_upload(tmp_path, upload_file: AppHarness, driver: WebDrive
substate_token = f"{token}_{state_full_name}"
upload_box = driver.find_elements(By.XPATH, "//input[@type='file']")[1]
- upload_button = driver.find_element(By.ID, f"upload_button_secondary")
- cancel_button = driver.find_element(By.ID, f"cancel_button_secondary")
+ upload_button = driver.find_element(By.ID, "upload_button_secondary")
+ cancel_button = driver.find_element(By.ID, "cancel_button_secondary")
exp_name = "large.txt"
target_file = tmp_path / exp_name
@@ -369,6 +384,9 @@ async def test_cancel_upload(tmp_path, upload_file: AppHarness, driver: WebDrive
# look up the backend state and assert on progress
state = await upload_file.get_state(substate_token)
assert state.substates[state_name].progress_dicts
- assert exp_name not in state.substates[state_name]._file_data
+ file_data = state.substates[state_name]._file_data
+ assert isinstance(file_data, dict)
+ normalized_file_data = {Path(k).name: v for k, v in file_data.items()}
+ assert Path(exp_name).name not in normalized_file_data
target_file.unlink()
diff --git a/tests/integration/test_var_operations.py b/tests/integration/test_var_operations.py
index 919a39f3b..7a7c8328d 100644
--- a/tests/integration/test_var_operations.py
+++ b/tests/integration/test_var_operations.py
@@ -613,7 +613,7 @@ def var_operations(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("var_operations"),
- app_source=VarOperations, # type: ignore
+ app_source=VarOperations,
) as harness:
assert harness.app_instance is not None, "app is not running"
yield harness
@@ -793,8 +793,8 @@ def test_var_operations(driver, var_operations: AppHarness):
("foreach_list_ix", "1\n2"),
("foreach_list_nested", "1\n1\n2"),
# rx.memo component with state
- ("memo_comp", "[1,2]10"),
- ("memo_comp_nested", "[3,4]5"),
+ ("memo_comp", "1210"),
+ ("memo_comp_nested", "345"),
# foreach in a match
("foreach_in_match", "first\nsecond\nthird"),
]
diff --git a/tests/integration/tests_playwright/test_stateless_app.py b/tests/integration/tests_playwright/test_stateless_app.py
new file mode 100644
index 000000000..0c0b2959b
--- /dev/null
+++ b/tests/integration/tests_playwright/test_stateless_app.py
@@ -0,0 +1,59 @@
+"""Integration tests for a stateless app."""
+
+from typing import Generator
+
+import httpx
+import pytest
+from playwright.sync_api import Page, expect
+
+import reflex as rx
+from reflex.testing import AppHarness
+
+
+def StatelessApp():
+ """A stateless app that renders a heading."""
+ import reflex as rx
+
+ def index():
+ return rx.heading("This is a stateless app")
+
+ app = rx.App()
+ app.add_page(index)
+
+
+@pytest.fixture(scope="module")
+def stateless_app(tmp_path_factory) -> Generator[AppHarness, None, None]:
+ """Create a stateless app AppHarness.
+
+ Args:
+ tmp_path_factory: pytest fixture for creating temporary directories.
+
+ Yields:
+ AppHarness: A harness for testing the stateless app.
+ """
+ with AppHarness.create(
+ root=tmp_path_factory.mktemp("stateless_app"),
+ app_source=StatelessApp,
+ ) as harness:
+ yield harness
+
+
+def test_statelessness(stateless_app: AppHarness, page: Page):
+ """Test that the stateless app renders a heading but backend/_event is not mounted.
+
+ Args:
+ stateless_app: A harness for testing the stateless app.
+ page: A Playwright page.
+ """
+ assert stateless_app.frontend_url is not None
+ assert stateless_app.backend is not None
+ assert stateless_app.backend.started
+
+ res = httpx.get(rx.config.get_config().api_url + "/_event")
+ assert res.status_code == 404
+
+ res2 = httpx.get(rx.config.get_config().api_url + "/ping")
+ assert res2.status_code == 200
+
+ page.goto(stateless_app.frontend_url)
+ expect(page.get_by_role("heading")).to_have_text("This is a stateless app")
diff --git a/tests/integration/test_table.py b/tests/integration/tests_playwright/test_table.py
similarity index 55%
rename from tests/integration/test_table.py
rename to tests/integration/tests_playwright/test_table.py
index 09004a874..0a39b197e 100644
--- a/tests/integration/test_table.py
+++ b/tests/integration/tests_playwright/test_table.py
@@ -3,10 +3,18 @@
from typing import Generator
import pytest
-from selenium.webdriver.common.by import By
+from playwright.sync_api import Page
from reflex.testing import AppHarness
+expected_col_headers = ["Name", "Age", "Location"]
+expected_row_headers = ["John", "Jane", "Joe"]
+expected_cells_data = [
+ ["30", "New York"],
+ ["31", "San Fransisco"],
+ ["32", "Los Angeles"],
+]
+
def Table():
"""App using table component."""
@@ -17,11 +25,6 @@ def Table():
@app.add_page
def index():
return rx.center(
- rx.input(
- id="token",
- value=rx.State.router.session.client_token,
- is_read_only=True,
- ),
rx.table.root(
rx.table.header(
rx.table.row(
@@ -53,7 +56,7 @@ def Table():
@pytest.fixture()
-def table(tmp_path_factory) -> Generator[AppHarness, None, None]:
+def table_app(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""Start Table app at tmp_path via AppHarness.
Args:
@@ -65,53 +68,33 @@ def table(tmp_path_factory) -> Generator[AppHarness, None, None]:
"""
with AppHarness.create(
root=tmp_path_factory.mktemp("table"),
- app_source=Table, # type: ignore
+ app_source=Table,
) as harness:
assert harness.app_instance is not None, "app is not running"
yield harness
-@pytest.fixture
-def driver(table: AppHarness):
- """GEt an instance of the browser open to the table app.
-
- Args:
- table: harness for Table app
-
- Yields:
- WebDriver instance.
- """
- driver = table.frontend()
- try:
- token_input = driver.find_element(By.ID, "token")
- assert token_input
- # wait for the backend connection to send the token
- token = table.poll_for_value(token_input)
- assert token is not None
-
- yield driver
- finally:
- driver.quit()
-
-
-def test_table(driver, table: AppHarness):
+def test_table(page: Page, table_app: AppHarness):
"""Test that a table component is rendered properly.
Args:
- driver: Selenium WebDriver open to the app
- table: Harness for Table app
+ table_app: Harness for Table app
+ page: Playwright page instance
"""
- assert table.app_instance is not None, "app is not running"
+ assert table_app.frontend_url is not None, "frontend url is not available"
- thead = driver.find_element(By.TAG_NAME, "thead")
- # poll till page is fully loaded.
- table.poll_for_content(element=thead)
- # check headers
- assert thead.find_element(By.TAG_NAME, "tr").text == "Name Age Location"
- # check first row value
- assert (
- driver.find_element(By.TAG_NAME, "tbody")
- .find_elements(By.TAG_NAME, "tr")[0]
- .text
- == "John 30 New York"
- )
+ page.goto(table_app.frontend_url)
+ table = page.get_by_role("table")
+
+ # Check column headers
+ headers = table.get_by_role("columnheader").all_inner_texts()
+ assert headers == expected_col_headers
+
+ # Check rows headers
+ rows = table.get_by_role("rowheader").all_inner_texts()
+ assert rows == expected_row_headers
+
+ # Check cells
+ rows = table.get_by_role("cell").all_inner_texts()
+ for i, expected_row in enumerate(expected_cells_data):
+ assert [rows[idx := i * 2], rows[idx + 1]] == expected_row
diff --git a/tests/test_node_version.py b/tests/test_node_version.py
index 9555eb524..defba3d20 100644
--- a/tests/test_node_version.py
+++ b/tests/test_node_version.py
@@ -43,7 +43,7 @@ def node_version_app(tmp_path) -> Generator[AppHarness, Any, None]:
"""
with AppHarness.create(
root=tmp_path,
- app_source=TestNodeVersionApp, # type: ignore
+ app_source=TestNodeVersionApp,
) as harness:
yield harness
diff --git a/tests/units/experimental/custom_script.js b/tests/units/assets/custom_script.js
similarity index 100%
rename from tests/units/experimental/custom_script.js
rename to tests/units/assets/custom_script.js
diff --git a/tests/units/assets/test_assets.py b/tests/units/assets/test_assets.py
new file mode 100644
index 000000000..b957f1902
--- /dev/null
+++ b/tests/units/assets/test_assets.py
@@ -0,0 +1,94 @@
+import shutil
+from pathlib import Path
+from typing import Generator
+
+import pytest
+
+import reflex as rx
+import reflex.constants as constants
+
+
+def test_shared_asset() -> None:
+ """Test shared assets."""
+ # The asset function copies a file to the app's external assets directory.
+ asset = rx.asset(path="custom_script.js", shared=True, subfolder="subfolder")
+ assert asset == "/external/test_assets/subfolder/custom_script.js"
+ result_file = Path(
+ Path.cwd(), "assets/external/test_assets/subfolder/custom_script.js"
+ )
+ assert result_file.exists()
+
+ # Running a second time should not raise an error.
+ asset = rx.asset(path="custom_script.js", shared=True, subfolder="subfolder")
+
+ # Test the asset function without a subfolder.
+ asset = rx.asset(path="custom_script.js", shared=True)
+ assert asset == "/external/test_assets/custom_script.js"
+ result_file = Path(Path.cwd(), "assets/external/test_assets/custom_script.js")
+ assert result_file.exists()
+
+ # clean up
+ shutil.rmtree(Path.cwd() / "assets/external")
+
+ with pytest.raises(FileNotFoundError):
+ asset = rx.asset("non_existent_file.js")
+
+ # Nothing is done to assets when file does not exist.
+ assert not Path(Path.cwd() / "assets/external").exists()
+
+
+def test_deprecated_x_asset(capsys) -> None:
+ """Test that the deprecated asset function raises a warning.
+
+ Args:
+ capsys: Pytest fixture that captures stdout and stderr.
+ """
+ assert rx.asset("custom_script.js", shared=True) == rx._x.asset("custom_script.js")
+ assert (
+ "DeprecationWarning: rx._x.asset has been deprecated in version 0.6.6"
+ in capsys.readouterr().out
+ )
+
+
+@pytest.mark.parametrize(
+ "path,shared",
+ [
+ pytest.param("non_existing_file", True),
+ pytest.param("non_existing_file", False),
+ ],
+)
+def test_invalid_assets(path: str, shared: bool) -> None:
+ """Test that asset raises an error when the file does not exist.
+
+ Args:
+ path: The path to the asset.
+ shared: Whether the asset should be shared.
+ """
+ with pytest.raises(FileNotFoundError):
+ _ = rx.asset(path, shared=shared)
+
+
+@pytest.fixture
+def custom_script_in_asset_dir() -> Generator[Path, None, None]:
+ """Create a custom_script.js file in the app's assets directory.
+
+ Yields:
+ The path to the custom_script.js file.
+ """
+ asset_dir = Path.cwd() / constants.Dirs.APP_ASSETS
+ asset_dir.mkdir(exist_ok=True)
+ path = asset_dir / "custom_script.js"
+ path.touch()
+ yield path
+ path.unlink()
+
+
+def test_local_asset(custom_script_in_asset_dir: Path) -> None:
+ """Test that no error is raised if shared is set and both files exist.
+
+ Args:
+ custom_script_in_asset_dir: Fixture that creates a custom_script.js file in the app's assets directory.
+
+ """
+ asset = rx.asset("custom_script.js", shared=False)
+ assert asset == "/custom_script.js"
diff --git a/tests/units/compiler/test_compiler.py b/tests/units/compiler/test_compiler.py
index afacf43c5..22f5c8483 100644
--- a/tests/units/compiler/test_compiler.py
+++ b/tests/units/compiler/test_compiler.py
@@ -131,11 +131,11 @@ def test_compile_stylesheets(tmp_path, mocker):
assert compiler.compile_root_stylesheet(stylesheets) == (
str(Path(".web") / "styles" / "styles.css"),
- f"@import url('./tailwind.css'); \n"
- f"@import url('https://fonts.googleapis.com/css?family=Sofia&effect=neon|outline|emboss|shadow-multiple'); \n"
- f"@import url('https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css'); \n"
- f"@import url('../public/styles.css'); \n"
- f"@import url('https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css'); \n",
+ "@import url('./tailwind.css'); \n"
+ "@import url('https://fonts.googleapis.com/css?family=Sofia&effect=neon|outline|emboss|shadow-multiple'); \n"
+ "@import url('https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css'); \n"
+ "@import url('../public/styles.css'); \n"
+ "@import url('https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css'); \n",
)
diff --git a/tests/units/components/base/test_script.py b/tests/units/components/base/test_script.py
index b909b6c61..e9c40188b 100644
--- a/tests/units/components/base/test_script.py
+++ b/tests/units/components/base/test_script.py
@@ -62,14 +62,14 @@ def test_script_event_handler():
)
render_dict = component.render()
assert (
- f'onReady={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_ready", ({{ }}), ({{ }})))], args, ({{ }})))))}}'
+ f'onReady={{((...args) => (addEvents([(Event("{EvState.get_full_name()}.on_ready", ({{ }}), ({{ }})))], args, ({{ }}))))}}'
in render_dict["props"]
)
assert (
- f'onLoad={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_load", ({{ }}), ({{ }})))], args, ({{ }})))))}}'
+ f'onLoad={{((...args) => (addEvents([(Event("{EvState.get_full_name()}.on_load", ({{ }}), ({{ }})))], args, ({{ }}))))}}'
in render_dict["props"]
)
assert (
- f'onError={{((...args) => ((addEvents([(Event("{EvState.get_full_name()}.on_error", ({{ }}), ({{ }})))], args, ({{ }})))))}}'
+ f'onError={{((...args) => (addEvents([(Event("{EvState.get_full_name()}.on_error", ({{ }}), ({{ }})))], args, ({{ }}))))}}'
in render_dict["props"]
)
diff --git a/tests/units/components/core/test_banner.py b/tests/units/components/core/test_banner.py
index 02b030902..fe6de5eae 100644
--- a/tests/units/components/core/test_banner.py
+++ b/tests/units/components/core/test_banner.py
@@ -4,6 +4,7 @@ from reflex.components.core.banner import (
ConnectionPulser,
WebsocketTargetURL,
)
+from reflex.components.radix.themes.base import RadixThemesComponent
from reflex.components.radix.themes.typography.text import Text
@@ -12,7 +13,7 @@ def test_websocket_target_url():
var_data = url._get_all_var_data()
assert var_data is not None
assert sorted(tuple((key for key, _ in var_data.imports))) == sorted(
- ("/utils/state", "/env.json")
+ ("$/utils/state", "$/env.json")
)
@@ -22,10 +23,10 @@ def test_connection_banner():
assert sorted(tuple(_imports)) == sorted(
(
"react",
- "/utils/context",
- "/utils/state",
- "@radix-ui/themes@^3.0.0",
- "/env.json",
+ "$/utils/context",
+ "$/utils/state",
+ RadixThemesComponent().library or "",
+ "$/env.json",
)
)
@@ -40,10 +41,10 @@ def test_connection_modal():
assert sorted(tuple(_imports)) == sorted(
(
"react",
- "/utils/context",
- "/utils/state",
- "@radix-ui/themes@^3.0.0",
- "/env.json",
+ "$/utils/context",
+ "$/utils/state",
+ RadixThemesComponent().library or "",
+ "$/env.json",
)
)
diff --git a/tests/units/components/core/test_colors.py b/tests/units/components/core/test_colors.py
index a6175d56a..74fbeb20f 100644
--- a/tests/units/components/core/test_colors.py
+++ b/tests/units/components/core/test_colors.py
@@ -14,6 +14,7 @@ class ColorState(rx.State):
color: str = "mint"
color_part: str = "tom"
shade: int = 4
+ alpha: bool = False
color_state_name = ColorState.get_full_name().replace(".", "__")
@@ -31,7 +32,14 @@ def create_color_var(color):
(create_color_var(rx.color("mint", 3, True)), '"var(--mint-a3)"', Color),
(
create_color_var(rx.color(ColorState.color, ColorState.shade)), # type: ignore
- f'("var(--"+{str(color_state_name)}.color+"-"+{str(color_state_name)}.shade+")")',
+ f'("var(--"+{str(color_state_name)}.color+"-"+(((__to_string) => __to_string.toString())({str(color_state_name)}.shade))+")")',
+ Color,
+ ),
+ (
+ create_color_var(
+ rx.color(ColorState.color, ColorState.shade, ColorState.alpha) # type: ignore
+ ),
+ f'("var(--"+{str(color_state_name)}.color+"-"+({str(color_state_name)}.alpha ? "a" : "")+(((__to_string) => __to_string.toString())({str(color_state_name)}.shade))+")")',
Color,
),
(
@@ -43,7 +51,7 @@ def create_color_var(color):
create_color_var(
rx.color(f"{ColorState.color_part}ato", f"{ColorState.shade}") # type: ignore
),
- f'("var(--"+{str(color_state_name)}.color_part+"ato-"+{str(color_state_name)}.shade+")")',
+ f'("var(--"+({str(color_state_name)}.color_part+"ato")+"-"+{str(color_state_name)}.shade+")")',
Color,
),
(
diff --git a/tests/units/components/core/test_debounce.py b/tests/units/components/core/test_debounce.py
index 7856ee090..2fad9c925 100644
--- a/tests/units/components/core/test_debounce.py
+++ b/tests/units/components/core/test_debounce.py
@@ -41,7 +41,6 @@ class S(BaseState):
def on_change(self, v: str):
"""Dummy on_change handler.
-
Args:
v: The changed value.
"""
diff --git a/tests/units/components/datadisplay/test_code.py b/tests/units/components/datadisplay/test_code.py
index 809c68fe5..6b7168756 100644
--- a/tests/units/components/datadisplay/test_code.py
+++ b/tests/units/components/datadisplay/test_code.py
@@ -11,22 +11,3 @@ def test_code_light_dark_theme(theme, expected):
code_block = CodeBlock.create(theme=theme)
assert code_block.theme._js_expr == expected # type: ignore
-
-
-def generate_custom_code(language, expected_case):
- return f"SyntaxHighlighter.registerLanguage('{language}', {expected_case})"
-
-
-@pytest.mark.parametrize(
- "language, expected_case",
- [
- ("python", "python"),
- ("firestore-security-rules", "firestoreSecurityRules"),
- ("typescript", "typescript"),
- ],
-)
-def test_get_custom_code(language, expected_case):
- code_block = CodeBlock.create(language=language)
- assert code_block._get_custom_code() == generate_custom_code(
- language, expected_case
- )
diff --git a/tests/units/components/datadisplay/test_shiki_code.py b/tests/units/components/datadisplay/test_shiki_code.py
new file mode 100644
index 000000000..eb473ba06
--- /dev/null
+++ b/tests/units/components/datadisplay/test_shiki_code.py
@@ -0,0 +1,172 @@
+import pytest
+
+from reflex.components.datadisplay.shiki_code_block import (
+ ShikiBaseTransformers,
+ ShikiCodeBlock,
+ ShikiHighLevelCodeBlock,
+ ShikiJsTransformer,
+)
+from reflex.components.el.elements.forms import Button
+from reflex.components.lucide.icon import Icon
+from reflex.components.radix.themes.layout.box import Box
+from reflex.style import Style
+from reflex.vars import Var
+
+
+@pytest.mark.parametrize(
+ "library, fns, expected_output, raises_exception",
+ [
+ ("some_library", ["function_one"], ["function_one"], False),
+ ("some_library", [123], None, True),
+ ("some_library", [], [], False),
+ (
+ "some_library",
+ ["function_one", "function_two"],
+ ["function_one", "function_two"],
+ False,
+ ),
+ ("", ["function_one"], ["function_one"], False),
+ ("some_library", ["function_one", 789], None, True),
+ ("", [], [], False),
+ ],
+)
+def test_create_transformer(library, fns, expected_output, raises_exception):
+ if raises_exception:
+ # Ensure ValueError is raised for invalid cases
+ with pytest.raises(ValueError):
+ ShikiCodeBlock.create_transformer(library, fns)
+ else:
+ transformer = ShikiCodeBlock.create_transformer(library, fns)
+ assert isinstance(transformer, ShikiBaseTransformers)
+ assert transformer.library == library
+
+ # Verify that the functions are correctly wrapped in FunctionStringVar
+ function_names = [str(fn) for fn in transformer.fns]
+ assert function_names == expected_output
+
+
+@pytest.mark.parametrize(
+ "code_block, children, props, expected_first_child, expected_styles",
+ [
+ ("print('Hello')", ["print('Hello')"], {}, "print('Hello')", {}),
+ (
+ "print('Hello')",
+ ["print('Hello')", "More content"],
+ {},
+ "print('Hello')",
+ {},
+ ),
+ (
+ "print('Hello')",
+ ["print('Hello')"],
+ {
+ "transformers": [
+ ShikiBaseTransformers(
+ library="lib", fns=[], style=Style({"color": "red"})
+ )
+ ]
+ },
+ "print('Hello')",
+ {"color": "red"},
+ ),
+ (
+ "print('Hello')",
+ ["print('Hello')"],
+ {
+ "transformers": [
+ ShikiBaseTransformers(
+ library="lib", fns=[], style=Style({"color": "red"})
+ )
+ ],
+ "style": {"background": "blue"},
+ },
+ "print('Hello')",
+ {"color": "red", "background": "blue"},
+ ),
+ ],
+)
+def test_create_shiki_code_block(
+ code_block, children, props, expected_first_child, expected_styles
+):
+ component = ShikiCodeBlock.create(code_block, *children, **props)
+
+ # Test that the created component is a Box
+ assert isinstance(component, Box)
+
+ # Test that the first child is the code
+ code_block_component = component.children[0]
+ assert code_block_component.code._var_value == expected_first_child # type: ignore
+
+ applied_styles = component.style
+ for key, value in expected_styles.items():
+ assert Var.create(applied_styles[key])._var_value == value
+
+
+@pytest.mark.parametrize(
+ "children, props, expected_transformers, expected_button_type",
+ [
+ (["print('Hello')"], {"use_transformers": True}, [ShikiJsTransformer], None),
+ (["print('Hello')"], {"can_copy": True}, None, Button),
+ (
+ ["print('Hello')"],
+ {
+ "can_copy": True,
+ "copy_button": Button.create(Icon.create(tag="a_arrow_down")),
+ },
+ None,
+ Button,
+ ),
+ ],
+)
+def test_create_shiki_high_level_code_block(
+ children, props, expected_transformers, expected_button_type
+):
+ component = ShikiHighLevelCodeBlock.create(*children, **props)
+
+ # Test that the created component is a Box
+ assert isinstance(component, Box)
+
+ # Test that the first child is the code block component
+ code_block_component = component.children[0]
+ assert code_block_component.code._var_value == children[0] # type: ignore
+
+ # Check if the transformer is set correctly if expected
+ if expected_transformers:
+ exp_trans_names = [t.__name__ for t in expected_transformers]
+ for transformer in code_block_component.transformers._var_value: # type: ignore
+ assert type(transformer).__name__ in exp_trans_names
+
+ # Check if the second child is the copy button if can_copy is True
+ if props.get("can_copy", False):
+ if props.get("copy_button"):
+ assert isinstance(component.children[1], expected_button_type)
+ assert component.children[1] == props["copy_button"]
+ else:
+ assert isinstance(component.children[1], expected_button_type)
+ else:
+ assert len(component.children) == 1
+
+
+@pytest.mark.parametrize(
+ "children, props",
+ [
+ (["print('Hello')"], {"theme": "dark"}),
+ (["print('Hello')"], {"language": "javascript"}),
+ ],
+)
+def test_shiki_high_level_code_block_theme_language_mapping(children, props):
+ component = ShikiHighLevelCodeBlock.create(*children, **props)
+
+ # Test that the theme is mapped correctly
+ if "theme" in props:
+ assert component.children[
+ 0
+ ].theme._var_value == ShikiHighLevelCodeBlock._map_themes(props["theme"]) # type: ignore
+
+ # Test that the language is mapped correctly
+ if "language" in props:
+ assert component.children[
+ 0
+ ].language._var_value == ShikiHighLevelCodeBlock._map_languages( # type: ignore
+ props["language"]
+ )
diff --git a/tests/units/components/forms/test_uploads.py b/tests/units/components/forms/test_uploads.py
deleted file mode 100644
index 3b2ee014f..000000000
--- a/tests/units/components/forms/test_uploads.py
+++ /dev/null
@@ -1,205 +0,0 @@
-import pytest
-
-import reflex as rx
-
-
-@pytest.fixture
-def upload_root_component():
- """A test upload component function.
-
- Returns:
- A test upload component function.
- """
-
- def upload_root_component():
- return rx.upload.root(
- rx.button("select file"),
- rx.text("Drag and drop files here or click to select files"),
- border="1px dotted black",
- )
-
- return upload_root_component()
-
-
-@pytest.fixture
-def upload_component():
- """A test upload component function.
-
- Returns:
- A test upload component function.
- """
-
- def upload_component():
- return rx.upload(
- rx.button("select file"),
- rx.text("Drag and drop files here or click to select files"),
- border="1px dotted black",
- )
-
- return upload_component()
-
-
-@pytest.fixture
-def upload_component_id_special():
- def upload_component():
- return rx.upload(
- rx.button("select file"),
- rx.text("Drag and drop files here or click to select files"),
- border="1px dotted black",
- id="#spec!`al-_98ID",
- )
-
- return upload_component()
-
-
-@pytest.fixture
-def upload_component_with_props():
- """A test upload component with props function.
-
- Returns:
- A test upload component with props function.
- """
-
- def upload_component_with_props():
- return rx.upload(
- rx.button("select file"),
- rx.text("Drag and drop files here or click to select files"),
- border="1px dotted black",
- no_drag=True,
- max_files=2,
- )
-
- return upload_component_with_props()
-
-
-def test_upload_root_component_render(upload_root_component):
- """Test that the render function is set correctly.
-
- Args:
- upload_root_component: component fixture
- """
- upload = upload_root_component.render()
-
- # upload
- assert upload["name"] == "ReactDropzone"
- assert upload["props"] == [
- 'id={"default"}',
- "multiple={true}",
- "onDrop={e => setFilesById(filesById => {\n"
- " const updatedFilesById = Object.assign({}, filesById);\n"
- ' updatedFilesById["default"] = e;\n'
- " return updatedFilesById;\n"
- " })\n"
- " }",
- "ref={ref_default}",
- ]
- assert upload["args"] == ("getRootProps", "getInputProps")
-
- # box inside of upload
- [box] = upload["children"]
- assert box["name"] == "RadixThemesBox"
- assert box["props"] == [
- 'className={"rx-Upload"}',
- 'css={({ ["border"] : "1px dotted black" })}',
- "{...getRootProps()}",
- ]
-
- # input, button and text inside of box
- [input, button, text] = box["children"]
- assert input["name"] == "input"
- assert input["props"] == ['type={"file"}', "{...getInputProps()}"]
-
- assert button["name"] == "RadixThemesButton"
- assert button["children"][0]["contents"] == '{"select file"}'
-
- assert text["name"] == "RadixThemesText"
- assert (
- text["children"][0]["contents"]
- == '{"Drag and drop files here or click to select files"}'
- )
-
-
-def test_upload_component_render(upload_component):
- """Test that the render function is set correctly.
-
- Args:
- upload_component: component fixture
- """
- upload = upload_component.render()
-
- # upload
- assert upload["name"] == "ReactDropzone"
- assert upload["props"] == [
- 'id={"default"}',
- "multiple={true}",
- "onDrop={e => setFilesById(filesById => {\n"
- " const updatedFilesById = Object.assign({}, filesById);\n"
- ' updatedFilesById["default"] = e;\n'
- " return updatedFilesById;\n"
- " })\n"
- " }",
- "ref={ref_default}",
- ]
- assert upload["args"] == ("getRootProps", "getInputProps")
-
- # box inside of upload
- [box] = upload["children"]
- assert box["name"] == "RadixThemesBox"
- assert box["props"] == [
- 'className={"rx-Upload"}',
- 'css={({ ["border"] : "1px dotted black", ["padding"] : "5em", ["textAlign"] : "center" })}',
- "{...getRootProps()}",
- ]
-
- # input, button and text inside of box
- [input, button, text] = box["children"]
- assert input["name"] == "input"
- assert input["props"] == ['type={"file"}', "{...getInputProps()}"]
-
- assert button["name"] == "RadixThemesButton"
- assert button["children"][0]["contents"] == '{"select file"}'
-
- assert text["name"] == "RadixThemesText"
- assert (
- text["children"][0]["contents"]
- == '{"Drag and drop files here or click to select files"}'
- )
-
-
-def test_upload_component_with_props_render(upload_component_with_props):
- """Test that the render function is set correctly.
-
- Args:
- upload_component_with_props: component fixture
- """
- upload = upload_component_with_props.render()
-
- assert upload["props"] == [
- 'id={"default"}',
- "maxFiles={2}",
- "multiple={true}",
- "noDrag={true}",
- "onDrop={e => setFilesById(filesById => {\n"
- " const updatedFilesById = Object.assign({}, filesById);\n"
- ' updatedFilesById["default"] = e;\n'
- " return updatedFilesById;\n"
- " })\n"
- " }",
- "ref={ref_default}",
- ]
-
-
-def test_upload_component_id_with_special_chars(upload_component_id_special):
- upload = upload_component_id_special.render()
-
- assert upload["props"] == [
- r'id={"#spec!`al-_98ID"}',
- "multiple={true}",
- "onDrop={e => setFilesById(filesById => {\n"
- " const updatedFilesById = Object.assign({}, filesById);\n"
- ' updatedFilesById["#spec!`al-_98ID"] = e;\n'
- " return updatedFilesById;\n"
- " })\n"
- " }",
- "ref={ref__spec_al__98ID}",
- ]
diff --git a/tests/units/components/markdown/__init__.py b/tests/units/components/markdown/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/units/components/markdown/test_markdown.py b/tests/units/components/markdown/test_markdown.py
new file mode 100644
index 000000000..866f32ae1
--- /dev/null
+++ b/tests/units/components/markdown/test_markdown.py
@@ -0,0 +1,190 @@
+from typing import Type
+
+import pytest
+
+from reflex.components.component import Component, memo
+from reflex.components.datadisplay.code import CodeBlock
+from reflex.components.datadisplay.shiki_code_block import ShikiHighLevelCodeBlock
+from reflex.components.markdown.markdown import Markdown, MarkdownComponentMap
+from reflex.components.radix.themes.layout.box import Box
+from reflex.components.radix.themes.typography.heading import Heading
+from reflex.vars.base import Var
+
+
+class CustomMarkdownComponent(Component, MarkdownComponentMap):
+ """A custom markdown component."""
+
+ tag = "CustomMarkdownComponent"
+ library = "custom"
+
+ @classmethod
+ def get_fn_args(cls) -> tuple[str, ...]:
+ """Return the function arguments.
+
+ Returns:
+ The function arguments.
+ """
+ return ("custom_node", "custom_children", "custom_props")
+
+ @classmethod
+ def get_fn_body(cls) -> Var:
+ """Return the function body.
+
+ Returns:
+ The function body.
+ """
+ return Var(_js_expr="{return custom_node + custom_children + custom_props}")
+
+
+def syntax_highlighter_memoized_component(codeblock: Type[Component]):
+ @memo
+ def code_block(code: str, language: str):
+ return Box.create(
+ codeblock.create(
+ code,
+ language=language,
+ class_name="code-block",
+ can_copy=True,
+ ),
+ class_name="relative mb-4",
+ )
+
+ def code_block_markdown(*children, **props):
+ return code_block(
+ code=children[0], language=props.pop("language", "plain"), **props
+ )
+
+ return code_block_markdown
+
+
+@pytest.mark.parametrize(
+ "fn_body, fn_args, explicit_return, expected",
+ [
+ (
+ None,
+ None,
+ False,
+ Var(_js_expr="(({node, children, ...props}) => undefined)"),
+ ),
+ ("return node", ("node",), True, Var(_js_expr="(({node}) => {return node})")),
+ (
+ "return node + children",
+ ("node", "children"),
+ True,
+ Var(_js_expr="(({node, children}) => {return node + children})"),
+ ),
+ (
+ "return node + props",
+ ("node", "...props"),
+ True,
+ Var(_js_expr="(({node, ...props}) => {return node + props})"),
+ ),
+ (
+ "return node + children + props",
+ ("node", "children", "...props"),
+ True,
+ Var(
+ _js_expr="(({node, children, ...props}) => {return node + children + props})"
+ ),
+ ),
+ ],
+)
+def test_create_map_fn_var(fn_body, fn_args, explicit_return, expected):
+ result = MarkdownComponentMap.create_map_fn_var(
+ fn_body=Var(_js_expr=fn_body, _var_type=str) if fn_body else None,
+ fn_args=fn_args,
+ explicit_return=explicit_return,
+ )
+ assert result._js_expr == expected._js_expr
+
+
+@pytest.mark.parametrize(
+ ("cls", "fn_body", "fn_args", "explicit_return", "expected"),
+ [
+ (
+ MarkdownComponentMap,
+ None,
+ None,
+ False,
+ Var(_js_expr="(({node, children, ...props}) => undefined)"),
+ ),
+ (
+ MarkdownComponentMap,
+ "return node",
+ ("node",),
+ True,
+ Var(_js_expr="(({node}) => {return node})"),
+ ),
+ (
+ CustomMarkdownComponent,
+ None,
+ None,
+ True,
+ Var(
+ _js_expr="(({custom_node, custom_children, custom_props}) => {return custom_node + custom_children + custom_props})"
+ ),
+ ),
+ (
+ CustomMarkdownComponent,
+ "return custom_node",
+ ("custom_node",),
+ True,
+ Var(_js_expr="(({custom_node}) => {return custom_node})"),
+ ),
+ ],
+)
+def test_create_map_fn_var_subclass(cls, fn_body, fn_args, explicit_return, expected):
+ result = cls.create_map_fn_var(
+ fn_body=Var(_js_expr=fn_body, _var_type=int) if fn_body else None,
+ fn_args=fn_args,
+ explicit_return=explicit_return,
+ )
+ assert result._js_expr == expected._js_expr
+
+
+@pytest.mark.parametrize(
+ "key,component_map, expected",
+ [
+ (
+ "code",
+ {},
+ """(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?.*)/); const _language = match ? match[1] : ''; if (_language) { (async () => { try { const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${_language}`); SyntaxHighlighter.registerLanguage(_language, module.default); } catch (error) { console.error(`Error importing language module for ${_language}:`, error); } })(); } ; return inline ? ( {children} ) : ( ); })""",
+ ),
+ (
+ "code",
+ {
+ "codeblock": lambda value, **props: ShikiHighLevelCodeBlock.create(
+ value, **props
+ )
+ },
+ """(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?.*)/); const _language = match ? match[1] : ''; ; return inline ? ( {children} ) : ( ); })""",
+ ),
+ (
+ "h1",
+ {
+ "h1": lambda value: CustomMarkdownComponent.create(
+ Heading.create(value, as_="h1", size="6", margin_y="0.5em")
+ )
+ },
+ """(({custom_node, custom_children, custom_props}) => ({children}))""",
+ ),
+ (
+ "code",
+ {"codeblock": syntax_highlighter_memoized_component(CodeBlock)},
+ """(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?.*)/); const _language = match ? match[1] : ''; if (_language) { (async () => { try { const module = await import(`react-syntax-highlighter/dist/cjs/languages/prism/${_language}`); SyntaxHighlighter.registerLanguage(_language, module.default); } catch (error) { console.error(`Error importing language module for ${_language}:`, error); } })(); } ; return inline ? ( {children} ) : ( ); })""",
+ ),
+ (
+ "code",
+ {
+ "codeblock": syntax_highlighter_memoized_component(
+ ShikiHighLevelCodeBlock
+ )
+ },
+ """(({node, inline, className, children, ...props}) => { const match = (className || '').match(/language-(?.*)/); const _language = match ? match[1] : ''; ; return inline ? ( {children} ) : ( ); })""",
+ ),
+ ],
+)
+def test_markdown_format_component(key, component_map, expected):
+ markdown = Markdown.create("# header", component_map=component_map)
+ result = markdown.format_component_map()
+ assert str(result[key]) == expected
diff --git a/tests/units/components/test_component.py b/tests/units/components/test_component.py
index b7b721a92..a2485d10e 100644
--- a/tests/units/components/test_component.py
+++ b/tests/units/components/test_component.py
@@ -19,14 +19,15 @@ from reflex.constants import EventTriggers
from reflex.event import (
EventChain,
EventHandler,
- empty_event,
input_event,
+ no_args_event_spec,
parse_args_spec,
+ passthrough_event_spec,
)
from reflex.state import BaseState
from reflex.style import Style
from reflex.utils import imports
-from reflex.utils.exceptions import EventFnArgMismatch, EventHandlerArgMismatch
+from reflex.utils.exceptions import EventFnArgMismatch
from reflex.utils.imports import ImportDict, ImportVar, ParsedImportDict, parse_imports
from reflex.vars import VarData
from reflex.vars.base import LiteralVar, Var
@@ -43,6 +44,18 @@ def test_state():
def do_something_arg(self, arg):
pass
+ def do_something_with_bool(self, arg: bool):
+ pass
+
+ def do_something_with_int(self, arg: int):
+ pass
+
+ def do_something_with_list_int(self, arg: list[int]):
+ pass
+
+ def do_something_with_list_str(self, arg: list[str]):
+ pass
+
return TestState
@@ -95,8 +108,10 @@ def component2() -> Type[Component]:
"""
return {
**super().get_event_triggers(),
- "on_open": lambda e0: [e0],
- "on_close": lambda e0: [e0],
+ "on_open": passthrough_event_spec(bool),
+ "on_close": passthrough_event_spec(bool),
+ "on_user_visited_count_changed": passthrough_event_spec(int),
+ "on_user_list_changed": passthrough_event_spec(List[str]),
}
def _get_imports(self) -> ParsedImportDict:
@@ -582,7 +597,14 @@ def test_get_event_triggers(component1, component2):
assert component1().get_event_triggers().keys() == default_triggers
assert (
component2().get_event_triggers().keys()
- == {"on_open", "on_close", "on_prop_event"} | default_triggers
+ == {
+ "on_open",
+ "on_close",
+ "on_prop_event",
+ "on_user_visited_count_changed",
+ "on_user_list_changed",
+ }
+ | default_triggers
)
@@ -642,21 +664,18 @@ def test_component_create_unallowed_types(children, test_component):
"name": "Fragment",
"props": [],
"contents": "",
- "args": None,
"special_props": [],
"children": [
{
"name": "RadixThemesText",
"props": ['as={"p"}'],
"contents": "",
- "args": None,
"special_props": [],
"children": [
{
"name": "",
"props": [],
"contents": '{"first_text"}',
- "args": None,
"special_props": [],
"children": [],
"autofocus": False,
@@ -671,15 +690,12 @@ def test_component_create_unallowed_types(children, test_component):
(
(rx.text("first_text"), rx.text("second_text")),
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [],
"contents": '{"first_text"}',
@@ -694,11 +710,9 @@ def test_component_create_unallowed_types(children, test_component):
"special_props": [],
},
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [],
"contents": '{"second_text"}',
@@ -722,15 +736,12 @@ def test_component_create_unallowed_types(children, test_component):
(
(rx.text("first_text"), rx.box((rx.text("second_text"),))),
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [],
"contents": '{"first_text"}',
@@ -745,19 +756,15 @@ def test_component_create_unallowed_types(children, test_component):
"special_props": [],
},
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [
{
- "args": None,
"autofocus": False,
"children": [],
"contents": '{"second_text"}',
@@ -837,9 +844,9 @@ def test_component_event_trigger_arbitrary_args():
comp = C1.create(on_foo=C1State.mock_handler)
assert comp.render()["props"][0] == (
- "onFoo={((__e, _alpha, _bravo, _charlie) => ((addEvents("
+ "onFoo={((__e, _alpha, _bravo, _charlie) => (addEvents("
f'[(Event("{C1State.get_full_name()}.mock_handler", ({{ ["_e"] : __e["target"]["value"], ["_bravo"] : _bravo["nested"], ["_charlie"] : (_charlie["custom"] + 42) }}), ({{ }})))], '
- "[__e, _alpha, _bravo, _charlie], ({ })))))}"
+ "[__e, _alpha, _bravo, _charlie], ({ }))))}"
)
@@ -897,26 +904,30 @@ def test_invalid_event_handler_args(component2, test_state):
test_state: A test state.
"""
# EventHandler args must match
- with pytest.raises(EventHandlerArgMismatch):
+ with pytest.raises(EventFnArgMismatch):
component2.create(on_click=test_state.do_something_arg)
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(on_open=test_state.do_something)
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(on_prop_event=test_state.do_something)
# Multiple EventHandler args: all must match
- with pytest.raises(EventHandlerArgMismatch):
+ with pytest.raises(EventFnArgMismatch):
component2.create(
on_click=[test_state.do_something_arg, test_state.do_something]
)
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(
- on_open=[test_state.do_something_arg, test_state.do_something]
- )
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(
- on_prop_event=[test_state.do_something_arg, test_state.do_something]
- )
+
+ # Enable when 0.7.0 happens
+ # # Event Handler types must match
+ # with pytest.raises(EventHandlerArgTypeMismatch):
+ # component2.create(
+ # on_user_visited_count_changed=test_state.do_something_with_bool
+ # )
+ # with pytest.raises(EventHandlerArgTypeMismatch):
+ # component2.create(on_user_list_changed=test_state.do_something_with_int)
+ # with pytest.raises(EventHandlerArgTypeMismatch):
+ # component2.create(on_user_list_changed=test_state.do_something_with_list_int)
+
+ # component2.create(on_open=test_state.do_something_with_int)
+ # component2.create(on_open=test_state.do_something_with_bool)
+ # component2.create(on_user_visited_count_changed=test_state.do_something_with_int)
+ # component2.create(on_user_list_changed=test_state.do_something_with_list_str)
# lambda cannot return weird values.
with pytest.raises(ValueError):
@@ -931,38 +942,19 @@ def test_invalid_event_handler_args(component2, test_state):
# lambda signature must match event trigger.
with pytest.raises(EventFnArgMismatch):
component2.create(on_click=lambda _: test_state.do_something_arg(1))
- with pytest.raises(EventFnArgMismatch):
- component2.create(on_open=lambda: test_state.do_something)
- with pytest.raises(EventFnArgMismatch):
- component2.create(on_prop_event=lambda: test_state.do_something)
# lambda returning EventHandler must match spec
- with pytest.raises(EventHandlerArgMismatch):
+ with pytest.raises(EventFnArgMismatch):
component2.create(on_click=lambda: test_state.do_something_arg)
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(on_open=lambda _: test_state.do_something)
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(on_prop_event=lambda _: test_state.do_something)
# Mixed EventSpec and EventHandler must match spec.
- with pytest.raises(EventHandlerArgMismatch):
+ with pytest.raises(EventFnArgMismatch):
component2.create(
on_click=lambda: [
test_state.do_something_arg(1),
test_state.do_something_arg,
]
)
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(
- on_open=lambda _: [test_state.do_something_arg(1), test_state.do_something]
- )
- with pytest.raises(EventHandlerArgMismatch):
- component2.create(
- on_prop_event=lambda _: [
- test_state.do_something_arg(1),
- test_state.do_something,
- ]
- )
def test_valid_event_handler_args(component2, test_state):
@@ -976,6 +968,10 @@ def test_valid_event_handler_args(component2, test_state):
component2.create(on_click=test_state.do_something)
component2.create(on_click=test_state.do_something_arg(1))
+ # Does not raise because event handlers are allowed to have less args than the spec.
+ component2.create(on_open=test_state.do_something)
+ component2.create(on_prop_event=test_state.do_something)
+
# Controlled event handlers should take args.
component2.create(on_open=test_state.do_something_arg)
component2.create(on_prop_event=test_state.do_something_arg)
@@ -984,10 +980,20 @@ def test_valid_event_handler_args(component2, test_state):
component2.create(on_open=test_state.do_something())
component2.create(on_prop_event=test_state.do_something())
+ # Multiple EventHandler args: all must match
+ component2.create(on_open=[test_state.do_something_arg, test_state.do_something])
+ component2.create(
+ on_prop_event=[test_state.do_something_arg, test_state.do_something]
+ )
+
# lambda returning EventHandler is okay if the spec matches.
component2.create(on_click=lambda: test_state.do_something)
component2.create(on_open=lambda _: test_state.do_something_arg)
component2.create(on_prop_event=lambda _: test_state.do_something_arg)
+ component2.create(on_open=lambda: test_state.do_something)
+ component2.create(on_prop_event=lambda: test_state.do_something)
+ component2.create(on_open=lambda _: test_state.do_something)
+ component2.create(on_prop_event=lambda _: test_state.do_something)
# lambda can always return an EventSpec.
component2.create(on_click=lambda: test_state.do_something_arg(1))
@@ -1020,6 +1026,15 @@ def test_valid_event_handler_args(component2, test_state):
component2.create(
on_prop_event=lambda _: [test_state.do_something_arg, test_state.do_something()]
)
+ component2.create(
+ on_open=lambda _: [test_state.do_something_arg(1), test_state.do_something]
+ )
+ component2.create(
+ on_prop_event=lambda _: [
+ test_state.do_something_arg(1),
+ test_state.do_something,
+ ]
+ )
def test_get_hooks_nested(component1, component2, component3):
@@ -1117,10 +1132,10 @@ def test_component_with_only_valid_children(fixture, request):
@pytest.mark.parametrize(
"component,rendered",
[
- (rx.text("hi"), '\n {"hi"}\n'),
+ (rx.text("hi"), '\n\n{"hi"}\n'),
(
rx.box(rx.heading("test", size="3")),
- '\n \n {"test"}\n\n',
+ '\n\n\n\n{"test"}\n\n',
),
],
)
@@ -1191,7 +1206,7 @@ TEST_VAR_DICT_OF_DICT = LiteralVar.create({"a": {"b": "test"}})._replace(
merge_var_data=TEST_VAR._var_data
)
FORMATTED_TEST_VAR_DICT_OF_DICT = LiteralVar.create(
- {"a": {"b": f"footestbar"}}
+ {"a": {"b": "footestbar"}}
)._replace(merge_var_data=TEST_VAR._var_data)
TEST_VAR_LIST_OF_LIST = LiteralVar.create([["test"]])._replace(
@@ -1795,8 +1810,8 @@ def test_custom_component_declare_event_handlers_in_fields():
class TestComponent(Component):
on_a: EventHandler[lambda e0: [e0]]
on_b: EventHandler[input_event]
- on_c: EventHandler[empty_event]
- on_d: EventHandler[empty_event]
+ on_c: EventHandler[no_args_event_spec]
+ on_d: EventHandler[no_args_event_spec]
on_e: EventHandler
on_f: EventHandler[lambda a, b, c: [c, b, a]]
diff --git a/tests/units/components/test_component_future_annotations.py b/tests/units/components/test_component_future_annotations.py
index 44ec52c16..0867a2d37 100644
--- a/tests/units/components/test_component_future_annotations.py
+++ b/tests/units/components/test_component_future_annotations.py
@@ -3,7 +3,7 @@ from __future__ import annotations
from typing import Any
from reflex.components.component import Component
-from reflex.event import EventHandler, empty_event, input_event
+from reflex.event import EventHandler, input_event, no_args_event_spec
# This is a repeat of its namesake in test_component.py.
@@ -26,8 +26,8 @@ def test_custom_component_declare_event_handlers_in_fields():
class TestComponent(Component):
on_a: EventHandler[lambda e0: [e0]]
on_b: EventHandler[input_event]
- on_c: EventHandler[empty_event]
- on_d: EventHandler[empty_event]
+ on_c: EventHandler[no_args_event_spec]
+ on_d: EventHandler[no_args_event_spec]
custom_component = ReferenceComponent.create()
test_component = TestComponent.create()
diff --git a/tests/units/components/test_component_state.py b/tests/units/components/test_component_state.py
index 574997ba5..1b62e35c8 100644
--- a/tests/units/components/test_component_state.py
+++ b/tests/units/components/test_component_state.py
@@ -1,7 +1,10 @@
"""Ensure that Components returned by ComponentState.create have independent State classes."""
+import pytest
+
import reflex as rx
from reflex.components.base.bare import Bare
+from reflex.utils.exceptions import ReflexRuntimeError
def test_component_state():
@@ -40,3 +43,21 @@ def test_component_state():
assert len(cs2.children) == 1
assert cs2.children[0].render() == Bare.create("b").render()
assert cs2.id == "b"
+
+
+def test_init_component_state() -> None:
+ """Ensure that ComponentState subclasses cannot be instantiated directly."""
+
+ class CS(rx.ComponentState):
+ @classmethod
+ def get_component(cls, *children, **props):
+ return rx.el.div()
+
+ with pytest.raises(ReflexRuntimeError):
+ CS()
+
+ class SubCS(CS):
+ pass
+
+ with pytest.raises(ReflexRuntimeError):
+ SubCS()
diff --git a/tests/units/components/test_props.py b/tests/units/components/test_props.py
new file mode 100644
index 000000000..8ab07f135
--- /dev/null
+++ b/tests/units/components/test_props.py
@@ -0,0 +1,63 @@
+import pytest
+
+from reflex.components.props import NoExtrasAllowedProps
+from reflex.utils.exceptions import InvalidPropValueError
+
+try:
+ from pydantic.v1 import ValidationError
+except ModuleNotFoundError:
+ from pydantic import ValidationError
+
+
+class PropA(NoExtrasAllowedProps):
+ """Base prop class."""
+
+ foo: str
+ bar: str
+
+
+class PropB(NoExtrasAllowedProps):
+ """Prop class with nested props."""
+
+ foobar: str
+ foobaz: PropA
+
+
+@pytest.mark.parametrize(
+ "props_class, kwargs, should_raise",
+ [
+ (PropA, {"foo": "value", "bar": "another_value"}, False),
+ (PropA, {"fooz": "value", "bar": "another_value"}, True),
+ (
+ PropB,
+ {
+ "foobaz": {"foo": "value", "bar": "another_value"},
+ "foobar": "foo_bar_value",
+ },
+ False,
+ ),
+ (
+ PropB,
+ {
+ "fooba": {"foo": "value", "bar": "another_value"},
+ "foobar": "foo_bar_value",
+ },
+ True,
+ ),
+ (
+ PropB,
+ {
+ "foobaz": {"foobar": "value", "bar": "another_value"},
+ "foobar": "foo_bar_value",
+ },
+ True,
+ ),
+ ],
+)
+def test_no_extras_allowed_props(props_class, kwargs, should_raise):
+ if should_raise:
+ with pytest.raises((ValidationError, InvalidPropValueError)):
+ props_class(**kwargs)
+ else:
+ props_instance = props_class(**kwargs)
+ assert isinstance(props_instance, props_class)
diff --git a/tests/units/experimental/test_assets.py b/tests/units/experimental/test_assets.py
deleted file mode 100644
index 8037bcc75..000000000
--- a/tests/units/experimental/test_assets.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import shutil
-from pathlib import Path
-
-import pytest
-
-import reflex as rx
-
-
-def test_asset():
- # Test the asset function.
-
- # The asset function copies a file to the app's external assets directory.
- asset = rx._x.asset("custom_script.js", "subfolder")
- assert asset == "/external/test_assets/subfolder/custom_script.js"
- result_file = Path(
- Path.cwd(), "assets/external/test_assets/subfolder/custom_script.js"
- )
- assert result_file.exists()
-
- # Running a second time should not raise an error.
- asset = rx._x.asset("custom_script.js", "subfolder")
-
- # Test the asset function without a subfolder.
- asset = rx._x.asset("custom_script.js")
- assert asset == "/external/test_assets/custom_script.js"
- result_file = Path(Path.cwd(), "assets/external/test_assets/custom_script.js")
- assert result_file.exists()
-
- # clean up
- shutil.rmtree(Path.cwd() / "assets/external")
-
- with pytest.raises(FileNotFoundError):
- asset = rx._x.asset("non_existent_file.js")
-
- # Nothing is done to assets when file does not exist.
- assert not Path(Path.cwd() / "assets/external").exists()
diff --git a/tests/units/states/upload.py b/tests/units/states/upload.py
index f81e9f235..338025bcd 100644
--- a/tests/units/states/upload.py
+++ b/tests/units/states/upload.py
@@ -71,7 +71,7 @@ class FileUploadState(State):
assert file.filename is not None
self.img_list.append(file.filename)
- @rx.background
+ @rx.event(background=True)
async def bg_upload(self, files: List[rx.UploadFile]):
"""Background task cannot be upload handler.
@@ -119,7 +119,7 @@ class ChildFileUploadState(FileStateBase1):
assert file.filename is not None
self.img_list.append(file.filename)
- @rx.background
+ @rx.event(background=True)
async def bg_upload(self, files: List[rx.UploadFile]):
"""Background task cannot be upload handler.
@@ -167,7 +167,7 @@ class GrandChildFileUploadState(FileStateBase2):
assert file.filename is not None
self.img_list.append(file.filename)
- @rx.background
+ @rx.event(background=True)
async def bg_upload(self, files: List[rx.UploadFile]):
"""Background task cannot be upload handler.
diff --git a/tests/units/test_app.py b/tests/units/test_app.py
index 51d9b8841..cdd3c10f8 100644
--- a/tests/units/test_app.py
+++ b/tests/units/test_app.py
@@ -237,9 +237,12 @@ def test_add_page_default_route(app: App, index_page, about_page):
about_page: The about page.
"""
assert app.pages == {}
+ assert app.unevaluated_pages == {}
app.add_page(index_page)
+ app._compile_page("index")
assert app.pages.keys() == {"index"}
app.add_page(about_page)
+ app._compile_page("about")
assert app.pages.keys() == {"index", "about"}
@@ -252,8 +255,9 @@ def test_add_page_set_route(app: App, index_page, windows_platform: bool):
windows_platform: Whether the system is windows.
"""
route = "test" if windows_platform else "/test"
- assert app.pages == {}
+ assert app.unevaluated_pages == {}
app.add_page(index_page, route=route)
+ app._compile_page("test")
assert app.pages.keys() == {"test"}
@@ -267,8 +271,9 @@ def test_add_page_set_route_dynamic(index_page, windows_platform: bool):
app = App(state=EmptyState)
assert app.state is not None
route = "/test/[dynamic]"
- assert app.pages == {}
+ assert app.unevaluated_pages == {}
app.add_page(index_page, route=route)
+ app._compile_page("test/[dynamic]")
assert app.pages.keys() == {"test/[dynamic]"}
assert "dynamic" in app.state.computed_vars
assert app.state.computed_vars["dynamic"]._deps(objclass=EmptyState) == {
@@ -286,9 +291,9 @@ def test_add_page_set_route_nested(app: App, index_page, windows_platform: bool)
windows_platform: Whether the system is windows.
"""
route = "test\\nested" if windows_platform else "/test/nested"
- assert app.pages == {}
+ assert app.unevaluated_pages == {}
app.add_page(index_page, route=route)
- assert app.pages.keys() == {route.strip(os.path.sep)}
+ assert app.unevaluated_pages.keys() == {route.strip(os.path.sep)}
def test_add_page_invalid_api_route(app: App, index_page):
@@ -782,11 +787,11 @@ async def test_upload_file(tmp_path, state, delta, token: str, mocker):
}
file1 = UploadFile(
- filename=f"image1.jpg",
+ filename="image1.jpg",
file=bio,
)
file2 = UploadFile(
- filename=f"image2.jpg",
+ filename="image2.jpg",
file=bio,
)
upload_fn = upload(app)
@@ -869,7 +874,7 @@ async def test_upload_file_background(state, tmp_path, token):
await fn(request_mock, [file_mock])
assert (
err.value.args[0]
- == f"@rx.background is not supported for upload handler `{state.get_full_name()}.bg_upload`."
+ == f"@rx.event(background=True) is not supported for upload handler `{state.get_full_name()}.bg_upload`."
)
if isinstance(app.state_manager, StateManagerRedis):
@@ -1002,8 +1007,9 @@ async def test_dynamic_route_var_route_change_completed_on_load(
substate_token = _substate_key(token, DynamicState)
sid = "mock_sid"
client_ip = "127.0.0.1"
- state = await app.state_manager.get_state(substate_token)
- assert state.dynamic == ""
+ async with app.state_manager.modify_state(substate_token) as state:
+ state.router_data = {"simulate": "hydrated"}
+ assert state.dynamic == ""
exp_vals = ["foo", "foobar", "baz"]
def _event(name, val, **kwargs):
@@ -1175,6 +1181,7 @@ async def test_process_events(mocker, token: str):
"ip": "127.0.0.1",
}
app = App(state=GenState)
+
mocker.patch.object(app, "_postprocess", AsyncMock())
event = Event(
token=token,
@@ -1182,6 +1189,8 @@ async def test_process_events(mocker, token: str):
payload={"c": 5},
router_data=router_data,
)
+ async with app.state_manager.modify_state(event.substate_token) as state:
+ state.router_data = {"simulate": "hydrated"}
async for _update in process(app, event, "mock_sid", {}, "127.0.0.1"):
pass
@@ -1206,7 +1215,7 @@ async def test_process_events(mocker, token: str):
],
)
def test_overlay_component(
- state: State | None,
+ state: Type[State] | None,
overlay_component: Component | ComponentCallable | None,
exp_page_child: Type[Component] | None,
):
@@ -1238,6 +1247,7 @@ def test_overlay_component(
app.add_page(rx.box("Index"), route="/test")
# overlay components are wrapped during compile only
+ app._compile_page("test")
app._setup_overlay_component()
page = app.pages["test"]
@@ -1365,6 +1375,7 @@ def test_app_state_determination():
# Add a page with `on_load` enables state.
a1.add_page(rx.box("About"), route="/about", on_load=rx.console_log(""))
+ a1._compile_page("about")
assert a1.state is not None
a2 = App()
@@ -1372,6 +1383,7 @@ def test_app_state_determination():
# Referencing a state Var enables state.
a2.add_page(rx.box(rx.text(GenState.value)), route="/")
+ a2._compile_page("index")
assert a2.state is not None
a3 = App()
@@ -1379,6 +1391,7 @@ def test_app_state_determination():
# Referencing router enables state.
a3.add_page(rx.box(rx.text(State.router.page.full_path)), route="/")
+ a3._compile_page("index")
assert a3.state is not None
a4 = App()
@@ -1390,16 +1403,10 @@ def test_app_state_determination():
a4.add_page(
rx.box(rx.button("Click", on_click=DynamicState.on_counter)), route="/page2"
)
+ a4._compile_page("page2")
assert a4.state is not None
-# for coverage
-def test_raise_on_connect_error():
- """Test that the connect_error function is called."""
- with pytest.raises(ValueError):
- App(connect_error_component="Foo")
-
-
def test_raise_on_state():
"""Test that the state is set."""
# state kwargs is deprecated, we just make sure the app is created anyway.
@@ -1469,6 +1476,9 @@ def test_add_page_component_returning_tuple():
app.add_page(index) # type: ignore
app.add_page(page2) # type: ignore
+ app._compile_page("index")
+ app._compile_page("page2")
+
assert isinstance((fragment_wrapper := app.pages["index"].children[0]), Fragment)
assert isinstance((first_text := fragment_wrapper.children[0]), Text)
assert str(first_text.children[0].contents) == '"first"' # type: ignore
diff --git a/tests/units/test_config.py b/tests/units/test_config.py
index a6c6fe697..e5d4622bd 100644
--- a/tests/units/test_config.py
+++ b/tests/units/test_config.py
@@ -1,11 +1,21 @@
import multiprocessing
import os
+from pathlib import Path
+from typing import Any, Dict
import pytest
import reflex as rx
import reflex.config
-from reflex.constants import Endpoint
+from reflex.config import (
+ EnvVar,
+ env_var,
+ environment,
+ interpret_boolean_env,
+ interpret_enum_env,
+ interpret_int_env,
+)
+from reflex.constants import Endpoint, Env
def test_requires_app_name():
@@ -41,7 +51,12 @@ def test_set_app_name(base_config_values):
("TELEMETRY_ENABLED", True),
],
)
-def test_update_from_env(base_config_values, monkeypatch, env_var, value):
+def test_update_from_env(
+ base_config_values: Dict[str, Any],
+ monkeypatch: pytest.MonkeyPatch,
+ env_var: str,
+ value: Any,
+):
"""Test that environment variables override config values.
Args:
@@ -56,6 +71,29 @@ def test_update_from_env(base_config_values, monkeypatch, env_var, value):
assert getattr(config, env_var.lower()) == value
+def test_update_from_env_path(
+ base_config_values: Dict[str, Any],
+ monkeypatch: pytest.MonkeyPatch,
+ tmp_path: Path,
+):
+ """Test that environment variables override config values.
+
+ Args:
+ base_config_values: Config values.
+ monkeypatch: The pytest monkeypatch object.
+ tmp_path: The pytest tmp_path fixture object.
+ """
+ monkeypatch.setenv("BUN_PATH", "/test")
+ assert os.environ.get("BUN_PATH") == "/test"
+ with pytest.raises(ValueError):
+ rx.Config(**base_config_values)
+
+ monkeypatch.setenv("BUN_PATH", str(tmp_path))
+ assert os.environ.get("BUN_PATH") == str(tmp_path)
+ config = rx.Config(**base_config_values)
+ assert config.bun_path == tmp_path
+
+
@pytest.mark.parametrize(
"kwargs, expected",
[
@@ -177,11 +215,11 @@ def test_replace_defaults(
assert getattr(c, key) == value
-def reflex_dir_constant():
- return rx.constants.Reflex.DIR
+def reflex_dir_constant() -> Path:
+ return environment.REFLEX_DIR.get()
-def test_reflex_dir_env_var(monkeypatch, tmp_path):
+def test_reflex_dir_env_var(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
"""Test that the REFLEX_DIR environment variable is used to set the Reflex.DIR constant.
Args:
@@ -191,5 +229,54 @@ def test_reflex_dir_env_var(monkeypatch, tmp_path):
monkeypatch.setenv("REFLEX_DIR", str(tmp_path))
mp_ctx = multiprocessing.get_context(method="spawn")
+ assert reflex_dir_constant() == tmp_path
with mp_ctx.Pool(processes=1) as pool:
assert pool.apply(reflex_dir_constant) == tmp_path
+
+
+def test_interpret_enum_env() -> None:
+ assert interpret_enum_env(Env.PROD.value, Env, "REFLEX_ENV") == Env.PROD
+
+
+def test_interpret_int_env() -> None:
+ assert interpret_int_env("3001", "FRONTEND_PORT") == 3001
+
+
+@pytest.mark.parametrize("value, expected", [("true", True), ("false", False)])
+def test_interpret_bool_env(value: str, expected: bool) -> None:
+ assert interpret_boolean_env(value, "TELEMETRY_ENABLED") == expected
+
+
+def test_env_var():
+ class TestEnv:
+ BLUBB: EnvVar[str] = env_var("default")
+ INTERNAL: EnvVar[str] = env_var("default", internal=True)
+ BOOLEAN: EnvVar[bool] = env_var(False)
+
+ assert TestEnv.BLUBB.get() == "default"
+ assert TestEnv.BLUBB.name == "BLUBB"
+ TestEnv.BLUBB.set("new")
+ assert os.environ.get("BLUBB") == "new"
+ assert TestEnv.BLUBB.get() == "new"
+ TestEnv.BLUBB.set(None)
+ assert "BLUBB" not in os.environ
+
+ assert TestEnv.INTERNAL.get() == "default"
+ assert TestEnv.INTERNAL.name == "__INTERNAL"
+ TestEnv.INTERNAL.set("new")
+ assert os.environ.get("__INTERNAL") == "new"
+ assert TestEnv.INTERNAL.get() == "new"
+ assert TestEnv.INTERNAL.getenv() == "new"
+ TestEnv.INTERNAL.set(None)
+ assert "__INTERNAL" not in os.environ
+
+ assert TestEnv.BOOLEAN.get() is False
+ assert TestEnv.BOOLEAN.name == "BOOLEAN"
+ TestEnv.BOOLEAN.set(True)
+ assert os.environ.get("BOOLEAN") == "True"
+ assert TestEnv.BOOLEAN.get() is True
+ TestEnv.BOOLEAN.set(False)
+ assert os.environ.get("BOOLEAN") == "False"
+ assert TestEnv.BOOLEAN.get() is False
+ TestEnv.BOOLEAN.set(None)
+ assert "BOOLEAN" not in os.environ
diff --git a/tests/units/test_event.py b/tests/units/test_event.py
index d7b7cf7a2..4399ab2a0 100644
--- a/tests/units/test_event.py
+++ b/tests/units/test_event.py
@@ -1,7 +1,8 @@
-from typing import List
+from typing import Callable, List
import pytest
+import reflex as rx
from reflex.event import (
Event,
EventChain,
@@ -107,7 +108,7 @@ def test_call_event_handler_partial():
def spec(a2: Var[str]) -> List[Var[str]]:
return [a2]
- handler = EventHandler(fn=test_fn_with_args)
+ handler = EventHandler(fn=test_fn_with_args, state_full_name="BigState")
event_spec = handler(make_var("first"))
event_spec2 = call_event_handler(event_spec, spec)
@@ -115,7 +116,10 @@ def test_call_event_handler_partial():
assert len(event_spec.args) == 1
assert event_spec.args[0][0].equals(Var(_js_expr="arg1"))
assert event_spec.args[0][1].equals(Var(_js_expr="first"))
- assert format.format_event(event_spec) == 'Event("test_fn_with_args", {arg1:first})'
+ assert (
+ format.format_event(event_spec)
+ == 'Event("BigState.test_fn_with_args", {arg1:first})'
+ )
assert event_spec2 is not event_spec
assert event_spec2.handler == handler
@@ -126,7 +130,7 @@ def test_call_event_handler_partial():
assert event_spec2.args[1][1].equals(Var(_js_expr="_a2", _var_type=str))
assert (
format.format_event(event_spec2)
- == 'Event("test_fn_with_args", {arg1:first,arg2:_a2})'
+ == 'Event("BigState.test_fn_with_args", {arg1:first,arg2:_a2})'
)
@@ -216,24 +220,40 @@ def test_event_console_log():
"""Test the event console log function."""
spec = event.console_log("message")
assert isinstance(spec, EventSpec)
- assert spec.handler.fn.__qualname__ == "_console"
- assert spec.args[0][0].equals(Var(_js_expr="message"))
- assert spec.args[0][1].equals(LiteralVar.create("message"))
- assert format.format_event(spec) == 'Event("_console", {message:"message"})'
+ assert spec.handler.fn.__qualname__ == "_call_function"
+ assert spec.args[0][0].equals(Var(_js_expr="function"))
+ assert spec.args[0][1].equals(
+ Var('(() => (console["log"]("message")))', _var_type=Callable)
+ )
+ assert (
+ format.format_event(spec)
+ == 'Event("_call_function", {function:(() => (console["log"]("message")))})'
+ )
spec = event.console_log(Var(_js_expr="message"))
- assert format.format_event(spec) == 'Event("_console", {message:message})'
+ assert (
+ format.format_event(spec)
+ == 'Event("_call_function", {function:(() => (console["log"](message)))})'
+ )
def test_event_window_alert():
"""Test the event window alert function."""
spec = event.window_alert("message")
assert isinstance(spec, EventSpec)
- assert spec.handler.fn.__qualname__ == "_alert"
- assert spec.args[0][0].equals(Var(_js_expr="message"))
- assert spec.args[0][1].equals(LiteralVar.create("message"))
- assert format.format_event(spec) == 'Event("_alert", {message:"message"})'
+ assert spec.handler.fn.__qualname__ == "_call_function"
+ assert spec.args[0][0].equals(Var(_js_expr="function"))
+ assert spec.args[0][1].equals(
+ Var('(() => (window["alert"]("message")))', _var_type=Callable)
+ )
+ assert (
+ format.format_event(spec)
+ == 'Event("_call_function", {function:(() => (window["alert"]("message")))})'
+ )
spec = event.window_alert(Var(_js_expr="message"))
- assert format.format_event(spec) == 'Event("_alert", {message:message})'
+ assert (
+ format.format_event(spec)
+ == 'Event("_call_function", {function:(() => (window["alert"](message)))})'
+ )
def test_set_focus():
@@ -420,3 +440,17 @@ def test_event_var_data():
# Ensure chain carries _var_data
chain_var = Var.create(EventChain(events=[S.s(S.x)], args_spec=_args_spec))
assert chain_var._get_all_var_data() == S.x._get_all_var_data()
+
+
+def test_event_bound_method() -> None:
+ class S(BaseState):
+ @event
+ def e(self, arg: str):
+ print(arg)
+
+ class Wrapper:
+ def get_handler(self, arg: str):
+ return S.e(arg)
+
+ w = Wrapper()
+ _ = rx.input(on_change=w.get_handler)
diff --git a/tests/units/test_prerequisites.py b/tests/units/test_prerequisites.py
index c4f57a998..2497318e7 100644
--- a/tests/units/test_prerequisites.py
+++ b/tests/units/test_prerequisites.py
@@ -24,7 +24,15 @@ from reflex.utils.prerequisites import (
app_name="test",
),
False,
- 'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true};',
+ 'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
+ ),
+ (
+ Config(
+ app_name="test",
+ static_page_generation_timeout=30,
+ ),
+ False,
+ 'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 30};',
),
(
Config(
@@ -32,7 +40,7 @@ from reflex.utils.prerequisites import (
next_compression=False,
),
False,
- 'module.exports = {basePath: "", compress: false, reactStrictMode: true, trailingSlash: true};',
+ 'module.exports = {basePath: "", compress: false, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
@@ -40,7 +48,7 @@ from reflex.utils.prerequisites import (
frontend_path="/test",
),
False,
- 'module.exports = {basePath: "/test", compress: true, reactStrictMode: true, trailingSlash: true};',
+ 'module.exports = {basePath: "/test", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
@@ -49,14 +57,14 @@ from reflex.utils.prerequisites import (
next_compression=False,
),
False,
- 'module.exports = {basePath: "/test", compress: false, reactStrictMode: true, trailingSlash: true};',
+ 'module.exports = {basePath: "/test", compress: false, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
),
(
Config(
app_name="test",
),
True,
- 'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, output: "export", distDir: "_static"};',
+ 'module.exports = {basePath: "", compress: true, reactStrictMode: true, trailingSlash: true, staticPageGenerationTimeout: 60, output: "export", distDir: "_static"};',
),
],
)
diff --git a/tests/units/test_state.py b/tests/units/test_state.py
index 534438aae..1bf4ae707 100644
--- a/tests/units/test_state.py
+++ b/tests/units/test_state.py
@@ -8,13 +8,26 @@ import functools
import json
import os
import sys
+import threading
from textwrap import dedent
-from typing import Any, AsyncGenerator, Callable, Dict, List, Optional, Union
+from typing import (
+ Any,
+ AsyncGenerator,
+ Callable,
+ Dict,
+ List,
+ Optional,
+ Set,
+ Tuple,
+ Union,
+)
from unittest.mock import AsyncMock, Mock
import pytest
import pytest_asyncio
from plotly.graph_objects import Figure
+from pydantic import BaseModel as BaseModelV2
+from pydantic.v1 import BaseModel as BaseModelV1
import reflex as rx
import reflex.config
@@ -42,9 +55,9 @@ from reflex.state import (
)
from reflex.testing import chdir
from reflex.utils import format, prerequisites, types
-from reflex.utils.exceptions import SetUndefinedStateVarError
+from reflex.utils.exceptions import ReflexRuntimeError, SetUndefinedStateVarError
from reflex.utils.format import json_dumps
-from reflex.vars.base import ComputedVar, Var
+from reflex.vars.base import Var, computed_var
from tests.units.states.mutation import MutableSQLAModel, MutableTestState
from .states import GenState
@@ -106,8 +119,9 @@ class TestState(BaseState):
fig: Figure = Figure()
dt: datetime.datetime = datetime.datetime.fromisoformat("1989-11-09T18:53:00+01:00")
_backend: int = 0
+ asynctest: int = 0
- @ComputedVar
+ @computed_var
def sum(self) -> float:
"""Dynamically sum the numbers.
@@ -116,7 +130,7 @@ class TestState(BaseState):
"""
return self.num1 + self.num2
- @ComputedVar
+ @computed_var
def upper(self) -> str:
"""Uppercase the key.
@@ -129,6 +143,14 @@ class TestState(BaseState):
"""Do something."""
pass
+ async def set_asynctest(self, value: int):
+ """Set the asynctest value. Intentionally overwrite the default setter with an async one.
+
+ Args:
+ value: The new value.
+ """
+ self.asynctest = value
+
class ChildState(TestState):
"""A child state fixture."""
@@ -313,6 +335,7 @@ def test_class_vars(test_state):
"upper",
"fig",
"dt",
+ "asynctest",
}
@@ -733,6 +756,7 @@ def test_reset(test_state, child_state):
"mapping",
"dt",
"_backend",
+ "asynctest",
}
# The dirty vars should be reset.
@@ -1112,7 +1136,7 @@ def test_child_state():
v: int = 2
class ChildState(MainState):
- @ComputedVar
+ @computed_var
def rendered_var(self):
return self.v
@@ -1131,7 +1155,7 @@ def test_conditional_computed_vars():
t1: str = "a"
t2: str = "b"
- @ComputedVar
+ @computed_var
def rendered_var(self) -> str:
if self.flag:
return self.t1
@@ -1546,7 +1570,7 @@ def test_error_on_state_method_shadow():
assert (
err.value.args[0]
- == f"The event handler name `reset` shadows a builtin State method; use a different name instead"
+ == "The event handler name `reset` shadows a builtin State method; use a different name instead"
)
@@ -1814,12 +1838,11 @@ async def test_state_manager_lock_expire_contend(
@pytest.fixture(scope="function")
-def mock_app(monkeypatch, state_manager: StateManager) -> rx.App:
- """Mock app fixture.
+def mock_app_simple(monkeypatch) -> rx.App:
+ """Simple Mock app fixture.
Args:
monkeypatch: Pytest monkeypatch object.
- state_manager: A state manager.
Returns:
The app, after mocking out prerequisites.get_app()
@@ -1830,7 +1853,6 @@ def mock_app(monkeypatch, state_manager: StateManager) -> rx.App:
setattr(app_module, CompileVars.APP, app)
app.state = TestState
- app._state_manager = state_manager
app.event_namespace.emit = AsyncMock() # type: ignore
def _mock_get_app(*args, **kwargs):
@@ -1840,6 +1862,21 @@ def mock_app(monkeypatch, state_manager: StateManager) -> rx.App:
return app
+@pytest.fixture(scope="function")
+def mock_app(mock_app_simple: rx.App, state_manager: StateManager) -> rx.App:
+ """Mock app fixture.
+
+ Args:
+ mock_app_simple: A simple mock app.
+ state_manager: A state manager.
+
+ Returns:
+ The app, after mocking out prerequisites.get_app()
+ """
+ mock_app_simple._state_manager = state_manager
+ return mock_app_simple
+
+
@pytest.mark.asyncio
async def test_state_proxy(grandchild_state: GrandchildState, mock_app: rx.App):
"""Test that the state proxy works.
@@ -1945,6 +1982,10 @@ class BackgroundTaskState(BaseState):
order: List[str] = []
dict_list: Dict[str, List[int]] = {"foo": [1, 2, 3]}
+ def __init__(self, **kwargs): # noqa: D107
+ super().__init__(**kwargs)
+ self.router_data = {"simulate": "hydrate"}
+
@rx.var(cache=False)
def computed_order(self) -> List[str]:
"""Get the order as a computed var.
@@ -1954,7 +1995,7 @@ class BackgroundTaskState(BaseState):
"""
return self.order
- @rx.background
+ @rx.event(background=True)
async def background_task(self):
"""A background task that updates the state."""
async with self:
@@ -1991,7 +2032,7 @@ class BackgroundTaskState(BaseState):
self.other() # direct calling event handlers works in context
self._private_method()
- @rx.background
+ @rx.event(background=True)
async def background_task_reset(self):
"""A background task that resets the state."""
with pytest.raises(ImmutableStateError):
@@ -2005,7 +2046,7 @@ class BackgroundTaskState(BaseState):
async with self:
self.order.append("reset")
- @rx.background
+ @rx.event(background=True)
async def background_task_generator(self):
"""A background task generator that does nothing.
@@ -2695,7 +2736,7 @@ def test_set_base_field_via_setter():
assert "c2" in bfss.dirty_vars
-def exp_is_hydrated(state: State, is_hydrated: bool = True) -> Dict[str, Any]:
+def exp_is_hydrated(state: BaseState, is_hydrated: bool = True) -> Dict[str, Any]:
"""Expected IS_HYDRATED delta that would be emitted by HydrateMiddleware.
Args:
@@ -2713,6 +2754,7 @@ class OnLoadState(State):
num: int = 0
+ @rx.event
def test_handler(self):
"""Test handler."""
self.num += 1
@@ -2773,7 +2815,8 @@ async def test_preprocess(app_module_mock, token, test_state, expected, mocker):
app = app_module_mock.app = App(
state=State, load_events={"index": [test_state.test_handler]}
)
- state = State()
+ async with app.state_manager.modify_state(_substate_key(token, State)) as state:
+ state.router_data = {"simulate": "hydrate"}
updates = []
async for update in rx.app.process(
@@ -2820,7 +2863,8 @@ async def test_preprocess_multiple_load_events(app_module_mock, token, mocker):
state=State,
load_events={"index": [OnLoadState.test_handler, OnLoadState.test_handler]},
)
- state = State()
+ async with app.state_manager.modify_state(_substate_key(token, State)) as state:
+ state.router_data = {"simulate": "hydrate"}
updates = []
async for update in rx.app.process(
@@ -3082,12 +3126,12 @@ def test_potentially_dirty_substates():
"""
class State(RxState):
- @ComputedVar
+ @computed_var
def foo(self) -> str:
return ""
class C1(State):
- @ComputedVar
+ @computed_var
def bar(self) -> str:
return ""
@@ -3179,6 +3223,13 @@ async def test_setvar(mock_app: rx.App, token: str):
TestState.setvar(42, 42)
+@pytest.mark.asyncio
+async def test_setvar_async_setter():
+ """Test that overridden async setters raise Exception when used with setvar."""
+ with pytest.raises(NotImplementedError):
+ TestState.setvar("asynctest", 42)
+
+
@pytest.mark.skipif("REDIS_URL" not in os.environ, reason="Test requires redis")
@pytest.mark.parametrize(
"expiration_kwargs, expected_values",
@@ -3313,3 +3364,277 @@ def test_assignment_to_undeclared_vars():
state.handle_supported_regular_vars()
state.handle_non_var()
+
+
+@pytest.mark.asyncio
+async def test_deserialize_gc_state_disk(token):
+ """Test that a state can be deserialized from disk with a grandchild state.
+
+ Args:
+ token: A token.
+ """
+
+ class Root(BaseState):
+ pass
+
+ class State(Root):
+ num: int = 42
+
+ class Child(State):
+ foo: str = "bar"
+
+ dsm = StateManagerDisk(state=Root)
+ async with dsm.modify_state(token) as root:
+ s = await root.get_state(State)
+ s.num += 1
+ c = await root.get_state(Child)
+ assert s._get_was_touched()
+ assert not c._get_was_touched()
+
+ dsm2 = StateManagerDisk(state=Root)
+ root = await dsm2.get_state(token)
+ s = await root.get_state(State)
+ assert s.num == 43
+ c = await root.get_state(Child)
+ assert c.foo == "bar"
+
+
+class Obj(Base):
+ """A object containing a callable for testing fallback pickle."""
+
+ _f: Callable
+
+
+def test_fallback_pickle():
+ """Test that state serialization will fall back to dill."""
+
+ class DillState(BaseState):
+ _o: Optional[Obj] = None
+ _f: Optional[Callable] = None
+ _g: Any = None
+
+ state = DillState(_reflex_internal_init=True) # type: ignore
+ state._o = Obj(_f=lambda: 42)
+ state._f = lambda: 420
+
+ pk = state._serialize()
+
+ unpickled_state = BaseState._deserialize(pk)
+ assert unpickled_state._f() == 420
+ assert unpickled_state._o._f() == 42
+
+ # Threading locks are unpicklable normally, and raise TypeError instead of PicklingError.
+ state2 = DillState(_reflex_internal_init=True) # type: ignore
+ state2._g = threading.Lock()
+ pk2 = state2._serialize()
+ unpickled_state2 = BaseState._deserialize(pk2)
+ assert isinstance(unpickled_state2._g, type(threading.Lock()))
+
+ # Some object, like generator, are still unpicklable with dill.
+ state3 = DillState(_reflex_internal_init=True) # type: ignore
+ state3._g = (i for i in range(10))
+ pk3 = state3._serialize()
+ assert len(pk3) == 0
+
+
+def test_typed_state() -> None:
+ class TypedState(rx.State):
+ field: rx.Field[str] = rx.field("")
+
+ _ = TypedState(field="str")
+
+
+class ModelV1(BaseModelV1):
+ """A pydantic BaseModel v1."""
+
+ foo: str = "bar"
+
+
+class ModelV2(BaseModelV2):
+ """A pydantic BaseModel v2."""
+
+ foo: str = "bar"
+
+
+@dataclasses.dataclass
+class ModelDC:
+ """A dataclass."""
+
+ foo: str = "bar"
+
+
+class PydanticState(rx.State):
+ """A state with pydantic BaseModel vars."""
+
+ v1: ModelV1 = ModelV1()
+ v2: ModelV2 = ModelV2()
+ dc: ModelDC = ModelDC()
+
+
+def test_mutable_models():
+ """Test that dataclass and pydantic BaseModel v1 and v2 use dep tracking."""
+ state = PydanticState()
+ assert isinstance(state.v1, MutableProxy)
+ state.v1.foo = "baz"
+ assert state.dirty_vars == {"v1"}
+ state.dirty_vars.clear()
+
+ assert isinstance(state.v2, MutableProxy)
+ state.v2.foo = "baz"
+ assert state.dirty_vars == {"v2"}
+ state.dirty_vars.clear()
+
+ # Not yet supported ENG-4083
+ # assert isinstance(state.dc, MutableProxy)
+ # state.dc.foo = "baz"
+ # assert state.dirty_vars == {"dc"}
+ # state.dirty_vars.clear()
+
+
+def test_get_value():
+ class GetValueState(rx.State):
+ foo: str = "FOO"
+ bar: str = "BAR"
+
+ state = GetValueState()
+
+ assert state.dict() == {
+ state.get_full_name(): {
+ "foo": "FOO",
+ "bar": "BAR",
+ }
+ }
+ assert state.get_delta() == {}
+
+ state.bar = "foo"
+
+ assert state.dict() == {
+ state.get_full_name(): {
+ "foo": "FOO",
+ "bar": "foo",
+ }
+ }
+ assert state.get_delta() == {
+ state.get_full_name(): {
+ "bar": "foo",
+ }
+ }
+
+
+def test_init_mixin() -> None:
+ """Ensure that State mixins can not be instantiated directly."""
+
+ class Mixin(BaseState, mixin=True):
+ pass
+
+ with pytest.raises(ReflexRuntimeError):
+ Mixin()
+
+ class SubMixin(Mixin, mixin=True):
+ pass
+
+ with pytest.raises(ReflexRuntimeError):
+ SubMixin()
+
+
+class ReflexModel(rx.Model):
+ """A model for testing."""
+
+ foo: str
+
+
+class UpcastState(rx.State):
+ """A state for testing upcasting."""
+
+ passed: bool = False
+
+ def rx_model(self, m: ReflexModel): # noqa: D102
+ assert isinstance(m, ReflexModel)
+ self.passed = True
+
+ def rx_base(self, o: Object): # noqa: D102
+ assert isinstance(o, Object)
+ self.passed = True
+
+ def rx_base_or_none(self, o: Optional[Object]): # noqa: D102
+ if o is not None:
+ assert isinstance(o, Object)
+ self.passed = True
+
+ def rx_basemodelv1(self, m: ModelV1): # noqa: D102
+ assert isinstance(m, ModelV1)
+ self.passed = True
+
+ def rx_basemodelv2(self, m: ModelV2): # noqa: D102
+ assert isinstance(m, ModelV2)
+ self.passed = True
+
+ def rx_dataclass(self, dc: ModelDC): # noqa: D102
+ assert isinstance(dc, ModelDC)
+ self.passed = True
+
+ def py_set(self, s: set): # noqa: D102
+ assert isinstance(s, set)
+ self.passed = True
+
+ def py_Set(self, s: Set): # noqa: D102
+ assert isinstance(s, Set)
+ self.passed = True
+
+ def py_tuple(self, t: tuple): # noqa: D102
+ assert isinstance(t, tuple)
+ self.passed = True
+
+ def py_Tuple(self, t: Tuple): # noqa: D102
+ assert isinstance(t, tuple)
+ self.passed = True
+
+ def py_dict(self, d: dict[str, str]): # noqa: D102
+ assert isinstance(d, dict)
+ self.passed = True
+
+ def py_list(self, ls: list[str]): # noqa: D102
+ assert isinstance(ls, list)
+ self.passed = True
+
+ def py_Any(self, a: Any): # noqa: D102
+ assert isinstance(a, list)
+ self.passed = True
+
+ def py_unresolvable(self, u: "Unresolvable"): # noqa: D102, F821 # type: ignore
+ assert isinstance(u, list)
+ self.passed = True
+
+
+@pytest.mark.asyncio
+@pytest.mark.usefixtures("mock_app_simple")
+@pytest.mark.parametrize(
+ ("handler", "payload"),
+ [
+ (UpcastState.rx_model, {"m": {"foo": "bar"}}),
+ (UpcastState.rx_base, {"o": {"foo": "bar"}}),
+ (UpcastState.rx_base_or_none, {"o": {"foo": "bar"}}),
+ (UpcastState.rx_base_or_none, {"o": None}),
+ (UpcastState.rx_basemodelv1, {"m": {"foo": "bar"}}),
+ (UpcastState.rx_basemodelv2, {"m": {"foo": "bar"}}),
+ (UpcastState.rx_dataclass, {"dc": {"foo": "bar"}}),
+ (UpcastState.py_set, {"s": ["foo", "foo"]}),
+ (UpcastState.py_Set, {"s": ["foo", "foo"]}),
+ (UpcastState.py_tuple, {"t": ["foo", "foo"]}),
+ (UpcastState.py_Tuple, {"t": ["foo", "foo"]}),
+ (UpcastState.py_dict, {"d": {"foo": "bar"}}),
+ (UpcastState.py_list, {"ls": ["foo", "foo"]}),
+ (UpcastState.py_Any, {"a": ["foo"]}),
+ (UpcastState.py_unresolvable, {"u": ["foo"]}),
+ ],
+)
+async def test_upcast_event_handler_arg(handler, payload):
+ """Test that upcast event handler args work correctly.
+
+ Args:
+ handler: The handler to test.
+ payload: The payload to test.
+ """
+ state = UpcastState()
+ async for update in state._process_event(handler, state, payload):
+ assert update.delta == {UpcastState.get_full_name(): {"passed": True}}
diff --git a/tests/units/test_testing.py b/tests/units/test_testing.py
index b01709202..83a03ad83 100644
--- a/tests/units/test_testing.py
+++ b/tests/units/test_testing.py
@@ -29,7 +29,7 @@ def test_app_harness(tmp_path):
with AppHarness.create(
root=tmp_path,
- app_source=BasicApp, # type: ignore
+ app_source=BasicApp,
) as harness:
assert harness.app_instance is not None
assert harness.backend is not None
diff --git a/tests/units/test_var.py b/tests/units/test_var.py
index 74f482b4d..2aabfd256 100644
--- a/tests/units/test_var.py
+++ b/tests/units/test_var.py
@@ -22,12 +22,12 @@ from reflex.vars.base import (
var_operation,
var_operation_return,
)
-from reflex.vars.function import ArgsFunctionOperation, FunctionStringVar
-from reflex.vars.number import (
- LiteralBooleanVar,
- LiteralNumberVar,
- NumberVar,
+from reflex.vars.function import (
+ ArgsFunctionOperation,
+ DestructuredArg,
+ FunctionStringVar,
)
+from reflex.vars.number import LiteralBooleanVar, LiteralNumberVar, NumberVar
from reflex.vars.object import LiteralObjectVar, ObjectVar
from reflex.vars.sequence import (
ArrayVar,
@@ -215,7 +215,7 @@ def test_str(prop, expected):
@pytest.mark.parametrize(
- "prop,expected",
+ ("prop", "expected"),
[
(Var(_js_expr="p", _var_type=int), 0),
(Var(_js_expr="p", _var_type=float), 0.0),
@@ -227,14 +227,14 @@ def test_str(prop, expected):
(Var(_js_expr="p", _var_type=set), set()),
],
)
-def test_default_value(prop, expected):
+def test_default_value(prop: Var, expected):
"""Test that the default value of a var is correct.
Args:
prop: The var to test.
expected: The expected default value.
"""
- assert prop.get_default_value() == expected
+ assert prop._get_default_value() == expected
@pytest.mark.parametrize(
@@ -250,14 +250,14 @@ def test_default_value(prop, expected):
],
),
)
-def test_get_setter(prop, expected):
+def test_get_setter(prop: Var, expected):
"""Test that the name of the setter function of a var is correct.
Args:
prop: The var to test.
expected: The expected name of the setter function.
"""
- assert prop.get_setter_name() == expected
+ assert prop._get_setter_name() == expected
@pytest.mark.parametrize(
@@ -519,8 +519,8 @@ def test_var_indexing_types(var, type_):
type_ : The type on indexed object.
"""
- assert var[2]._var_type == type_[0]
- assert var[3]._var_type == type_[1]
+ assert var[0]._var_type == type_[0]
+ assert var[1]._var_type == type_[1]
def test_var_indexing_str():
@@ -925,13 +925,13 @@ def test_function_var():
)
assert (
str(manual_addition_func.call(1, 2))
- == '(((a, b) => (({ ["args"] : [a, b], ["result"] : a + b })))(1, 2))'
+ == '(((a, b) => ({ ["args"] : [a, b], ["result"] : a + b }))(1, 2))'
)
- increment_func = addition_func(1)
+ increment_func = addition_func.partial(1)
assert (
str(increment_func.call(2))
- == "(((...args) => ((((a, b) => a + b)(1, ...args))))(2))"
+ == "(((...args) => (((a, b) => a + b)(1, ...args)))(2))"
)
create_hello_statement = ArgsFunctionOperation.create(
@@ -941,9 +941,25 @@ def test_function_var():
last_name = LiteralStringVar.create("Universe")
assert (
str(create_hello_statement.call(f"{first_name} {last_name}"))
- == '(((name) => (("Hello, "+name+"!")))("Steven Universe"))'
+ == '(((name) => ("Hello, "+name+"!"))("Steven Universe"))'
)
+ # Test with destructured arguments
+ destructured_func = ArgsFunctionOperation.create(
+ (DestructuredArg(fields=("a", "b")),),
+ Var(_js_expr="a + b"),
+ )
+ assert (
+ str(destructured_func.call({"a": 1, "b": 2}))
+ == '((({a, b}) => a + b)(({ ["a"] : 1, ["b"] : 2 })))'
+ )
+
+ # Test with explicit return
+ explicit_return_func = ArgsFunctionOperation.create(
+ ("a", "b"), Var(_js_expr="return a + b"), explicit_return=True
+ )
+ assert str(explicit_return_func.call(1, 2)) == "(((a, b) => {return a + b})(1, 2))"
+
def test_var_operation():
@var_operation
@@ -1306,7 +1322,6 @@ def test_fstring_roundtrip(value):
Var(_js_expr="var", _var_type=float).guess_type(),
Var(_js_expr="var", _var_type=str).guess_type(),
Var(_js_expr="var", _var_type=bool).guess_type(),
- Var(_js_expr="var", _var_type=dict).guess_type(),
Var(_js_expr="var", _var_type=None).guess_type(),
],
)
@@ -1318,7 +1333,7 @@ def test_unsupported_types_for_reverse(var):
"""
with pytest.raises(TypeError) as err:
var.reverse()
- assert err.value.args[0] == f"Cannot reverse non-list var."
+ assert err.value.args[0] == "Cannot reverse non-list var."
@pytest.mark.parametrize(
@@ -1327,10 +1342,10 @@ def test_unsupported_types_for_reverse(var):
Var(_js_expr="var", _var_type=int).guess_type(),
Var(_js_expr="var", _var_type=float).guess_type(),
Var(_js_expr="var", _var_type=bool).guess_type(),
- Var(_js_expr="var", _var_type=None).guess_type(),
+ Var(_js_expr="var", _var_type=type(None)).guess_type(),
],
)
-def test_unsupported_types_for_contains(var):
+def test_unsupported_types_for_contains(var: Var):
"""Test that unsupported types for contains throw a type error.
Args:
diff --git a/tests/units/utils/test_format.py b/tests/units/utils/test_format.py
index 17485d52e..cd1d0179d 100644
--- a/tests/units/utils/test_format.py
+++ b/tests/units/utils/test_format.py
@@ -374,7 +374,7 @@ def test_format_match(
events=[EventSpec(handler=EventHandler(fn=mock_event))],
args_spec=lambda: [],
),
- '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ })))))',
+ '((...args) => (addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ }))))',
),
(
EventChain(
@@ -395,7 +395,7 @@ def test_format_match(
],
args_spec=lambda e: [e.target.value],
),
- '((_e) => ((addEvents([(Event("mock_event", ({ ["arg"] : _e["target"]["value"] }), ({ })))], [_e], ({ })))))',
+ '((_e) => (addEvents([(Event("mock_event", ({ ["arg"] : _e["target"]["value"] }), ({ })))], [_e], ({ }))))',
),
(
EventChain(
@@ -403,7 +403,7 @@ def test_format_match(
args_spec=lambda: [],
event_actions={"stopPropagation": True},
),
- '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ ["stopPropagation"] : true })))))',
+ '((...args) => (addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ ["stopPropagation"] : true }))))',
),
(
EventChain(
@@ -415,7 +415,7 @@ def test_format_match(
],
args_spec=lambda: [],
),
- '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ ["stopPropagation"] : true })))], args, ({ })))))',
+ '((...args) => (addEvents([(Event("mock_event", ({ }), ({ ["stopPropagation"] : true })))], args, ({ }))))',
),
(
EventChain(
@@ -423,7 +423,7 @@ def test_format_match(
args_spec=lambda: [],
event_actions={"preventDefault": True},
),
- '((...args) => ((addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ ["preventDefault"] : true })))))',
+ '((...args) => (addEvents([(Event("mock_event", ({ }), ({ })))], args, ({ ["preventDefault"] : true }))))',
),
({"a": "red", "b": "blue"}, '({ ["a"] : "red", ["b"] : "blue" })'),
(Var(_js_expr="var", _var_type=int).guess_type(), "var"),
@@ -601,6 +601,7 @@ formatted_router = {
"sum": 3.14,
"upper": "",
"router": formatted_router,
+ "asynctest": 0,
},
ChildState.get_full_name(): {
"count": 23,
diff --git a/tests/units/utils/test_serializers.py b/tests/units/utils/test_serializers.py
index 8050470c6..355f40d3f 100644
--- a/tests/units/utils/test_serializers.py
+++ b/tests/units/utils/test_serializers.py
@@ -20,7 +20,6 @@ from reflex.vars.base import LiteralVar
def test_has_serializer(type_: Type, expected: bool):
"""Test that has_serializer returns the correct value.
-
Args:
type_: The type to check.
expected: The expected result.
@@ -41,7 +40,6 @@ def test_has_serializer(type_: Type, expected: bool):
def test_get_serializer(type_: Type, expected: serializers.Serializer):
"""Test that get_serializer returns the correct value.
-
Args:
type_: The type to check.
expected: The expected result.
@@ -195,7 +193,6 @@ class BaseSubclass(Base):
def test_serialize(value: Any, expected: str):
"""Test that serialize returns the correct value.
-
Args:
value: The value to serialize.
expected: The expected result.
diff --git a/tests/units/utils/test_utils.py b/tests/units/utils/test_utils.py
index 81579acc7..dd1a3b3ef 100644
--- a/tests/units/utils/test_utils.py
+++ b/tests/units/utils/test_utils.py
@@ -2,7 +2,7 @@ import os
import typing
from functools import cached_property
from pathlib import Path
-from typing import Any, ClassVar, List, Literal, Type, Union
+from typing import Any, ClassVar, Dict, List, Literal, Type, Union
import pytest
import typer
@@ -10,15 +10,12 @@ from packaging import version
from reflex import constants
from reflex.base import Base
+from reflex.config import environment
from reflex.event import EventHandler
from reflex.state import BaseState
-from reflex.utils import (
- build,
- prerequisites,
- types,
-)
+from reflex.utils import build, prerequisites, types
from reflex.utils import exec as utils_exec
-from reflex.utils.exceptions import ReflexError
+from reflex.utils.exceptions import ReflexError, SystemPackageMissingError
from reflex.vars.base import Var
@@ -77,6 +74,47 @@ def test_is_generic_alias(cls: type, expected: bool):
assert types.is_generic_alias(cls) == expected
+@pytest.mark.parametrize(
+ ("subclass", "superclass", "expected"),
+ [
+ *[
+ (base_type, base_type, True)
+ for base_type in [int, float, str, bool, list, dict]
+ ],
+ *[
+ (one_type, another_type, False)
+ for one_type in [int, float, str, list, dict]
+ for another_type in [int, float, str, list, dict]
+ if one_type != another_type
+ ],
+ (bool, int, True),
+ (int, bool, False),
+ (list, List, True),
+ (list, List[str], True), # this is wrong, but it's a limitation of the function
+ (List, list, True),
+ (List[int], list, True),
+ (List[int], List, True),
+ (List[int], List[str], False),
+ (List[int], List[int], True),
+ (List[int], List[float], False),
+ (List[int], List[Union[int, float]], True),
+ (List[int], List[Union[float, str]], False),
+ (Union[int, float], List[Union[int, float]], False),
+ (Union[int, float], Union[int, float, str], True),
+ (Union[int, float], Union[str, float], False),
+ (Dict[str, int], Dict[str, int], True),
+ (Dict[str, bool], Dict[str, int], True),
+ (Dict[str, int], Dict[str, bool], False),
+ (Dict[str, Any], dict[str, str], False),
+ (Dict[str, str], dict[str, str], True),
+ (Dict[str, str], dict[str, Any], True),
+ (Dict[str, Any], dict[str, Any], True),
+ ],
+)
+def test_typehint_issubclass(subclass, superclass, expected):
+ assert types.typehint_issubclass(subclass, superclass) == expected
+
+
def test_validate_invalid_bun_path(mocker):
"""Test that an error is thrown when a custom specified bun path is not valid
or does not exist.
@@ -461,7 +499,7 @@ def test_bun_install_without_unzip(mocker):
mocker.patch("pathlib.Path.exists", return_value=False)
mocker.patch("reflex.utils.prerequisites.constants.IS_WINDOWS", False)
- with pytest.raises(FileNotFoundError):
+ with pytest.raises(SystemPackageMissingError):
prerequisites.install_bun()
@@ -552,3 +590,11 @@ def test_style_prop_with_event_handler_value(callable):
rx.box(
style=style, # type: ignore
)
+
+
+def test_is_prod_mode() -> None:
+ """Test that the prod mode is correctly determined."""
+ environment.REFLEX_ENV_MODE.set(constants.Env.PROD)
+ assert utils_exec.is_prod_mode()
+ environment.REFLEX_ENV_MODE.set(None)
+ assert not utils_exec.is_prod_mode()
diff --git a/tests/units/vars/test_object.py b/tests/units/vars/test_object.py
new file mode 100644
index 000000000..efcb21166
--- /dev/null
+++ b/tests/units/vars/test_object.py
@@ -0,0 +1,102 @@
+import pytest
+from typing_extensions import assert_type
+
+import reflex as rx
+from reflex.utils.types import GenericType
+from reflex.vars.base import Var
+from reflex.vars.object import LiteralObjectVar, ObjectVar
+
+
+class Bare:
+ """A bare class with a single attribute."""
+
+ quantity: int = 0
+
+
+@rx.serializer
+def serialize_bare(obj: Bare) -> dict:
+ """A serializer for the bare class.
+
+ Args:
+ obj: The object to serialize.
+
+ Returns:
+ A dictionary with the quantity attribute.
+ """
+ return {"quantity": obj.quantity}
+
+
+class Base(rx.Base):
+ """A reflex base class with a single attribute."""
+
+ quantity: int = 0
+
+
+class ObjectState(rx.State):
+ """A reflex state with bare and base objects."""
+
+ bare: rx.Field[Bare] = rx.field(Bare())
+ base: rx.Field[Base] = rx.field(Base())
+
+
+@pytest.mark.parametrize("type_", [Base, Bare])
+def test_var_create(type_: GenericType) -> None:
+ my_object = type_()
+ var = Var.create(my_object)
+ assert var._var_type is type_
+
+ quantity = var.quantity
+ assert quantity._var_type is int
+
+
+@pytest.mark.parametrize("type_", [Base, Bare])
+def test_literal_create(type_: GenericType) -> None:
+ my_object = type_()
+ var = LiteralObjectVar.create(my_object)
+ assert var._var_type is type_
+
+ quantity = var.quantity
+ assert quantity._var_type is int
+
+
+@pytest.mark.parametrize("type_", [Base, Bare])
+def test_guess(type_: GenericType) -> None:
+ my_object = type_()
+ var = Var.create(my_object)
+ var = var.guess_type()
+ assert var._var_type is type_
+
+ quantity = var.quantity
+ assert quantity._var_type is int
+
+
+@pytest.mark.parametrize("type_", [Base, Bare])
+def test_state(type_: GenericType) -> None:
+ attr_name = type_.__name__.lower()
+ var = getattr(ObjectState, attr_name)
+ assert var._var_type is type_
+
+ quantity = var.quantity
+ assert quantity._var_type is int
+
+
+@pytest.mark.parametrize("type_", [Base, Bare])
+def test_state_to_operation(type_: GenericType) -> None:
+ attr_name = type_.__name__.lower()
+ original_var = getattr(ObjectState, attr_name)
+
+ var = original_var.to(ObjectVar, type_)
+ assert var._var_type is type_
+
+ var = original_var.to(ObjectVar)
+ assert var._var_type is type_
+
+
+def test_typing() -> None:
+ # Bare
+ var = ObjectState.bare.to(ObjectVar)
+ _ = assert_type(var, ObjectVar[Bare])
+
+ # Base
+ var = ObjectState.base
+ _ = assert_type(var, ObjectVar[Base])