svelte-multiselect 5.0.4 → 5.0.5

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.
@@ -1,4 +1,5 @@
1
- <script>import { createEventDispatcher } from 'svelte';
1
+ <script>import scrollIntoView from 'scroll-into-view-if-needed';
2
+ import { createEventDispatcher } from 'svelte';
2
3
  import { get_label, get_value } from './';
3
4
  import CircleSpinner from './CircleSpinner.svelte';
4
5
  import { CrossIcon, DisabledIcon, ExpandIcon } from './icons';
@@ -232,7 +233,8 @@ async function handleKeydown(event) {
232
233
  // around start/end of option list. Find a better solution than waiting 10 ms to.
233
234
  setTimeout(() => {
234
235
  const li = document.querySelector(`ul.options > li.active`);
235
- li?.scrollIntoView();
236
+ if (li)
237
+ scrollIntoView(li, { scrollMode: `if-needed` });
236
238
  }, 10);
237
239
  }
238
240
  }
@@ -499,9 +501,11 @@ const if_enter_or_space = (handler) => (event) => {
499
501
  background: none;
500
502
  flex: 1; /* this + next line fix issue #12 https://git.io/JiDe3 */
501
503
  min-width: 2em;
502
- color: inherit;
504
+ /* ensure input uses text color and not --sms-selected-text-color */
505
+ color: var(--sms-text-color);
503
506
  font-size: inherit;
504
507
  cursor: inherit; /* needed for disabled state */
508
+ border-radius: 0; /* reset ul.selected > li */
505
509
  }
506
510
  :where(div.multiselect > ul.selected > li > input)::placeholder {
507
511
  padding-left: 5pt;
@@ -0,0 +1,5 @@
1
+ <svg {...$$props} viewBox="0 0 24 24" fill="currentColor">
2
+ <path
3
+ d="M8.422 20.081c0 .896.01 1.753.016 2.285a.617.617 0 0 0 .422.58c2.078.686 4.317.718 6.414.091l.292-.087a.67.67 0 0 0 .478-.638c.005-.733.017-2.017.017-3.53c0-1.372-.477-2.25-1.031-2.707c3.399-.366 6.97-1.61 6.97-7.227c0-1.61-.592-2.91-1.566-3.934c.153-.366.688-1.866-.153-3.878c0 0-1.28-.403-4.201 1.5a14.76 14.76 0 0 0-3.82-.494c-1.298 0-2.597.165-3.819.494C5.52.65 4.24 1.036 4.24 1.036c-.84 2.012-.306 3.512-.153 3.878a5.565 5.565 0 0 0-1.566 3.934c0 5.598 3.552 6.86 6.951 7.227c-.439.366-.84 1.006-.973 1.957c-.879.384-3.075 1.006-4.45-1.207c-.286-.44-1.146-1.519-2.349-1.5c-1.28.018-.516.695.02.97c.648.347 1.393 1.646 1.565 2.067c.306.823 1.299 2.396 5.137 1.72Z"
4
+ />
5
+ </svg>
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} OctocatProps */
2
+ /** @typedef {typeof __propDef.events} OctocatEvents */
3
+ /** @typedef {typeof __propDef.slots} OctocatSlots */
4
+ export default class Octocat extends SvelteComponentTyped<{
5
+ [x: string]: any;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type OctocatProps = typeof __propDef.props;
11
+ export type OctocatEvents = typeof __propDef.events;
12
+ export type OctocatSlots = typeof __propDef.slots;
13
+ import { SvelteComponentTyped } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ [x: string]: any;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};
package/icons/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as ExpandIcon } from './ChevronExpand.svelte';
2
2
  export { default as CrossIcon } from './Cross.svelte';
3
3
  export { default as DisabledIcon } from './Disabled.svelte';
4
+ export { default as Octocat } from './Octocat.svelte';
package/icons/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default as ExpandIcon } from './ChevronExpand.svelte';
2
2
  export { default as CrossIcon } from './Cross.svelte';
3
3
  export { default as DisabledIcon } from './Disabled.svelte';
4
+ export { default as Octocat } from './Octocat.svelte';
package/package.json CHANGED
@@ -5,19 +5,19 @@
5
5
  "homepage": "https://svelte-multiselect.netlify.app",
6
6
  "repository": "https://github.com/janosh/svelte-multiselect",
7
7
  "license": "MIT",
8
- "version": "5.0.4",
8
+ "version": "5.0.5",
9
9
  "type": "module",
10
10
  "svelte": "index.js",
11
11
  "main": "index.js",
12
12
  "bugs": "https://github.com/janosh/svelte-multiselect/issues",
13
13
  "devDependencies": {
14
- "@playwright/test": "^1.23.1",
15
- "@sveltejs/adapter-static": "^1.0.0-next.34",
16
- "@sveltejs/kit": "^1.0.0-next.360",
17
- "@sveltejs/vite-plugin-svelte": "^1.0.0-next.49",
18
- "@typescript-eslint/eslint-plugin": "^5.30.5",
19
- "@typescript-eslint/parser": "^5.30.5",
20
- "eslint": "^8.19.0",
14
+ "@playwright/test": "^1.24.1",
15
+ "@sveltejs/adapter-static": "^1.0.0-next.38",
16
+ "@sveltejs/kit": "^1.0.0-next.396",
17
+ "@sveltejs/vite-plugin-svelte": "^1.0.1",
18
+ "@typescript-eslint/eslint-plugin": "^5.31.0",
19
+ "@typescript-eslint/parser": "^5.31.0",
20
+ "eslint": "^8.20.0",
21
21
  "eslint-plugin-svelte3": "^4.0.0",
22
22
  "hastscript": "^7.0.2",
23
23
  "jsdom": "^20.0.0",
@@ -26,16 +26,17 @@
26
26
  "prettier-plugin-svelte": "^2.7.0",
27
27
  "rehype-autolink-headings": "^6.1.1",
28
28
  "rehype-slug": "^5.0.1",
29
- "svelte": "^3.48.0",
29
+ "scroll-into-view-if-needed": "^2.2.29",
30
+ "svelte": "^3.49.0",
30
31
  "svelte-check": "^2.8.0",
31
32
  "svelte-github-corner": "^0.1.0",
32
33
  "svelte-preprocess": "^4.10.6",
33
- "svelte-toc": "^0.2.9",
34
- "svelte2tsx": "^0.5.11",
34
+ "svelte-toc": "^0.2.10",
35
+ "svelte2tsx": "^0.5.13",
35
36
  "tslib": "^2.4.0",
36
37
  "typescript": "^4.7.4",
37
- "vite": "^2.9.13",
38
- "vitest": "^0.18.0"
38
+ "vite": "^3.0.4",
39
+ "vitest": "^0.19.1"
39
40
  },
40
41
  "keywords": [
41
42
  "svelte",
package/readme.md CHANGED
@@ -35,15 +35,17 @@
35
35
 
36
36
  ## Recent breaking changes
37
37
 
38
- - v4.0.1 renamed the `readonly` prop to `disabled` which now prevents all form or user interaction with this component including opening the dropdown list which was still possible before. See [#45](https://github.com/janosh/svelte-multiselect/issues/45) for details. The associated CSS class applied to the outer `div` was likewise renamed to `div.multiselect.{readonly=>disabled}`.
38
+ - v4.0.1 renamed the `readonly` prop to `disabled` which now prevents all form of user interaction with this component including opening the dropdown list which was still possible before. See [#45](https://github.com/janosh/svelte-multiselect/issues/45) for details. The associated CSS class applied to the outer `div` was likewise renamed `div.multiselect.{readonly=>disabled}`.
39
39
 
40
40
  - v4.0.3 CSS variables starting with `--sms-input-<attr>` were renamed to just `--sms-<attr>`. E.g. `--sms-input-min-height` is now `--sms-min-height`.
41
41
 
42
- - v5.0.0 Support both simple and object options. Previously string or number options were converted to objects internally and returned by `bind:selected`. Now, if you pass in `string[]`, that's what you'll get from `bind:selected`.
42
+ - v5.0.0 Support both simple and object options. Previously strings and numbers were converted to `{ value, label }` objects internally and returned by `bind:selected`. Now, if you pass in `string[]`, that's exactly what you'll get from `bind:selected`.
43
43
 
44
44
  ## Installation
45
45
 
46
46
  ```sh
47
+ npm install -D svelte-multiselect
48
+ pnpm install -D svelte-multiselect
47
49
  yarn add -D svelte-multiselect
48
50
  ```
49
51
 
@@ -108,9 +110,11 @@ Full list of props/bindable variables for this component:
108
110
 
109
111
  ## Exposed methods
110
112
 
111
- 1. `filterFunc = (op: Option, searchText: string) => boolean`: Determine what options are shown when user enters search string to filter dropdown list. Defaults to:
113
+ 1. `filterFunc = (op: Option, searchText: string) => boolean`: Customize how dropdown options are filtered when user enters search string into `<MultiSelect />`. Defaults to:
112
114
 
113
115
  ```ts
116
+ import type { Option } from 'svelte-multiselect'
117
+
114
118
  filterFunc = (op: Option, searchText: string) => {
115
119
  if (!searchText) return true
116
120
  return `${op.label}`.toLowerCase().includes(searchText.toLowerCase())