mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
refactor(search): use native binding for value prop
This commit is contained in:
parent
bc8903a67b
commit
417571b064
1 changed files with 2 additions and 8 deletions
|
@ -37,9 +37,6 @@
|
||||||
/** Specify the value of the search input */
|
/** Specify the value of the search input */
|
||||||
export let value = "";
|
export let value = "";
|
||||||
|
|
||||||
/** Specify the `type` attribute of the search input */
|
|
||||||
export let type = "text";
|
|
||||||
|
|
||||||
/** Specify the `placeholder` attribute of the search input */
|
/** Specify the `placeholder` attribute of the search input */
|
||||||
export let placeholder = "Search...";
|
export let placeholder = "Search...";
|
||||||
|
|
||||||
|
@ -125,6 +122,8 @@
|
||||||
<!-- svelte-ignore a11y-autofocus -->
|
<!-- svelte-ignore a11y-autofocus -->
|
||||||
<input
|
<input
|
||||||
bind:this="{ref}"
|
bind:this="{ref}"
|
||||||
|
bind:value
|
||||||
|
type="text"
|
||||||
role="searchbox"
|
role="searchbox"
|
||||||
class:bx--search-input="{true}"
|
class:bx--search-input="{true}"
|
||||||
autofocus="{autofocus === true ? true : undefined}"
|
autofocus="{autofocus === true ? true : undefined}"
|
||||||
|
@ -132,14 +131,9 @@
|
||||||
disabled="{disabled}"
|
disabled="{disabled}"
|
||||||
id="{id}"
|
id="{id}"
|
||||||
placeholder="{placeholder}"
|
placeholder="{placeholder}"
|
||||||
type="{type}"
|
|
||||||
value="{value}"
|
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:change
|
on:change
|
||||||
on:input
|
on:input
|
||||||
on:input="{({ target }) => {
|
|
||||||
value = target.value;
|
|
||||||
}}"
|
|
||||||
on:focus
|
on:focus
|
||||||
on:focus="{() => {
|
on:focus="{() => {
|
||||||
if (expandable) expanded = true;
|
if (expandable) expanded = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue