remove prop debounce_timeout
from input and textarea (#1645)
This commit is contained in:
parent
d884b7ba96
commit
af08e06569
@ -50,9 +50,6 @@ class Input(ChakraComponent):
|
|||||||
# "lg" | "md" | "sm" | "xs"
|
# "lg" | "md" | "sm" | "xs"
|
||||||
size: Var[str]
|
size: Var[str]
|
||||||
|
|
||||||
# Time in milliseconds to wait between end of input and triggering on_change
|
|
||||||
debounce_timeout: Var[int]
|
|
||||||
|
|
||||||
def _get_imports(self) -> imports.ImportDict:
|
def _get_imports(self) -> imports.ImportDict:
|
||||||
return imports.merge_imports(
|
return imports.merge_imports(
|
||||||
super()._get_imports(),
|
super()._get_imports(),
|
||||||
@ -84,12 +81,14 @@ class Input(ChakraComponent):
|
|||||||
Returns:
|
Returns:
|
||||||
The component.
|
The component.
|
||||||
"""
|
"""
|
||||||
if isinstance(props.get("value"), Var) and props.get("on_change"):
|
if (
|
||||||
|
isinstance(props.get("value"), Var) and props.get("on_change")
|
||||||
|
) or "debounce_timeout" in props:
|
||||||
|
# Currently default to 50ms, which appears to be a good balance
|
||||||
|
debounce_timeout = props.pop("debounce_timeout", 50)
|
||||||
# create a debounced input if the user requests full control to avoid typing jank
|
# create a debounced input if the user requests full control to avoid typing jank
|
||||||
return DebounceInput.create(
|
return DebounceInput.create(
|
||||||
super().create(*children, **props),
|
super().create(*children, **props), debounce_timeout=debounce_timeout
|
||||||
# Currently default to 50ms, which appears to be a good balance
|
|
||||||
debounce_timeout=props.get("debounce_timeout", 50),
|
|
||||||
)
|
)
|
||||||
return super().create(*children, **props)
|
return super().create(*children, **props)
|
||||||
|
|
||||||
|
@ -43,9 +43,6 @@ class TextArea(ChakraComponent):
|
|||||||
# "outline" | "filled" | "flushed" | "unstyled"
|
# "outline" | "filled" | "flushed" | "unstyled"
|
||||||
variant: Var[str]
|
variant: Var[str]
|
||||||
|
|
||||||
# Time in milliseconds to wait between end of input and triggering on_change
|
|
||||||
debounce_timeout: Var[int]
|
|
||||||
|
|
||||||
def get_controlled_triggers(self) -> Dict[str, Var]:
|
def get_controlled_triggers(self) -> Dict[str, Var]:
|
||||||
"""Get the event triggers that pass the component's value to the handler.
|
"""Get the event triggers that pass the component's value to the handler.
|
||||||
|
|
||||||
@ -71,11 +68,13 @@ class TextArea(ChakraComponent):
|
|||||||
Returns:
|
Returns:
|
||||||
The component.
|
The component.
|
||||||
"""
|
"""
|
||||||
if isinstance(props.get("value"), Var) and props.get("on_change"):
|
if (
|
||||||
|
isinstance(props.get("value"), Var) and props.get("on_change")
|
||||||
|
) or "debounce_timeout" in props:
|
||||||
|
# Currently default to 50ms, which appears to be a good balance
|
||||||
|
debounce_timeout = props.pop("debounce_timeout", 50)
|
||||||
# create a debounced input if the user requests full control to avoid typing jank
|
# create a debounced input if the user requests full control to avoid typing jank
|
||||||
return DebounceInput.create(
|
return DebounceInput.create(
|
||||||
super().create(*children, **props),
|
super().create(*children, **props), debounce_timeout=debounce_timeout
|
||||||
# Currently default to 50ms, which appears to be a good balance
|
|
||||||
debounce_timeout=props.get("debounce_timeout", 50),
|
|
||||||
)
|
)
|
||||||
return super().create(*children, **props)
|
return super().create(*children, **props)
|
||||||
|
Loading…
Reference in New Issue
Block a user