refac
This commit is contained in:
1 parent
a8e5f0a54d
commit
4bc4630721
2 files changed
+16
-1
No files matched your search
@@ -20,6 +20,9 @@
|
|||||||
/** CSS classes for the dropdown content container */
|
/** CSS classes for the dropdown content container */
|
||||||
export let contentClass = '';
|
export let contentClass = '';
|
||||||
|
|
||||||
|
/** Max height for the dropdown content */
|
||||||
|
export let maxHeight = '18rem';
|
||||||
|
|
||||||
/** Side offset in px */
|
/** Side offset in px */
|
||||||
export let sideOffset = 4;
|
export let sideOffset = 4;
|
||||||
|
|
||||||
@@ -187,6 +190,8 @@
|
|||||||
bind:this={contentEl}
|
bind:this={contentEl}
|
||||||
class={contentClass}
|
class={contentClass}
|
||||||
role="menu"
|
role="menu"
|
||||||
|
style:max-height={maxHeight}
|
||||||
|
style:overflow-y="auto"
|
||||||
transition:flyAndScale
|
transition:flyAndScale
|
||||||
on:click={(e) => e.stopPropagation()}
|
on:click={(e) => e.stopPropagation()}
|
||||||
on:pointerdown={(e) => e.stopPropagation()}
|
on:pointerdown={(e) => e.stopPropagation()}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
export let contentClass =
|
export let contentClass =
|
||||||
'rounded-2xl min-w-[170px] p-1 border border-gray-100 dark:border-gray-800 bg-white dark:bg-gray-850 dark:text-white shadow-lg';
|
'rounded-2xl min-w-[170px] p-1 border border-gray-100 dark:border-gray-800 bg-white dark:bg-gray-850 dark:text-white shadow-lg';
|
||||||
|
|
||||||
|
/** Max height for the dropdown content */
|
||||||
|
export let maxHeight = '18rem';
|
||||||
|
|
||||||
/** CSS classes for each item button */
|
/** CSS classes for each item button */
|
||||||
export let itemClass =
|
export let itemClass =
|
||||||
'flex w-full gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl';
|
'flex w-full gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl';
|
||||||
@@ -123,7 +126,14 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
{#if open}
|
{#if open}
|
||||||
<div use:portal bind:this={contentEl} class={contentClass} transition:flyAndScale>
|
<div
|
||||||
|
use:portal
|
||||||
|
bind:this={contentEl}
|
||||||
|
class={contentClass}
|
||||||
|
style:max-height={maxHeight}
|
||||||
|
style:overflow-y="auto"
|
||||||
|
transition:flyAndScale
|
||||||
|
>
|
||||||
<slot {open} {selectItem}>
|
<slot {open} {selectItem}>
|
||||||
{#each items as item}
|
{#each items as item}
|
||||||
<button class={itemClass} type="button" on:click={() => selectItem(item)}>
|
<button class={itemClass} type="button" on:click={() => selectItem(item)}>
|
||||||
|
|||||||
Reference in new issue
Block a user