mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
parent
eb0ad4106d
commit
02ba8cb6ee
10 changed files with 410 additions and 6 deletions
|
@ -7,21 +7,28 @@
|
|||
export let translateWithId = id => defaultTranslations[id];
|
||||
export let style = undefined;
|
||||
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { createEventDispatcher, getContext } from 'svelte';
|
||||
import Close16 from 'carbon-icons-svelte/lib/Close16';
|
||||
import { cx } from '../../lib';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const defaultTranslations = {
|
||||
[translationIds.clearAll]: 'Clear all selected items',
|
||||
[translationIds.clearSelection]: 'Clear selected item'
|
||||
};
|
||||
const dispatch = createEventDispatcher();
|
||||
const ctx = getContext('MultiSelect');
|
||||
|
||||
let selectionRef = undefined;
|
||||
|
||||
$: if (ctx && selectionRef) {
|
||||
ctx.declareRef({ key: 'selection', ref: selectionRef });
|
||||
}
|
||||
|
||||
$: description = selectionCount ? translateWithId('clearAll') : translateWithId('clearSelection');
|
||||
</script>
|
||||
|
||||
<div
|
||||
bind:this={selectionRef}
|
||||
role="button"
|
||||
aria-label="Clear Selection"
|
||||
tabindex={disabled ? '-1' : '0'}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue