@chayns-components/emoji-input 5.0.0-beta.112 → 5.0.0-beta.1122

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 (224) 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 +536 -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/{components → cjs/components}/emoji-picker/EmojiPicker.js +8 -11
  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 +101 -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 +239 -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 +60 -33
  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 +129 -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/{constants → cjs/constants}/emoji.js +4 -8
  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/{hooks → cjs/hooks}/emojiHistory.js +13 -15
  49. package/lib/cjs/hooks/emojiHistory.js.map +1 -0
  50. package/lib/{index.js → cjs/index.js} +1 -1
  51. package/lib/cjs/index.js.map +1 -0
  52. package/lib/cjs/types/api.js.map +1 -0
  53. package/lib/cjs/types/category.js.map +1 -0
  54. package/lib/{utils → cjs/utils}/emoji.js +14 -6
  55. package/lib/cjs/utils/emoji.js.map +1 -0
  56. package/lib/cjs/utils/environment.js.map +1 -0
  57. package/lib/cjs/utils/font.js.map +1 -0
  58. package/lib/cjs/utils/insert.js +110 -0
  59. package/lib/cjs/utils/insert.js.map +1 -0
  60. package/lib/cjs/utils/number.js +17 -0
  61. package/lib/cjs/utils/number.js.map +1 -0
  62. package/lib/cjs/utils/selection.js +281 -0
  63. package/lib/cjs/utils/selection.js.map +1 -0
  64. package/lib/cjs/utils/text.js +57 -0
  65. package/lib/cjs/utils/text.js.map +1 -0
  66. package/lib/esm/api/item-storage/get.js +30 -0
  67. package/lib/esm/api/item-storage/get.js.map +1 -0
  68. package/lib/esm/api/item-storage/put.js +35 -0
  69. package/lib/esm/api/item-storage/put.js.map +1 -0
  70. package/lib/esm/components/emoji-input/EmojiInput.js +518 -0
  71. package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -0
  72. package/lib/esm/components/emoji-input/EmojiInput.styles.js +151 -0
  73. package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -0
  74. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js +38 -0
  75. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
  76. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js +69 -0
  77. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
  78. package/lib/esm/components/emoji-picker/EmojiPicker.js +40 -0
  79. package/lib/esm/components/emoji-picker/EmojiPicker.js.map +1 -0
  80. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js +16 -0
  81. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
  82. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +96 -0
  83. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
  84. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +18 -0
  85. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
  86. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
  87. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
  88. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +74 -0
  89. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
  90. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +136 -0
  91. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
  92. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +20 -0
  93. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
  94. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +121 -0
  95. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
  96. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
  97. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
  98. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js +43 -0
  99. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
  100. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js +8 -0
  101. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
  102. package/lib/esm/constants/alignment.js +13 -0
  103. package/lib/esm/constants/alignment.js.map +1 -0
  104. package/lib/esm/constants/categories.js +13 -0
  105. package/lib/esm/constants/categories.js.map +1 -0
  106. package/lib/esm/constants/emoji-de-DE.json +3827 -0
  107. package/lib/esm/constants/emoji.js +3798 -0
  108. package/lib/esm/constants/emoji.js.map +1 -0
  109. package/lib/esm/constants/externalServerUrl.js +2 -0
  110. package/lib/esm/constants/externalServerUrl.js.map +1 -0
  111. package/lib/esm/constants/regex.js +9 -0
  112. package/lib/esm/constants/regex.js.map +1 -0
  113. package/lib/esm/hooks/emojiHistory.js +83 -0
  114. package/lib/esm/hooks/emojiHistory.js.map +1 -0
  115. package/lib/{index.d.ts → esm/index.js} +1 -0
  116. package/lib/esm/index.js.map +1 -0
  117. package/lib/esm/types/api.js +2 -0
  118. package/lib/esm/types/api.js.map +1 -0
  119. package/lib/esm/types/category.js +2 -0
  120. package/lib/esm/types/category.js.map +1 -0
  121. package/lib/esm/utils/emoji.js +92 -0
  122. package/lib/esm/utils/emoji.js.map +1 -0
  123. package/lib/esm/utils/environment.js +24 -0
  124. package/lib/esm/utils/environment.js.map +1 -0
  125. package/lib/esm/utils/font.js +10 -0
  126. package/lib/esm/utils/font.js.map +1 -0
  127. package/lib/esm/utils/insert.js +104 -0
  128. package/lib/esm/utils/insert.js.map +1 -0
  129. package/lib/esm/utils/number.js +10 -0
  130. package/lib/esm/utils/number.js.map +1 -0
  131. package/lib/esm/utils/selection.js +263 -0
  132. package/lib/esm/utils/selection.js.map +1 -0
  133. package/lib/esm/utils/text.js +48 -0
  134. package/lib/esm/utils/text.js.map +1 -0
  135. package/lib/types/components/emoji-input/EmojiInput.d.ts +96 -0
  136. package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +26 -0
  137. package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
  138. package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
  139. package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
  140. package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +6 -0
  141. package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +9 -0
  142. package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +5 -0
  143. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
  144. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +22 -0
  145. package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +0 -13
  146. package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
  147. package/lib/types/constants/regex.d.ts +8 -0
  148. package/lib/types/index.d.ts +6 -0
  149. package/lib/{utils → types/utils}/emoji.d.ts +2 -0
  150. package/lib/{utils → types/utils}/insert.d.ts +8 -1
  151. package/lib/types/utils/number.d.ts +1 -0
  152. package/lib/types/utils/selection.d.ts +23 -0
  153. package/lib/types/utils/text.d.ts +3 -0
  154. package/package.json +49 -31
  155. package/lib/api/item-storage/get.js.map +0 -1
  156. package/lib/api/item-storage/put.js.map +0 -1
  157. package/lib/components/emoji-input/EmojiInput.d.ts +0 -53
  158. package/lib/components/emoji-input/EmojiInput.js +0 -159
  159. package/lib/components/emoji-input/EmojiInput.js.map +0 -1
  160. package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -13
  161. package/lib/components/emoji-input/EmojiInput.styles.js +0 -145
  162. package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
  163. package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
  164. package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
  165. package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
  166. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -51
  167. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
  168. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
  169. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
  170. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -131
  171. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
  172. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -7
  173. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -99
  174. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
  175. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +0 -1
  176. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +0 -1
  177. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +0 -1
  178. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +0 -74
  179. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +0 -1
  180. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +0 -11
  181. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +0 -104
  182. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +0 -1
  183. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -150
  184. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
  185. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
  186. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -97
  187. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
  188. package/lib/constants/alignment.js.map +0 -1
  189. package/lib/constants/categories.js.map +0 -1
  190. package/lib/constants/emoji.js.map +0 -1
  191. package/lib/constants/externalServerUrl.js +0 -9
  192. package/lib/constants/externalServerUrl.js.map +0 -1
  193. package/lib/hooks/emojiHistory.js.map +0 -1
  194. package/lib/index.js.map +0 -1
  195. package/lib/types/api.js.map +0 -1
  196. package/lib/types/category.js.map +0 -1
  197. package/lib/utils/emoji.js.map +0 -1
  198. package/lib/utils/environment.js.map +0 -1
  199. package/lib/utils/font.js.map +0 -1
  200. package/lib/utils/insert.js +0 -50
  201. package/lib/utils/insert.js.map +0 -1
  202. package/lib/utils/selection.d.ts +0 -2
  203. package/lib/utils/selection.js +0 -43
  204. package/lib/utils/selection.js.map +0 -1
  205. /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
  206. /package/lib/{types → cjs/types}/api.js +0 -0
  207. /package/lib/{types → cjs/types}/category.js +0 -0
  208. /package/lib/{utils → cjs/utils}/environment.js +0 -0
  209. /package/lib/{utils → cjs/utils}/font.js +0 -0
  210. /package/lib/{api → types/api}/item-storage/get.d.ts +0 -0
  211. /package/lib/{api → types/api}/item-storage/put.d.ts +0 -0
  212. /package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +0 -0
  213. /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
  214. /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +0 -0
  215. /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +0 -0
  216. /package/lib/{constants → types/constants}/alignment.d.ts +0 -0
  217. /package/lib/{constants → types/constants}/categories.d.ts +0 -0
  218. /package/lib/{constants → types/constants}/emoji.d.ts +0 -0
  219. /package/lib/{constants → types/constants}/externalServerUrl.d.ts +0 -0
  220. /package/lib/{hooks → types/hooks}/emojiHistory.d.ts +0 -0
  221. /package/lib/types/{api.d.ts → types/api.d.ts} +0 -0
  222. /package/lib/types/{category.d.ts → types/category.d.ts} +0 -0
  223. /package/lib/{utils → types/utils}/environment.d.ts +0 -0
  224. /package/lib/{utils → types/utils}/font.d.ts +0 -0
@@ -0,0 +1,518 @@
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 } 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
+ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
13
+ const EmojiInput = /*#__PURE__*/forwardRef((_ref, ref) => {
14
+ let {
15
+ accessToken,
16
+ height,
17
+ inputId,
18
+ isDisabled,
19
+ maxHeight = '190px',
20
+ onBlur,
21
+ onFocus,
22
+ onInput,
23
+ onKeyDown,
24
+ onPrefixElementRemove,
25
+ onPopupVisibilityChange,
26
+ personId,
27
+ placeholder,
28
+ popupAlignment,
29
+ prefixElement,
30
+ rightElement,
31
+ shouldHidePlaceholderOnFocus = false,
32
+ shouldPreventEmojiPicker,
33
+ value
34
+ } = _ref;
35
+ const [isTouch] = useState(getIsTouch());
36
+ const [plainTextValue, setPlainTextValue] = useState(value);
37
+ const [hasFocus, setHasFocus] = useState(false);
38
+ const [progressDuration, setProgressDuration] = useState(0);
39
+ const [labelWidth, setLabelWidth] = useState(0);
40
+ const [isPopupVisible, setIsPopupVisible] = useState(false);
41
+ const [isPrefixAnimationFinished, setIsPrefixAnimationFinished] = useState(!prefixElement);
42
+ const [prefixElementWidth, setPrefixElementWidth] = useState();
43
+ const [textLength, setTextLength] = useState(0);
44
+ const areaProvider = useContext(AreaContext);
45
+ const editorRef = useRef(null);
46
+ const prefixElementRef = useRef(null);
47
+ const hasPrefixRendered = useRef(false);
48
+ const hasPrefixChanged = useRef(false);
49
+ const shouldDeleteOneMoreBackwards = useRef(false);
50
+ const shouldDeleteOneMoreForwards = useRef(false);
51
+ const valueRef = useRef(value);
52
+ const {
53
+ browser
54
+ } = getDevice();
55
+ const shouldChangeColor = useMemo(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]);
56
+
57
+ /**
58
+ * This function updates the content of the 'contentEditable' element if the new text is
59
+ * different from the previous content. So this is only true if, for example, a text like ":-)"
60
+ * has been replaced to the corresponding emoji.
61
+ *
62
+ * When updating the HTML, the current cursor position is saved before replacing the content, so
63
+ * that it can be set again afterward.
64
+ */
65
+ const handleUpdateHTML = useCallback(html => {
66
+ if (!editorRef.current) {
67
+ return;
68
+ }
69
+ let newInnerHTML = convertEmojisToUnicode(html);
70
+ newInnerHTML = convertTextToHTML(newInnerHTML);
71
+ if (newInnerHTML !== editorRef.current.innerHTML) {
72
+ saveSelection(editorRef.current, {
73
+ shouldIgnoreEmptyTextNodes: true
74
+ });
75
+ editorRef.current.innerHTML = newInnerHTML;
76
+ restoreSelection(editorRef.current);
77
+ }
78
+ }, []);
79
+ const handleBeforeInput = useCallback(event => {
80
+ if (!editorRef.current) {
81
+ return;
82
+ }
83
+ if (isDisabled) {
84
+ event.preventDefault();
85
+ event.stopPropagation();
86
+ return;
87
+ }
88
+ const {
89
+ data,
90
+ type
91
+ } = event.nativeEvent;
92
+ if (type === 'textInput' && data && data.includes('\n')) {
93
+ event.preventDefault();
94
+ event.stopPropagation();
95
+ const text = convertEmojisToUnicode(data);
96
+ insertTextAtCursorPosition({
97
+ editorElement: editorRef.current,
98
+ text
99
+ });
100
+ const newEvent = new Event('input', {
101
+ bubbles: true
102
+ });
103
+ editorRef.current.dispatchEvent(newEvent);
104
+ }
105
+ }, [isDisabled]);
106
+
107
+ /**
108
+ * This function handles the 'input' events of the 'contentEditable' element and also passes the
109
+ * respective event up accordingly if the 'onInput' property is a function.
110
+ */
111
+ const handleInput = useCallback(event => {
112
+ if (!editorRef.current) {
113
+ return;
114
+ }
115
+ if (isDisabled) {
116
+ event.stopPropagation();
117
+ event.preventDefault();
118
+ }
119
+ if (shouldDeleteOneMoreBackwards.current) {
120
+ shouldDeleteOneMoreBackwards.current = false;
121
+ shouldDeleteOneMoreForwards.current = false;
122
+ event.preventDefault();
123
+ event.stopPropagation();
124
+
125
+ // Remove content and set cursor to the right position
126
+ insertInvisibleCursorMarker();
127
+ return;
128
+ }
129
+ if (shouldDeleteOneMoreForwards.current) {
130
+ shouldDeleteOneMoreBackwards.current = false;
131
+ shouldDeleteOneMoreForwards.current = false;
132
+ event.preventDefault();
133
+ event.stopPropagation();
134
+
135
+ // noinspection JSDeprecatedSymbols
136
+ document.execCommand('forwardDelete', false);
137
+ return;
138
+ }
139
+ handleUpdateHTML(editorRef.current.innerHTML);
140
+ const text = convertHTMLToText(editorRef.current.innerHTML);
141
+ setPlainTextValue(text);
142
+ if (typeof onInput === 'function') {
143
+ onInput(event, text);
144
+ }
145
+ }, [handleUpdateHTML, isDisabled, onInput]);
146
+ const handleKeyDown = useCallback(event => {
147
+ if (isDisabled) {
148
+ event.preventDefault();
149
+ event.stopPropagation();
150
+ return;
151
+ }
152
+ if (event.key === 'Enter' && isPopupVisible) {
153
+ event.preventDefault();
154
+ return;
155
+ }
156
+ if (typeof onKeyDown === 'function') {
157
+ onKeyDown(event);
158
+ }
159
+ if (event.key === 'Enter' && !event.isPropagationStopped() && editorRef.current) {
160
+ event.preventDefault();
161
+
162
+ // noinspection JSDeprecatedSymbols
163
+ document.execCommand('insertLineBreak', false);
164
+ }
165
+ if (event.key === 'Backspace' || event.key === 'Delete' || event.key === 'Unidentified') {
166
+ const charCodeThatWillBeDeleted = getCharCodeThatWillBeDeleted(event);
167
+ if (charCodeThatWillBeDeleted === 8203) {
168
+ if (event.key === 'Backspace' || event.key === 'Unidentified') {
169
+ shouldDeleteOneMoreBackwards.current = true;
170
+ } else {
171
+ shouldDeleteOneMoreForwards.current = true;
172
+ }
173
+ }
174
+ }
175
+ }, [isDisabled, isPopupVisible, onKeyDown]);
176
+ const handlePopupVisibility = useCallback(isVisible => {
177
+ setIsPopupVisible(isVisible);
178
+ if (editorRef.current && isVisible) {
179
+ saveSelection(editorRef.current);
180
+ }
181
+ if (typeof onPopupVisibilityChange === 'function') {
182
+ onPopupVisibilityChange(isVisible);
183
+ }
184
+ }, [onPopupVisibilityChange]);
185
+
186
+ /**
187
+ * This function prevents formatting from being adopted when texts are inserted. To do this, the
188
+ * plain text is read from the event after the default behavior has been prevented. The plain
189
+ * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
190
+ */
191
+ const handlePaste = useCallback(event => {
192
+ if (editorRef.current) {
193
+ event.preventDefault();
194
+ if (isDisabled) {
195
+ event.stopPropagation();
196
+ return;
197
+ }
198
+
199
+ // This ensures, that only the copied text is inserted and not its HTML formatting.
200
+ let text = event.clipboardData.getData('text/plain');
201
+ text = convertEmojisToUnicode(text);
202
+
203
+ /* This ensures, that valid HTML in the inserted text is not interpreted as such. e.g. if the user
204
+ pasted the text '<b>test</b>' (not as formatted html), the <b> tags need to be escaped, to
205
+ prevent it from being interpreted as html. */
206
+ text = escapeHTML(text);
207
+
208
+ // Insert an invisible control character at the end of the text to place the cursor in the correct position after insertion.
209
+ if (text.includes('\n')) {
210
+ text += '\u200C';
211
+ }
212
+
213
+ // This deprecated function is used, because it causes the inserted content to be added to the undo stack.
214
+ // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.
215
+ // In that case on CTRL+Z the inserted text would not be removed.
216
+ document.execCommand('insertHTML', false, text);
217
+ const newEvent = new Event('input', {
218
+ bubbles: true
219
+ });
220
+ editorRef.current.dispatchEvent(newEvent);
221
+ }
222
+ }, [isDisabled]);
223
+
224
+ /**
225
+ * This function prevents formatting from being adopted when texts are dropped. To do this, the
226
+ * plain text is read from the event after the default behavior has been prevented. The plain
227
+ * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
228
+ */
229
+ const handleDrop = useCallback(event => {
230
+ if (editorRef.current) {
231
+ event.preventDefault();
232
+ if (isDisabled) {
233
+ event.stopPropagation();
234
+ return;
235
+ }
236
+
237
+ // This ensures, that only the dropped text is inserted and not its HTML formatting.
238
+ let text = event.dataTransfer?.getData('text');
239
+ if (!text) {
240
+ return;
241
+ }
242
+ text = convertEmojisToUnicode(text);
243
+
244
+ /* This ensures, that valid HTML in the inserted text is not interpreted as such. e.g. if the user
245
+ drops the text '<b>test</b>' (not as formatted html), the <b> tags need to be escaped, to
246
+ prevent it from being interpreted as html. */
247
+ text = escapeHTML(text);
248
+
249
+ // This deprecated function is used, because it causes the inserted content to be added to the undo stack.
250
+ // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.
251
+ // In that case on CTRL+Z the inserted text would not be removed.
252
+ document.execCommand('insertHTML', false, text);
253
+ const newEvent = new Event('input', {
254
+ bubbles: true
255
+ });
256
+ editorRef.current.dispatchEvent(newEvent);
257
+ }
258
+ }, [isDisabled]);
259
+
260
+ /**
261
+ * This function uses the 'insertTextAtCursorPosition' function to insert the emoji at the
262
+ * correct position in the editor element.
263
+ *
264
+ * At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,
265
+ * which in turn executes the 'onInput' function from the props. So this serves to ensure that
266
+ * the event is also passed through to the top when inserting via the popup.
267
+ */
268
+ const handlePopupSelect = useCallback(emoji => {
269
+ if (editorRef.current) {
270
+ insertTextAtCursorPosition({
271
+ editorElement: editorRef.current,
272
+ text: emoji,
273
+ shouldUseSavedSelection: true
274
+ });
275
+ const event = new Event('input', {
276
+ bubbles: true
277
+ });
278
+ editorRef.current.dispatchEvent(event);
279
+ }
280
+ }, []);
281
+ useEffect(() => {
282
+ if (typeof onPrefixElementRemove !== 'function') {
283
+ return;
284
+ }
285
+ if (!hasPrefixRendered.current) {
286
+ return;
287
+ }
288
+ const convertedText = convertHTMLToText(editorRef.current?.innerHTML ?? '').replace('&nbsp;', ' ');
289
+ const convertedPrefix = prefixElement && prefixElement.replace('&nbsp;', ' ');
290
+ if (convertedPrefix && convertedText.includes(convertedPrefix) && convertedText.length > convertedPrefix.length || convertedPrefix === convertedText) {
291
+ return;
292
+ }
293
+ if (hasPrefixChanged.current) {
294
+ hasPrefixChanged.current = false;
295
+ return;
296
+ }
297
+ onPrefixElementRemove();
298
+ hasPrefixRendered.current = false;
299
+ }, [onPrefixElementRemove, plainTextValue.length, prefixElement]);
300
+ useEffect(() => {
301
+ if (typeof prefixElement === 'string') {
302
+ hasPrefixChanged.current = true;
303
+ }
304
+ }, [prefixElement]);
305
+ useEffect(() => {
306
+ if (value !== plainTextValue) {
307
+ setPlainTextValue(value);
308
+ handleUpdateHTML(value);
309
+ }
310
+ }, [handleUpdateHTML, plainTextValue, value]);
311
+
312
+ // This effect is used to call the 'handleUpdateHTML' function once after the component has been
313
+ // rendered. This is necessary because the 'contentEditable' element otherwise does not display
314
+ // the HTML content correctly when the component is rendered for the first time.
315
+ useIsomorphicLayoutEffect(() => {
316
+ handleUpdateHTML(valueRef.current);
317
+ }, [handleUpdateHTML]);
318
+ const handleInsertTextAtCursorPosition = useCallback(text => {
319
+ if (editorRef.current) {
320
+ insertTextAtCursorPosition({
321
+ editorElement: editorRef.current,
322
+ text
323
+ });
324
+ const newEvent = new Event('input', {
325
+ bubbles: true
326
+ });
327
+ editorRef.current.dispatchEvent(newEvent);
328
+ }
329
+ }, []);
330
+ const handleReplaceText = useCallback((searchText, pasteText) => {
331
+ if (editorRef.current) {
332
+ replaceText({
333
+ editorElement: editorRef.current,
334
+ searchText,
335
+ pasteText
336
+ });
337
+ const newEvent = new Event('input', {
338
+ bubbles: true
339
+ });
340
+ editorRef.current.dispatchEvent(newEvent);
341
+ }
342
+ }, []);
343
+ const handleStartProgress = useCallback(duration => {
344
+ setProgressDuration(duration);
345
+ }, []);
346
+ const handleStopProgress = useCallback(() => {
347
+ setProgressDuration(0);
348
+ }, []);
349
+ useImperativeHandle(ref, () => ({
350
+ insertTextAtCursorPosition: handleInsertTextAtCursorPosition,
351
+ replaceText: handleReplaceText,
352
+ startProgress: handleStartProgress,
353
+ stopProgress: handleStopProgress,
354
+ focus: () => editorRef.current?.focus(),
355
+ blur: () => editorRef.current?.blur()
356
+ }), [handleInsertTextAtCursorPosition, handleReplaceText, handleStartProgress, handleStopProgress]);
357
+ useEffect(() => {
358
+ /**
359
+ * This function ensures that the input field does not lose focus when the popup is opened
360
+ * or an emoji is selected in it. For this purpose the corresponding elements get the class
361
+ * 'prevent-lose-focus'.
362
+ *
363
+ * The class can also be set to any other elements that should also not cause the input
364
+ * field to lose focus.
365
+ */
366
+ const handlePreventLoseFocus = event => {
367
+ const element = event.target;
368
+ if (element.classList.contains('prevent-lose-focus') || element.parentElement?.classList.contains('prevent-lose-focus') || element.parentElement?.parentElement?.classList.contains('prevent-lose-focus')) {
369
+ event.preventDefault();
370
+ event.stopPropagation();
371
+ }
372
+ };
373
+ document.body.addEventListener('mousedown', handlePreventLoseFocus);
374
+ return () => {
375
+ document.body.removeEventListener('mousedown', handlePreventLoseFocus);
376
+ };
377
+ }, []);
378
+ const shouldShowPlaceholder = useMemo(() => {
379
+ if (!isPrefixAnimationFinished) {
380
+ return false;
381
+ }
382
+ const isJustPrefixElement = prefixElement && convertTextToHTML(prefixElement) === editorRef.current?.innerHTML;
383
+ const shouldRenderPlaceholder = prefixElement && !plainTextValue || (prefixElement ? prefixElementWidth && prefixElementWidth > 0 : true);
384
+ switch (true) {
385
+ case (!plainTextValue || isJustPrefixElement) && shouldHidePlaceholderOnFocus && !hasFocus:
386
+ case (!plainTextValue || isJustPrefixElement) && !shouldHidePlaceholderOnFocus:
387
+ return shouldRenderPlaceholder;
388
+ case (!plainTextValue || isJustPrefixElement) && shouldHidePlaceholderOnFocus && hasFocus:
389
+ return false;
390
+ default:
391
+ return false;
392
+ }
393
+ }, [isPrefixAnimationFinished, hasFocus, plainTextValue, prefixElement, shouldHidePlaceholderOnFocus, prefixElementWidth]);
394
+ useEffect(() => {
395
+ if (prefixElement) {
396
+ setIsPrefixAnimationFinished(false);
397
+ }
398
+ }, [prefixElement]);
399
+ const handleFocus = event => {
400
+ if (typeof onFocus === 'function' && !isDisabled) {
401
+ onFocus(event);
402
+ }
403
+ setHasFocus(true);
404
+ };
405
+ const handleBlur = event => {
406
+ if (typeof onBlur === 'function' && !isDisabled) {
407
+ onBlur(event);
408
+ }
409
+ setHasFocus(false);
410
+ };
411
+ useEffect(() => {
412
+ if (editorRef.current && prefixElement) {
413
+ const text = convertEmojisToUnicode(prefixElement);
414
+ insertTextAtCursorPosition({
415
+ editorElement: editorRef.current,
416
+ text
417
+ });
418
+ handleUpdateHTML(prefixElement);
419
+ hasPrefixRendered.current = true;
420
+ }
421
+ }, [handleUpdateHTML, prefixElement]);
422
+ useEffect(() => {
423
+ if (prefixElementRef.current && prefixElement && convertTextToHTML(prefixElement) === editorRef.current?.innerHTML) {
424
+ setPrefixElementWidth(prefixElementRef.current.offsetWidth + 2);
425
+ } else {
426
+ setPrefixElementWidth(undefined);
427
+ }
428
+ }, [plainTextValue, prefixElement]);
429
+ useEffect(() => {
430
+ const handleResize = () => {
431
+ if (editorRef.current) {
432
+ setLabelWidth(editorRef.current.offsetWidth);
433
+ }
434
+ };
435
+ const resizeObserver = new ResizeObserver(handleResize);
436
+ if (editorRef.current) {
437
+ resizeObserver.observe(editorRef.current);
438
+ }
439
+ return () => {
440
+ resizeObserver.disconnect();
441
+ };
442
+ }, []);
443
+ useEffect(() => {
444
+ const blurElement = () => {
445
+ if (editorRef.current && document.activeElement === editorRef.current && isDisabled) {
446
+ editorRef.current.blur();
447
+ }
448
+ };
449
+ document.addEventListener('focus', blurElement, true);
450
+ return () => {
451
+ document.removeEventListener('focus', blurElement, true);
452
+ };
453
+ }, [isDisabled]);
454
+ return /*#__PURE__*/React.createElement(StyledEmojiInput, {
455
+ $isDisabled: isDisabled,
456
+ $shouldChangeColor: shouldChangeColor
457
+ }, /*#__PURE__*/React.createElement(AnimatePresence, {
458
+ initial: true
459
+ }, progressDuration > 0 && /*#__PURE__*/React.createElement(StyledMotionEmojiInputProgress, {
460
+ animate: {
461
+ width: '100%'
462
+ },
463
+ exit: {
464
+ opacity: 0
465
+ },
466
+ initial: {
467
+ opacity: 1,
468
+ width: '0%'
469
+ },
470
+ transition: {
471
+ width: {
472
+ ease: 'linear',
473
+ duration: progressDuration
474
+ },
475
+ opacity: {
476
+ type: 'tween',
477
+ duration: 0.3
478
+ }
479
+ }
480
+ })), /*#__PURE__*/React.createElement(StyledEmojiInputContent, null, prefixElement && /*#__PURE__*/React.createElement(PrefixElement, {
481
+ key: prefixElement,
482
+ element: prefixElement,
483
+ prefixElementRef: prefixElementRef,
484
+ setIsPrefixAnimationFinished: setIsPrefixAnimationFinished
485
+ }), /*#__PURE__*/React.createElement(StyledMotionEmojiInputEditor, {
486
+ $browser: browser?.name,
487
+ animate: {
488
+ maxHeight: height ?? maxHeight,
489
+ minHeight: height ?? '26px'
490
+ },
491
+ contentEditable: true,
492
+ id: inputId,
493
+ onBeforeInput: handleBeforeInput,
494
+ onBlur: handleBlur,
495
+ onFocus: handleFocus,
496
+ onInput: handleInput,
497
+ onKeyDown: handleKeyDown,
498
+ onPaste: handlePaste,
499
+ onDrop: handleDrop,
500
+ ref: editorRef,
501
+ $shouldShowContent: isPrefixAnimationFinished,
502
+ transition: {
503
+ type: 'tween',
504
+ duration: 0.2
505
+ }
506
+ }), shouldShowPlaceholder && /*#__PURE__*/React.createElement(StyledEmojiInputLabel, {
507
+ $maxWidth: labelWidth,
508
+ $offsetWidth: prefixElementWidth
509
+ }, placeholder), !isTouch && !shouldPreventEmojiPicker && /*#__PURE__*/React.createElement(EmojiPickerPopup, {
510
+ accessToken: accessToken,
511
+ onSelect: handlePopupSelect,
512
+ onPopupVisibilityChange: handlePopupVisibility,
513
+ personId: personId
514
+ })), rightElement && /*#__PURE__*/React.createElement(StyledEmojiInputRightWrapper, null, rightElement));
515
+ });
516
+ EmojiInput.displayName = 'EmojiInput';
517
+ export default EmojiInput;
518
+ //# 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","convertHTMLToText","convertTextToHTML","EmojiPickerPopup","StyledEmojiInput","StyledEmojiInputContent","StyledEmojiInputLabel","StyledEmojiInputRightWrapper","StyledMotionEmojiInputEditor","StyledMotionEmojiInputProgress","PrefixElement","useIsomorphicLayoutEffect","window","EmojiInput","_ref","ref","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPrefixElementRemove","onPopupVisibilityChange","personId","placeholder","popupAlignment","prefixElement","rightElement","shouldHidePlaceholderOnFocus","shouldPreventEmojiPicker","value","isTouch","plainTextValue","setPlainTextValue","hasFocus","setHasFocus","progressDuration","setProgressDuration","labelWidth","setLabelWidth","isPopupVisible","setIsPopupVisible","isPrefixAnimationFinished","setIsPrefixAnimationFinished","prefixElementWidth","setPrefixElementWidth","textLength","setTextLength","areaProvider","editorRef","prefixElementRef","hasPrefixRendered","hasPrefixChanged","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","browser","shouldChangeColor","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","charCodeThatWillBeDeleted","handlePopupVisibility","isVisible","handlePaste","clipboardData","getData","handleDrop","dataTransfer","handlePopupSelect","emoji","shouldUseSavedSelection","convertedText","replace","convertedPrefix","length","handleInsertTextAtCursorPosition","handleReplaceText","searchText","pasteText","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} 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';\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 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 type EmojiInputRef = {\n insertTextAtCursorPosition: (text: string) => void;\n replaceText: (searchText: string, replaceText: string) => 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 },\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 [textLength, setTextLength] = useState(0);\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 const { browser } = getDevice();\n\n const shouldChangeColor = useMemo(\n () => areaProvider.shouldChangeColor ?? false,\n [areaProvider.shouldChangeColor],\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((html: string) => {\n if (!editorRef.current) {\n return;\n }\n\n let newInnerHTML = convertEmojisToUnicode(html);\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\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);\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 [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 [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 (\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);\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 [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);\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 [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((searchText: string, pasteText: string) => {\n if (editorRef.current) {\n replaceText({ editorElement: editorRef.current, searchText, pasteText });\n\n const newEvent = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(newEvent);\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(prefixElement);\n\n insertTextAtCursorPosition({ editorElement: editorRef.current, text });\n\n handleUpdateHTML(prefixElement);\n hasPrefixRendered.current = true;\n }\n }, [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,QACV,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,QAC3B,qBAAqB;AAC5B,OAAOC,aAAa,MAAM,gCAAgC;AAE1D,MAAMC,yBAAyB,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGvB,eAAe,GAAGF,SAAS;AAgG7F,MAAM0B,UAAU,gBAAG7B,UAAU,CACzB,CAAA8B,IAAA,EAsBIC,GAAG,KACF;EAAA,IAtBD;IACIC,WAAW;IACXC,MAAM;IACNC,OAAO;IACPC,UAAU;IACVC,SAAS,GAAG,OAAO;IACnBC,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,SAAS;IACTC,qBAAqB;IACrBC,uBAAuB;IACvBC,QAAQ;IACRC,WAAW;IACXC,cAAc;IACdC,aAAa;IACbC,YAAY;IACZC,4BAA4B,GAAG,KAA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