feat(search): export autofocus prop

This commit is contained in:
Eric Liu 2019-12-25 07:22:29 -08:00
commit fd91dd80c5

View file

@ -2,6 +2,7 @@
let className = undefined; let className = undefined;
export { className as class }; export { className as class };
export let value = ''; export let value = '';
export let autofocus = false;
export let type = 'text'; export let type = 'text';
export let small = false; export let small = false;
export let placeHolderText = ''; export let placeHolderText = '';
@ -28,6 +29,7 @@
{style}> {style}>
<Search16 class={cx('--search-magnifier')} /> <Search16 class={cx('--search-magnifier')} />
<label for={id} class={cx('--label')}>{labelText}</label> <label for={id} class={cx('--label')}>{labelText}</label>
<!-- svelte-ignore a11y-autofocus -->
<input <input
bind:this={inputRef} bind:this={inputRef}
role="searchbox" role="searchbox"
@ -35,9 +37,10 @@
placeholder={placeHolderText} placeholder={placeHolderText}
on:change on:change
on:input on:input
on:input={event => { on:input={({ target }) => {
value = event.target.value; value = target.value;
}} }}
{autofocus}
{type} {type}
{id} {id}
{value} /> {value} />