@chayns-components/emoji-input 5.0.0-beta.132 → 5.0.0-beta.1320

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/README.md +4 -15
  2. package/lib/{api → cjs/api}/item-storage/get.js +4 -5
  3. package/lib/cjs/api/item-storage/get.js.map +1 -0
  4. package/lib/{api → cjs/api}/item-storage/put.js +5 -6
  5. package/lib/cjs/api/item-storage/put.js.map +1 -0
  6. package/lib/cjs/components/emoji-input/EmojiInput.js +561 -0
  7. package/lib/cjs/components/emoji-input/EmojiInput.js.map +1 -0
  8. package/lib/cjs/components/emoji-input/EmojiInput.styles.js +131 -0
  9. package/lib/cjs/components/emoji-input/EmojiInput.styles.js.map +1 -0
  10. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js +44 -0
  11. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
  12. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js +64 -0
  13. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
  14. package/lib/cjs/components/emoji-picker/EmojiPicker.js +47 -0
  15. package/lib/cjs/components/emoji-picker/EmojiPicker.js.map +1 -0
  16. package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.styles.js +3 -5
  17. package/lib/cjs/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
  18. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +99 -0
  19. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
  20. package/lib/{components → cjs/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +4 -6
  21. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
  22. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +260 -0
  23. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
  24. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +66 -0
  25. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
  26. package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +63 -34
  27. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
  28. package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +6 -3
  29. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
  30. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +130 -0
  31. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
  32. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
  33. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
  34. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js +51 -0
  35. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
  36. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js +15 -0
  37. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
  38. package/lib/{constants → cjs/constants}/alignment.js +2 -4
  39. package/lib/cjs/constants/alignment.js.map +1 -0
  40. package/lib/{constants → cjs/constants}/categories.js +1 -2
  41. package/lib/cjs/constants/categories.js.map +1 -0
  42. package/lib/cjs/constants/emoji.js +126 -0
  43. package/lib/cjs/constants/emoji.js.map +1 -0
  44. package/lib/cjs/constants/externalServerUrl.js +8 -0
  45. package/lib/cjs/constants/externalServerUrl.js.map +1 -0
  46. package/lib/cjs/constants/regex.js +15 -0
  47. package/lib/cjs/constants/regex.js.map +1 -0
  48. package/lib/cjs/hooks/cursor.js +110 -0
  49. package/lib/cjs/hooks/cursor.js.map +1 -0
  50. package/lib/{hooks → cjs/hooks}/emojiHistory.js +13 -15
  51. package/lib/cjs/hooks/emojiHistory.js.map +1 -0
  52. package/lib/{index.js → cjs/index.js} +28 -3
  53. package/lib/cjs/index.js.map +1 -0
  54. package/lib/cjs/types/api.js.map +1 -0
  55. package/lib/cjs/types/category.js.map +1 -0
  56. package/lib/cjs/utils/asyncEmojiData.js +10 -0
  57. package/lib/cjs/utils/asyncEmojiData.js.map +1 -0
  58. package/lib/cjs/utils/convertEmojisToUnicodeAsync.js +29 -0
  59. package/lib/cjs/utils/convertEmojisToUnicodeAsync.js.map +1 -0
  60. package/lib/{utils → cjs/utils}/emoji.js +17 -13
  61. package/lib/cjs/utils/emoji.js.map +1 -0
  62. package/lib/{constants/emoji.js → cjs/utils/emojiShortList.js} +4 -127
  63. package/lib/cjs/utils/emojiShortList.js.map +1 -0
  64. package/lib/cjs/utils/environment.js.map +1 -0
  65. package/lib/cjs/utils/font.js.map +1 -0
  66. package/lib/{utils → cjs/utils}/insert.js +47 -9
  67. package/lib/cjs/utils/insert.js.map +1 -0
  68. package/lib/cjs/utils/number.js +17 -0
  69. package/lib/cjs/utils/number.js.map +1 -0
  70. package/lib/cjs/utils/scroll.js +65 -0
  71. package/lib/cjs/utils/scroll.js.map +1 -0
  72. package/lib/cjs/utils/selection.js +351 -0
  73. package/lib/cjs/utils/selection.js.map +1 -0
  74. package/lib/cjs/utils/text.js +63 -0
  75. package/lib/cjs/utils/text.js.map +1 -0
  76. package/lib/esm/api/item-storage/get.js +29 -0
  77. package/lib/esm/api/item-storage/get.js.map +1 -0
  78. package/lib/esm/api/item-storage/put.js +34 -0
  79. package/lib/esm/api/item-storage/put.js.map +1 -0
  80. package/lib/esm/components/emoji-input/EmojiInput.js +542 -0
  81. package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -0
  82. package/lib/esm/components/emoji-input/EmojiInput.styles.js +124 -0
  83. package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -0
  84. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js +37 -0
  85. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
  86. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js +57 -0
  87. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
  88. package/lib/esm/components/emoji-picker/EmojiPicker.js +39 -0
  89. package/lib/esm/components/emoji-picker/EmojiPicker.js.map +1 -0
  90. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js +16 -0
  91. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
  92. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +91 -0
  93. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
  94. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +18 -0
  95. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
  96. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +251 -0
  97. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
  98. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +59 -0
  99. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
  100. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +137 -0
  101. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
  102. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +17 -0
  103. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
  104. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +120 -0
  105. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
  106. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +91 -0
  107. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
  108. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js +42 -0
  109. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
  110. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js +8 -0
  111. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
  112. package/lib/esm/constants/alignment.js +13 -0
  113. package/lib/esm/constants/alignment.js.map +1 -0
  114. package/lib/esm/constants/categories.js +13 -0
  115. package/lib/esm/constants/categories.js.map +1 -0
  116. package/lib/esm/constants/emoji-de-DE.json +3827 -0
  117. package/lib/esm/constants/emoji.js +120 -0
  118. package/lib/esm/constants/emoji.js.map +1 -0
  119. package/lib/esm/constants/externalServerUrl.js +2 -0
  120. package/lib/esm/constants/externalServerUrl.js.map +1 -0
  121. package/lib/esm/constants/regex.js +9 -0
  122. package/lib/esm/constants/regex.js.map +1 -0
  123. package/lib/esm/hooks/cursor.js +103 -0
  124. package/lib/esm/hooks/cursor.js.map +1 -0
  125. package/lib/esm/hooks/emojiHistory.js +81 -0
  126. package/lib/esm/hooks/emojiHistory.js.map +1 -0
  127. package/lib/{index.d.ts → esm/index.js} +3 -1
  128. package/lib/esm/index.js.map +1 -0
  129. package/lib/esm/types/api.js +2 -0
  130. package/lib/esm/types/api.js.map +1 -0
  131. package/lib/esm/types/category.js +2 -0
  132. package/lib/esm/types/category.js.map +1 -0
  133. package/lib/esm/utils/asyncEmojiData.js +2 -0
  134. package/lib/esm/utils/asyncEmojiData.js.map +1 -0
  135. package/lib/esm/utils/convertEmojisToUnicodeAsync.js +20 -0
  136. package/lib/esm/utils/convertEmojisToUnicodeAsync.js.map +1 -0
  137. package/lib/esm/utils/emoji.js +90 -0
  138. package/lib/esm/utils/emoji.js.map +1 -0
  139. package/lib/esm/utils/emojiShortList.js +3679 -0
  140. package/lib/esm/utils/emojiShortList.js.map +1 -0
  141. package/lib/esm/utils/environment.js +24 -0
  142. package/lib/esm/utils/environment.js.map +1 -0
  143. package/lib/esm/utils/font.js +10 -0
  144. package/lib/esm/utils/font.js.map +1 -0
  145. package/lib/esm/utils/insert.js +104 -0
  146. package/lib/esm/utils/insert.js.map +1 -0
  147. package/lib/esm/utils/number.js +10 -0
  148. package/lib/esm/utils/number.js.map +1 -0
  149. package/lib/esm/utils/scroll.js +58 -0
  150. package/lib/esm/utils/scroll.js.map +1 -0
  151. package/lib/esm/utils/selection.js +324 -0
  152. package/lib/esm/utils/selection.js.map +1 -0
  153. package/lib/esm/utils/text.js +54 -0
  154. package/lib/esm/utils/text.js.map +1 -0
  155. package/lib/types/components/emoji-input/EmojiInput.d.ts +101 -0
  156. package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +26 -0
  157. package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
  158. package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
  159. package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
  160. package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +4 -0
  161. package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +9 -0
  162. package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +10 -0
  163. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
  164. package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +5 -0
  165. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +20 -0
  166. package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +0 -13
  167. package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
  168. package/lib/types/constants/emoji.d.ts +4 -0
  169. package/lib/types/constants/regex.d.ts +8 -0
  170. package/lib/types/hooks/cursor.d.ts +11 -0
  171. package/lib/types/index.d.ts +7 -0
  172. package/lib/types/utils/asyncEmojiData.d.ts +1 -0
  173. package/lib/types/utils/convertEmojisToUnicodeAsync.d.ts +3 -0
  174. package/lib/types/utils/emoji.d.ts +10 -0
  175. package/lib/{constants/emoji.d.ts → types/utils/emojiShortList.d.ts} +0 -4
  176. package/lib/{utils → types/utils}/insert.d.ts +10 -1
  177. package/lib/types/utils/number.d.ts +1 -0
  178. package/lib/types/utils/scroll.d.ts +1 -0
  179. package/lib/types/utils/selection.d.ts +30 -0
  180. package/lib/types/utils/text.d.ts +5 -0
  181. package/package.json +50 -31
  182. package/lib/api/item-storage/get.js.map +0 -1
  183. package/lib/api/item-storage/put.js.map +0 -1
  184. package/lib/components/emoji-input/EmojiInput.d.ts +0 -55
  185. package/lib/components/emoji-input/EmojiInput.js +0 -163
  186. package/lib/components/emoji-input/EmojiInput.js.map +0 -1
  187. package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -13
  188. package/lib/components/emoji-input/EmojiInput.styles.js +0 -154
  189. package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
  190. package/lib/components/emoji-picker/EmojiPicker.js +0 -51
  191. package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
  192. package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
  193. package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
  194. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -51
  195. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
  196. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
  197. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
  198. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -131
  199. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
  200. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -7
  201. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -99
  202. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
  203. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +0 -1
  204. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +0 -1
  205. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +0 -1
  206. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +0 -74
  207. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +0 -1
  208. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +0 -11
  209. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +0 -104
  210. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +0 -1
  211. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -150
  212. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
  213. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
  214. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -97
  215. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
  216. package/lib/constants/alignment.js.map +0 -1
  217. package/lib/constants/categories.js.map +0 -1
  218. package/lib/constants/emoji.js.map +0 -1
  219. package/lib/constants/externalServerUrl.js +0 -9
  220. package/lib/constants/externalServerUrl.js.map +0 -1
  221. package/lib/constants/regex.d.ts +0 -2
  222. package/lib/constants/regex.js +0 -11
  223. package/lib/constants/regex.js.map +0 -1
  224. package/lib/hooks/emojiHistory.js.map +0 -1
  225. package/lib/index.js.map +0 -1
  226. package/lib/types/api.js.map +0 -1
  227. package/lib/types/category.js.map +0 -1
  228. package/lib/utils/emoji.d.ts +0 -3
  229. package/lib/utils/emoji.js.map +0 -1
  230. package/lib/utils/environment.js.map +0 -1
  231. package/lib/utils/font.js.map +0 -1
  232. package/lib/utils/insert.js.map +0 -1
  233. package/lib/utils/selection.d.ts +0 -8
  234. package/lib/utils/selection.js +0 -98
  235. package/lib/utils/selection.js.map +0 -1
  236. package/lib/utils/text.d.ts +0 -2
  237. package/lib/utils/text.js +0 -22
  238. package/lib/utils/text.js.map +0 -1
  239. /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
  240. /package/lib/{types → cjs/types}/api.js +0 -0
  241. /package/lib/{types → cjs/types}/category.js +0 -0
  242. /package/lib/{utils → cjs/utils}/environment.js +0 -0
  243. /package/lib/{utils → cjs/utils}/font.js +0 -0
  244. /package/lib/{api → types/api}/item-storage/get.d.ts +0 -0
  245. /package/lib/{api → types/api}/item-storage/put.d.ts +0 -0
  246. /package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +0 -0
  247. /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
  248. /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +0 -0
  249. /package/lib/{constants → types/constants}/alignment.d.ts +0 -0
  250. /package/lib/{constants → types/constants}/categories.d.ts +0 -0
  251. /package/lib/{constants → types/constants}/externalServerUrl.d.ts +0 -0
  252. /package/lib/{hooks → types/hooks}/emojiHistory.d.ts +0 -0
  253. /package/lib/types/{api.d.ts → types/api.d.ts} +0 -0
  254. /package/lib/types/{category.d.ts → types/category.d.ts} +0 -0
  255. /package/lib/{utils → types/utils}/environment.d.ts +0 -0
  256. /package/lib/{utils → types/utils}/font.d.ts +0 -0
@@ -0,0 +1,542 @@
1
+ import { AreaContext, getIsTouch } from '@chayns-components/core';
2
+ import { getDevice } from 'chayns-api';
3
+ import { AnimatePresence } from 'motion/react';
4
+ import React, { forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
5
+ import { convertEmojisToUnicode, escapeHTML } from '../../utils/emoji';
6
+ import { insertTextAtCursorPosition, replaceText } from '../../utils/insert';
7
+ import { getCharCodeThatWillBeDeleted, insertInvisibleCursorMarker, restoreSelection, saveSelection, insertPseudoMarker, insertCursorAtMarker } from '../../utils/selection';
8
+ import { convertHTMLToText, convertTextToHTML } from '../../utils/text';
9
+ import EmojiPickerPopup from '../emoji-picker-popup/EmojiPickerPopup';
10
+ import { StyledEmojiInput, StyledEmojiInputContent, StyledEmojiInputLabel, StyledEmojiInputRightWrapper, StyledMotionEmojiInputEditor, StyledMotionEmojiInputProgress } from './EmojiInput.styles';
11
+ import PrefixElement from './prefix-element/PrefixElement';
12
+ import { loadEmojiShortList } from '../../utils/asyncEmojiData';
13
+ import { scrollCursorIntoView } from '../../utils/scroll';
14
+ import { useCursorPosition } from '../../hooks/cursor';
15
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
16
+ const EmojiInput = /*#__PURE__*/forwardRef(({
17
+ accessToken,
18
+ height,
19
+ inputId,
20
+ isDisabled,
21
+ maxHeight = '190px',
22
+ onBlur,
23
+ onFocus,
24
+ onInput,
25
+ onKeyDown,
26
+ onPrefixElementRemove,
27
+ onPopupVisibilityChange,
28
+ personId,
29
+ placeholder,
30
+ popupAlignment,
31
+ prefixElement,
32
+ rightElement,
33
+ shouldHidePlaceholderOnFocus = false,
34
+ shouldPreventEmojiPicker,
35
+ value,
36
+ onCursorPositionChange
37
+ }, ref) => {
38
+ const [isTouch] = useState(getIsTouch());
39
+ const [plainTextValue, setPlainTextValue] = useState(value);
40
+ const [hasFocus, setHasFocus] = useState(false);
41
+ const [progressDuration, setProgressDuration] = useState(0);
42
+ const [labelWidth, setLabelWidth] = useState(0);
43
+ const [isPopupVisible, setIsPopupVisible] = useState(false);
44
+ const [isPrefixAnimationFinished, setIsPrefixAnimationFinished] = useState(!prefixElement);
45
+ const [prefixElementWidth, setPrefixElementWidth] = useState();
46
+ const [emojiShortNames, setEmojiShortNames] = useState({});
47
+ const [emojiRegShortNames, setEmojiRegShortNames] = useState(/./);
48
+ const areaProvider = useContext(AreaContext);
49
+ const editorRef = useRef(null);
50
+ const prefixElementRef = useRef(null);
51
+ const hasPrefixRendered = useRef(false);
52
+ const hasPrefixChanged = useRef(false);
53
+ const shouldDeleteOneMoreBackwards = useRef(false);
54
+ const shouldDeleteOneMoreForwards = useRef(false);
55
+ const valueRef = useRef(value);
56
+ useCursorPosition(editorRef, onCursorPositionChange, {
57
+ isDisabled
58
+ });
59
+ const {
60
+ browser
61
+ } = getDevice();
62
+ const shouldChangeColor = useMemo(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]);
63
+ useEffect(() => {
64
+ void loadEmojiShortList().then(({
65
+ shortNameList,
66
+ regShortnames
67
+ }) => {
68
+ setEmojiShortNames(shortNameList);
69
+ setEmojiRegShortNames(regShortnames);
70
+ });
71
+ }, []);
72
+
73
+ /**
74
+ * This function updates the content of the 'contentEditable' element if the new text is
75
+ * different from the previous content. So this is only true if, for example, a text like ":-)"
76
+ * has been replaced to the corresponding emoji.
77
+ *
78
+ * When updating the HTML, the current cursor position is saved before replacing the content, so
79
+ * that it can be set again afterward.
80
+ */
81
+ const handleUpdateHTML = useCallback(html => {
82
+ if (!editorRef.current) {
83
+ return;
84
+ }
85
+ let newInnerHTML = convertEmojisToUnicode(html, emojiRegShortNames, emojiShortNames);
86
+ newInnerHTML = convertTextToHTML(newInnerHTML);
87
+ if (newInnerHTML !== editorRef.current.innerHTML) {
88
+ saveSelection(editorRef.current, {
89
+ shouldIgnoreEmptyTextNodes: true
90
+ });
91
+ editorRef.current.innerHTML = newInnerHTML;
92
+ restoreSelection(editorRef.current);
93
+ }
94
+ }, [emojiRegShortNames, emojiShortNames]);
95
+ const handleBeforeInput = useCallback(event => {
96
+ if (!editorRef.current) {
97
+ return;
98
+ }
99
+ if (isDisabled) {
100
+ event.preventDefault();
101
+ event.stopPropagation();
102
+ return;
103
+ }
104
+ const {
105
+ data,
106
+ type
107
+ } = event.nativeEvent;
108
+ if (type === 'textInput' && data && data.includes('\n')) {
109
+ event.preventDefault();
110
+ event.stopPropagation();
111
+ const text = convertEmojisToUnicode(data, emojiRegShortNames, emojiShortNames);
112
+ insertTextAtCursorPosition({
113
+ editorElement: editorRef.current,
114
+ text
115
+ });
116
+ const newEvent = new Event('input', {
117
+ bubbles: true
118
+ });
119
+ editorRef.current.dispatchEvent(newEvent);
120
+ }
121
+ }, [emojiRegShortNames, emojiShortNames, isDisabled]);
122
+
123
+ /**
124
+ * This function handles the 'input' events of the 'contentEditable' element and also passes the
125
+ * respective event up accordingly if the 'onInput' property is a function.
126
+ */
127
+ const handleInput = useCallback(event => {
128
+ if (!editorRef.current) {
129
+ return;
130
+ }
131
+ if (isDisabled) {
132
+ event.stopPropagation();
133
+ event.preventDefault();
134
+ }
135
+ if (shouldDeleteOneMoreBackwards.current) {
136
+ shouldDeleteOneMoreBackwards.current = false;
137
+ shouldDeleteOneMoreForwards.current = false;
138
+ event.preventDefault();
139
+ event.stopPropagation();
140
+
141
+ // Remove content and set cursor to the right position
142
+ insertInvisibleCursorMarker();
143
+ return;
144
+ }
145
+ if (shouldDeleteOneMoreForwards.current) {
146
+ shouldDeleteOneMoreBackwards.current = false;
147
+ shouldDeleteOneMoreForwards.current = false;
148
+ event.preventDefault();
149
+ event.stopPropagation();
150
+
151
+ // noinspection JSDeprecatedSymbols
152
+ document.execCommand('forwardDelete', false);
153
+ return;
154
+ }
155
+ handleUpdateHTML(editorRef.current.innerHTML);
156
+ const text = convertHTMLToText(editorRef.current.innerHTML);
157
+ setPlainTextValue(text);
158
+ if (typeof onInput === 'function') {
159
+ onInput(event, text);
160
+ }
161
+ insertCursorAtMarker(editorRef);
162
+ }, [handleUpdateHTML, isDisabled, onInput]);
163
+ const handleKeyDown = useCallback(event => {
164
+ if (isDisabled) {
165
+ event.preventDefault();
166
+ event.stopPropagation();
167
+ return;
168
+ }
169
+ if (event.key === 'Enter' && isPopupVisible) {
170
+ event.preventDefault();
171
+ return;
172
+ }
173
+ if (typeof onKeyDown === 'function') {
174
+ onKeyDown(event);
175
+ }
176
+ if (event.key === 'Enter' && !event.isPropagationStopped() && editorRef.current) {
177
+ event.preventDefault();
178
+
179
+ // noinspection JSDeprecatedSymbols
180
+ document.execCommand('insertLineBreak', false);
181
+ }
182
+ if (event.key === 'Enter') {
183
+ requestAnimationFrame(() => {
184
+ if (editorRef.current) scrollCursorIntoView(editorRef.current);
185
+ });
186
+ }
187
+ if (event.key === 'Backspace' || event.key === 'Delete' || event.key === 'Unidentified') {
188
+ const charCodeThatWillBeDeleted = getCharCodeThatWillBeDeleted(event);
189
+ if (charCodeThatWillBeDeleted === 8203) {
190
+ if (event.key === 'Backspace' || event.key === 'Unidentified') {
191
+ shouldDeleteOneMoreBackwards.current = true;
192
+ } else {
193
+ shouldDeleteOneMoreForwards.current = true;
194
+ }
195
+ }
196
+ }
197
+ }, [isDisabled, isPopupVisible, onKeyDown]);
198
+ const handlePopupVisibility = useCallback(isVisible => {
199
+ setIsPopupVisible(isVisible);
200
+ if (editorRef.current && isVisible) {
201
+ saveSelection(editorRef.current);
202
+ }
203
+ if (typeof onPopupVisibilityChange === 'function') {
204
+ onPopupVisibilityChange(isVisible);
205
+ }
206
+ }, [onPopupVisibilityChange]);
207
+
208
+ /**
209
+ * This function prevents formatting from being adopted when texts are inserted. To do this, the
210
+ * plain text is read from the event after the default behavior has been prevented. The plain
211
+ * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
212
+ */
213
+ const handlePaste = useCallback(event => {
214
+ if (editorRef.current) {
215
+ event.preventDefault();
216
+ if (isDisabled) {
217
+ event.stopPropagation();
218
+ return;
219
+ }
220
+
221
+ // This ensures, that only the copied text is inserted and not its HTML formatting.
222
+ let text = event.clipboardData.getData('text/plain');
223
+ text = convertEmojisToUnicode(text, emojiRegShortNames, emojiShortNames);
224
+
225
+ /* This ensures, that valid HTML in the inserted text is not interpreted as such. e.g. if the user
226
+ pasted the text '<b>test</b>' (not as formatted html), the <b> tags need to be escaped, to
227
+ prevent it from being interpreted as html. */
228
+ text = escapeHTML(text);
229
+
230
+ // Insert an invisible control character at the end of the text to place the cursor in the correct position after insertion.
231
+ if (text.includes('\n')) {
232
+ text += '\u200C';
233
+ }
234
+
235
+ // This deprecated function is used, because it causes the inserted content to be added to the undo stack.
236
+ // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.
237
+ // In that case on CTRL+Z the inserted text would not be removed.
238
+ document.execCommand('insertHTML', false, text);
239
+ const newEvent = new Event('input', {
240
+ bubbles: true
241
+ });
242
+ editorRef.current.dispatchEvent(newEvent);
243
+ }
244
+ }, [emojiRegShortNames, emojiShortNames, isDisabled]);
245
+
246
+ /**
247
+ * This function prevents formatting from being adopted when texts are dropped. To do this, the
248
+ * plain text is read from the event after the default behavior has been prevented. The plain
249
+ * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
250
+ */
251
+ const handleDrop = useCallback(event => {
252
+ if (editorRef.current) {
253
+ event.preventDefault();
254
+ if (isDisabled) {
255
+ event.stopPropagation();
256
+ return;
257
+ }
258
+
259
+ // This ensures, that only the dropped text is inserted and not its HTML formatting.
260
+ let text = event.dataTransfer?.getData('text');
261
+ if (!text) {
262
+ return;
263
+ }
264
+ text = convertEmojisToUnicode(text, emojiRegShortNames, emojiShortNames);
265
+
266
+ /* This ensures, that valid HTML in the inserted text is not interpreted as such. e.g. if the user
267
+ drops the text '<b>test</b>' (not as formatted html), the <b> tags need to be escaped, to
268
+ prevent it from being interpreted as html. */
269
+ text = escapeHTML(text);
270
+
271
+ // This deprecated function is used, because it causes the inserted content to be added to the undo stack.
272
+ // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.
273
+ // In that case on CTRL+Z the inserted text would not be removed.
274
+ document.execCommand('insertHTML', false, text);
275
+ const newEvent = new Event('input', {
276
+ bubbles: true
277
+ });
278
+ editorRef.current.dispatchEvent(newEvent);
279
+ }
280
+ }, [emojiRegShortNames, emojiShortNames, isDisabled]);
281
+
282
+ /**
283
+ * This function uses the 'insertTextAtCursorPosition' function to insert the emoji at the
284
+ * correct position in the editor element.
285
+ *
286
+ * At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,
287
+ * which in turn executes the 'onInput' function from the props. So this serves to ensure that
288
+ * the event is also passed through to the top when inserting via the popup.
289
+ */
290
+ const handlePopupSelect = useCallback(emoji => {
291
+ if (editorRef.current) {
292
+ insertTextAtCursorPosition({
293
+ editorElement: editorRef.current,
294
+ text: emoji,
295
+ shouldUseSavedSelection: true
296
+ });
297
+ const event = new Event('input', {
298
+ bubbles: true
299
+ });
300
+ editorRef.current.dispatchEvent(event);
301
+ }
302
+ }, []);
303
+ useEffect(() => {
304
+ if (typeof onPrefixElementRemove !== 'function') {
305
+ return;
306
+ }
307
+ if (!hasPrefixRendered.current) {
308
+ return;
309
+ }
310
+ const convertedText = convertHTMLToText(editorRef.current?.innerHTML ?? '').replace('&nbsp;', ' ');
311
+ const convertedPrefix = prefixElement && prefixElement.replace('&nbsp;', ' ');
312
+ if (convertedPrefix && convertedText.includes(convertedPrefix) && convertedText.length > convertedPrefix.length || convertedPrefix === convertedText) {
313
+ return;
314
+ }
315
+ if (hasPrefixChanged.current) {
316
+ hasPrefixChanged.current = false;
317
+ return;
318
+ }
319
+ onPrefixElementRemove();
320
+ hasPrefixRendered.current = false;
321
+ }, [onPrefixElementRemove, plainTextValue.length, prefixElement]);
322
+ useEffect(() => {
323
+ if (typeof prefixElement === 'string') {
324
+ hasPrefixChanged.current = true;
325
+ }
326
+ }, [prefixElement]);
327
+ useEffect(() => {
328
+ if (value !== plainTextValue) {
329
+ setPlainTextValue(value);
330
+ handleUpdateHTML(value);
331
+ }
332
+ }, [handleUpdateHTML, plainTextValue, value]);
333
+
334
+ // This effect is used to call the 'handleUpdateHTML' function once after the component has been
335
+ // rendered. This is necessary because the 'contentEditable' element otherwise does not display
336
+ // the HTML content correctly when the component is rendered for the first time.
337
+ useIsomorphicLayoutEffect(() => {
338
+ handleUpdateHTML(valueRef.current);
339
+ }, [handleUpdateHTML]);
340
+ const handleInsertTextAtCursorPosition = useCallback(text => {
341
+ if (editorRef.current) {
342
+ insertTextAtCursorPosition({
343
+ editorElement: editorRef.current,
344
+ text
345
+ });
346
+ const newEvent = new Event('input', {
347
+ bubbles: true
348
+ });
349
+ editorRef.current.dispatchEvent(newEvent);
350
+ }
351
+ }, []);
352
+ const handleReplaceText = useCallback((searchText, pasteText, options) => {
353
+ if (editorRef.current) {
354
+ replaceText({
355
+ editorElement: editorRef.current,
356
+ searchText,
357
+ pasteText,
358
+ options
359
+ });
360
+ insertPseudoMarker();
361
+ const newEvent = new Event('input', {
362
+ bubbles: true
363
+ });
364
+ editorRef.current.dispatchEvent(newEvent);
365
+ }
366
+ }, []);
367
+ const handleStartProgress = useCallback(duration => {
368
+ setProgressDuration(duration);
369
+ }, []);
370
+ const handleStopProgress = useCallback(() => {
371
+ setProgressDuration(0);
372
+ }, []);
373
+ useImperativeHandle(ref, () => ({
374
+ insertTextAtCursorPosition: handleInsertTextAtCursorPosition,
375
+ replaceText: handleReplaceText,
376
+ startProgress: handleStartProgress,
377
+ stopProgress: handleStopProgress,
378
+ focus: () => editorRef.current?.focus(),
379
+ blur: () => editorRef.current?.blur()
380
+ }), [handleInsertTextAtCursorPosition, handleReplaceText, handleStartProgress, handleStopProgress]);
381
+ useEffect(() => {
382
+ /**
383
+ * This function ensures that the input field does not lose focus when the popup is opened
384
+ * or an emoji is selected in it. For this purpose the corresponding elements get the class
385
+ * 'prevent-lose-focus'.
386
+ *
387
+ * The class can also be set to any other elements that should also not cause the input
388
+ * field to lose focus.
389
+ */
390
+ const handlePreventLoseFocus = event => {
391
+ const element = event.target;
392
+ if (element.classList.contains('prevent-lose-focus') || element.parentElement?.classList.contains('prevent-lose-focus') || element.parentElement?.parentElement?.classList.contains('prevent-lose-focus')) {
393
+ event.preventDefault();
394
+ event.stopPropagation();
395
+ }
396
+ };
397
+ document.body.addEventListener('mousedown', handlePreventLoseFocus);
398
+ return () => {
399
+ document.body.removeEventListener('mousedown', handlePreventLoseFocus);
400
+ };
401
+ }, []);
402
+ const shouldShowPlaceholder = useMemo(() => {
403
+ if (!isPrefixAnimationFinished) {
404
+ return false;
405
+ }
406
+ const isJustPrefixElement = prefixElement && convertTextToHTML(prefixElement) === editorRef.current?.innerHTML;
407
+ const shouldRenderPlaceholder = prefixElement && !plainTextValue || (prefixElement ? prefixElementWidth && prefixElementWidth > 0 : true);
408
+ switch (true) {
409
+ case (!plainTextValue || isJustPrefixElement) && shouldHidePlaceholderOnFocus && !hasFocus:
410
+ case (!plainTextValue || isJustPrefixElement) && !shouldHidePlaceholderOnFocus:
411
+ return shouldRenderPlaceholder;
412
+ case (!plainTextValue || isJustPrefixElement) && shouldHidePlaceholderOnFocus && hasFocus:
413
+ return false;
414
+ default:
415
+ return false;
416
+ }
417
+ }, [isPrefixAnimationFinished, hasFocus, plainTextValue, prefixElement, shouldHidePlaceholderOnFocus, prefixElementWidth]);
418
+ useEffect(() => {
419
+ if (prefixElement) {
420
+ setIsPrefixAnimationFinished(false);
421
+ }
422
+ }, [prefixElement]);
423
+ const handleFocus = event => {
424
+ if (typeof onFocus === 'function' && !isDisabled) {
425
+ onFocus(event);
426
+ }
427
+ setHasFocus(true);
428
+ };
429
+ const handleBlur = event => {
430
+ if (typeof onBlur === 'function' && !isDisabled) {
431
+ onBlur(event);
432
+ }
433
+ setHasFocus(false);
434
+ };
435
+ useEffect(() => {
436
+ if (editorRef.current && prefixElement) {
437
+ const text = convertEmojisToUnicode(prefixElement, emojiRegShortNames, emojiShortNames);
438
+ insertTextAtCursorPosition({
439
+ editorElement: editorRef.current,
440
+ text
441
+ });
442
+ handleUpdateHTML(prefixElement);
443
+ hasPrefixRendered.current = true;
444
+ }
445
+ }, [emojiRegShortNames, emojiShortNames, handleUpdateHTML, prefixElement]);
446
+ useEffect(() => {
447
+ if (prefixElementRef.current && prefixElement && convertTextToHTML(prefixElement) === editorRef.current?.innerHTML) {
448
+ setPrefixElementWidth(prefixElementRef.current.offsetWidth + 2);
449
+ } else {
450
+ setPrefixElementWidth(undefined);
451
+ }
452
+ }, [plainTextValue, prefixElement]);
453
+ useEffect(() => {
454
+ const handleResize = () => {
455
+ if (editorRef.current) {
456
+ setLabelWidth(editorRef.current.offsetWidth);
457
+ }
458
+ };
459
+ const resizeObserver = new ResizeObserver(handleResize);
460
+ if (editorRef.current) {
461
+ resizeObserver.observe(editorRef.current);
462
+ }
463
+ return () => {
464
+ resizeObserver.disconnect();
465
+ };
466
+ }, []);
467
+ useEffect(() => {
468
+ const blurElement = () => {
469
+ if (editorRef.current && document.activeElement === editorRef.current && isDisabled) {
470
+ editorRef.current.blur();
471
+ }
472
+ };
473
+ document.addEventListener('focus', blurElement, true);
474
+ return () => {
475
+ document.removeEventListener('focus', blurElement, true);
476
+ };
477
+ }, [isDisabled]);
478
+ return /*#__PURE__*/React.createElement(StyledEmojiInput, {
479
+ $isDisabled: isDisabled,
480
+ $shouldChangeColor: shouldChangeColor
481
+ }, /*#__PURE__*/React.createElement(AnimatePresence, {
482
+ initial: true
483
+ }, progressDuration > 0 && /*#__PURE__*/React.createElement(StyledMotionEmojiInputProgress, {
484
+ animate: {
485
+ width: '100%'
486
+ },
487
+ exit: {
488
+ opacity: 0
489
+ },
490
+ initial: {
491
+ opacity: 1,
492
+ width: '0%'
493
+ },
494
+ transition: {
495
+ width: {
496
+ ease: 'linear',
497
+ duration: progressDuration
498
+ },
499
+ opacity: {
500
+ type: 'tween',
501
+ duration: 0.3
502
+ }
503
+ }
504
+ })), /*#__PURE__*/React.createElement(StyledEmojiInputContent, null, prefixElement && /*#__PURE__*/React.createElement(PrefixElement, {
505
+ key: prefixElement,
506
+ element: prefixElement,
507
+ prefixElementRef: prefixElementRef,
508
+ setIsPrefixAnimationFinished: setIsPrefixAnimationFinished
509
+ }), /*#__PURE__*/React.createElement(StyledMotionEmojiInputEditor, {
510
+ $browser: browser?.name,
511
+ animate: {
512
+ maxHeight: height ?? maxHeight,
513
+ minHeight: height ?? '26px'
514
+ },
515
+ contentEditable: true,
516
+ id: inputId,
517
+ onBeforeInput: handleBeforeInput,
518
+ onBlur: handleBlur,
519
+ onFocus: handleFocus,
520
+ onInput: handleInput,
521
+ onKeyDown: handleKeyDown,
522
+ onPaste: handlePaste,
523
+ onDrop: handleDrop,
524
+ ref: editorRef,
525
+ $shouldShowContent: isPrefixAnimationFinished,
526
+ transition: {
527
+ type: 'tween',
528
+ duration: 0.2
529
+ }
530
+ }), shouldShowPlaceholder && /*#__PURE__*/React.createElement(StyledEmojiInputLabel, {
531
+ $maxWidth: labelWidth,
532
+ $offsetWidth: prefixElementWidth
533
+ }, placeholder), !isTouch && !shouldPreventEmojiPicker && /*#__PURE__*/React.createElement(EmojiPickerPopup, {
534
+ accessToken: accessToken,
535
+ onSelect: handlePopupSelect,
536
+ onPopupVisibilityChange: handlePopupVisibility,
537
+ personId: personId
538
+ })), rightElement && /*#__PURE__*/React.createElement(StyledEmojiInputRightWrapper, null, rightElement));
539
+ });
540
+ EmojiInput.displayName = 'EmojiInput';
541
+ export default EmojiInput;
542
+ //# sourceMappingURL=EmojiInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmojiInput.js","names":["AreaContext","getIsTouch","getDevice","AnimatePresence","React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","convertEmojisToUnicode","escapeHTML","insertTextAtCursorPosition","replaceText","getCharCodeThatWillBeDeleted","insertInvisibleCursorMarker","restoreSelection","saveSelection","insertPseudoMarker","insertCursorAtMarker","convertHTMLToText","convertTextToHTML","EmojiPickerPopup","StyledEmojiInput","StyledEmojiInputContent","StyledEmojiInputLabel","StyledEmojiInputRightWrapper","StyledMotionEmojiInputEditor","StyledMotionEmojiInputProgress","PrefixElement","loadEmojiShortList","scrollCursorIntoView","useCursorPosition","useIsomorphicLayoutEffect","window","EmojiInput","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPrefixElementRemove","onPopupVisibilityChange","personId","placeholder","popupAlignment","prefixElement","rightElement","shouldHidePlaceholderOnFocus","shouldPreventEmojiPicker","value","onCursorPositionChange","ref","isTouch","plainTextValue","setPlainTextValue","hasFocus","setHasFocus","progressDuration","setProgressDuration","labelWidth","setLabelWidth","isPopupVisible","setIsPopupVisible","isPrefixAnimationFinished","setIsPrefixAnimationFinished","prefixElementWidth","setPrefixElementWidth","emojiShortNames","setEmojiShortNames","emojiRegShortNames","setEmojiRegShortNames","areaProvider","editorRef","prefixElementRef","hasPrefixRendered","hasPrefixChanged","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","browser","shouldChangeColor","then","shortNameList","regShortnames","handleUpdateHTML","html","current","newInnerHTML","innerHTML","shouldIgnoreEmptyTextNodes","handleBeforeInput","event","preventDefault","stopPropagation","data","type","nativeEvent","includes","text","editorElement","newEvent","Event","bubbles","dispatchEvent","handleInput","document","execCommand","handleKeyDown","key","isPropagationStopped","requestAnimationFrame","charCodeThatWillBeDeleted","handlePopupVisibility","isVisible","handlePaste","clipboardData","getData","handleDrop","dataTransfer","handlePopupSelect","emoji","shouldUseSavedSelection","convertedText","replace","convertedPrefix","length","handleInsertTextAtCursorPosition","handleReplaceText","searchText","pasteText","options","handleStartProgress","duration","handleStopProgress","startProgress","stopProgress","focus","blur","handlePreventLoseFocus","element","target","classList","contains","parentElement","body","addEventListener","removeEventListener","shouldShowPlaceholder","isJustPrefixElement","shouldRenderPlaceholder","handleFocus","handleBlur","offsetWidth","undefined","handleResize","resizeObserver","ResizeObserver","observe","disconnect","blurElement","activeElement","createElement","$isDisabled","$shouldChangeColor","initial","animate","width","exit","opacity","transition","ease","$browser","name","minHeight","contentEditable","id","onBeforeInput","onPaste","onDrop","$shouldShowContent","$maxWidth","$offsetWidth","onSelect","displayName"],"sources":["../../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import { AreaContext, BrowserName, getIsTouch } from '@chayns-components/core';\nimport { getDevice } from 'chayns-api';\nimport { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEvent,\n ClipboardEvent,\n CSSProperties,\n FocusEvent,\n FocusEventHandler,\n forwardRef,\n KeyboardEvent as TmpKeyboardEvent,\n KeyboardEventHandler,\n ReactElement,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n} from 'react';\nimport type { PopupAlignment } from '../../constants/alignment';\nimport { convertEmojisToUnicode, escapeHTML } from '../../utils/emoji';\nimport { insertTextAtCursorPosition, replaceText } from '../../utils/insert';\nimport {\n getCharCodeThatWillBeDeleted,\n insertInvisibleCursorMarker,\n restoreSelection,\n saveSelection,\n type ReplaceTextOptions,\n insertPseudoMarker,\n insertCursorAtMarker,\n} from '../../utils/selection';\nimport { convertHTMLToText, convertTextToHTML } from '../../utils/text';\nimport EmojiPickerPopup from '../emoji-picker-popup/EmojiPickerPopup';\nimport {\n StyledEmojiInput,\n StyledEmojiInputContent,\n StyledEmojiInputLabel,\n StyledEmojiInputRightWrapper,\n StyledMotionEmojiInputEditor,\n StyledMotionEmojiInputProgress,\n} from './EmojiInput.styles';\nimport PrefixElement from './prefix-element/PrefixElement';\nimport { loadEmojiShortList } from '../../utils/asyncEmojiData';\nimport { scrollCursorIntoView } from '../../utils/scroll';\nimport { useCursorPosition } from '../../hooks/cursor';\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nexport type EmojiInputProps = {\n /**\n * Access token of the logged-in user. Is needed to load and save the history of the emojis.\n */\n accessToken?: string;\n /**\n * Sets the height of the input field to a fixed value. If this value is not set, the component will use the needed height until the maximum height is reached.\n */\n height?: CSSProperties['height'];\n /**\n * HTML id of the input element\n */\n inputId?: string;\n /**\n * Disables the input so that it cannot be changed anymore\n */\n isDisabled?: boolean;\n /**\n * Sets the maximum height of the input field.\n */\n maxHeight?: CSSProperties['maxHeight'];\n /**\n * Function that is executed when the input field loses focus.\n */\n onBlur?: FocusEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the cursor position is changed.\n */\n onCursorPositionChange?: (position: number) => void;\n /**\n * Function that is executed when the input field gets the focus.\n */\n onFocus?: FocusEventHandler<HTMLDivElement>;\n /**\n * Function that is executed when the text of the input changes. In addition to the original\n * event, the original text is returned as second parameter, in which the internally used HTML\n * elements have been converted back to BB codes.\n */\n onInput?: (event: ChangeEvent<HTMLDivElement>, originalText: string) => void;\n /**\n * Function that is executed when a key is pressed down.\n */\n onKeyDown?: KeyboardEventHandler<HTMLDivElement>;\n /**\n * Function to be executed if the prefixElement is removed.\n */\n onPrefixElementRemove?: () => void;\n /**\n * Function that is executed when the visibility of the popup changes.\n * @param {boolean} isVisible - Whether the popup is visible or not\n */\n onPopupVisibilityChange?: (isVisible: boolean) => void;\n /**\n * Person id of the logged-in user. Is needed to load and save the history of the emojis.\n */\n personId?: string;\n /**\n * Placeholder for the input field\n */\n placeholder?: string | ReactElement;\n /**\n * Sets the alignment of the popup to a fixed value. If this value is not set, the component\n * calculates the best position on its own. Use the imported 'PopupAlignment' enum to set this\n * value.\n */\n popupAlignment?: PopupAlignment;\n /**\n * Element that is rendered before the input field but the placeholder is still visible.\n */\n prefixElement?: string;\n /**\n * Element that is rendered inside the EmojiInput on the right side.\n */\n rightElement?: ReactNode;\n /**\n * Whether the placeholder should be shown after the input has focus.\n */\n shouldHidePlaceholderOnFocus?: boolean;\n /**\n * Prevents the EmojiPickerPopup icon from being displayed\n */\n shouldPreventEmojiPicker?: boolean;\n /**\n * The plain text value of the input field. Instead of HTML elements BB codes must be used at\n * this point. These are then converted by the input field into corresponding HTML elements.\n */\n value: string;\n};\n\nexport interface EmojiInputRef {\n insertTextAtCursorPosition: (text: string) => void;\n replaceText: (searchText: string, replaceText: string, options?: ReplaceTextOptions) => void;\n startProgress: (durationInSeconds: number) => void;\n stopProgress: () => void;\n focus: () => void;\n blur: () => void;\n}\n\nconst EmojiInput = forwardRef<EmojiInputRef, EmojiInputProps>(\n (\n {\n accessToken,\n height,\n inputId,\n isDisabled,\n maxHeight = '190px',\n onBlur,\n onFocus,\n onInput,\n onKeyDown,\n onPrefixElementRemove,\n onPopupVisibilityChange,\n personId,\n placeholder,\n popupAlignment,\n prefixElement,\n rightElement,\n shouldHidePlaceholderOnFocus = false,\n shouldPreventEmojiPicker,\n value,\n onCursorPositionChange,\n },\n ref,\n ) => {\n const [isTouch] = useState(getIsTouch());\n const [plainTextValue, setPlainTextValue] = useState(value);\n const [hasFocus, setHasFocus] = useState(false);\n const [progressDuration, setProgressDuration] = useState(0);\n const [labelWidth, setLabelWidth] = useState(0);\n const [isPopupVisible, setIsPopupVisible] = useState(false);\n const [isPrefixAnimationFinished, setIsPrefixAnimationFinished] = useState(!prefixElement);\n const [prefixElementWidth, setPrefixElementWidth] = useState<number | undefined>();\n const [emojiShortNames, setEmojiShortNames] = useState<{ [p: string]: string }>({});\n const [emojiRegShortNames, setEmojiRegShortNames] = useState<RegExp>(/./);\n\n const areaProvider = useContext(AreaContext);\n\n const editorRef = useRef<HTMLDivElement>(null);\n const prefixElementRef = useRef<HTMLDivElement>(null);\n const hasPrefixRendered = useRef(false);\n const hasPrefixChanged = useRef(false);\n const shouldDeleteOneMoreBackwards = useRef(false);\n const shouldDeleteOneMoreForwards = useRef(false);\n\n const valueRef = useRef(value);\n\n useCursorPosition(editorRef, onCursorPositionChange, { isDisabled });\n\n const { browser } = getDevice();\n\n const shouldChangeColor = useMemo(\n () => areaProvider.shouldChangeColor ?? false,\n [areaProvider.shouldChangeColor],\n );\n\n useEffect(() => {\n void loadEmojiShortList().then(({ shortNameList, regShortnames }) => {\n setEmojiShortNames(shortNameList);\n setEmojiRegShortNames(regShortnames);\n });\n }, []);\n\n /**\n * This function updates the content of the 'contentEditable' element if the new text is\n * different from the previous content. So this is only true if, for example, a text like \":-)\"\n * has been replaced to the corresponding emoji.\n *\n * When updating the HTML, the current cursor position is saved before replacing the content, so\n * that it can be set again afterward.\n */\n const handleUpdateHTML = useCallback(\n (html: string) => {\n if (!editorRef.current) {\n return;\n }\n\n let newInnerHTML = convertEmojisToUnicode(\n html,\n emojiRegShortNames,\n emojiShortNames,\n );\n\n newInnerHTML = convertTextToHTML(newInnerHTML);\n\n if (newInnerHTML !== editorRef.current.innerHTML) {\n saveSelection(editorRef.current, { shouldIgnoreEmptyTextNodes: true });\n\n editorRef.current.innerHTML = newInnerHTML;\n\n restoreSelection(editorRef.current);\n }\n },\n [emojiRegShortNames, emojiShortNames],\n );\n\n const handleBeforeInput = useCallback(\n (event: FormEvent<HTMLDivElement>) => {\n if (!editorRef.current) {\n return;\n }\n\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n\n return;\n }\n\n const { data, type } = event.nativeEvent as InputEvent;\n\n if (type === 'textInput' && data && data.includes('\\n')) {\n event.preventDefault();\n event.stopPropagation();\n\n const text = convertEmojisToUnicode(data, emojiRegShortNames, emojiShortNames);\n\n insertTextAtCursorPosition({ editorElement: editorRef.current, text });\n\n const newEvent = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(newEvent);\n }\n },\n [emojiRegShortNames, emojiShortNames, isDisabled],\n );\n\n /**\n * This function handles the 'input' events of the 'contentEditable' element and also passes the\n * respective event up accordingly if the 'onInput' property is a function.\n */\n const handleInput = useCallback(\n (event: ChangeEvent<HTMLDivElement>) => {\n if (!editorRef.current) {\n return;\n }\n\n if (isDisabled) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n if (shouldDeleteOneMoreBackwards.current) {\n shouldDeleteOneMoreBackwards.current = false;\n shouldDeleteOneMoreForwards.current = false;\n\n event.preventDefault();\n event.stopPropagation();\n\n // Remove content and set cursor to the right position\n insertInvisibleCursorMarker();\n\n return;\n }\n\n if (shouldDeleteOneMoreForwards.current) {\n shouldDeleteOneMoreBackwards.current = false;\n shouldDeleteOneMoreForwards.current = false;\n\n event.preventDefault();\n event.stopPropagation();\n\n // noinspection JSDeprecatedSymbols\n document.execCommand('forwardDelete', false);\n\n return;\n }\n\n handleUpdateHTML(editorRef.current.innerHTML);\n\n const text = convertHTMLToText(editorRef.current.innerHTML);\n\n setPlainTextValue(text);\n\n if (typeof onInput === 'function') {\n onInput(event, text);\n }\n\n insertCursorAtMarker(editorRef);\n },\n [handleUpdateHTML, isDisabled, onInput],\n );\n\n const handleKeyDown = useCallback(\n (event: TmpKeyboardEvent<HTMLDivElement>) => {\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n\n return;\n }\n\n if (event.key === 'Enter' && isPopupVisible) {\n event.preventDefault();\n\n return;\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n\n if (event.key === 'Enter' && !event.isPropagationStopped() && editorRef.current) {\n event.preventDefault();\n\n // noinspection JSDeprecatedSymbols\n document.execCommand('insertLineBreak', false);\n }\n\n if (event.key === 'Enter') {\n requestAnimationFrame(() => {\n if (editorRef.current) scrollCursorIntoView(editorRef.current);\n });\n }\n\n if (\n event.key === 'Backspace' ||\n event.key === 'Delete' ||\n event.key === 'Unidentified'\n ) {\n const charCodeThatWillBeDeleted = getCharCodeThatWillBeDeleted(event);\n\n if (charCodeThatWillBeDeleted === 8203) {\n if (event.key === 'Backspace' || event.key === 'Unidentified') {\n shouldDeleteOneMoreBackwards.current = true;\n } else {\n shouldDeleteOneMoreForwards.current = true;\n }\n }\n }\n },\n [isDisabled, isPopupVisible, onKeyDown],\n );\n\n const handlePopupVisibility = useCallback(\n (isVisible: boolean) => {\n setIsPopupVisible(isVisible);\n\n if (editorRef.current && isVisible) {\n saveSelection(editorRef.current);\n }\n\n if (typeof onPopupVisibilityChange === 'function') {\n onPopupVisibilityChange(isVisible);\n }\n },\n [onPopupVisibilityChange],\n );\n\n /**\n * This function prevents formatting from being adopted when texts are inserted. To do this, the\n * plain text is read from the event after the default behavior has been prevented. The plain\n * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')\n */\n const handlePaste = useCallback(\n (event: ClipboardEvent<HTMLDivElement>) => {\n if (editorRef.current) {\n event.preventDefault();\n\n if (isDisabled) {\n event.stopPropagation();\n\n return;\n }\n\n // This ensures, that only the copied text is inserted and not its HTML formatting.\n let text = event.clipboardData.getData('text/plain');\n\n text = convertEmojisToUnicode(text, emojiRegShortNames, emojiShortNames);\n\n /* This ensures, that valid HTML in the inserted text is not interpreted as such. e.g. if the user\n pasted the text '<b>test</b>' (not as formatted html), the <b> tags need to be escaped, to\n prevent it from being interpreted as html. */\n text = escapeHTML(text);\n\n // Insert an invisible control character at the end of the text to place the cursor in the correct position after insertion.\n if (text.includes('\\n')) {\n text += '\\u200C';\n }\n\n // This deprecated function is used, because it causes the inserted content to be added to the undo stack.\n // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.\n // In that case on CTRL+Z the inserted text would not be removed.\n document.execCommand('insertHTML', false, text);\n\n const newEvent = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(newEvent);\n }\n },\n [emojiRegShortNames, emojiShortNames, isDisabled],\n );\n\n /**\n * This function prevents formatting from being adopted when texts are dropped. To do this, the\n * plain text is read from the event after the default behavior has been prevented. The plain\n * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')\n */\n const handleDrop = useCallback(\n (event: React.DragEvent<HTMLDivElement>) => {\n if (editorRef.current) {\n event.preventDefault();\n\n if (isDisabled) {\n event.stopPropagation();\n\n return;\n }\n\n // This ensures, that only the dropped text is inserted and not its HTML formatting.\n let text = event.dataTransfer?.getData('text');\n\n if (!text) {\n return;\n }\n\n text = convertEmojisToUnicode(text, emojiRegShortNames, emojiShortNames);\n\n /* This ensures, that valid HTML in the inserted text is not interpreted as such. e.g. if the user\n drops the text '<b>test</b>' (not as formatted html), the <b> tags need to be escaped, to\n prevent it from being interpreted as html. */\n text = escapeHTML(text);\n\n // This deprecated function is used, because it causes the inserted content to be added to the undo stack.\n // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.\n // In that case on CTRL+Z the inserted text would not be removed.\n document.execCommand('insertHTML', false, text);\n\n const newEvent = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(newEvent);\n }\n },\n [emojiRegShortNames, emojiShortNames, isDisabled],\n );\n\n /**\n * This function uses the 'insertTextAtCursorPosition' function to insert the emoji at the\n * correct position in the editor element.\n *\n * At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,\n * which in turn executes the 'onInput' function from the props. So this serves to ensure that\n * the event is also passed through to the top when inserting via the popup.\n */\n const handlePopupSelect = useCallback((emoji: string) => {\n if (editorRef.current) {\n insertTextAtCursorPosition({\n editorElement: editorRef.current,\n text: emoji,\n shouldUseSavedSelection: true,\n });\n\n const event = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(event);\n }\n }, []);\n\n useEffect(() => {\n if (typeof onPrefixElementRemove !== 'function') {\n return;\n }\n\n if (!hasPrefixRendered.current) {\n return;\n }\n\n const convertedText = convertHTMLToText(editorRef.current?.innerHTML ?? '').replace(\n '&nbsp;',\n ' ',\n );\n const convertedPrefix = prefixElement && prefixElement.replace('&nbsp;', ' ');\n\n if (\n (convertedPrefix &&\n convertedText.includes(convertedPrefix) &&\n convertedText.length > convertedPrefix.length) ||\n convertedPrefix === convertedText\n ) {\n return;\n }\n\n if (hasPrefixChanged.current) {\n hasPrefixChanged.current = false;\n\n return;\n }\n\n onPrefixElementRemove();\n hasPrefixRendered.current = false;\n }, [onPrefixElementRemove, plainTextValue.length, prefixElement]);\n\n useEffect(() => {\n if (typeof prefixElement === 'string') {\n hasPrefixChanged.current = true;\n }\n }, [prefixElement]);\n\n useEffect(() => {\n if (value !== plainTextValue) {\n setPlainTextValue(value);\n\n handleUpdateHTML(value);\n }\n }, [handleUpdateHTML, plainTextValue, value]);\n\n // This effect is used to call the 'handleUpdateHTML' function once after the component has been\n // rendered. This is necessary because the 'contentEditable' element otherwise does not display\n // the HTML content correctly when the component is rendered for the first time.\n useIsomorphicLayoutEffect(() => {\n handleUpdateHTML(valueRef.current);\n }, [handleUpdateHTML]);\n\n const handleInsertTextAtCursorPosition = useCallback((text: string) => {\n if (editorRef.current) {\n insertTextAtCursorPosition({ editorElement: editorRef.current, text });\n\n const newEvent = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(newEvent);\n }\n }, []);\n\n const handleReplaceText = useCallback(\n (searchText: string, pasteText: string, options?: ReplaceTextOptions) => {\n if (editorRef.current) {\n replaceText({\n editorElement: editorRef.current,\n searchText,\n pasteText,\n options,\n });\n\n insertPseudoMarker();\n\n const newEvent = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(newEvent);\n }\n },\n [],\n );\n\n const handleStartProgress = useCallback((duration: number) => {\n setProgressDuration(duration);\n }, []);\n\n const handleStopProgress = useCallback(() => {\n setProgressDuration(0);\n }, []);\n\n useImperativeHandle(\n ref,\n () => ({\n insertTextAtCursorPosition: handleInsertTextAtCursorPosition,\n replaceText: handleReplaceText,\n startProgress: handleStartProgress,\n stopProgress: handleStopProgress,\n focus: () => editorRef.current?.focus(),\n blur: () => editorRef.current?.blur(),\n }),\n [\n handleInsertTextAtCursorPosition,\n handleReplaceText,\n handleStartProgress,\n handleStopProgress,\n ],\n );\n\n useEffect(() => {\n /**\n * This function ensures that the input field does not lose focus when the popup is opened\n * or an emoji is selected in it. For this purpose the corresponding elements get the class\n * 'prevent-lose-focus'.\n *\n * The class can also be set to any other elements that should also not cause the input\n * field to lose focus.\n */\n const handlePreventLoseFocus = (event: MouseEvent) => {\n const element = event.target as Element;\n\n if (\n element.classList.contains('prevent-lose-focus') ||\n element.parentElement?.classList.contains('prevent-lose-focus') ||\n element.parentElement?.parentElement?.classList.contains('prevent-lose-focus')\n ) {\n event.preventDefault();\n event.stopPropagation();\n }\n };\n\n document.body.addEventListener('mousedown', handlePreventLoseFocus);\n\n return () => {\n document.body.removeEventListener('mousedown', handlePreventLoseFocus);\n };\n }, []);\n\n const shouldShowPlaceholder = useMemo(() => {\n if (!isPrefixAnimationFinished) {\n return false;\n }\n\n const isJustPrefixElement =\n prefixElement && convertTextToHTML(prefixElement) === editorRef.current?.innerHTML;\n\n const shouldRenderPlaceholder =\n (prefixElement && !plainTextValue) ||\n (prefixElement ? prefixElementWidth && prefixElementWidth > 0 : true);\n\n switch (true) {\n case (!plainTextValue || isJustPrefixElement) &&\n shouldHidePlaceholderOnFocus &&\n !hasFocus:\n case (!plainTextValue || isJustPrefixElement) && !shouldHidePlaceholderOnFocus:\n return shouldRenderPlaceholder;\n case (!plainTextValue || isJustPrefixElement) &&\n shouldHidePlaceholderOnFocus &&\n hasFocus:\n return false;\n default:\n return false;\n }\n }, [\n isPrefixAnimationFinished,\n hasFocus,\n plainTextValue,\n prefixElement,\n shouldHidePlaceholderOnFocus,\n prefixElementWidth,\n ]);\n\n useEffect(() => {\n if (prefixElement) {\n setIsPrefixAnimationFinished(false);\n }\n }, [prefixElement]);\n\n const handleFocus = (event: FocusEvent<HTMLDivElement>) => {\n if (typeof onFocus === 'function' && !isDisabled) {\n onFocus(event);\n }\n\n setHasFocus(true);\n };\n\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (typeof onBlur === 'function' && !isDisabled) {\n onBlur(event);\n }\n\n setHasFocus(false);\n };\n\n useEffect(() => {\n if (editorRef.current && prefixElement) {\n const text = convertEmojisToUnicode(\n prefixElement,\n emojiRegShortNames,\n emojiShortNames,\n );\n\n insertTextAtCursorPosition({ editorElement: editorRef.current, text });\n\n handleUpdateHTML(prefixElement);\n hasPrefixRendered.current = true;\n }\n }, [emojiRegShortNames, emojiShortNames, handleUpdateHTML, prefixElement]);\n\n useEffect(() => {\n if (\n prefixElementRef.current &&\n prefixElement &&\n convertTextToHTML(prefixElement) === editorRef.current?.innerHTML\n ) {\n setPrefixElementWidth(prefixElementRef.current.offsetWidth + 2);\n } else {\n setPrefixElementWidth(undefined);\n }\n }, [plainTextValue, prefixElement]);\n\n useEffect(() => {\n const handleResize = () => {\n if (editorRef.current) {\n setLabelWidth(editorRef.current.offsetWidth);\n }\n };\n\n const resizeObserver = new ResizeObserver(handleResize);\n\n if (editorRef.current) {\n resizeObserver.observe(editorRef.current);\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, []);\n\n useEffect(() => {\n const blurElement = () => {\n if (\n editorRef.current &&\n document.activeElement === editorRef.current &&\n isDisabled\n ) {\n editorRef.current.blur();\n }\n };\n\n document.addEventListener('focus', blurElement, true);\n\n return () => {\n document.removeEventListener('focus', blurElement, true);\n };\n }, [isDisabled]);\n\n return (\n <StyledEmojiInput $isDisabled={isDisabled} $shouldChangeColor={shouldChangeColor}>\n <AnimatePresence initial>\n {progressDuration > 0 && (\n <StyledMotionEmojiInputProgress\n animate={{ width: '100%' }}\n exit={{ opacity: 0 }}\n initial={{ opacity: 1, width: '0%' }}\n transition={{\n width: {\n ease: 'linear',\n duration: progressDuration,\n },\n opacity: {\n type: 'tween',\n duration: 0.3,\n },\n }}\n />\n )}\n </AnimatePresence>\n <StyledEmojiInputContent>\n {prefixElement && (\n <PrefixElement\n key={prefixElement}\n element={prefixElement}\n prefixElementRef={prefixElementRef}\n setIsPrefixAnimationFinished={setIsPrefixAnimationFinished}\n />\n )}\n <StyledMotionEmojiInputEditor\n $browser={browser?.name as BrowserName}\n animate={{ maxHeight: height ?? maxHeight, minHeight: height ?? '26px' }}\n contentEditable\n id={inputId}\n onBeforeInput={handleBeforeInput}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onInput={handleInput}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n onDrop={handleDrop}\n ref={editorRef}\n $shouldShowContent={isPrefixAnimationFinished}\n transition={{ type: 'tween', duration: 0.2 }}\n />\n\n {shouldShowPlaceholder && (\n <StyledEmojiInputLabel\n $maxWidth={labelWidth}\n $offsetWidth={prefixElementWidth}\n >\n {placeholder}\n </StyledEmojiInputLabel>\n )}\n {!isTouch && !shouldPreventEmojiPicker && (\n <EmojiPickerPopup\n accessToken={accessToken}\n onSelect={handlePopupSelect}\n onPopupVisibilityChange={handlePopupVisibility}\n personId={personId}\n />\n )}\n </StyledEmojiInputContent>\n {rightElement && (\n <StyledEmojiInputRightWrapper>{rightElement}</StyledEmojiInputRightWrapper>\n )}\n </StyledEmojiInput>\n );\n },\n);\n\nEmojiInput.displayName = 'EmojiInput';\n\nexport default EmojiInput;\n"],"mappings":"AAAA,SAASA,WAAW,EAAeC,UAAU,QAAQ,yBAAyB;AAC9E,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAMRC,UAAU,EAKVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEL,OAAO;AAEd,SAASC,sBAAsB,EAAEC,UAAU,QAAQ,mBAAmB;AACtE,SAASC,0BAA0B,EAAEC,WAAW,QAAQ,oBAAoB;AAC5E,SACIC,4BAA4B,EAC5BC,2BAA2B,EAC3BC,gBAAgB,EAChBC,aAAa,EAEbC,kBAAkB,EAClBC,oBAAoB,QACjB,uBAAuB;AAC9B,SAASC,iBAAiB,EAAEC,iBAAiB,QAAQ,kBAAkB;AACvE,OAAOC,gBAAgB,MAAM,wCAAwC;AACrE,SACIC,gBAAgB,EAChBC,uBAAuB,EACvBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,8BAA8B,QAC3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