refactor(search): use native binding for value prop (#1173)

* refactor(search): use native binding for value prop

* feat(search): type the value prop as any
This commit is contained in:
metonym 2022-03-13 19:02:46 -07:00 committed by GitHub
commit ba0abe8e34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 47 deletions

View file

@ -4,6 +4,12 @@
* @event {null} collapse
*/
/**
* Specify the value of the search input
* @type {any}
*/
export let value = "";
/**
* @deprecated this prop will be removed in the next major release
* Use size="sm" instead
@ -34,12 +40,6 @@
/** Set to `true to expand the search input */
export let expanded = false;
/** 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 +125,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 +134,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;