Allow DebounceInput as child of FormControl Component (#3660)
This commit is contained in:
parent
dc33d208b4
commit
eed0edc12a
@ -5,6 +5,7 @@ from __future__ import annotations
|
|||||||
from typing import Any, Literal
|
from typing import Any, Literal
|
||||||
|
|
||||||
from reflex.components.component import ComponentNamespace
|
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.el.elements.forms import Form as HTMLForm
|
||||||
from reflex.components.radix.themes.components.text_field import TextFieldRoot
|
from reflex.components.radix.themes.components.text_field import TextFieldRoot
|
||||||
from reflex.event import EventHandler
|
from reflex.event import EventHandler
|
||||||
@ -103,9 +104,9 @@ class FormControl(FormComponent):
|
|||||||
f"FormControl can only have at most one child, got {len(children)} children"
|
f"FormControl can only have at most one child, got {len(children)} children"
|
||||||
)
|
)
|
||||||
for child in children:
|
for child in children:
|
||||||
if not isinstance(child, TextFieldRoot):
|
if not isinstance(child, (TextFieldRoot, DebounceInput)):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
"Only Radix TextFieldRoot is allowed as child of FormControl"
|
"Only Radix TextFieldRoot and DebounceInput are allowed as children of FormControl"
|
||||||
)
|
)
|
||||||
return super().create(*children, **props)
|
return super().create(*children, **props)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user