svelte-multiselect 4.0.3 → 4.0.4
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.
- package/MultiSelect.svelte +6 -7
- package/package.json +1 -1
- package/readme.md +7 -10
package/MultiSelect.svelte
CHANGED
|
@@ -57,16 +57,15 @@ function isObject(item) {
|
|
|
57
57
|
}
|
|
58
58
|
// process proto options to full ones with mandatory labels
|
|
59
59
|
$: _options = options.map((rawOp) => {
|
|
60
|
-
// convert to objects internally if user passed list of strings or numbers as options
|
|
61
60
|
if (isObject(rawOp)) {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
return
|
|
61
|
+
const option = { ...rawOp };
|
|
62
|
+
if (option.value === undefined)
|
|
63
|
+
option.value = option.label;
|
|
64
|
+
return option;
|
|
66
65
|
}
|
|
67
66
|
else {
|
|
68
67
|
if (![`string`, `number`].includes(typeof rawOp)) {
|
|
69
|
-
console.
|
|
68
|
+
console.warn(`MultiSelect options must be objects, strings or numbers, got ${typeof rawOp}`);
|
|
70
69
|
}
|
|
71
70
|
// even if we logged error above, try to proceed hoping user knows what they're doing
|
|
72
71
|
return { label: rawOp, value: rawOp };
|
|
@@ -74,7 +73,7 @@ $: _options = options.map((rawOp) => {
|
|
|
74
73
|
});
|
|
75
74
|
$: labels = _options.map((op) => op.label);
|
|
76
75
|
$: if (new Set(labels).size !== options.length) {
|
|
77
|
-
console.
|
|
76
|
+
console.warn(`Option labels should be unique. Duplicates found: ${labels.filter((label, idx) => labels.indexOf(label) !== idx)}`);
|
|
78
77
|
}
|
|
79
78
|
let wiggle = false;
|
|
80
79
|
$: selectedLabels = selected.map((op) => op.label);
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"homepage": "https://svelte-multiselect.netlify.app",
|
|
6
6
|
"repository": "https://github.com/janosh/svelte-multiselect",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "4.0.
|
|
8
|
+
"version": "4.0.4",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"svelte": "index.js",
|
|
11
11
|
"bugs": "https://github.com/janosh/svelte-multiselect/issues",
|
package/readme.md
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
<h1 align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/janosh/svelte-
|
|
3
|
-
<br> Svelte MultiSelect
|
|
2
|
+
<img src="https://raw.githubusercontent.com/janosh/svelte-multiselect/main/static/favicon.svg" alt="Svelte MultiSelect" height="60" width="60">
|
|
3
|
+
<br class="hide-in-docs"> Svelte MultiSelect
|
|
4
4
|
</h1>
|
|
5
5
|
|
|
6
6
|
<h4 align="center">
|
|
7
7
|
|
|
8
|
+
[](https://svelte.dev/repl/a5a14b8f15d64cb083b567292480db05)
|
|
8
9
|
[](https://github.com/janosh/svelte-multiselect/actions/workflows/test.yml)
|
|
9
10
|
[](https://app.netlify.com/sites/svelte-multiselect/deploys)
|
|
10
|
-
[](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
|
|
11
|
+
[](https://npmjs.com/package/svelte-multiselect)
|
|
12
|
+
[](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
|
|
13
13
|
|
|
14
14
|
</h4>
|
|
15
15
|
|
|
16
|
-
**Keyboard-friendly,
|
|
16
|
+
**Keyboard-friendly, accessible multi-select Svelte component.**
|
|
17
17
|
<strong class="hide-in-docs">
|
|
18
|
-
<a href="https://svelte-multiselect.netlify.app">Docs</a>
|
|
19
|
-
</strong>
|
|
20
|
-
<strong>
|
|
21
|
-
<a href="https://svelte.dev/repl/a5a14b8f15d64cb083b567292480db05">REPL</a>
|
|
18
|
+
<a href="https://svelte-multiselect.netlify.app">Docs</a>
|
|
22
19
|
</strong>
|
|
23
20
|
|
|
24
21
|
<slot name="examples" />
|