refactor(search): use native binding for value prop

This commit is contained in:
Eric Liu 2022-03-13 18:58:17 -07:00
commit 417571b064

View file

@ -37,9 +37,6 @@
/** Specify the value of the search input */
export let value = "";
/** Specify the `type` attribute of the search input */
export let type = "text";
/** Specify the `placeholder` attribute of the search input */
export let placeholder = "Search...";
@ -125,6 +122,8 @@
<!-- svelte-ignore a11y-autofocus -->
<input
bind:this="{ref}"
bind:value
type="text"
role="searchbox"
class:bx--search-input="{true}"
autofocus="{autofocus === true ? true : undefined}"
@ -132,14 +131,9 @@
disabled="{disabled}"
id="{id}"
placeholder="{placeholder}"
type="{type}"
value="{value}"
{...$$restProps}
on:change
on:input
on:input="{({ target }) => {
value = target.value;
}}"
on:focus
on:focus="{() => {
if (expandable) expanded = true;