@chayns-components/emoji-input 5.0.0-beta.303 → 5.0.0-beta.308

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 (35) hide show
  1. package/lib/components/emoji-input/EmojiInput.js +3 -4
  2. package/lib/components/emoji-input/EmojiInput.js.map +1 -1
  3. package/lib/components/emoji-input/EmojiInput.styles.d.ts +543 -8
  4. package/lib/components/emoji-input/EmojiInput.styles.js +4 -4
  5. package/lib/components/emoji-input/EmojiInput.styles.js.map +1 -1
  6. package/lib/components/emoji-picker/EmojiPicker.js +1 -2
  7. package/lib/components/emoji-picker/EmojiPicker.js.map +1 -1
  8. package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +274 -1
  9. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +540 -2
  10. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -1
  11. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +3 -4
  12. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -1
  13. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +279 -5
  14. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +4 -4
  15. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -1
  16. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +274 -1
  17. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +816 -6
  18. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +2 -2
  19. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -1
  20. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +1 -2
  21. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -1
  22. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +542 -5
  23. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +2 -2
  24. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -1
  25. package/lib/hooks/emojiHistory.js +2 -3
  26. package/lib/hooks/emojiHistory.js.map +1 -1
  27. package/lib/types/api.js +0 -4
  28. package/lib/types/category.js +0 -4
  29. package/lib/utils/emoji.js +2 -6
  30. package/lib/utils/emoji.js.map +1 -1
  31. package/lib/utils/insert.js +1 -1
  32. package/lib/utils/insert.js.map +1 -1
  33. package/lib/utils/selection.js +10 -16
  34. package/lib/utils/selection.js.map +1 -1
  35. package/package.json +14 -14
@@ -180,9 +180,8 @@ const EmojiInput = _ref => {
180
180
  * field to lose focus.
181
181
  */
182
182
  const handlePreventLoseFocus = event => {
183
- var _element$parentElemen, _element$parentElemen2;
184
183
  const element = event.target;
185
- if (element.classList.contains('prevent-lose-focus') || (_element$parentElemen = element.parentElement) !== null && _element$parentElemen !== void 0 && _element$parentElemen.classList.contains('prevent-lose-focus') || (_element$parentElemen2 = element.parentElement) !== null && _element$parentElemen2 !== void 0 && (_element$parentElemen2 = _element$parentElemen2.parentElement) !== null && _element$parentElemen2 !== void 0 && _element$parentElemen2.classList.contains('prevent-lose-focus')) {
184
+ if (element.classList.contains('prevent-lose-focus') || element.parentElement?.classList.contains('prevent-lose-focus') || element.parentElement?.parentElement?.classList.contains('prevent-lose-focus')) {
186
185
  event.preventDefault();
187
186
  event.stopPropagation();
188
187
  }
@@ -198,8 +197,8 @@ const EmojiInput = _ref => {
198
197
  isRightElementGiven: !!rightElement
199
198
  }, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledMotionEmojiInputEditor, {
200
199
  animate: {
201
- maxHeight: height !== null && height !== void 0 ? height : maxHeight,
202
- minHeight: height !== null && height !== void 0 ? height : '26px'
200
+ maxHeight: height ?? maxHeight,
201
+ minHeight: height ?? '26px'
203
202
  },
204
203
  contentEditable: !isDisabled,
205
204
  id: inputId,
@@ -1 +1 @@
1
- {"version":3,"file":"EmojiInput.js","names":["_react","_interopRequireWildcard","require","_emoji","_environment","_insert","_selection","_text","_EmojiPickerPopup","_interopRequireDefault","_EmojiInput","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","EmojiInput","_ref","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPopupVisibilityChange","personId","placeholder","popupAlignment","rightElement","shouldPreventEmojiPicker","value","isMobile","useState","getIsMobile","plainTextValue","setPlainTextValue","editorRef","useRef","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","handleUpdateHTML","useCallback","html","current","newInnerHTML","convertEmojisToUnicode","convertTextToHTML","innerHTML","saveSelection","shouldIgnoreEmptyTextNodes","restoreSelection","handleInput","event","preventDefault","stopPropagation","document","execCommand","text","convertHTMLToText","handleKeyDown","key","shiftKey","isPropagationStopped","charCodeThatWillBeDeleted","getCharCodeThatWillBeDeleted","handlePaste","clipboardData","getData","insertTextAtCursorPosition","editorElement","newEvent","Event","bubbles","dispatchEvent","handlePopupSelect","emoji","useEffect","useLayoutEffect","handlePreventLoseFocus","_element$parentElemen","_element$parentElemen2","element","target","classList","contains","parentElement","body","addEventListener","removeEventListener","createElement","StyledEmojiInput","StyledEmojiInputContent","isRightElementGiven","StyledMotionEmojiInputEditor","animate","minHeight","contentEditable","id","onPaste","ref","transition","type","duration","alignment","onSelect","StyledEmojiInputRightWrapper","displayName","_default","exports"],"sources":["../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ClipboardEvent,\n CSSProperties,\n FC,\n FocusEventHandler,\n KeyboardEvent,\n KeyboardEventHandler,\n ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport type { PopupAlignment } from '../../constants/alignment';\nimport { convertEmojisToUnicode } from '../../utils/emoji';\nimport { getIsMobile } from '../../utils/environment';\nimport { insertTextAtCursorPosition } from '../../utils/insert';\nimport {\n getCharCodeThatWillBeDeleted,\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 StyledEmojiInputRightWrapper,\n StyledMotionEmojiInputEditor,\n} from './EmojiInput.styles';\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 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;\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 inside the EmojiInput on the right side.\n */\n rightElement?: ReactNode;\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\nconst EmojiInput: FC<EmojiInputProps> = ({\n accessToken,\n height,\n inputId,\n isDisabled,\n maxHeight = '190px',\n onBlur,\n onFocus,\n onInput,\n onKeyDown,\n onPopupVisibilityChange,\n personId,\n placeholder,\n popupAlignment,\n rightElement,\n shouldPreventEmojiPicker,\n value,\n}) => {\n const [isMobile] = useState(getIsMobile());\n const [plainTextValue, setPlainTextValue] = useState(value);\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const shouldDeleteOneMoreBackwards = useRef(false);\n const shouldDeleteOneMoreForwards = useRef(false);\n\n const valueRef = useRef(value);\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 /**\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 (shouldDeleteOneMoreBackwards.current) {\n shouldDeleteOneMoreBackwards.current = false;\n shouldDeleteOneMoreForwards.current = false;\n\n event.preventDefault();\n event.stopPropagation();\n\n document.execCommand('delete', false);\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 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, onInput]\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n\n if (\n event.key === 'Enter' &&\n !event.shiftKey &&\n !event.isPropagationStopped() &&\n editorRef.current\n ) {\n event.preventDefault();\n\n document.execCommand('insertLineBreak', false);\n }\n\n if (event.key === 'Backspace' || event.key === 'Delete') {\n const charCodeThatWillBeDeleted = getCharCodeThatWillBeDeleted(event);\n\n if (charCodeThatWillBeDeleted === 8203) {\n if (event.key === 'Backspace') {\n shouldDeleteOneMoreBackwards.current = true;\n } else {\n shouldDeleteOneMoreForwards.current = true;\n }\n }\n }\n },\n [onKeyDown]\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 the\n * 'insertTextAtCursorPosition' function.\n */\n const handlePaste = useCallback((event: ClipboardEvent<HTMLDivElement>) => {\n if (editorRef.current) {\n event.preventDefault();\n\n let text = event.clipboardData.getData('text/plain');\n\n text = convertEmojisToUnicode(text);\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\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({ editorElement: editorRef.current, text: emoji });\n\n const event = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(event);\n }\n }, []);\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 useLayoutEffect(() => {\n handleUpdateHTML(valueRef.current);\n }, [handleUpdateHTML]);\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 return (\n <StyledEmojiInput isDisabled={isDisabled}>\n <StyledEmojiInputContent isRightElementGiven={!!rightElement}>\n <StyledMotionEmojiInputEditor\n animate={{ maxHeight: height ?? maxHeight, minHeight: height ?? '26px' }}\n contentEditable={!isDisabled}\n id={inputId}\n onBlur={onBlur}\n onFocus={onFocus}\n onInput={handleInput}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n ref={editorRef}\n transition={{ type: 'tween', duration: 0.2 }}\n />\n {!isMobile && !shouldPreventEmojiPicker && (\n <EmojiPickerPopup\n accessToken={accessToken}\n alignment={popupAlignment}\n onSelect={handlePopupSelect}\n onPopupVisibilityChange={onPopupVisibilityChange}\n personId={personId}\n />\n )}\n </StyledEmojiInputContent>\n {rightElement && (\n <StyledEmojiInputRightWrapper>{rightElement}</StyledEmojiInputRightWrapper>\n )}\n </StyledEmojiInput>\n );\n};\n\nEmojiInput.displayName = 'EmojiInput';\n\nexport default EmojiInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAgBA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAK6B,SAAAO,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAd,wBAAAc,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE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AAA,CAAAsG,uBAAuB;IAACC,mBAAmB,EAAE,CAAC,CAACjE;EAAa,gBACzDhD,MAAA,CAAAa,OAAA,CAAAiG,aAAA,CAACpG,WAAA,CAAAwG,4BAA4B;IACzBC,OAAO,EAAE;MAAE5E,SAAS,EAAEH,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIG,SAAS;MAAE6E,SAAS,EAAEhF,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI;IAAO,CAAE;IACzEiF,eAAe,EAAE,CAAC/E,UAAW;IAC7BgF,EAAE,EAAEjF,OAAQ;IACZG,MAAM,EAAEA,MAAO;IACfC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAE8B,WAAY;IACrB7B,SAAS,EAAEqC,aAAc;IACzBuC,OAAO,EAAEjC,WAAY;IACrBxC,WAAW,EAAEA,WAAY;IACzB0E,GAAG,EAAEhE,SAAU;IACfiE,UAAU,EAAE;MAAEC,IAAI,EAAE,OAAO;MAAEC,QAAQ,EAAE;IAAI;EAAE,CAChD,CAAC,EACD,CAACxE,QAAQ,IAAI,CAACF,wBAAwB,iBACnCjD,MAAA,CAAAa,OAAA,CAAAiG,aAAA,CAACtG,iBAAA,CAAAK,OAAgB;IACbsB,WAAW,EAAEA,WAAY;IACzByF,SAAS,EAAE7E,cAAe;IAC1B8E,QAAQ,EAAE9B,iBAAkB;IAC5BnD,uBAAuB,EAAEA,uBAAwB;IACjDC,QAAQ,EAAEA;EAAS,CACtB,CAEgB,CAAC,EACzBG,YAAY,iBACThD,MAAA,CAAAa,OAAA,CAAAiG,aAAA,CAACpG,WAAA,CAAAoH,4BAA4B,QAAE9E,YAA2C,CAEhE,CAAC;AAE3B,CAAC;AAEDf,UAAU,CAAC8F,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApH,OAAA,GAEvBoB,UAAU"}
1
+ {"version":3,"file":"EmojiInput.js","names":["_react","_interopRequireWildcard","require","_emoji","_environment","_insert","_selection","_text","_EmojiPickerPopup","_interopRequireDefault","_EmojiInput","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","EmojiInput","_ref","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPopupVisibilityChange","personId","placeholder","popupAlignment","rightElement","shouldPreventEmojiPicker","value","isMobile","useState","getIsMobile","plainTextValue","setPlainTextValue","editorRef","useRef","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","handleUpdateHTML","useCallback","html","current","newInnerHTML","convertEmojisToUnicode","convertTextToHTML","innerHTML","saveSelection","shouldIgnoreEmptyTextNodes","restoreSelection","handleInput","event","preventDefault","stopPropagation","document","execCommand","text","convertHTMLToText","handleKeyDown","key","shiftKey","isPropagationStopped","charCodeThatWillBeDeleted","getCharCodeThatWillBeDeleted","handlePaste","clipboardData","getData","insertTextAtCursorPosition","editorElement","newEvent","Event","bubbles","dispatchEvent","handlePopupSelect","emoji","useEffect","useLayoutEffect","handlePreventLoseFocus","element","target","classList","contains","parentElement","body","addEventListener","removeEventListener","createElement","StyledEmojiInput","StyledEmojiInputContent","isRightElementGiven","StyledMotionEmojiInputEditor","animate","minHeight","contentEditable","id","onPaste","ref","transition","type","duration","alignment","onSelect","StyledEmojiInputRightWrapper","displayName","_default","exports"],"sources":["../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ClipboardEvent,\n CSSProperties,\n FC,\n FocusEventHandler,\n KeyboardEvent,\n KeyboardEventHandler,\n ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport type { PopupAlignment } from '../../constants/alignment';\nimport { convertEmojisToUnicode } from '../../utils/emoji';\nimport { getIsMobile } from '../../utils/environment';\nimport { insertTextAtCursorPosition } from '../../utils/insert';\nimport {\n getCharCodeThatWillBeDeleted,\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 StyledEmojiInputRightWrapper,\n StyledMotionEmojiInputEditor,\n} from './EmojiInput.styles';\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 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;\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 inside the EmojiInput on the right side.\n */\n rightElement?: ReactNode;\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\nconst EmojiInput: FC<EmojiInputProps> = ({\n accessToken,\n height,\n inputId,\n isDisabled,\n maxHeight = '190px',\n onBlur,\n onFocus,\n onInput,\n onKeyDown,\n onPopupVisibilityChange,\n personId,\n placeholder,\n popupAlignment,\n rightElement,\n shouldPreventEmojiPicker,\n value,\n}) => {\n const [isMobile] = useState(getIsMobile());\n const [plainTextValue, setPlainTextValue] = useState(value);\n\n const editorRef = useRef<HTMLDivElement>(null);\n\n const shouldDeleteOneMoreBackwards = useRef(false);\n const shouldDeleteOneMoreForwards = useRef(false);\n\n const valueRef = useRef(value);\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 /**\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 (shouldDeleteOneMoreBackwards.current) {\n shouldDeleteOneMoreBackwards.current = false;\n shouldDeleteOneMoreForwards.current = false;\n\n event.preventDefault();\n event.stopPropagation();\n\n document.execCommand('delete', false);\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 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, onInput]\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n\n if (\n event.key === 'Enter' &&\n !event.shiftKey &&\n !event.isPropagationStopped() &&\n editorRef.current\n ) {\n event.preventDefault();\n\n document.execCommand('insertLineBreak', false);\n }\n\n if (event.key === 'Backspace' || event.key === 'Delete') {\n const charCodeThatWillBeDeleted = getCharCodeThatWillBeDeleted(event);\n\n if (charCodeThatWillBeDeleted === 8203) {\n if (event.key === 'Backspace') {\n shouldDeleteOneMoreBackwards.current = true;\n } else {\n shouldDeleteOneMoreForwards.current = true;\n }\n }\n }\n },\n [onKeyDown]\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 the\n * 'insertTextAtCursorPosition' function.\n */\n const handlePaste = useCallback((event: ClipboardEvent<HTMLDivElement>) => {\n if (editorRef.current) {\n event.preventDefault();\n\n let text = event.clipboardData.getData('text/plain');\n\n text = convertEmojisToUnicode(text);\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\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({ editorElement: editorRef.current, text: emoji });\n\n const event = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(event);\n }\n }, []);\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 useLayoutEffect(() => {\n handleUpdateHTML(valueRef.current);\n }, [handleUpdateHTML]);\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 return (\n <StyledEmojiInput isDisabled={isDisabled}>\n <StyledEmojiInputContent isRightElementGiven={!!rightElement}>\n <StyledMotionEmojiInputEditor\n animate={{ maxHeight: height ?? maxHeight, minHeight: height ?? '26px' }}\n contentEditable={!isDisabled}\n id={inputId}\n onBlur={onBlur}\n onFocus={onFocus}\n onInput={handleInput}\n onKeyDown={handleKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n ref={editorRef}\n transition={{ type: 'tween', duration: 0.2 }}\n />\n {!isMobile && !shouldPreventEmojiPicker && (\n <EmojiPickerPopup\n accessToken={accessToken}\n alignment={popupAlignment}\n onSelect={handlePopupSelect}\n onPopupVisibilityChange={onPopupVisibilityChange}\n personId={personId}\n />\n )}\n </StyledEmojiInputContent>\n {rightElement && (\n <StyledEmojiInputRightWrapper>{rightElement}</StyledEmojiInputRightWrapper>\n )}\n </StyledEmojiInput>\n );\n};\n\nEmojiInput.displayName = 'EmojiInput';\n\nexport default EmojiInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAgBA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAK6B,SAAAO,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAd,wBAAAc,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAZ,CAAA,oBAAAY,CAAA,IAAAH,MAAA,CAAAI,SAAA,CA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