simplesvelte 2.4.1 → 2.4.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.
Files changed (2) hide show
  1. package/dist/Select.svelte +38 -37
  2. package/package.json +1 -1
@@ -474,6 +474,7 @@
474
474
  tabindex="0"
475
475
  class="btn btn-sm btn-circle btn-ghost bg-base-100 absolute top-1 right-1"
476
476
  onclick={(e) => {
477
+ e.preventDefault()
477
478
  e.stopPropagation()
478
479
  clearAll()
479
480
  }}
@@ -495,46 +496,46 @@
495
496
  id={popoverId}
496
497
  popover
497
498
  role="listbox"
498
- class="dropdown menu bg-base-100 rounded-box z-50 mt-2 flex flex-col flex-nowrap gap-1 p-2 shadow outline m-0"
499
+ class="dropdown menu bg-base-100 rounded-box z-50 mt-2 flex flex-col flex-nowrap gap-1 p-2 shadow outline m-0 {!dropdownOpen ? 'pointer-events-none' : ''}"
499
500
  style="position-anchor: {anchorName}; position: absolute; top: anchor(bottom); left: anchor(left); width: anchor-size(width)"
500
501
  ontoggle={handlePopoverToggle}>
501
502
  {#if multiple && filteredItems.length > 1}
502
- <!-- Select All / Clear All options for multi-select -->
503
- <div class="flex gap-2">
504
- <button
505
- type="button"
506
- class="btn btn-sm hover:bg-base-content/10 grow"
507
- onclick={() => {
508
- const allValues = filteredItems.map((item) => item.value)
509
- value = [...allValues]
510
- if (onchange) onchange(value)
511
- }}>
512
- Select All
513
- </button>
514
- <button
515
- type="button"
516
- class="btn btn-sm hover:bg-base-content/10 grow"
517
- onclick={() => {
518
- value = []
519
- if (onchange) onchange(value)
520
- }}>
521
- Clear All
522
- </button>
523
- </div>
524
- {/if}
525
- {#if isLoading}
526
- <li class="m-2 flex items-center justify-center gap-2 text-sm text-gray-500">
527
- <span class="loading loading-spinner loading-sm"></span>
528
- Loading...
529
- </li>
530
- {:else if fetchError}
531
- <li class="m-2 text-center text-sm text-error">{fetchError}</li>
532
- {:else if filteredItems.length === 0}
533
- <li class="m-2 text-center text-sm text-gray-500">No items found</li>
534
- {/if}
503
+ <!-- Select All / Clear All options for multi-select -->
504
+ <div class="flex gap-2">
505
+ <button
506
+ type="button"
507
+ class="btn btn-sm hover:bg-base-content/10 grow"
508
+ onclick={() => {
509
+ const allValues = filteredItems.map((item) => item.value)
510
+ value = [...allValues]
511
+ if (onchange) onchange(value)
512
+ }}>
513
+ Select All
514
+ </button>
515
+ <button
516
+ type="button"
517
+ class="btn btn-sm hover:bg-base-content/10 grow"
518
+ onclick={() => {
519
+ value = []
520
+ if (onchange) onchange(value)
521
+ }}>
522
+ Clear All
523
+ </button>
524
+ </div>
525
+ {/if}
526
+ {#if isLoading}
527
+ <li class="m-2 flex items-center justify-center gap-2 text-sm text-gray-500">
528
+ <span class="loading loading-spinner loading-sm"></span>
529
+ Loading...
530
+ </li>
531
+ {:else if fetchError}
532
+ <li class="m-2 text-center text-sm text-error">{fetchError}</li>
533
+ {:else if filteredItems.length === 0}
534
+ <li class="m-2 text-center text-sm text-gray-500">No items found</li>
535
+ {/if}
535
536
 
536
- {#if flatList.length > 0}
537
- <div class="relative max-h-80 overflow-y-auto pr-2" use:scrollToSelected onscroll={handleScroll}>
537
+ {#if flatList.length > 0}
538
+ <div class="relative max-h-80 overflow-y-auto pr-2" use:scrollToSelected onscroll={handleScroll}>
538
539
  <!-- Virtual spacer for items before visible range -->
539
540
  {#if visibleItems.startIndex > 0}
540
541
  <div style="height: {visibleItems.startIndex * itemHeight}px;"></div>
@@ -562,7 +563,7 @@
562
563
  onclick={(e) => {
563
564
  e.stopPropagation()
564
565
  toggleItemSelection(item.value)
565
- searchEL?.focus()
566
+ if (multiple) searchEL?.focus()
566
567
  }}>
567
568
  {#if multiple}
568
569
  <input
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplesvelte",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "scripts": {
5
5
  "dev": "bun vite dev",
6
6
  "build": "bun vite build && bun run prepack",