reflex 0.4.5a1__py3-none-any.whl → 0.4.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +5 -15
- reflex/.templates/jinja/web/pages/index.js.jinja2 +4 -0
- reflex/.templates/jinja/web/pages/stateful_component.js.jinja2 +4 -0
- reflex/.templates/web/utils/state.js +3 -0
- reflex/__init__.py +12 -2
- reflex/__init__.pyi +4 -0
- reflex/app.py +23 -3
- reflex/base.py +16 -4
- reflex/compiler/compiler.py +1 -0
- reflex/compiler/utils.py +11 -2
- reflex/components/base/app_wrap.pyi +1 -1
- reflex/components/base/bare.py +3 -4
- reflex/components/base/body.pyi +1 -1
- reflex/components/base/document.pyi +1 -1
- reflex/components/base/fragment.pyi +1 -1
- reflex/components/base/head.pyi +1 -1
- reflex/components/base/link.pyi +1 -1
- reflex/components/base/meta.pyi +1 -1
- reflex/components/base/script.pyi +1 -1
- reflex/components/chakra/base.pyi +1 -1
- reflex/components/chakra/datadisplay/badge.pyi +1 -1
- reflex/components/chakra/datadisplay/code.pyi +1 -1
- reflex/components/chakra/datadisplay/divider.pyi +1 -1
- reflex/components/chakra/datadisplay/keyboard_key.pyi +1 -1
- reflex/components/chakra/datadisplay/list.pyi +1 -1
- reflex/components/chakra/datadisplay/stat.pyi +1 -1
- reflex/components/chakra/datadisplay/table.pyi +1 -1
- reflex/components/chakra/datadisplay/tag.pyi +1 -1
- reflex/components/chakra/disclosure/accordion.pyi +1 -1
- reflex/components/chakra/disclosure/tabs.pyi +1 -1
- reflex/components/chakra/disclosure/transition.pyi +1 -1
- reflex/components/chakra/disclosure/visuallyhidden.pyi +1 -1
- reflex/components/chakra/feedback/alert.pyi +1 -1
- reflex/components/chakra/feedback/circularprogress.pyi +1 -1
- reflex/components/chakra/feedback/progress.pyi +1 -1
- reflex/components/chakra/feedback/skeleton.pyi +1 -1
- reflex/components/chakra/feedback/spinner.pyi +1 -1
- reflex/components/chakra/forms/button.pyi +1 -1
- reflex/components/chakra/forms/checkbox.pyi +1 -1
- reflex/components/chakra/forms/colormodeswitch.pyi +1 -1
- reflex/components/chakra/forms/date_picker.pyi +1 -1
- reflex/components/chakra/forms/date_time_picker.pyi +1 -1
- reflex/components/chakra/forms/editable.pyi +1 -1
- reflex/components/chakra/forms/email.pyi +1 -1
- reflex/components/chakra/forms/form.pyi +1 -1
- reflex/components/chakra/forms/iconbutton.pyi +1 -1
- reflex/components/chakra/forms/input.pyi +1 -1
- reflex/components/chakra/forms/numberinput.pyi +1 -1
- reflex/components/chakra/forms/password.pyi +1 -1
- reflex/components/chakra/forms/pininput.pyi +1 -1
- reflex/components/chakra/forms/radio.pyi +1 -1
- reflex/components/chakra/forms/rangeslider.pyi +1 -1
- reflex/components/chakra/forms/select.pyi +1 -1
- reflex/components/chakra/forms/slider.pyi +1 -1
- reflex/components/chakra/forms/switch.pyi +1 -1
- reflex/components/chakra/forms/textarea.pyi +1 -1
- reflex/components/chakra/forms/time_picker.pyi +1 -1
- reflex/components/chakra/layout/aspect_ratio.pyi +1 -1
- reflex/components/chakra/layout/box.pyi +1 -1
- reflex/components/chakra/layout/card.pyi +1 -1
- reflex/components/chakra/layout/center.pyi +1 -1
- reflex/components/chakra/layout/container.pyi +1 -1
- reflex/components/chakra/layout/flex.pyi +1 -1
- reflex/components/chakra/layout/grid.pyi +1 -1
- reflex/components/chakra/layout/spacer.pyi +1 -1
- reflex/components/chakra/layout/stack.pyi +1 -1
- reflex/components/chakra/layout/wrap.pyi +1 -1
- reflex/components/chakra/media/avatar.pyi +1 -1
- reflex/components/chakra/media/icon.pyi +1 -1
- reflex/components/chakra/media/image.pyi +1 -1
- reflex/components/chakra/navigation/breadcrumb.pyi +1 -1
- reflex/components/chakra/navigation/link.pyi +1 -1
- reflex/components/chakra/navigation/linkoverlay.pyi +1 -1
- reflex/components/chakra/navigation/stepper.pyi +1 -1
- reflex/components/chakra/overlay/alertdialog.pyi +1 -1
- reflex/components/chakra/overlay/drawer.pyi +1 -1
- reflex/components/chakra/overlay/menu.pyi +1 -1
- reflex/components/chakra/overlay/modal.pyi +1 -1
- reflex/components/chakra/overlay/popover.pyi +1 -1
- reflex/components/chakra/overlay/tooltip.pyi +1 -1
- reflex/components/chakra/typography/heading.pyi +1 -1
- reflex/components/chakra/typography/highlight.pyi +1 -1
- reflex/components/chakra/typography/span.pyi +1 -1
- reflex/components/chakra/typography/text.pyi +1 -1
- reflex/components/component.py +82 -30
- reflex/components/core/banner.py +1 -2
- reflex/components/core/banner.pyi +1 -2
- reflex/components/core/client_side_routing.pyi +1 -1
- reflex/components/core/cond.py +1 -1
- reflex/components/core/debounce.pyi +1 -1
- reflex/components/core/html.pyi +1 -1
- reflex/components/core/responsive.py +1 -1
- reflex/components/core/upload.pyi +1 -1
- reflex/components/datadisplay/code.py +17 -9
- reflex/components/datadisplay/code.pyi +3 -1
- reflex/components/datadisplay/dataeditor.pyi +1 -1
- reflex/components/el/element.pyi +1 -1
- reflex/components/el/elements/base.pyi +1 -1
- reflex/components/el/elements/forms.py +78 -1
- reflex/components/el/elements/forms.pyi +10 -2
- reflex/components/el/elements/inline.pyi +1 -1
- reflex/components/el/elements/media.pyi +1 -1
- reflex/components/el/elements/metadata.pyi +1 -1
- reflex/components/el/elements/other.pyi +1 -1
- reflex/components/el/elements/scripts.pyi +1 -1
- reflex/components/el/elements/sectioning.pyi +1 -1
- reflex/components/el/elements/tables.pyi +1 -1
- reflex/components/el/elements/typography.pyi +1 -1
- reflex/components/gridjs/datatable.pyi +1 -1
- reflex/components/lucide/icon.py +275 -115
- reflex/components/lucide/icon.pyi +259 -114
- reflex/components/markdown/markdown.pyi +1 -1
- reflex/components/moment/moment.pyi +1 -1
- reflex/components/next/base.pyi +1 -1
- reflex/components/next/image.pyi +1 -1
- reflex/components/next/link.pyi +1 -1
- reflex/components/next/video.pyi +1 -1
- reflex/components/plotly/plotly.pyi +1 -1
- reflex/components/radix/primitives/accordion.pyi +1 -1
- reflex/components/radix/primitives/base.pyi +1 -1
- reflex/components/radix/primitives/drawer.pyi +1 -1
- reflex/components/radix/primitives/form.pyi +1 -1
- reflex/components/radix/primitives/progress.pyi +1 -1
- reflex/components/radix/primitives/slider.pyi +1 -1
- reflex/components/radix/themes/base.pyi +1 -1
- reflex/components/radix/themes/color_mode.pyi +1 -1
- reflex/components/radix/themes/components/alert_dialog.pyi +1 -1
- reflex/components/radix/themes/components/aspect_ratio.pyi +1 -1
- reflex/components/radix/themes/components/avatar.pyi +1 -1
- reflex/components/radix/themes/components/badge.pyi +1 -1
- reflex/components/radix/themes/components/button.pyi +1 -1
- reflex/components/radix/themes/components/callout.pyi +1 -1
- reflex/components/radix/themes/components/card.pyi +1 -1
- reflex/components/radix/themes/components/checkbox.pyi +1 -1
- reflex/components/radix/themes/components/context_menu.pyi +1 -1
- reflex/components/radix/themes/components/dialog.pyi +1 -1
- reflex/components/radix/themes/components/dropdown_menu.pyi +1 -1
- reflex/components/radix/themes/components/hover_card.pyi +1 -1
- reflex/components/radix/themes/components/icon_button.pyi +1 -1
- reflex/components/radix/themes/components/inset.pyi +1 -1
- reflex/components/radix/themes/components/popover.pyi +1 -1
- reflex/components/radix/themes/components/radio_group.pyi +1 -1
- reflex/components/radix/themes/components/scroll_area.pyi +1 -1
- reflex/components/radix/themes/components/select.py +4 -1
- reflex/components/radix/themes/components/select.pyi +5 -1
- reflex/components/radix/themes/components/separator.pyi +1 -1
- reflex/components/radix/themes/components/slider.pyi +1 -1
- reflex/components/radix/themes/components/switch.pyi +1 -1
- reflex/components/radix/themes/components/table.pyi +1 -1
- reflex/components/radix/themes/components/tabs.pyi +1 -1
- reflex/components/radix/themes/components/text_area.pyi +5 -1
- reflex/components/radix/themes/components/text_field.pyi +1 -1
- reflex/components/radix/themes/components/tooltip.pyi +1 -1
- reflex/components/radix/themes/layout/__init__.py +5 -4
- reflex/components/radix/themes/layout/base.pyi +1 -1
- reflex/components/radix/themes/layout/box.pyi +1 -1
- reflex/components/radix/themes/layout/center.pyi +1 -1
- reflex/components/radix/themes/layout/container.pyi +1 -1
- reflex/components/radix/themes/layout/flex.pyi +1 -1
- reflex/components/radix/themes/layout/grid.pyi +1 -1
- reflex/components/radix/themes/layout/list.py +21 -13
- reflex/components/radix/themes/layout/list.pyi +139 -481
- reflex/components/radix/themes/layout/section.pyi +1 -1
- reflex/components/radix/themes/layout/spacer.pyi +1 -1
- reflex/components/radix/themes/layout/stack.pyi +1 -1
- reflex/components/radix/themes/typography/blockquote.pyi +1 -1
- reflex/components/radix/themes/typography/code.pyi +1 -1
- reflex/components/radix/themes/typography/heading.pyi +1 -1
- reflex/components/radix/themes/typography/link.pyi +1 -1
- reflex/components/radix/themes/typography/text.pyi +1 -1
- reflex/components/react_player/audio.pyi +1 -1
- reflex/components/react_player/react_player.pyi +1 -1
- reflex/components/react_player/video.pyi +1 -1
- reflex/components/recharts/cartesian.pyi +1 -1
- reflex/components/recharts/charts.pyi +1 -1
- reflex/components/recharts/general.pyi +1 -1
- reflex/components/recharts/polar.pyi +1 -1
- reflex/components/recharts/recharts.pyi +1 -1
- reflex/components/suneditor/editor.pyi +1 -1
- reflex/config.py +12 -2
- reflex/custom_components/custom_components.py +305 -21
- reflex/event.py +36 -46
- reflex/reflex.py +19 -13
- reflex/state.py +184 -39
- reflex/testing.py +15 -11
- reflex/utils/console.py +15 -7
- reflex/utils/exec.py +9 -0
- reflex/utils/prerequisites.py +12 -1
- reflex/utils/processes.py +8 -25
- reflex/utils/pyi_generator.py +842 -0
- reflex/utils/telemetry.py +18 -1
- reflex/utils/types.py +14 -2
- reflex/vars.py +33 -3
- {reflex-0.4.5a1.dist-info → reflex-0.4.6.dist-info}/METADATA +31 -29
- {reflex-0.4.5a1.dist-info → reflex-0.4.6.dist-info}/RECORD +198 -198
- reflex/page.pyi +0 -17
- {reflex-0.4.5a1.dist-info → reflex-0.4.6.dist-info}/LICENSE +0 -0
- {reflex-0.4.5a1.dist-info → reflex-0.4.6.dist-info}/WHEEL +0 -0
- {reflex-0.4.5a1.dist-info → reflex-0.4.6.dist-info}/entry_points.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/core/banner.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -21,7 +21,6 @@ from reflex.components.radix.themes.components.dialog import (
|
|
|
21
21
|
from reflex.components.radix.themes.layout import Flex
|
|
22
22
|
from reflex.components.radix.themes.typography.text import Text
|
|
23
23
|
from reflex.constants import Dirs, Hooks, Imports
|
|
24
|
-
from reflex.state import State
|
|
25
24
|
from reflex.utils import imports
|
|
26
25
|
from reflex.vars import Var, VarData
|
|
27
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/core/client_side_routing.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
reflex/components/core/cond.py
CHANGED
|
@@ -206,7 +206,7 @@ def color_mode_cond(light: Any, dark: Any = None) -> Var | Component:
|
|
|
206
206
|
The conditional component or prop.
|
|
207
207
|
"""
|
|
208
208
|
return cond(
|
|
209
|
-
color_mode == LIGHT_COLOR_MODE,
|
|
209
|
+
color_mode == Var.create(LIGHT_COLOR_MODE, _var_is_string=True),
|
|
210
210
|
light,
|
|
211
211
|
dark,
|
|
212
212
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/core/debounce.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
reflex/components/core/html.pyi
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/core/html.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/core/upload.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -387,9 +387,9 @@ class CodeBlock(Component):
|
|
|
387
387
|
merged_imports = imports.merge_imports(
|
|
388
388
|
merged_imports,
|
|
389
389
|
{
|
|
390
|
-
f"react-syntax-highlighter/dist/cjs/styles/prism/{theme}": {
|
|
390
|
+
f"react-syntax-highlighter/dist/cjs/styles/prism/{self.convert_theme_name(theme)}": {
|
|
391
391
|
ImportVar(
|
|
392
|
-
tag=format.to_camel_case(theme),
|
|
392
|
+
tag=format.to_camel_case(self.convert_theme_name(theme)),
|
|
393
393
|
is_default=True,
|
|
394
394
|
install=False,
|
|
395
395
|
)
|
|
@@ -451,13 +451,7 @@ class CodeBlock(Component):
|
|
|
451
451
|
# react-syntax-highlighter doesnt have an explicit "light" or "dark" theme so we use one-light and one-dark
|
|
452
452
|
# themes respectively to ensure code compatibility.
|
|
453
453
|
if "theme" in props and not isinstance(props["theme"], Var):
|
|
454
|
-
props["theme"] = (
|
|
455
|
-
"one-light"
|
|
456
|
-
if props["theme"] == "light"
|
|
457
|
-
else "one-dark"
|
|
458
|
-
if props["theme"] == "dark"
|
|
459
|
-
else props["theme"]
|
|
460
|
-
)
|
|
454
|
+
props["theme"] = cls.convert_theme_name(props["theme"])
|
|
461
455
|
|
|
462
456
|
if can_copy:
|
|
463
457
|
code = children[0]
|
|
@@ -511,3 +505,17 @@ class CodeBlock(Component):
|
|
|
511
505
|
if self.code is not None:
|
|
512
506
|
out.special_props.add(Var.create_safe(f"children={str(self.code)}"))
|
|
513
507
|
return out
|
|
508
|
+
|
|
509
|
+
@staticmethod
|
|
510
|
+
def convert_theme_name(theme) -> str:
|
|
511
|
+
"""Convert theme names to appropriate names.
|
|
512
|
+
|
|
513
|
+
Args:
|
|
514
|
+
theme: The theme name.
|
|
515
|
+
|
|
516
|
+
Returns:
|
|
517
|
+
The right theme name.
|
|
518
|
+
"""
|
|
519
|
+
if theme in ["light", "dark"]:
|
|
520
|
+
return f"one-{theme}"
|
|
521
|
+
return theme
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/datadisplay/code.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1110,3 +1110,5 @@ class CodeBlock(Component):
|
|
|
1110
1110
|
The text component.
|
|
1111
1111
|
"""
|
|
1112
1112
|
...
|
|
1113
|
+
@staticmethod
|
|
1114
|
+
def convert_theme_name(theme) -> str: ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/datadisplay/dataeditor.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
reflex/components/el/element.pyi
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/element.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/base.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
from hashlib import md5
|
|
5
|
-
from typing import Any, Dict, Iterator, Union
|
|
5
|
+
from typing import Any, Dict, Iterator, Set, Union
|
|
6
6
|
|
|
7
7
|
from jinja2 import Environment
|
|
8
8
|
|
|
@@ -500,6 +500,36 @@ class Select(BaseHTML):
|
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
|
|
503
|
+
AUTO_HEIGHT_JS = """
|
|
504
|
+
const autoHeightOnInput = (e, is_enabled) => {
|
|
505
|
+
if (is_enabled) {
|
|
506
|
+
const el = e.target;
|
|
507
|
+
el.style.overflowY = "hidden";
|
|
508
|
+
el.style.height = "auto";
|
|
509
|
+
el.style.height = (e.target.scrollHeight) + "px";
|
|
510
|
+
if (el.form && !el.form.data_resize_on_reset) {
|
|
511
|
+
el.form.addEventListener("reset", () => window.setTimeout(() => autoHeightOnInput(e, is_enabled), 0))
|
|
512
|
+
el.form.data_resize_on_reset = true;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
"""
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
ENTER_KEY_SUBMIT_JS = """
|
|
520
|
+
const enterKeySubmitOnKeyDown = (e, is_enabled) => {
|
|
521
|
+
if (is_enabled && e.which === 13 && !e.shiftKey) {
|
|
522
|
+
e.preventDefault();
|
|
523
|
+
if (!e.repeat) {
|
|
524
|
+
if (e.target.form) {
|
|
525
|
+
e.target.form.requestSubmit();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
"""
|
|
531
|
+
|
|
532
|
+
|
|
503
533
|
class Textarea(BaseHTML):
|
|
504
534
|
"""Display the textarea element."""
|
|
505
535
|
|
|
@@ -511,6 +541,9 @@ class Textarea(BaseHTML):
|
|
|
511
541
|
# Automatically focuses the textarea when the page loads
|
|
512
542
|
auto_focus: Var[Union[str, int, bool]]
|
|
513
543
|
|
|
544
|
+
# Automatically fit the content height to the text (use min-height with this prop)
|
|
545
|
+
auto_height: Var[bool]
|
|
546
|
+
|
|
514
547
|
# Visible width of the text control, in average character widths
|
|
515
548
|
cols: Var[Union[str, int, bool]]
|
|
516
549
|
|
|
@@ -520,6 +553,9 @@ class Textarea(BaseHTML):
|
|
|
520
553
|
# Disables the textarea
|
|
521
554
|
disabled: Var[Union[str, int, bool]]
|
|
522
555
|
|
|
556
|
+
# Enter key submits form (shift-enter adds new line)
|
|
557
|
+
enter_key_submit: Var[bool]
|
|
558
|
+
|
|
523
559
|
# Associates the textarea with a form (by id)
|
|
524
560
|
form: Var[Union[str, int, bool]]
|
|
525
561
|
|
|
@@ -550,6 +586,47 @@ class Textarea(BaseHTML):
|
|
|
550
586
|
# How the text in the textarea is to be wrapped when submitting the form
|
|
551
587
|
wrap: Var[Union[str, int, bool]]
|
|
552
588
|
|
|
589
|
+
def _exclude_props(self) -> list[str]:
|
|
590
|
+
return super()._exclude_props() + [
|
|
591
|
+
"auto_height",
|
|
592
|
+
"enter_key_submit",
|
|
593
|
+
]
|
|
594
|
+
|
|
595
|
+
def get_custom_code(self) -> Set[str]:
|
|
596
|
+
"""Include the custom code for auto_height and enter_key_submit functionality.
|
|
597
|
+
|
|
598
|
+
Returns:
|
|
599
|
+
The custom code for the component.
|
|
600
|
+
"""
|
|
601
|
+
custom_code = super().get_custom_code()
|
|
602
|
+
if self.auto_height is not None:
|
|
603
|
+
custom_code.add(AUTO_HEIGHT_JS)
|
|
604
|
+
if self.enter_key_submit is not None:
|
|
605
|
+
custom_code.add(ENTER_KEY_SUBMIT_JS)
|
|
606
|
+
return custom_code
|
|
607
|
+
|
|
608
|
+
def _render(self) -> Tag:
|
|
609
|
+
tag = super()._render()
|
|
610
|
+
if self.enter_key_submit is not None:
|
|
611
|
+
if "on_key_down" in self.event_triggers:
|
|
612
|
+
raise ValueError(
|
|
613
|
+
"Cannot combine `enter_key_submit` with `on_key_down`.",
|
|
614
|
+
)
|
|
615
|
+
tag.add_props(
|
|
616
|
+
on_key_down=Var.create_safe(
|
|
617
|
+
f"(e) => enterKeySubmitOnKeyDown(e, {self.enter_key_submit._var_name_unwrapped})",
|
|
618
|
+
_var_is_local=False,
|
|
619
|
+
)._replace(merge_var_data=self.enter_key_submit._var_data),
|
|
620
|
+
)
|
|
621
|
+
if self.auto_height is not None:
|
|
622
|
+
tag.add_props(
|
|
623
|
+
on_input=Var.create_safe(
|
|
624
|
+
f"(e) => autoHeightOnInput(e, {self.auto_height._var_name_unwrapped})",
|
|
625
|
+
_var_is_local=False,
|
|
626
|
+
)._replace(merge_var_data=self.auto_height._var_data),
|
|
627
|
+
)
|
|
628
|
+
return tag
|
|
629
|
+
|
|
553
630
|
def get_event_triggers(self) -> Dict[str, Any]:
|
|
554
631
|
"""Get the event triggers that pass the component's value to the handler.
|
|
555
632
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/forms.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -8,7 +8,7 @@ from reflex.vars import Var, BaseVar, ComputedVar
|
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from hashlib import md5
|
|
11
|
-
from typing import Any, Dict, Iterator, Union
|
|
11
|
+
from typing import Any, Dict, Iterator, Set, Union
|
|
12
12
|
from jinja2 import Environment
|
|
13
13
|
from reflex.components.el.element import Element
|
|
14
14
|
from reflex.components.tags.tag import Tag
|
|
@@ -2018,7 +2018,11 @@ class Select(BaseHTML):
|
|
|
2018
2018
|
"""
|
|
2019
2019
|
...
|
|
2020
2020
|
|
|
2021
|
+
AUTO_HEIGHT_JS = '\nconst autoHeightOnInput = (e, is_enabled) => {\n if (is_enabled) {\n const el = e.target;\n el.style.overflowY = "hidden";\n el.style.height = "auto";\n el.style.height = (e.target.scrollHeight) + "px";\n if (el.form && !el.form.data_resize_on_reset) {\n el.form.addEventListener("reset", () => window.setTimeout(() => autoHeightOnInput(e, is_enabled), 0))\n el.form.data_resize_on_reset = true;\n }\n }\n}\n'
|
|
2022
|
+
ENTER_KEY_SUBMIT_JS = "\nconst enterKeySubmitOnKeyDown = (e, is_enabled) => {\n if (is_enabled && e.which === 13 && !e.shiftKey) {\n e.preventDefault();\n if (!e.repeat) {\n if (e.target.form) {\n e.target.form.requestSubmit();\n }\n }\n }\n}\n"
|
|
2023
|
+
|
|
2021
2024
|
class Textarea(BaseHTML):
|
|
2025
|
+
def get_custom_code(self) -> Set[str]: ...
|
|
2022
2026
|
def get_event_triggers(self) -> Dict[str, Any]: ...
|
|
2023
2027
|
@overload
|
|
2024
2028
|
@classmethod
|
|
@@ -2031,6 +2035,7 @@ class Textarea(BaseHTML):
|
|
|
2031
2035
|
auto_focus: Optional[
|
|
2032
2036
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
2033
2037
|
] = None,
|
|
2038
|
+
auto_height: Optional[Union[Var[bool], bool]] = None,
|
|
2034
2039
|
cols: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
|
|
2035
2040
|
dirname: Optional[
|
|
2036
2041
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
@@ -2038,6 +2043,7 @@ class Textarea(BaseHTML):
|
|
|
2038
2043
|
disabled: Optional[
|
|
2039
2044
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
2040
2045
|
] = None,
|
|
2046
|
+
enter_key_submit: Optional[Union[Var[bool], bool]] = None,
|
|
2041
2047
|
form: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
|
|
2042
2048
|
max_length: Optional[
|
|
2043
2049
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
@@ -2168,9 +2174,11 @@ class Textarea(BaseHTML):
|
|
|
2168
2174
|
*children: The children of the component.
|
|
2169
2175
|
auto_complete: Whether the form control should have autocomplete enabled
|
|
2170
2176
|
auto_focus: Automatically focuses the textarea when the page loads
|
|
2177
|
+
auto_height: Automatically fit the content height to the text (use min-height with this prop)
|
|
2171
2178
|
cols: Visible width of the text control, in average character widths
|
|
2172
2179
|
dirname: Name part of the textarea to submit in 'dir' and 'name' pair when form is submitted
|
|
2173
2180
|
disabled: Disables the textarea
|
|
2181
|
+
enter_key_submit: Enter key submits form (shift-enter adds new line)
|
|
2174
2182
|
form: Associates the textarea with a form (by id)
|
|
2175
2183
|
max_length: Maximum number of characters allowed in the textarea
|
|
2176
2184
|
min_length: Minimum number of characters required in the textarea
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/inline.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/media.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/metadata.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/other.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/scripts.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/sectioning.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/tables.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/el/elements/typography.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Stub file for reflex/components/gridjs/datatable.py"""
|
|
2
2
|
# ------------------- DO NOT EDIT ----------------------
|
|
3
|
-
# This file was generated by `
|
|
3
|
+
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
4
4
|
# ------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
from typing import Any, Dict, Literal, Optional, Union, overload
|