@txstate-mws/svelte-components 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,6 +22,7 @@ let inputvalue = '';
|
|
|
22
22
|
let popupvalue = undefined;
|
|
23
23
|
let inputelement;
|
|
24
24
|
const descriptionid = randomid();
|
|
25
|
+
const dispatch = createEventDispatcher();
|
|
25
26
|
$: debouncedGetOptions = debouncedPromise(getOptions, 100, []);
|
|
26
27
|
$: selectedSet = new Set(selected.map(s => s.value));
|
|
27
28
|
async function reactToInput(..._) {
|
|
@@ -42,12 +43,14 @@ function addSelection(e) {
|
|
|
42
43
|
const opt = { ...e.detail, label: e.detail.label || e.detail.value };
|
|
43
44
|
selected = [...selected, opt];
|
|
44
45
|
popupvalue = undefined;
|
|
46
|
+
dispatch('change', selected);
|
|
45
47
|
}
|
|
46
48
|
function removeSelection(opt, idx, nextfocus = 1) {
|
|
47
49
|
if (hilitedpill === opt.value) {
|
|
48
50
|
hilitedpill = selected[idx + nextfocus]?.value;
|
|
49
51
|
}
|
|
50
52
|
selected = selected.filter(s => s.value !== opt.value);
|
|
53
|
+
dispatch('change', selected);
|
|
51
54
|
}
|
|
52
55
|
function inputkeydown(e) {
|
|
53
56
|
if (modifierKey(e))
|
|
@@ -97,8 +100,6 @@ function reactToHilite(..._) {
|
|
|
97
100
|
inputelement.removeAttribute('aria-activedescendant');
|
|
98
101
|
}
|
|
99
102
|
$: reactToHilite(hilitedpill, id);
|
|
100
|
-
const dispatch = createEventDispatcher();
|
|
101
|
-
$: dispatch('change', selected);
|
|
102
103
|
</script>
|
|
103
104
|
|
|
104
105
|
<fieldset>
|
|
@@ -197,6 +197,7 @@ $: hasSelected = showSelected && items.some(itm => itm.value === value);
|
|
|
197
197
|
<ul bind:this={menuelement} id={menuid} role='listbox' style={width ? `width: ${width}` : ''} class={menuClass} class:hasSelected class:defaultmenu={!menuClass && !menuContainerClass} on:keydown={onkeydown}>
|
|
198
198
|
{#each items as item, i (item.value)}
|
|
199
199
|
{#if showSelected || item.value !== value}
|
|
200
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
200
201
|
<li
|
|
201
202
|
id={`${menuid}-${i}`}
|
|
202
203
|
bind:this={itemelements[i]}
|