{"version":3,"file":"EmoticonItem.mjs","names":[],"sources":["../../../../../src/components/TextareaComposer/SuggestionList/EmoticonItem.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport type { ComponentProps } from 'react';\nimport React from 'react';\nimport { EmojiContextMenuButton } from '../../Dialog';\n\nexport type EmoticonItemProps = {\n  entity: {\n    name: string;\n    /** The emoji character. */\n    native: string;\n    /**\n     * Parts of the entity's name (or ID when it has none) split around the user input. Parts that\n     * match get the `str-chat__emoji-item--highlight` class.\n     */\n    tokenizedDisplayName: { token: string; parts: string[] };\n  };\n  focused?: boolean;\n} & ComponentProps<'button'>;\n\nexport const EmoticonItem = (props: EmoticonItemProps) => {\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  const { className, entity, focused: _, ...buttonProps } = props;\n  const hasEntity = Object.keys(entity).length;\n  if (!hasEntity) return null;\n\n  const { parts, token } = entity.tokenizedDisplayName ?? ({} as EmoticonItemProps);\n\n  return (\n    <EmojiContextMenuButton\n      {...buttonProps}\n      className={clsx('str-chat__emoji-item', className)}\n      emoji={entity.native}\n    >\n      {parts?.map((part, i) =>\n        part.toLowerCase() === token ? (\n          <span className='str-chat__emoji-item--highlight' key={`part-${i}`}>\n            {part}\n          </span>\n        ) : (\n          <span className='str-chat__emoji-item--part' key={`part-${i}`}>\n            {part}\n          </span>\n        ),\n      ) ?? null}\n    </EmojiContextMenuButton>\n  );\n};\n"],"mappings":";;;;;AAmBA,IAAa,gBAAgB,UAA6B;CAExD,MAAM,EAAE,WAAW,QAAQ,SAAS,GAAG,GAAG,gBAAgB;CAE1D,IAAI,CADc,OAAO,KAAK,MAAM,CAAC,CAAC,QACtB,OAAO;CAEvB,MAAM,EAAE,OAAO,UAAU,OAAO,wBAAyB,CAAC;CAE1D,OACE,oBAAC,wBAAD;EACE,GAAI;EACJ,WAAW,KAAK,wBAAwB,SAAS;EACjD,OAAO,OAAO;YAEb,OAAO,KAAK,MAAM,MACjB,KAAK,YAAY,MAAM,QACrB,oBAAC,QAAD;GAAM,WAAU;aACb;EACG,GAFiD,QAAQ,GAEzD,IAEN,oBAAC,QAAD;GAAM,WAAU;aACb;EACG,GAF4C,QAAQ,GAEpD,CAEV,KAAK;CACiB,CAAA;AAE5B"}