mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +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 let disabled = false;
|
||||
export let helperText = "";
|
||||
|
||||
/**
|
||||
* Set an id for the list box component
|
||||
* @type {string} [id]
|
||||
*/
|
||||
export let id = "ccs-" + Math.random().toString(36);
|
||||
export let invalid = false;
|
||||
export let invalidText = "";
|
||||
export let items = [];
|
||||
export let itemToString = item => item.text || item.id;
|
||||
export let itemToString = (item) => item.text || item.id;
|
||||
export let light = false;
|
||||
export let open = false;
|
||||
export let placeholder = "";
|
||||
|
@ -26,7 +31,7 @@
|
|||
ListBoxMenu,
|
||||
ListBoxMenuIcon,
|
||||
ListBoxMenuItem,
|
||||
ListBoxSelection
|
||||
ListBoxSelection,
|
||||
} from "../ListBox";
|
||||
|
||||
let selectedId = undefined;
|
||||
|
@ -48,7 +53,7 @@
|
|||
afterUpdate(() => {
|
||||
if (open) {
|
||||
ref.focus();
|
||||
filteredItems = items.filter(item => shouldFilterItem(item, value));
|
||||
filteredItems = items.filter((item) => shouldFilterItem(item, value));
|
||||
} else {
|
||||
highlightedIndex = -1;
|
||||
inputValue = selectedItem ? selectedItem.text : "";
|
||||
|
@ -61,7 +66,7 @@
|
|||
$: highlightedId = items[highlightedIndex]
|
||||
? items[highlightedIndex].id
|
||||
: undefined;
|
||||
$: filteredItems = items.filter(item => shouldFilterItem(item, value));
|
||||
$: filteredItems = items.filter((item) => shouldFilterItem(item, value));
|
||||
$: selectedItem = items[selectedIndex];
|
||||
$: inputValue = selectedItem ? selectedItem.text : undefined;
|
||||
$: value = inputValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue