mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
feat(search): dispatch clear event
This commit is contained in:
parent
92e463c816
commit
8a07f833fd
3 changed files with 30 additions and 26 deletions
|
@ -84,10 +84,13 @@
|
|||
*/
|
||||
export let ref = null;
|
||||
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Close16 from "carbon-icons-svelte/lib/Close16";
|
||||
import Close20 from "carbon-icons-svelte/lib/Close20";
|
||||
import Search16 from "carbon-icons-svelte/lib/Search16";
|
||||
import SearchSkeleton from "./Search.Skeleton.svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
||||
{#if skeleton}
|
||||
|
@ -143,6 +146,7 @@
|
|||
on:click="{() => {
|
||||
value = '';
|
||||
ref.focus();
|
||||
dispatch('clear');
|
||||
}}"
|
||||
>
|
||||
<svelte:component this="{size === 'xl' ? Close20 : Close16}" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue