Support custom min widths for popovers

This commit is contained in:
Andrew Kingston 2024-02-19 16:28:23 +00:00
parent 433c3a6306
commit 602f35537d
3 changed files with 6 additions and 4 deletions

View File

@ -15,6 +15,7 @@ export default function positionDropdown(element, opts) {
align, align,
maxHeight, maxHeight,
maxWidth, maxWidth,
minWidth,
useAnchorWidth, useAnchorWidth,
offset = 5, offset = 5,
customUpdate, customUpdate,
@ -28,7 +29,7 @@ export default function positionDropdown(element, opts) {
const elementBounds = element.getBoundingClientRect() const elementBounds = element.getBoundingClientRect()
let styles = { let styles = {
maxHeight: null, maxHeight: null,
minWidth: null, minWidth,
maxWidth, maxWidth,
left: null, left: null,
top: null, top: null,

View File

@ -12,6 +12,7 @@
export let anchor export let anchor
export let align = "right" export let align = "right"
export let portalTarget export let portalTarget
export let minWidth
export let maxWidth export let maxWidth
export let maxHeight export let maxHeight
export let open = false export let open = false
@ -21,7 +22,6 @@
export let customHeight export let customHeight
export let animate = true export let animate = true
export let customZindex export let customZindex
export let handlePostionUpdate export let handlePostionUpdate
export let showPopover = true export let showPopover = true
export let clickOutsideOverride = false export let clickOutsideOverride = false
@ -86,6 +86,7 @@
align, align,
maxHeight, maxHeight,
maxWidth, maxWidth,
minWidth,
useAnchorWidth, useAnchorWidth,
offset, offset,
customUpdate: handlePostionUpdate, customUpdate: handlePostionUpdate,

View File

@ -124,11 +124,11 @@
align="left-outside" align="left-outside"
bind:this={popover} bind:this={popover}
anchor={popoverAnchor} anchor={popoverAnchor}
maxWidth={600} minWidth={0}
maxWidth={480}
maxHeight={300} maxHeight={300}
dismissible={false} dismissible={false}
on:mouseenter={stopHiding} on:mouseenter={stopHiding}
on:mouseleave={hidePopover}
> >
<div class="helper"> <div class="helper">
<Layout gap="S"> <Layout gap="S">