fixes
This commit is contained in:
@@ -144,6 +144,23 @@ const QuickAddMenu = ({
|
||||
);
|
||||
|
||||
const canCreate = Boolean(onCreate);
|
||||
const isAnchoredMenu = positionStrategy === 'absolute' && align === 'start';
|
||||
const menuClassName = 'menu menu--floating';
|
||||
const anchoredMenuStyle = isAnchoredMenu && menuStyle
|
||||
? {
|
||||
top: menuStyle.top,
|
||||
left: menuStyle.left,
|
||||
...(menuStyle.width ? { width: menuStyle.width } : null),
|
||||
}
|
||||
: undefined;
|
||||
const menuInlineStyle = isAnchoredMenu ? anchoredMenuStyle : menuStyle || undefined;
|
||||
const hasFloatingWidthVar = Boolean(menuInlineStyle && Object.prototype.hasOwnProperty.call(menuInlineStyle, '--floating-min-width'));
|
||||
const menuStyleWithVar = hasFloatingWidthVar
|
||||
? menuInlineStyle
|
||||
: {
|
||||
...(menuInlineStyle || {}),
|
||||
'--floating-min-width': `${Math.max(menuMinWidth, 0)}px`,
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={className ? `quick-add ${className}` : 'quick-add'}>
|
||||
@@ -162,10 +179,11 @@ const QuickAddMenu = ({
|
||||
</button>
|
||||
{isOpen ? (
|
||||
<div
|
||||
className="menu menu--floating quick-add__menu"
|
||||
className={menuClassName}
|
||||
ref={menuRef}
|
||||
style={menuStyle || undefined}
|
||||
style={menuStyleWithVar}
|
||||
role="menu"
|
||||
data-floating-position
|
||||
>
|
||||
{canCreate ? (
|
||||
<form className="quick-add__form" onSubmit={handleCreate}>
|
||||
@@ -183,7 +201,7 @@ const QuickAddMenu = ({
|
||||
</button>
|
||||
</form>
|
||||
) : null}
|
||||
<div className="menu__list quick-add__list" role="presentation">
|
||||
<div className="menu__list" role="presentation">
|
||||
{filteredOptions.length ? (
|
||||
filteredOptions.map((option) => {
|
||||
const key = option.id ?? option.index;
|
||||
|
||||
Reference in New Issue
Block a user