/** * Placement of the `` dropdown, kept apart from the component so it can be * tested against arbitrary viewports. */ /** * @import { EmojiAnchorRect } from '../../typedefs'; */ /** * Width of the dropdown, also enforced in the component’s stylesheet. */ export const LIST_WIDTH: 280; /** * Gap between the dropdown and the caret, and the minimum margin to the viewport edges. */ export const LIST_OFFSET: 4; export const VIEWPORT_MARGIN: 8; export function getSuggestionListPosition({ anchorRect, listMaxHeight, viewport, rtl }: { anchorRect: EmojiAnchorRect; listMaxHeight: number; viewport: { width: number; height: number; }; rtl: boolean; }): SuggestionListPosition; export type SuggestionListPosition = { /** * CSS `top`, when the list hangs below the caret. */ top: string | undefined; /** * CSS `bottom`, when the list is flipped above the caret. */ bottom: string | undefined; /** * CSS `left`. */ left: string; /** * CSS `max-height`. */ maxHeight: string; }; import type { EmojiAnchorRect } from '../../typedefs';