@chayns-components/emoji-input 5.0.0-beta.1004 → 5.0.0-beta.1005
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.
- package/lib/cjs/components/emoji-input/EmojiInput.js +53 -53
- package/lib/cjs/components/emoji-input/EmojiInput.js.map +1 -1
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js +3 -3
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js.map +1 -1
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +2 -2
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -1
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +18 -18
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -1
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +2 -2
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -1
- package/lib/esm/components/emoji-input/EmojiInput.js +1 -1
- package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -1
- package/lib/esm/components/emoji-input/EmojiInput.styles.js +1 -1
- package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -1
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +1 -1
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -1
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +1 -1
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -1
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +1 -1
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -1
- package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +4 -526
- package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +2 -263
- package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +2 -263
- package/package.json +4 -4
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _core = require("@chayns-components/core");
|
|
8
8
|
var _chaynsApi = require("chayns-api");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _react = require("motion/react");
|
|
10
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _emoji = require("../../utils/emoji");
|
|
12
12
|
var _insert = require("../../utils/insert");
|
|
13
13
|
var _selection = require("../../utils/selection");
|
|
@@ -18,8 +18,8 @@ var _PrefixElement = _interopRequireDefault(require("./prefix-element/PrefixElem
|
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ?
|
|
22
|
-
const EmojiInput = /*#__PURE__*/(0,
|
|
21
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? _react2.useLayoutEffect : _react2.useEffect;
|
|
22
|
+
const EmojiInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
23
23
|
accessToken,
|
|
24
24
|
height,
|
|
25
25
|
inputId,
|
|
@@ -40,27 +40,27 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
40
40
|
shouldPreventEmojiPicker,
|
|
41
41
|
value
|
|
42
42
|
}, ref) => {
|
|
43
|
-
const [isTouch] = (0,
|
|
44
|
-
const [plainTextValue, setPlainTextValue] = (0,
|
|
45
|
-
const [hasFocus, setHasFocus] = (0,
|
|
46
|
-
const [progressDuration, setProgressDuration] = (0,
|
|
47
|
-
const [labelWidth, setLabelWidth] = (0,
|
|
48
|
-
const [isPopupVisible, setIsPopupVisible] = (0,
|
|
49
|
-
const [isPrefixAnimationFinished, setIsPrefixAnimationFinished] = (0,
|
|
50
|
-
const [prefixElementWidth, setPrefixElementWidth] = (0,
|
|
51
|
-
const [textLength, setTextLength] = (0,
|
|
52
|
-
const areaProvider = (0,
|
|
53
|
-
const editorRef = (0,
|
|
54
|
-
const prefixElementRef = (0,
|
|
55
|
-
const hasPrefixRendered = (0,
|
|
56
|
-
const hasPrefixChanged = (0,
|
|
57
|
-
const shouldDeleteOneMoreBackwards = (0,
|
|
58
|
-
const shouldDeleteOneMoreForwards = (0,
|
|
59
|
-
const valueRef = (0,
|
|
43
|
+
const [isTouch] = (0, _react2.useState)((0, _core.getIsTouch)());
|
|
44
|
+
const [plainTextValue, setPlainTextValue] = (0, _react2.useState)(value);
|
|
45
|
+
const [hasFocus, setHasFocus] = (0, _react2.useState)(false);
|
|
46
|
+
const [progressDuration, setProgressDuration] = (0, _react2.useState)(0);
|
|
47
|
+
const [labelWidth, setLabelWidth] = (0, _react2.useState)(0);
|
|
48
|
+
const [isPopupVisible, setIsPopupVisible] = (0, _react2.useState)(false);
|
|
49
|
+
const [isPrefixAnimationFinished, setIsPrefixAnimationFinished] = (0, _react2.useState)(!prefixElement);
|
|
50
|
+
const [prefixElementWidth, setPrefixElementWidth] = (0, _react2.useState)();
|
|
51
|
+
const [textLength, setTextLength] = (0, _react2.useState)(0);
|
|
52
|
+
const areaProvider = (0, _react2.useContext)(_core.AreaContext);
|
|
53
|
+
const editorRef = (0, _react2.useRef)(null);
|
|
54
|
+
const prefixElementRef = (0, _react2.useRef)(null);
|
|
55
|
+
const hasPrefixRendered = (0, _react2.useRef)(false);
|
|
56
|
+
const hasPrefixChanged = (0, _react2.useRef)(false);
|
|
57
|
+
const shouldDeleteOneMoreBackwards = (0, _react2.useRef)(false);
|
|
58
|
+
const shouldDeleteOneMoreForwards = (0, _react2.useRef)(false);
|
|
59
|
+
const valueRef = (0, _react2.useRef)(value);
|
|
60
60
|
const {
|
|
61
61
|
browser
|
|
62
62
|
} = (0, _chaynsApi.getDevice)();
|
|
63
|
-
const shouldChangeColor = (0,
|
|
63
|
+
const shouldChangeColor = (0, _react2.useMemo)(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]);
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* This function updates the content of the 'contentEditable' element if the new text is
|
|
@@ -70,7 +70,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
70
70
|
* When updating the HTML, the current cursor position is saved before replacing the content, so
|
|
71
71
|
* that it can be set again afterward.
|
|
72
72
|
*/
|
|
73
|
-
const handleUpdateHTML = (0,
|
|
73
|
+
const handleUpdateHTML = (0, _react2.useCallback)(html => {
|
|
74
74
|
if (!editorRef.current) {
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
@@ -84,7 +84,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
84
84
|
(0, _selection.restoreSelection)(editorRef.current);
|
|
85
85
|
}
|
|
86
86
|
}, []);
|
|
87
|
-
const handleBeforeInput = (0,
|
|
87
|
+
const handleBeforeInput = (0, _react2.useCallback)(event => {
|
|
88
88
|
if (!editorRef.current) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
@@ -116,7 +116,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
116
116
|
* This function handles the 'input' events of the 'contentEditable' element and also passes the
|
|
117
117
|
* respective event up accordingly if the 'onInput' property is a function.
|
|
118
118
|
*/
|
|
119
|
-
const handleInput = (0,
|
|
119
|
+
const handleInput = (0, _react2.useCallback)(event => {
|
|
120
120
|
if (!editorRef.current) {
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
@@ -151,7 +151,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
151
151
|
onInput(event, text);
|
|
152
152
|
}
|
|
153
153
|
}, [handleUpdateHTML, isDisabled, onInput]);
|
|
154
|
-
const handleKeyDown = (0,
|
|
154
|
+
const handleKeyDown = (0, _react2.useCallback)(event => {
|
|
155
155
|
if (isDisabled) {
|
|
156
156
|
event.preventDefault();
|
|
157
157
|
event.stopPropagation();
|
|
@@ -181,7 +181,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}, [isDisabled, isPopupVisible, onKeyDown]);
|
|
184
|
-
const handlePopupVisibility = (0,
|
|
184
|
+
const handlePopupVisibility = (0, _react2.useCallback)(isVisible => {
|
|
185
185
|
setIsPopupVisible(isVisible);
|
|
186
186
|
if (editorRef.current && isVisible) {
|
|
187
187
|
(0, _selection.saveSelection)(editorRef.current);
|
|
@@ -196,7 +196,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
196
196
|
* plain text is read from the event after the default behavior has been prevented. The plain
|
|
197
197
|
* text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
|
|
198
198
|
*/
|
|
199
|
-
const handlePaste = (0,
|
|
199
|
+
const handlePaste = (0, _react2.useCallback)(event => {
|
|
200
200
|
if (editorRef.current) {
|
|
201
201
|
event.preventDefault();
|
|
202
202
|
if (isDisabled) {
|
|
@@ -229,7 +229,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
229
229
|
* plain text is read from the event after the default behavior has been prevented. The plain
|
|
230
230
|
* text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
|
|
231
231
|
*/
|
|
232
|
-
const handleDrop = (0,
|
|
232
|
+
const handleDrop = (0, _react2.useCallback)(event => {
|
|
233
233
|
if (editorRef.current) {
|
|
234
234
|
var _event$dataTransfer;
|
|
235
235
|
event.preventDefault();
|
|
@@ -269,7 +269,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
269
269
|
* which in turn executes the 'onInput' function from the props. So this serves to ensure that
|
|
270
270
|
* the event is also passed through to the top when inserting via the popup.
|
|
271
271
|
*/
|
|
272
|
-
const handlePopupSelect = (0,
|
|
272
|
+
const handlePopupSelect = (0, _react2.useCallback)(emoji => {
|
|
273
273
|
if (editorRef.current) {
|
|
274
274
|
(0, _insert.insertTextAtCursorPosition)({
|
|
275
275
|
editorElement: editorRef.current,
|
|
@@ -282,7 +282,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
282
282
|
editorRef.current.dispatchEvent(event);
|
|
283
283
|
}
|
|
284
284
|
}, []);
|
|
285
|
-
(0,
|
|
285
|
+
(0, _react2.useEffect)(() => {
|
|
286
286
|
var _editorRef$current;
|
|
287
287
|
if (typeof onPrefixElementRemove !== 'function') {
|
|
288
288
|
return;
|
|
@@ -302,12 +302,12 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
302
302
|
onPrefixElementRemove();
|
|
303
303
|
hasPrefixRendered.current = false;
|
|
304
304
|
}, [onPrefixElementRemove, plainTextValue.length, prefixElement]);
|
|
305
|
-
(0,
|
|
305
|
+
(0, _react2.useEffect)(() => {
|
|
306
306
|
if (typeof prefixElement === 'string') {
|
|
307
307
|
hasPrefixChanged.current = true;
|
|
308
308
|
}
|
|
309
309
|
}, [prefixElement]);
|
|
310
|
-
(0,
|
|
310
|
+
(0, _react2.useEffect)(() => {
|
|
311
311
|
if (value !== plainTextValue) {
|
|
312
312
|
setPlainTextValue(value);
|
|
313
313
|
handleUpdateHTML(value);
|
|
@@ -320,7 +320,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
320
320
|
useIsomorphicLayoutEffect(() => {
|
|
321
321
|
handleUpdateHTML(valueRef.current);
|
|
322
322
|
}, [handleUpdateHTML]);
|
|
323
|
-
const handleInsertTextAtCursorPosition = (0,
|
|
323
|
+
const handleInsertTextAtCursorPosition = (0, _react2.useCallback)(text => {
|
|
324
324
|
if (editorRef.current) {
|
|
325
325
|
(0, _insert.insertTextAtCursorPosition)({
|
|
326
326
|
editorElement: editorRef.current,
|
|
@@ -332,7 +332,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
332
332
|
editorRef.current.dispatchEvent(newEvent);
|
|
333
333
|
}
|
|
334
334
|
}, []);
|
|
335
|
-
const handleReplaceText = (0,
|
|
335
|
+
const handleReplaceText = (0, _react2.useCallback)((searchText, pasteText) => {
|
|
336
336
|
if (editorRef.current) {
|
|
337
337
|
(0, _insert.replaceText)({
|
|
338
338
|
editorElement: editorRef.current,
|
|
@@ -345,19 +345,19 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
345
345
|
editorRef.current.dispatchEvent(newEvent);
|
|
346
346
|
}
|
|
347
347
|
}, []);
|
|
348
|
-
const handleStartProgress = (0,
|
|
348
|
+
const handleStartProgress = (0, _react2.useCallback)(duration => {
|
|
349
349
|
setProgressDuration(duration);
|
|
350
350
|
}, []);
|
|
351
|
-
const handleStopProgress = (0,
|
|
351
|
+
const handleStopProgress = (0, _react2.useCallback)(() => {
|
|
352
352
|
setProgressDuration(0);
|
|
353
353
|
}, []);
|
|
354
|
-
(0,
|
|
354
|
+
(0, _react2.useImperativeHandle)(ref, () => ({
|
|
355
355
|
insertTextAtCursorPosition: handleInsertTextAtCursorPosition,
|
|
356
356
|
replaceText: handleReplaceText,
|
|
357
357
|
startProgress: handleStartProgress,
|
|
358
358
|
stopProgress: handleStopProgress
|
|
359
359
|
}), [handleInsertTextAtCursorPosition, handleReplaceText, handleStartProgress, handleStopProgress]);
|
|
360
|
-
(0,
|
|
360
|
+
(0, _react2.useEffect)(() => {
|
|
361
361
|
/**
|
|
362
362
|
* This function ensures that the input field does not lose focus when the popup is opened
|
|
363
363
|
* or an emoji is selected in it. For this purpose the corresponding elements get the class
|
|
@@ -379,7 +379,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
379
379
|
document.body.removeEventListener('mousedown', handlePreventLoseFocus);
|
|
380
380
|
};
|
|
381
381
|
}, []);
|
|
382
|
-
const shouldShowPlaceholder = (0,
|
|
382
|
+
const shouldShowPlaceholder = (0, _react2.useMemo)(() => {
|
|
383
383
|
var _editorRef$current2;
|
|
384
384
|
if (!isPrefixAnimationFinished) {
|
|
385
385
|
return false;
|
|
@@ -396,7 +396,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
396
396
|
return false;
|
|
397
397
|
}
|
|
398
398
|
}, [isPrefixAnimationFinished, hasFocus, plainTextValue, prefixElement, shouldHidePlaceholderOnFocus, prefixElementWidth]);
|
|
399
|
-
(0,
|
|
399
|
+
(0, _react2.useEffect)(() => {
|
|
400
400
|
if (prefixElement) {
|
|
401
401
|
setIsPrefixAnimationFinished(false);
|
|
402
402
|
}
|
|
@@ -413,7 +413,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
413
413
|
}
|
|
414
414
|
setHasFocus(false);
|
|
415
415
|
};
|
|
416
|
-
(0,
|
|
416
|
+
(0, _react2.useEffect)(() => {
|
|
417
417
|
if (editorRef.current && prefixElement) {
|
|
418
418
|
const text = (0, _emoji.convertEmojisToUnicode)(prefixElement);
|
|
419
419
|
(0, _insert.insertTextAtCursorPosition)({
|
|
@@ -424,7 +424,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
424
424
|
hasPrefixRendered.current = true;
|
|
425
425
|
}
|
|
426
426
|
}, [handleUpdateHTML, prefixElement]);
|
|
427
|
-
(0,
|
|
427
|
+
(0, _react2.useEffect)(() => {
|
|
428
428
|
var _editorRef$current3;
|
|
429
429
|
if (prefixElementRef.current && prefixElement && (0, _text.convertTextToHTML)(prefixElement) === ((_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.innerHTML)) {
|
|
430
430
|
setPrefixElementWidth(prefixElementRef.current.offsetWidth + 2);
|
|
@@ -432,7 +432,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
432
432
|
setPrefixElementWidth(undefined);
|
|
433
433
|
}
|
|
434
434
|
}, [plainTextValue, prefixElement]);
|
|
435
|
-
(0,
|
|
435
|
+
(0, _react2.useEffect)(() => {
|
|
436
436
|
const handleResize = () => {
|
|
437
437
|
if (editorRef.current) {
|
|
438
438
|
setLabelWidth(editorRef.current.offsetWidth);
|
|
@@ -446,7 +446,7 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
446
446
|
resizeObserver.disconnect();
|
|
447
447
|
};
|
|
448
448
|
}, []);
|
|
449
|
-
(0,
|
|
449
|
+
(0, _react2.useEffect)(() => {
|
|
450
450
|
const blurElement = () => {
|
|
451
451
|
if (editorRef.current && document.activeElement === editorRef.current && isDisabled) {
|
|
452
452
|
editorRef.current.blur();
|
|
@@ -457,12 +457,12 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
457
457
|
document.removeEventListener('focus', blurElement, true);
|
|
458
458
|
};
|
|
459
459
|
}, [isDisabled]);
|
|
460
|
-
return /*#__PURE__*/
|
|
460
|
+
return /*#__PURE__*/_react2.default.createElement(_EmojiInput.StyledEmojiInput, {
|
|
461
461
|
$isDisabled: isDisabled,
|
|
462
462
|
$shouldChangeColor: shouldChangeColor
|
|
463
|
-
}, /*#__PURE__*/
|
|
463
|
+
}, /*#__PURE__*/_react2.default.createElement(_react.AnimatePresence, {
|
|
464
464
|
initial: true
|
|
465
|
-
}, progressDuration > 0 && /*#__PURE__*/
|
|
465
|
+
}, progressDuration > 0 && /*#__PURE__*/_react2.default.createElement(_EmojiInput.StyledMotionEmojiInputProgress, {
|
|
466
466
|
animate: {
|
|
467
467
|
width: '100%'
|
|
468
468
|
},
|
|
@@ -483,12 +483,12 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
483
483
|
duration: 0.3
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
})), /*#__PURE__*/
|
|
486
|
+
})), /*#__PURE__*/_react2.default.createElement(_EmojiInput.StyledEmojiInputContent, null, prefixElement && /*#__PURE__*/_react2.default.createElement(_PrefixElement.default, {
|
|
487
487
|
key: prefixElement,
|
|
488
488
|
element: prefixElement,
|
|
489
489
|
prefixElementRef: prefixElementRef,
|
|
490
490
|
setIsPrefixAnimationFinished: setIsPrefixAnimationFinished
|
|
491
|
-
}), /*#__PURE__*/
|
|
491
|
+
}), /*#__PURE__*/_react2.default.createElement(_EmojiInput.StyledMotionEmojiInputEditor, {
|
|
492
492
|
$browser: browser === null || browser === void 0 ? void 0 : browser.name,
|
|
493
493
|
animate: {
|
|
494
494
|
maxHeight: height ?? maxHeight,
|
|
@@ -509,15 +509,15 @@ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
509
509
|
type: 'tween',
|
|
510
510
|
duration: 0.2
|
|
511
511
|
}
|
|
512
|
-
}), shouldShowPlaceholder && /*#__PURE__*/
|
|
512
|
+
}), shouldShowPlaceholder && /*#__PURE__*/_react2.default.createElement(_EmojiInput.StyledEmojiInputLabel, {
|
|
513
513
|
$maxWidth: labelWidth,
|
|
514
514
|
$offsetWidth: prefixElementWidth
|
|
515
|
-
}, placeholder), !isTouch && !shouldPreventEmojiPicker && /*#__PURE__*/
|
|
515
|
+
}, placeholder), !isTouch && !shouldPreventEmojiPicker && /*#__PURE__*/_react2.default.createElement(_EmojiPickerPopup.default, {
|
|
516
516
|
accessToken: accessToken,
|
|
517
517
|
onSelect: handlePopupSelect,
|
|
518
518
|
onPopupVisibilityChange: handlePopupVisibility,
|
|
519
519
|
personId: personId
|
|
520
|
-
})), rightElement && /*#__PURE__*/
|
|
520
|
+
})), rightElement && /*#__PURE__*/_react2.default.createElement(_EmojiInput.StyledEmojiInputRightWrapper, null, rightElement));
|
|
521
521
|
});
|
|
522
522
|
EmojiInput.displayName = 'EmojiInput';
|
|
523
523
|
var _default = exports.default = EmojiInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiInput.js","names":["_core","require","_chaynsApi","_framerMotion","_react","_interopRequireWildcard","_emoji","_insert","_selection","_text","_EmojiPickerPopup","_interopRequireDefault","_EmojiInput","_PrefixElement","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","EmojiInput","forwardRef","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPrefixElementRemove","onPopupVisibilityChange","personId","placeholder","popupAlignment","prefixElement","rightElement","shouldHidePlaceholderOnFocus","shouldPreventEmojiPicker","value","ref","isTouch","useState","getIsTouch","plainTextValue","setPlainTextValue","hasFocus","setHasFocus","progressDuration","setProgressDuration","labelWidth","setLabelWidth","isPopupVisible","setIsPopupVisible","isPrefixAnimationFinished","setIsPrefixAnimationFinished","prefixElementWidth","setPrefixElementWidth","textLength","setTextLength","areaProvider","useContext","AreaContext","editorRef","useRef","prefixElementRef","hasPrefixRendered","hasPrefixChanged","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","browser","getDevice","shouldChangeColor","useMemo","handleUpdateHTML","useCallback","html","current","newInnerHTML","convertEmojisToUnicode","convertTextToHTML","innerHTML","saveSelection","shouldIgnoreEmptyTextNodes","restoreSelection","handleBeforeInput","event","preventDefault","stopPropagation","data","type","nativeEvent","includes","text","insertTextAtCursorPosition","editorElement","newEvent","Event","bubbles","dispatchEvent","handleInput","insertInvisibleCursorMarker","document","execCommand","convertHTMLToText","handleKeyDown","key","isPropagationStopped","charCodeThatWillBeDeleted","getCharCodeThatWillBeDeleted","handlePopupVisibility","isVisible","handlePaste","clipboardData","getData","escapeHTML","handleDrop","_event$dataTransfer","dataTransfer","handlePopupSelect","emoji","shouldUseSavedSelection","_editorRef$current","convertedText","replace","convertedPrefix","length","handleInsertTextAtCursorPosition","handleReplaceText","searchText","pasteText","replaceText","handleStartProgress","duration","handleStopProgress","useImperativeHandle","startProgress","stopProgress","handlePreventLoseFocus","_element$parentElemen","_element$parentElemen2","element","target","classList","contains","parentElement","body","addEventListener","removeEventListener","shouldShowPlaceholder","_editorRef$current2","isJustPrefixElement","shouldRenderPlaceholder","handleFocus","handleBlur","_editorRef$current3","offsetWidth","undefined","handleResize","resizeObserver","ResizeObserver","observe","disconnect","blurElement","activeElement","blur","createElement","StyledEmojiInput","$isDisabled","$shouldChangeColor","AnimatePresence","initial","StyledMotionEmojiInputProgress","animate","width","exit","opacity","transition","ease","StyledEmojiInputContent","StyledMotionEmojiInputEditor","$browser","name","minHeight","contentEditable","id","onBeforeInput","onPaste","onDrop","$shouldShowContent","StyledEmojiInputLabel","$maxWidth","$offsetWidth","onSelect","StyledEmojiInputRightWrapper","displayName","_default","exports"],"sources":["../../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import { AreaContext, BrowserName, getIsTouch } from '@chayns-components/core';\nimport { getDevice } from 'chayns-api';\nimport { AnimatePresence } from 'framer-motion';\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};\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 = true,\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 // 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 ' ',\n ' ',\n );\n const convertedPrefix = prefixElement && prefixElement.replace(' ', ' ');\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 }),\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,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAsBA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAMA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAQA,IAAAY,cAAA,GAAAF,sBAAA,CAAAV,OAAA;AAA2D,SAAAU,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA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Y;IACzB6K,QAAQ,EAAE1E,iBAAkB;IAC5BzF,uBAAuB,EAAEgF,qBAAsB;IAC/C/E,QAAQ,EAAEA;EAAS,CACtB,CAEgB,CAAC,EACzBI,YAAY,iBACTnD,MAAA,CAAAY,OAAA,CAAA0K,aAAA,CAAC9K,WAAA,CAAA0M,4BAA4B,QAAE/J,YAA2C,CAEhE,CAAC;AAE3B,CACJ,CAAC;AAEDjB,UAAU,CAACiL,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzM,OAAA,GAEvBsB,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"EmojiInput.js","names":["_core","require","_chaynsApi","_react","_react2","_interopRequireWildcard","_emoji","_insert","_selection","_text","_EmojiPickerPopup","_interopRequireDefault","_EmojiInput","_PrefixElement","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useIsomorphicLayoutEffect","window","useLayoutEffect","useEffect","EmojiInput","forwardRef","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPrefixElementRemove","onPopupVisibilityChange","personId","placeholder","popupAlignment","prefixElement","rightElement","shouldHidePlaceholderOnFocus","shouldPreventEmojiPicker","value","ref","isTouch","useState","getIsTouch","plainTextValue","setPlainTextValue","hasFocus","setHasFocus","progressDuration","setProgressDuration","labelWidth","setLabelWidth","isPopupVisible","setIsPopupVisible","isPrefixAnimationFinished","setIsPrefixAnimationFinished","prefixElementWidth","setPrefixElementWidth","textLength","setTextLength","areaProvider","useContext","AreaContext","editorRef","useRef","prefixElementRef","hasPrefixRendered","hasPrefixChanged","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","browser","getDevice","shouldChangeColor","useMemo","handleUpdateHTML","useCallback","html","current","newInnerHTML","convertEmojisToUnicode","convertTextToHTML","innerHTML","saveSelection","shouldIgnoreEmptyTextNodes","restoreSelection","handleBeforeInput","event","preventDefault","stopPropagation","data","type","nativeEvent","includes","text","insertTextAtCursorPosition","editorElement","newEvent","Event","bubbles","dispatchEvent","handleInput","insertInvisibleCursorMarker","document","execCommand","convertHTMLToText","handleKeyDown","key","isPropagationStopped","charCodeThatWillBeDeleted","getCharCodeThatWillBeDeleted","handlePopupVisibility","isVisible","handlePaste","clipboardData","getData","escapeHTML","handleDrop","_event$dataTransfer","dataTransfer","handlePopupSelect","emoji","shouldUseSavedSelection","_editorRef$current","convertedText","replace","convertedPrefix","length","handleInsertTextAtCursorPosition","handleReplaceText","searchText","pasteText","replaceText","handleStartProgress","duration","handleStopProgress","useImperativeHandle","startProgress","stopProgress","handlePreventLoseFocus","_element$parentElemen","_element$parentElemen2","element","target","classList","contains","parentElement","body","addEventListener","removeEventListener","shouldShowPlaceholder","_editorRef$current2","isJustPrefixElement","shouldRenderPlaceholder","handleFocus","handleBlur","_editorRef$current3","offsetWidth","undefined","handleResize","resizeObserver","ResizeObserver","observe","disconnect","blurElement","activeElement","blur","createElement","StyledEmojiInput","$isDisabled","$shouldChangeColor","AnimatePresence","initial","StyledMotionEmojiInputProgress","animate","width","exit","opacity","transition","ease","StyledEmojiInputContent","StyledMotionEmojiInputEditor","$browser","name","minHeight","contentEditable","id","onBeforeInput","onPaste","onDrop","$shouldShowContent","StyledEmojiInputLabel","$maxWidth","$offsetWidth","onSelect","StyledEmojiInputRightWrapper","displayName","_default","exports"],"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};\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 = true,\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 // 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 ' ',\n ' ',\n );\n const convertedPrefix = prefixElement && prefixElement.replace(' ', ' ');\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 }),\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,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAsBA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAMA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAQA,IAAAY,cAAA,GAAAF,sBAAA,CAAAV,OAAA;AAA2D,SAAAU,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA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F,uBAAuB,EAAEgF,qBAAsB;IAC/C/E,QAAQ,EAAEA;EAAS,CACtB,CAEgB,CAAC,EACzBI,YAAY,iBACTnD,OAAA,CAAAY,OAAA,CAAA0K,aAAA,CAAC9K,WAAA,CAAA0M,4BAA4B,QAAE/J,YAA2C,CAEhE,CAAC;AAE3B,CACJ,CAAC;AAEDjB,UAAU,CAACiL,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzM,OAAA,GAEvBsB,UAAU","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.StyledMotionEmojiInputProgress = exports.StyledMotionEmojiInputEditor = exports.StyledEmojiInputRightWrapper = exports.StyledEmojiInputLabel = exports.StyledEmojiInputContent = exports.StyledEmojiInput = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("motion/react");
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
var _font = require("../../utils/font");
|
|
10
10
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -28,7 +28,7 @@ const StyledEmojiInput = exports.StyledEmojiInput = _styledComponents.default.di
|
|
|
28
28
|
position: relative;
|
|
29
29
|
transition: opacity 0.3s ease;
|
|
30
30
|
`;
|
|
31
|
-
const StyledMotionEmojiInputProgress = exports.StyledMotionEmojiInputProgress = (0, _styledComponents.default)(
|
|
31
|
+
const StyledMotionEmojiInputProgress = exports.StyledMotionEmojiInputProgress = (0, _styledComponents.default)(_react.motion.div)`
|
|
32
32
|
background-color: ${({
|
|
33
33
|
theme
|
|
34
34
|
}) => theme['402']};
|
|
@@ -46,7 +46,7 @@ const StyledEmojiInputContent = exports.StyledEmojiInputContent = _styledCompone
|
|
|
46
46
|
padding: 8px 10px;
|
|
47
47
|
z-index: 3;
|
|
48
48
|
`;
|
|
49
|
-
const StyledMotionEmojiInputEditor = exports.StyledMotionEmojiInputEditor = (0, _styledComponents.default)(
|
|
49
|
+
const StyledMotionEmojiInputEditor = exports.StyledMotionEmojiInputEditor = (0, _styledComponents.default)(_react.motion.div)`
|
|
50
50
|
color: ${({
|
|
51
51
|
theme,
|
|
52
52
|
$shouldShowContent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiInput.styles.js","names":["
|
|
1
|
+
{"version":3,"file":"EmojiInput.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_font","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledEmojiInput","exports","styled","div","theme","$shouldChangeColor","colorMode","$isDisabled","StyledMotionEmojiInputProgress","motion","StyledEmojiInputContent","StyledMotionEmojiInputEditor","$shouldShowContent","text","getFontFamily","$browser","css","StyledEmojiInputRightWrapper","StyledEmojiInputLabel","label","$offsetWidth","$maxWidth"],"sources":["../../../../src/components/emoji-input/EmojiInput.styles.ts"],"sourcesContent":["import type { BrowserName, WithTheme } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { getFontFamily } from '../../utils/font';\n\ntype StyledEmojiInputProps = WithTheme<{ $isDisabled?: boolean; $shouldChangeColor: boolean }>;\n\nexport const StyledEmojiInput = styled.div<StyledEmojiInputProps>`\n align-items: center;\n background-color: ${({ theme, $shouldChangeColor }: StyledEmojiInputProps) =>\n theme.colorMode === 'classic' || $shouldChangeColor ? theme['000'] : theme['100']};\n border-radius: 3px;\n display: flex;\n border: 1px solid rgba(160, 160, 160, 0.3);\n min-height: 42px;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n pointer-events: ${({ $isDisabled }) => ($isDisabled ? 'none' : 'initial')};\n position: relative;\n transition: opacity 0.3s ease;\n`;\n\ntype StyledMotionEmojiInputProgressProps = WithTheme<unknown>;\n\nexport const StyledMotionEmojiInputProgress = styled(\n motion.div,\n)<StyledMotionEmojiInputProgressProps>`\n background-color: ${({ theme }: StyledMotionEmojiInputProgressProps) => theme['402']};\n height: 100%;\n position: absolute;\n z-index: 2;\n border-radius: 3px;\n`;\n\nexport const StyledEmojiInputContent = styled.div`\n align-items: end;\n border-radius: 3px;\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n padding: 8px 10px;\n z-index: 3;\n`;\n\ntype StyledEmojiInputEditorProps = WithTheme<{\n $shouldShowContent: boolean;\n $browser: BrowserName;\n}>;\n\nexport const StyledMotionEmojiInputEditor = styled(motion.div)<StyledEmojiInputEditorProps>`\n color: ${({ theme, $shouldShowContent }: StyledEmojiInputEditorProps) =>\n $shouldShowContent ? theme.text : theme['100']};\n flex: 1 1 auto;\n font-family: ${getFontFamily};\n overflow-y: scroll;\n overflow-x: hidden;\n word-break: break-word;\n\n // This fixes a bug where the field is not editable in certain browsers.\n // This is for example the case on iOS 15 or older.\n -webkit-user-modify: read-write;\n -webkit-user-select: text;\n\n lc_mention,\n nerIgnore,\n nerReplace {\n font-weight: bold;\n\n span {\n opacity: 0.5;\n }\n }\n\n // Styles for custom scrollbar\n ${({ $browser, theme }: StyledEmojiInputEditorProps) =>\n $browser === 'firefox'\n ? css`\n scrollbar-color: rgba(${theme['text-rgb']}, 0.15) transparent;\n scrollbar-width: thin;\n `\n : css`\n &::-webkit-scrollbar {\n width: 5px;\n }\n\n &::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-button {\n background-color: transparent;\n height: 5px;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: rgba(${theme['text-rgb']}, 0.15);\n border-radius: 20px;\n }\n `}\n`;\n\nexport const StyledEmojiInputRightWrapper = styled.div`\n align-self: stretch;\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n flex: 0 0 auto;\n overflow: hidden;\n`;\n\ntype StyledEmojiInputLabelProps = WithTheme<{\n $maxWidth: number;\n $offsetWidth?: number;\n}>;\n\nexport const StyledEmojiInputLabel = styled.label<StyledEmojiInputLabelProps>`\n color: rgba(${({ theme }: StyledEmojiInputLabelProps) => theme['text-rgb']}, 0.45);\n left: ${({ $offsetWidth }) => ($offsetWidth ? `${$offsetWidth + 10}px` : '10px')};\n top: 12px;\n align-items: baseline;\n display: flex;\n flex: 0 0 auto;\n gap: 4px;\n line-height: 1.3;\n pointer-events: none;\n position: absolute;\n user-select: none;\n white-space: nowrap;\n max-width: ${({ $maxWidth, $offsetWidth }) => `${$maxWidth - ($offsetWidth ?? 0)}px`};\n overflow: hidden;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAiD,SAAAI,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,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA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