simplesvelte 2.4.3 → 2.4.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/dist/Select.svelte +18 -10
- package/package.json +1 -1
package/dist/Select.svelte
CHANGED
|
@@ -354,12 +354,25 @@
|
|
|
354
354
|
|
|
355
355
|
function openDropdown() {
|
|
356
356
|
if (!popoverEl) return
|
|
357
|
-
|
|
357
|
+
try {
|
|
358
|
+
if (!popoverEl.matches(':popover-open')) {
|
|
359
|
+
popoverEl.showPopover()
|
|
360
|
+
}
|
|
361
|
+
} catch {
|
|
362
|
+
// Ignore errors if popover is in an invalid state
|
|
363
|
+
}
|
|
358
364
|
}
|
|
359
365
|
|
|
360
366
|
function closeDropdown() {
|
|
361
367
|
if (!popoverEl) return
|
|
362
|
-
|
|
368
|
+
try {
|
|
369
|
+
// Check if open before hiding
|
|
370
|
+
if (popoverEl.matches(':popover-open')) {
|
|
371
|
+
popoverEl.hidePopover()
|
|
372
|
+
}
|
|
373
|
+
} catch {
|
|
374
|
+
// Ignore errors if popover is in an invalid state
|
|
375
|
+
}
|
|
363
376
|
}
|
|
364
377
|
|
|
365
378
|
// Handle popover toggle event to sync state
|
|
@@ -444,10 +457,7 @@
|
|
|
444
457
|
class="h-full min-w-[120px] flex-1 outline-0 {dropdownOpen ? 'cursor-text' : 'cursor-pointer'}"
|
|
445
458
|
bind:this={searchEL}
|
|
446
459
|
bind:value={filterInput}
|
|
447
|
-
onclick={(
|
|
448
|
-
e.stopPropagation()
|
|
449
|
-
openDropdown()
|
|
450
|
-
}}
|
|
460
|
+
onclick={() => openDropdown()}
|
|
451
461
|
placeholder="Search..."
|
|
452
462
|
required={required && (!Array.isArray(normalizedValue) || normalizedValue.length === 0)} />
|
|
453
463
|
</div>
|
|
@@ -459,9 +469,7 @@
|
|
|
459
469
|
bind:this={searchEL}
|
|
460
470
|
value={filter}
|
|
461
471
|
oninput={(e) => (filterInput = e.currentTarget.value)}
|
|
462
|
-
onclick={(
|
|
463
|
-
e.stopPropagation()
|
|
464
|
-
// Clear filter when opening dropdown so all options are visible
|
|
472
|
+
onclick={() => {
|
|
465
473
|
filterInput = ''
|
|
466
474
|
openDropdown()
|
|
467
475
|
}}
|
|
@@ -497,7 +505,7 @@
|
|
|
497
505
|
popover
|
|
498
506
|
role="listbox"
|
|
499
507
|
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' : ''}"
|
|
500
|
-
style="position-anchor: {anchorName}; position:
|
|
508
|
+
style="position-anchor: {anchorName}; position: fixed; top: anchor(bottom); left: anchor(left); width: anchor-size(width)"
|
|
501
509
|
ontoggle={handlePopoverToggle}>
|
|
502
510
|
{#if multiple && filteredItems.length > 1}
|
|
503
511
|
<!-- Select All / Clear All options for multi-select -->
|