svelte-multiselect 3.2.2 → 3.2.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.
@@ -82,7 +82,7 @@ $: if (
82
82
  // make the first filtered option active
83
83
  activeOption = matchingEnabledOptions[0];
84
84
  function add(label) {
85
- if (selected.length - (maxSelect ?? 0) < 1)
85
+ if (maxSelect && maxSelect > 1 && selected.length >= maxSelect)
86
86
  wiggle = true;
87
87
  if (!readonly &&
88
88
  !selectedLabels.includes(label) &&
@@ -115,9 +115,6 @@ function remove(label) {
115
115
  dispatch(`change`, { option, type: `remove` });
116
116
  }
117
117
  function setOptionsVisible(show) {
118
- // nothing to do if visibility is already as intended
119
- if (readonly || show === showOptions)
120
- return;
121
118
  showOptions = show;
122
119
  if (show)
123
120
  input?.focus();
@@ -209,7 +206,7 @@ display above those of another following shortly after it -->
209
206
  use:onClickOutside={() => setOptionsVisible(false)}
210
207
  use:onClickOutside={() => dispatch(`blur`)}
211
208
  >
212
- <ExpandIcon height="14pt" style="padding: 0 3pt 0 1pt;" />
209
+ <ExpandIcon style="min-width: 1em; padding: 0 1pt;" />
213
210
  <ul class="selected {ulSelectedClass}">
214
211
  {#each selected as option, idx}
215
212
  <li class={liSelectedClass}>
@@ -228,18 +225,20 @@ display above those of another following shortly after it -->
228
225
  {/if}
229
226
  </li>
230
227
  {/each}
228
+ <li style="display: contents;">
229
+ <input
230
+ bind:this={input}
231
+ autocomplete="off"
232
+ bind:value={searchText}
233
+ on:mouseup|self|stopPropagation={() => setOptionsVisible(true)}
234
+ on:keydown={handleKeydown}
235
+ on:focus={() => setOptionsVisible(true)}
236
+ {id}
237
+ {name}
238
+ placeholder={selectedLabels.length ? `` : placeholder}
239
+ />
240
+ </li>
231
241
  </ul>
232
- <input
233
- bind:this={input}
234
- autocomplete="off"
235
- bind:value={searchText}
236
- on:mouseup|self|stopPropagation={() => setOptionsVisible(true)}
237
- on:keydown={handleKeydown}
238
- on:focus={() => setOptionsVisible(true)}
239
- {id}
240
- {name}
241
- placeholder={selectedLabels.length ? `` : placeholder}
242
- />
243
242
  {#if readonly}
244
243
  <ReadOnlyIcon height="14pt" />
245
244
  {:else if selected.length > 0}
@@ -296,14 +295,13 @@ display above those of another following shortly after it -->
296
295
  position: relative;
297
296
  margin: 1em 0;
298
297
  align-items: center;
299
- min-height: 18pt;
300
298
  display: flex;
301
299
  cursor: text;
302
300
  padding: 0 3pt;
303
301
  border: var(--sms-border, 1pt solid lightgray);
304
302
  border-radius: var(--sms-border-radius, 5pt);
305
303
  background: var(--sms-input-bg);
306
- height: var(--sms-input-height, 2em);
304
+ min-height: var(--sms-input-min-height, 22pt);
307
305
  }
308
306
  :where(div.multiselect.open) {
309
307
  z-index: var(--sms-open-z-index, 4);
@@ -317,6 +315,7 @@ display above those of another following shortly after it -->
317
315
 
318
316
  :where(div.multiselect > ul.selected) {
319
317
  display: flex;
318
+ flex: 1;
320
319
  padding: 0;
321
320
  margin: 0;
322
321
  flex-wrap: wrap;
@@ -326,7 +325,8 @@ display above those of another following shortly after it -->
326
325
  border-radius: 4pt;
327
326
  display: flex;
328
327
  margin: 2pt;
329
- padding: 0 0 0 5pt;
328
+ line-height: normal;
329
+ padding: 1pt 2pt 1pt 5pt;
330
330
  transition: 0.3s;
331
331
  white-space: nowrap;
332
332
  background: var(--sms-selected-bg, var(--sms-active-color, cornflowerblue));
@@ -354,7 +354,7 @@ display above those of another following shortly after it -->
354
354
  transform: scale(1.04);
355
355
  }
356
356
 
357
- :where(div.multiselect > input) {
357
+ :where(div.multiselect > ul.selected > li > input) {
358
358
  border: none;
359
359
  outline: none;
360
360
  background: none;
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": "3.2.2",
8
+ "version": "3.2.3",
9
9
  "type": "module",
10
10
  "svelte": "index.js",
11
11
  "bugs": "https://github.com/janosh/svelte-multiselect/issues",
package/readme.md CHANGED
@@ -221,7 +221,7 @@ If you only want to make small adjustments, you can pass the following CSS varia
221
221
  - `border: var(--sms-focus-border, 1pt solid var(--sms-active-color, cornflowerblue))`: Border when component has focus. Defaults to `--sms-active-color` if not set which defaults to `cornflowerblue`.
222
222
  - `div.multiselect.readonly`
223
223
  - `background: var(--sms-readonly-bg, lightgray)`: Background when in readonly state.
224
- - `div.multiselect > input`
224
+ - `div.multiselect > ul.selected > li > input`
225
225
  - `color: var(--sms-text-color, inherit)`: Input text color.
226
226
  - `div.multiselect > ul.selected > li`
227
227
  - `background: var(--sms-selected-bg, var(--sms-active-color, cornflowerblue))`: Background of selected options.
@@ -300,7 +300,7 @@ You can alternatively style every part of this component with more fine-grained
300
300
  :global(div.multiselect > ul.selected > li button, button.remove-all) {
301
301
  /* buttons to remove a single or all selected options at once */
302
302
  }
303
- :global(div.multiselect > input) {
303
+ :global(div.multiselect > ul.selected > li > input) {
304
304
  /* input inside the top-level wrapper div */
305
305
  }
306
306
  :global(div.multiselect > ul.options) {