mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-23 12:02:10 +03:00
fix: empty composite field input (#8451)
Fixes: #7225 --------- Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
parent
24c0b0f873
commit
96c8673278
@ -19,9 +19,8 @@ import { toSpliced } from '~/utils/array/toSpliced';
|
||||
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
|
||||
|
||||
const StyledDropdownMenu = styled(DropdownMenu)`
|
||||
margin-left: -1px;
|
||||
margin: -1px;
|
||||
position: relative;
|
||||
margin-top: -1px;
|
||||
`;
|
||||
|
||||
type MultiItemFieldInputProps<T> = {
|
||||
@ -65,8 +64,12 @@ export const MultiItemFieldInput = <T,>({
|
||||
};
|
||||
|
||||
const handleDropdownCloseOutside = (event: MouseEvent | TouchEvent) => {
|
||||
onCancel?.();
|
||||
event.stopImmediatePropagation();
|
||||
if (inputValue?.trim().length > 0) {
|
||||
handleSubmitInput();
|
||||
} else {
|
||||
onCancel?.();
|
||||
}
|
||||
};
|
||||
|
||||
useListenClickOutside({
|
||||
@ -202,10 +205,12 @@ export const MultiItemFieldInput = <T,>({
|
||||
}
|
||||
onEnter={handleSubmitInput}
|
||||
rightComponent={
|
||||
items.length ? (
|
||||
<LightIconButton
|
||||
Icon={isAddingNewItem ? IconPlus : IconCheck}
|
||||
onClick={handleSubmitInput}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
|
@ -36,6 +36,10 @@ const StyledInputContainer = styled.div`
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
&:not(:first-of-type) {
|
||||
padding: ${({ theme }) => theme.spacing(1)};
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledRightContainer = styled.div`
|
||||
|
Loading…
Reference in New Issue
Block a user