mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
chore: add more prop annotations
This commit is contained in:
parent
8c1ffd4cb0
commit
773b18d314
75 changed files with 877 additions and 137 deletions
|
@ -1,11 +1,16 @@
|
|||
<script>
|
||||
export const translationIds = {
|
||||
clearAll: "clearAll",
|
||||
clearSelection: "clearSelection"
|
||||
clearSelection: "clearSelection",
|
||||
};
|
||||
export let disabled = false;
|
||||
export let selectionCount = undefined;
|
||||
export let translateWithId = id => defaultTranslations[id];
|
||||
export let translateWithId = (id) => defaultTranslations[id];
|
||||
|
||||
/**
|
||||
* Obtain a reference to the top-level HTML element
|
||||
* @type {null | HTMLElement} [ref=null]
|
||||
*/
|
||||
export let ref = null;
|
||||
|
||||
import { createEventDispatcher, getContext } from "svelte";
|
||||
|
@ -13,7 +18,7 @@
|
|||
|
||||
const defaultTranslations = {
|
||||
[translationIds.clearAll]: "Clear all selected items",
|
||||
[translationIds.clearSelection]: "Clear selected item"
|
||||
[translationIds.clearSelection]: "Clear selected item",
|
||||
};
|
||||
const dispatch = createEventDispatcher();
|
||||
const ctx = getContext("MultiSelect");
|
||||
|
@ -37,12 +42,12 @@
|
|||
class:bx--tag--filter={selectionCount}
|
||||
class:bx--list-box__selection--multi={selectionCount}
|
||||
{...$$restProps}
|
||||
on:click|preventDefault|stopPropagation={e => {
|
||||
on:click|preventDefault|stopPropagation={(e) => {
|
||||
if (!disabled) {
|
||||
dispatch('clear', e);
|
||||
}
|
||||
}}
|
||||
on:keydown|stopPropagation={e => {
|
||||
on:keydown|stopPropagation={(e) => {
|
||||
if (!disabled && e.key === 'Enter') {
|
||||
dispatch('clear', e);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue