Fix form record picker field (#11817)

- enrich response so the record is available in the step output. Today
this is available in the schema but only the id is set
- make the full record picker clickable instead of the arrow only

<img width="467" alt="Capture d’écran 2025-04-30 à 16 08 04"
src="https://github.com/user-attachments/assets/db74b9a6-7f1d-4e54-bf06-9be3d67ee398"
/>
This commit is contained in:
Thomas Trompette
2025-05-05 14:58:11 +02:00
committed by GitHub
parent c9eff401df
commit 6128d660c2
8 changed files with 270 additions and 54 deletions

View File

@ -25,19 +25,24 @@ import { isDefined } from 'twenty-shared/utils';
import { useIsMobile } from 'twenty-ui/utilities';
import { useDropdown } from '../hooks/useDropdown';
type Width = `${string}px` | `${number}%` | 'auto' | number;
const StyledDropdownFallbackAnchor = styled.div`
left: 0;
position: fixed;
top: 0;
`;
const StyledClickableComponent = styled.div`
const StyledClickableComponent = styled.div<{
width?: Width;
}>`
height: fit-content;
width: ${({ width }) => width ?? 'auto'};
`;
export type DropdownProps = {
className?: string;
clickableComponent?: ReactNode;
clickableComponentWidth?: Width;
dropdownComponents: ReactNode;
hotkey?: {
key: Keys;
@ -46,7 +51,7 @@ export type DropdownProps = {
dropdownHotkeyScope: HotkeyScope;
dropdownId: string;
dropdownPlacement?: Placement;
dropdownWidth?: `${string}px` | `${number}%` | 'auto' | number;
dropdownWidth?: Width;
dropdownOffset?: DropdownOffset;
dropdownStrategy?: 'fixed' | 'absolute';
onClickOutside?: () => void;
@ -70,6 +75,7 @@ export const Dropdown = ({
onClose,
onOpen,
avoidPortal,
clickableComponentWidth = 'auto',
}: DropdownProps) => {
const { isDropdownOpen, toggleDropdown } = useDropdown(dropdownId);
@ -159,6 +165,7 @@ export const Dropdown = ({
aria-expanded={isDropdownOpen}
aria-haspopup={true}
role="button"
width={clickableComponentWidth}
>
{clickableComponent}
</StyledClickableComponent>