@txstate-mws/svelte-components 1.3.1 → 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.
|
@@ -97,11 +97,14 @@ const windowclick = (_) => {
|
|
|
97
97
|
</script>
|
|
98
98
|
<svelte:window on:click={windowclick} />
|
|
99
99
|
<div class={className} role="alertdialog" aria-modal="true" on:click|stopPropagation on:keydown|stopPropagation={keydown} on:focusin={focusin}>
|
|
100
|
+
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
100
101
|
<div bind:this={abovelockelement} tabindex="0"></div>
|
|
101
102
|
<div bind:this={lockelement} on:keydown={keydown}>
|
|
103
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
102
104
|
{#if hidefocus}<div class="hiddenfocus" use:buttonify on:blur={() => { hidefocus = false }} on:click={() => escapable && dispatch('escape')}><ScreenReaderOnly>{hidefocuslabel}{#if escapable}, click to escape or use escape key at any time{/if}</ScreenReaderOnly></div>{/if}
|
|
103
105
|
<slot></slot>
|
|
104
106
|
</div>
|
|
107
|
+
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
105
108
|
<div tabindex="0"></div>
|
|
106
109
|
</div>
|
|
107
110
|
|
package/components/Modal.svelte
CHANGED
|
@@ -23,6 +23,7 @@ onMount(() => {
|
|
|
23
23
|
});
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
26
27
|
<div use:portal={usePortal} class="modal-backdrop" class:opaque on:click|stopPropagation|preventDefault={() => escapable && endmodal()}>
|
|
27
28
|
<FocusLock class="modal-container {containerClass}" {escapable} on:escape {hidefocus} {hidefocuslabel} {returnfocusto} {initialfocus}>
|
|
28
29
|
<slot></slot>
|
|
@@ -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,13 +100,12 @@ 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>
|
|
105
106
|
<ul class="multiselect-selected" class:disabled role="listbox">
|
|
106
107
|
{#each selected as option, i}
|
|
108
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
107
109
|
<li id={id + option.value} role="option" tabindex="-1" class="multiselect-pill" class:hilited={hilitedpill === option.value}
|
|
108
110
|
on:click|preventDefault|stopPropagation={() => !disabled && removeSelection(option, i, 1)} on:mousedown={e => disabled && e.preventDefault()}
|
|
109
111
|
aria-selected="true">
|
|
@@ -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]}
|