import { type SelectControlProps, StyledControlContainer, } from '@/ui/input/components/SelectControl'; import { styled } from '@linaria/react'; import React, { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { IconChevronDown, type IconComponent, OverflowingTextWithTooltip, TintedIconTile, } from 'twenty-ui-deprecated/display'; import { type ThemeColor } from 'twenty-ui-deprecated/theme'; import { ThemeContext, themeCssVariables, } from 'twenty-ui-deprecated/theme-constants'; const StyledIconChevronDownWrapper = styled.div<{ disabled?: boolean; }>` color: ${({ disabled }) => disabled ? themeCssVariables.font.color.extraLight : themeCssVariables.font.color.tertiary}; display: flex; `; type MultiSelectOptionType = { label: string; Icon: IconComponent; iconThemeColor?: ThemeColor | null; }; type MultiSelectControlProps = Omit & { fixedIcon?: IconComponent; fixedText?: string; selectedOptions: MultiSelectOptionType[]; }; export const MultiSelectControl = ({ fixedIcon, fixedText, selectedOptions, isDisabled, selectSizeVariant, textAccent = 'default', hasRightElement, }: MultiSelectControlProps) => { const { theme } = useContext(ThemeContext); const firstSelectedOption = selectedOptions?.[0]; return ( {isDefined(fixedIcon) ? ( React.createElement(fixedIcon, { color: isDisabled ? theme.font.color.light : theme.font.color.primary, size: theme.icon.size.md, stroke: theme.icon.stroke.sm, }) ) : isDefined(firstSelectedOption?.Icon) ? ( isDefined(firstSelectedOption.iconThemeColor) ? ( ) : ( ) ) : null} {isDefined(fixedText) ? ( ) : ( )} ); };