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.
@@ -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 op = { ...rawOp };
63
- if (!op.value)
64
- op.value = op.label;
65
- return op;
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.error(`MultiSelect options must be objects, strings or numbers, got ${typeof rawOp}`);
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.error(`Option labels must be unique. Duplicates found: ${labels.filter((label, idx) => labels.indexOf(label) !== idx)}`);
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.3",
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-toc/main/static/favicon.svg" alt="Svelte MultiSelect" height=60>
3
- <br>&ensp;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">&ensp;Svelte MultiSelect
4
4
  </h1>
5
5
 
6
6
  <h4 align="center">
7
7
 
8
+ [![REPL](https://img.shields.io/badge/Svelte-REPL-blue)](https://svelte.dev/repl/a5a14b8f15d64cb083b567292480db05)
8
9
  [![Tests](https://github.com/janosh/svelte-multiselect/actions/workflows/test.yml/badge.svg)](https://github.com/janosh/svelte-multiselect/actions/workflows/test.yml)
9
10
  [![Netlify Status](https://api.netlify.com/api/v1/badges/a45b62c3-ea45-4cfd-9912-77ec4fc8d7e8/deploy-status)](https://app.netlify.com/sites/svelte-multiselect/deploys)
10
- [![NPM version](https://img.shields.io/npm/v/svelte-multiselect?color=blue&logo=NPM)](https://npmjs.com/package/svelte-multiselect)
11
- [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/janosh/svelte-multiselect/main.svg)](https://results.pre-commit.ci/latest/github/janosh/svelte-multiselect/main)
12
- [![Needs Svelte version](https://img.shields.io/npm/dependency-version/svelte-multiselect/dev/svelte)](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
11
+ [![NPM version](https://img.shields.io/npm/v/svelte-multiselect?logo=NPM&color=purple)](https://npmjs.com/package/svelte-multiselect)
12
+ [![Needs Svelte version](https://img.shields.io/npm/dependency-version/svelte-multiselect/dev/svelte?color=teal)](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
13
13
 
14
14
  </h4>
15
15
 
16
- **Keyboard-friendly, zero-dependency multi-select Svelte component.**
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> &bull;
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" />