@chayns-components/emoji-input 5.0.0-beta.1004 → 5.0.0-beta.1007
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 +5 -4
package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.StyledMotionEmojiPickerCategory = exports.StyledEmojiPickerCategories = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("motion/react");
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
var _font = require("../../../utils/font");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -17,7 +17,7 @@ const StyledEmojiPickerCategories = exports.StyledEmojiPickerCategories = _style
|
|
|
17
17
|
padding-top: 10px;
|
|
18
18
|
width: 100%;
|
|
19
19
|
`;
|
|
20
|
-
const StyledMotionEmojiPickerCategory = exports.StyledMotionEmojiPickerCategory = (0, _styledComponents.default)(
|
|
20
|
+
const StyledMotionEmojiPickerCategory = exports.StyledMotionEmojiPickerCategory = (0, _styledComponents.default)(_react.motion.div)`
|
|
21
21
|
cursor: pointer;
|
|
22
22
|
font-family: ${_font.getFontFamily};
|
|
23
23
|
font-size: 20px;
|
package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiPickerCategories.styles.js","names":["
|
|
1
|
+
{"version":3,"file":"EmojiPickerCategories.styles.js","names":["_react","require","_styledComponents","_interopRequireDefault","_font","e","__esModule","default","StyledEmojiPickerCategories","exports","styled","div","StyledMotionEmojiPickerCategory","motion","getFontFamily"],"sources":["../../../../../src/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled from 'styled-components';\nimport { getFontFamily } from '../../../utils/font';\n\nexport const StyledEmojiPickerCategories = styled.div`\n align-items: center;\n border-top: 1px solid rgba(160, 160, 160, 0.3);\n display: flex;\n flex: 0 0 auto;\n justify-content: space-between;\n padding-top: 10px;\n width: 100%;\n`;\n\nexport const StyledMotionEmojiPickerCategory = styled(motion.div)<FramerMotionBugFix>`\n cursor: pointer;\n font-family: ${getFontFamily};\n font-size: 20px;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAoD,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE7C,MAAMG,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAGE,yBAAM,CAACC,GAAG;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,+BAA+B,GAAAH,OAAA,CAAAG,+BAAA,GAAG,IAAAF,yBAAM,EAACG,aAAM,CAACF,GAAG,CAAqB;AACrF;AACA,mBAAmBG,mBAAa;AAChC;AACA,CAAC","ignoreList":[]}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _react = require("motion/react");
|
|
8
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _alignment = require("../../../../constants/alignment");
|
|
10
10
|
var _Emoji = require("./Emoji.styles");
|
|
11
11
|
var _SkinTonePopup = _interopRequireDefault(require("./skin-tone-popup/SkinTonePopup"));
|
|
@@ -24,21 +24,21 @@ const Emoji = ({
|
|
|
24
24
|
onRightClick,
|
|
25
25
|
index
|
|
26
26
|
}) => {
|
|
27
|
-
const [shouldShowPopup, setShouldShowPopup] = (0,
|
|
28
|
-
const [skinTonePopupAnchorAlignment, setSkinTonePopupAnchorAlignment] = (0,
|
|
29
|
-
const [skinTonePopupAnchorOffset, setSkinTonePopupAnchorOffset] = (0,
|
|
30
|
-
const [skinTonePopupOverlayPosition, setSkinTonePopupOverlayPosition] = (0,
|
|
27
|
+
const [shouldShowPopup, setShouldShowPopup] = (0, _react2.useState)(false);
|
|
28
|
+
const [skinTonePopupAnchorAlignment, setSkinTonePopupAnchorAlignment] = (0, _react2.useState)(_alignment.AnchorAlignment.Top);
|
|
29
|
+
const [skinTonePopupAnchorOffset, setSkinTonePopupAnchorOffset] = (0, _react2.useState)(0);
|
|
30
|
+
const [skinTonePopupOverlayPosition, setSkinTonePopupOverlayPosition] = (0, _react2.useState)({
|
|
31
31
|
top: 0
|
|
32
32
|
});
|
|
33
|
-
const [skinTonePopupPosition, setSkinTonePopupPosition] = (0,
|
|
33
|
+
const [skinTonePopupPosition, setSkinTonePopupPosition] = (0, _react2.useState)({
|
|
34
34
|
left: 0,
|
|
35
35
|
top: 0
|
|
36
36
|
});
|
|
37
|
-
const emojiRef = (0,
|
|
38
|
-
const handleClick = (0,
|
|
37
|
+
const emojiRef = (0, _react2.useRef)(null);
|
|
38
|
+
const handleClick = (0, _react2.useCallback)(() => {
|
|
39
39
|
onSelect(emoji);
|
|
40
40
|
}, [emoji, onSelect]);
|
|
41
|
-
const calculatePopupPosition = (0,
|
|
41
|
+
const calculatePopupPosition = (0, _react2.useCallback)(() => {
|
|
42
42
|
if (!emojiRef.current) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
@@ -93,7 +93,7 @@ const Emoji = ({
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}, [isSkinToneSupported]);
|
|
96
|
-
const handleContextMenu = (0,
|
|
96
|
+
const handleContextMenu = (0, _react2.useCallback)(event => {
|
|
97
97
|
event.preventDefault();
|
|
98
98
|
event.stopPropagation();
|
|
99
99
|
if (isSkinToneSupported) {
|
|
@@ -101,23 +101,23 @@ const Emoji = ({
|
|
|
101
101
|
calculatePopupPosition();
|
|
102
102
|
}
|
|
103
103
|
}, [calculatePopupPosition, index, isSkinToneSupported, onRightClick]);
|
|
104
|
-
(0,
|
|
104
|
+
(0, _react2.useEffect)(() => {
|
|
105
105
|
if (emojiRef.current && shouldShowSkinTonePopup && skinTonePopupPosition.top === 0 && skinTonePopupPosition.left === 0) {
|
|
106
106
|
calculatePopupPosition();
|
|
107
107
|
}
|
|
108
108
|
}, [calculatePopupPosition, index, isSkinToneSupported, shouldShowSkinTonePopup, skinTonePopupPosition]);
|
|
109
|
-
(0,
|
|
109
|
+
(0, _react2.useEffect)(() => {
|
|
110
110
|
if (shouldShowSkinTonePopup) {
|
|
111
111
|
setShouldShowPopup(shouldShowSkinTonePopup);
|
|
112
112
|
}
|
|
113
113
|
}, [shouldShowSkinTonePopup]);
|
|
114
|
-
const handleHidePopup = (0,
|
|
114
|
+
const handleHidePopup = (0, _react2.useCallback)(() => {
|
|
115
115
|
setShouldShowPopup(false);
|
|
116
116
|
}, []);
|
|
117
|
-
(0,
|
|
117
|
+
(0, _react2.useEffect)(() => {
|
|
118
118
|
onPopupVisibilityChange(shouldShowPopup);
|
|
119
119
|
}, [onPopupVisibilityChange, shouldShowPopup]);
|
|
120
|
-
return /*#__PURE__*/
|
|
120
|
+
return /*#__PURE__*/_react2.default.createElement(_Emoji.StyledEmoji, {
|
|
121
121
|
ref: emojiRef,
|
|
122
122
|
$isSelected: isSelected,
|
|
123
123
|
"data-emoji": emoji,
|
|
@@ -126,9 +126,9 @@ const Emoji = ({
|
|
|
126
126
|
className: "prevent-lose-focus",
|
|
127
127
|
onClick: handleClick,
|
|
128
128
|
onContextMenu: handleContextMenu
|
|
129
|
-
}, emoji, /*#__PURE__*/
|
|
129
|
+
}, emoji, /*#__PURE__*/_react2.default.createElement(_react.AnimatePresence, {
|
|
130
130
|
initial: false
|
|
131
|
-
}, shouldShowPopup && /*#__PURE__*/
|
|
131
|
+
}, shouldShowPopup && /*#__PURE__*/_react2.default.createElement(_SkinTonePopup.default, {
|
|
132
132
|
anchorAlignment: skinTonePopupAnchorAlignment,
|
|
133
133
|
anchorOffset: skinTonePopupAnchorOffset,
|
|
134
134
|
emoji: emoji,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emoji.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_alignment","_Emoji","_SkinTonePopup","_interopRequireDefault","_SkinTonePopup2","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Emoji","emoji","isSelected","name","isSkinToneSupported","onPopupVisibilityChange","onSelect","shouldShowSkinTonePopup","onRightClick","index","shouldShowPopup","setShouldShowPopup","useState","skinTonePopupAnchorAlignment","setSkinTonePopupAnchorAlignment","AnchorAlignment","Top","skinTonePopupAnchorOffset","setSkinTonePopupAnchorOffset","skinTonePopupOverlayPosition","setSkinTonePopupOverlayPosition","top","skinTonePopupPosition","setSkinTonePopupPosition","left","emojiRef","useRef","handleClick","useCallback","calculatePopupPosition","current","element","parentElement","height","elementHeight","elementLeft","elementTop","width","elementWidth","getBoundingClientRect","parentHeight","parentLeft","parentTop","parentWidth","scrollTop","anchorAlignment","anchorOffset","skinTonePopupContentSize","maxLeft","minLeft","Bottom","handleContextMenu","event","preventDefault","stopPropagation","useEffect","handleHidePopup","createElement","StyledEmoji","ref","$isSelected","className","onClick","onContextMenu","AnimatePresence","initial","key","onHidePopup","overlayPosition","position","displayName","_default","exports"],"sources":["../../../../../../src/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { FC, MouseEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport { AnchorAlignment } from '../../../../constants/alignment';\nimport { StyledEmoji } from './Emoji.styles';\nimport SkinTonePopup, { SkinTonePopupProps } from './skin-tone-popup/SkinTonePopup';\nimport { skinTonePopupContentSize } from './skin-tone-popup/SkinTonePopup.styles';\n\nexport type EmojiProps = {\n emoji: string;\n isSelected: boolean;\n name: string;\n index: number;\n isSkinToneSupported: boolean;\n onPopupVisibilityChange: (isVisible: boolean) => void;\n onSelect: (emoji: string) => void;\n onRightClick: (newIndex: number) => void;\n shouldShowSkinTonePopup: boolean;\n};\n\nconst Emoji: FC<EmojiProps> = ({\n emoji,\n isSelected,\n name,\n isSkinToneSupported,\n onPopupVisibilityChange,\n onSelect,\n shouldShowSkinTonePopup,\n onRightClick,\n index,\n}) => {\n const [shouldShowPopup, setShouldShowPopup] = useState(false);\n const [skinTonePopupAnchorAlignment, setSkinTonePopupAnchorAlignment] = useState(\n AnchorAlignment.Top,\n );\n const [skinTonePopupAnchorOffset, setSkinTonePopupAnchorOffset] = useState(0);\n const [skinTonePopupOverlayPosition, setSkinTonePopupOverlayPosition] = useState<\n SkinTonePopupProps['overlayPosition']\n >({ top: 0 });\n const [skinTonePopupPosition, setSkinTonePopupPosition] = useState<\n SkinTonePopupProps['position']\n >({ left: 0, top: 0 });\n\n const emojiRef = useRef<HTMLDivElement>(null);\n\n const handleClick = useCallback(() => {\n onSelect(emoji);\n }, [emoji, onSelect]);\n\n const calculatePopupPosition = useCallback(() => {\n if (!emojiRef.current) {\n return;\n }\n\n const element = emojiRef.current;\n const { parentElement } = emojiRef.current;\n\n if (parentElement) {\n const {\n height: elementHeight,\n left: elementLeft,\n top: elementTop,\n width: elementWidth,\n } = element.getBoundingClientRect();\n\n const {\n height: parentHeight,\n left: parentLeft,\n top: parentTop,\n width: parentWidth,\n } = parentElement.getBoundingClientRect();\n\n const { scrollTop } = parentElement;\n\n let anchorAlignment = AnchorAlignment.Top;\n let anchorOffset = 0;\n\n let left =\n elementLeft - parentLeft - skinTonePopupContentSize.width / 2 + elementWidth / 2;\n\n let top = elementTop - parentTop + elementHeight + scrollTop;\n\n const maxLeft = parentWidth - skinTonePopupContentSize.width - 12;\n const minLeft = 12;\n\n if (left < minLeft) {\n anchorOffset = left - minLeft;\n left = minLeft;\n } else if (left > maxLeft) {\n anchorOffset = left - maxLeft;\n left = maxLeft;\n }\n\n if (top + skinTonePopupContentSize.height > parentHeight + scrollTop) {\n anchorAlignment = AnchorAlignment.Bottom;\n top -= elementHeight + skinTonePopupContentSize.height;\n }\n\n if (isSkinToneSupported) {\n setSkinTonePopupAnchorAlignment(anchorAlignment);\n setSkinTonePopupAnchorOffset(anchorOffset);\n setSkinTonePopupPosition({ left, top });\n setSkinTonePopupOverlayPosition({ top: scrollTop });\n setShouldShowPopup(true);\n }\n }\n }, [isSkinToneSupported]);\n\n const handleContextMenu = useCallback(\n (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (isSkinToneSupported) {\n onRightClick(index);\n calculatePopupPosition();\n }\n },\n [calculatePopupPosition, index, isSkinToneSupported, onRightClick],\n );\n\n useEffect(() => {\n if (\n emojiRef.current &&\n shouldShowSkinTonePopup &&\n skinTonePopupPosition.top === 0 &&\n skinTonePopupPosition.left === 0\n ) {\n calculatePopupPosition();\n }\n }, [\n calculatePopupPosition,\n index,\n isSkinToneSupported,\n shouldShowSkinTonePopup,\n skinTonePopupPosition,\n ]);\n\n useEffect(() => {\n if (shouldShowSkinTonePopup) {\n setShouldShowPopup(shouldShowSkinTonePopup);\n }\n }, [shouldShowSkinTonePopup]);\n\n const handleHidePopup = useCallback(() => {\n setShouldShowPopup(false);\n }, []);\n\n useEffect(() => {\n onPopupVisibilityChange(shouldShowPopup);\n }, [onPopupVisibilityChange, shouldShowPopup]);\n\n return (\n <StyledEmoji\n ref={emojiRef}\n $isSelected={isSelected}\n data-emoji={emoji}\n data-name={name}\n data-skin-tone-support={isSkinToneSupported}\n className=\"prevent-lose-focus\"\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n >\n {emoji}\n <AnimatePresence initial={false}>\n {shouldShowPopup && (\n <SkinTonePopup\n anchorAlignment={skinTonePopupAnchorAlignment}\n anchorOffset={skinTonePopupAnchorOffset}\n emoji={emoji}\n key={emoji}\n onHidePopup={handleHidePopup}\n onSelect={onSelect}\n overlayPosition={skinTonePopupOverlayPosition}\n position={skinTonePopupPosition}\n />\n )}\n </AnimatePresence>\n </StyledEmoji>\n );\n};\n\nEmoji.displayName = 'Emoji';\n\nexport default Emoji;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AAAkF,SAAAM,uBAAAE,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,SAAAN,wBAAAM,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,C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AAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1F,OAAA,GAEbkB,KAAK","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Emoji.js","names":["_react","require","_react2","_interopRequireWildcard","_alignment","_Emoji","_SkinTonePopup","_interopRequireDefault","_SkinTonePopup2","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Emoji","emoji","isSelected","name","isSkinToneSupported","onPopupVisibilityChange","onSelect","shouldShowSkinTonePopup","onRightClick","index","shouldShowPopup","setShouldShowPopup","useState","skinTonePopupAnchorAlignment","setSkinTonePopupAnchorAlignment","AnchorAlignment","Top","skinTonePopupAnchorOffset","setSkinTonePopupAnchorOffset","skinTonePopupOverlayPosition","setSkinTonePopupOverlayPosition","top","skinTonePopupPosition","setSkinTonePopupPosition","left","emojiRef","useRef","handleClick","useCallback","calculatePopupPosition","current","element","parentElement","height","elementHeight","elementLeft","elementTop","width","elementWidth","getBoundingClientRect","parentHeight","parentLeft","parentTop","parentWidth","scrollTop","anchorAlignment","anchorOffset","skinTonePopupContentSize","maxLeft","minLeft","Bottom","handleContextMenu","event","preventDefault","stopPropagation","useEffect","handleHidePopup","createElement","StyledEmoji","ref","$isSelected","className","onClick","onContextMenu","AnimatePresence","initial","key","onHidePopup","overlayPosition","position","displayName","_default","exports"],"sources":["../../../../../../src/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { FC, MouseEvent, useCallback, useEffect, useRef, useState } from 'react';\nimport { AnchorAlignment } from '../../../../constants/alignment';\nimport { StyledEmoji } from './Emoji.styles';\nimport SkinTonePopup, { SkinTonePopupProps } from './skin-tone-popup/SkinTonePopup';\nimport { skinTonePopupContentSize } from './skin-tone-popup/SkinTonePopup.styles';\n\nexport type EmojiProps = {\n emoji: string;\n isSelected: boolean;\n name: string;\n index: number;\n isSkinToneSupported: boolean;\n onPopupVisibilityChange: (isVisible: boolean) => void;\n onSelect: (emoji: string) => void;\n onRightClick: (newIndex: number) => void;\n shouldShowSkinTonePopup: boolean;\n};\n\nconst Emoji: FC<EmojiProps> = ({\n emoji,\n isSelected,\n name,\n isSkinToneSupported,\n onPopupVisibilityChange,\n onSelect,\n shouldShowSkinTonePopup,\n onRightClick,\n index,\n}) => {\n const [shouldShowPopup, setShouldShowPopup] = useState(false);\n const [skinTonePopupAnchorAlignment, setSkinTonePopupAnchorAlignment] = useState(\n AnchorAlignment.Top,\n );\n const [skinTonePopupAnchorOffset, setSkinTonePopupAnchorOffset] = useState(0);\n const [skinTonePopupOverlayPosition, setSkinTonePopupOverlayPosition] = useState<\n SkinTonePopupProps['overlayPosition']\n >({ top: 0 });\n const [skinTonePopupPosition, setSkinTonePopupPosition] = useState<\n SkinTonePopupProps['position']\n >({ left: 0, top: 0 });\n\n const emojiRef = useRef<HTMLDivElement>(null);\n\n const handleClick = useCallback(() => {\n onSelect(emoji);\n }, [emoji, onSelect]);\n\n const calculatePopupPosition = useCallback(() => {\n if (!emojiRef.current) {\n return;\n }\n\n const element = emojiRef.current;\n const { parentElement } = emojiRef.current;\n\n if (parentElement) {\n const {\n height: elementHeight,\n left: elementLeft,\n top: elementTop,\n width: elementWidth,\n } = element.getBoundingClientRect();\n\n const {\n height: parentHeight,\n left: parentLeft,\n top: parentTop,\n width: parentWidth,\n } = parentElement.getBoundingClientRect();\n\n const { scrollTop } = parentElement;\n\n let anchorAlignment = AnchorAlignment.Top;\n let anchorOffset = 0;\n\n let left =\n elementLeft - parentLeft - skinTonePopupContentSize.width / 2 + elementWidth / 2;\n\n let top = elementTop - parentTop + elementHeight + scrollTop;\n\n const maxLeft = parentWidth - skinTonePopupContentSize.width - 12;\n const minLeft = 12;\n\n if (left < minLeft) {\n anchorOffset = left - minLeft;\n left = minLeft;\n } else if (left > maxLeft) {\n anchorOffset = left - maxLeft;\n left = maxLeft;\n }\n\n if (top + skinTonePopupContentSize.height > parentHeight + scrollTop) {\n anchorAlignment = AnchorAlignment.Bottom;\n top -= elementHeight + skinTonePopupContentSize.height;\n }\n\n if (isSkinToneSupported) {\n setSkinTonePopupAnchorAlignment(anchorAlignment);\n setSkinTonePopupAnchorOffset(anchorOffset);\n setSkinTonePopupPosition({ left, top });\n setSkinTonePopupOverlayPosition({ top: scrollTop });\n setShouldShowPopup(true);\n }\n }\n }, [isSkinToneSupported]);\n\n const handleContextMenu = useCallback(\n (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (isSkinToneSupported) {\n onRightClick(index);\n calculatePopupPosition();\n }\n },\n [calculatePopupPosition, index, isSkinToneSupported, onRightClick],\n );\n\n useEffect(() => {\n if (\n emojiRef.current &&\n shouldShowSkinTonePopup &&\n skinTonePopupPosition.top === 0 &&\n skinTonePopupPosition.left === 0\n ) {\n calculatePopupPosition();\n }\n }, [\n calculatePopupPosition,\n index,\n isSkinToneSupported,\n shouldShowSkinTonePopup,\n skinTonePopupPosition,\n ]);\n\n useEffect(() => {\n if (shouldShowSkinTonePopup) {\n setShouldShowPopup(shouldShowSkinTonePopup);\n }\n }, [shouldShowSkinTonePopup]);\n\n const handleHidePopup = useCallback(() => {\n setShouldShowPopup(false);\n }, []);\n\n useEffect(() => {\n onPopupVisibilityChange(shouldShowPopup);\n }, [onPopupVisibilityChange, shouldShowPopup]);\n\n return (\n <StyledEmoji\n ref={emojiRef}\n $isSelected={isSelected}\n data-emoji={emoji}\n data-name={name}\n data-skin-tone-support={isSkinToneSupported}\n className=\"prevent-lose-focus\"\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n >\n {emoji}\n <AnimatePresence initial={false}>\n {shouldShowPopup && (\n <SkinTonePopup\n anchorAlignment={skinTonePopupAnchorAlignment}\n anchorOffset={skinTonePopupAnchorOffset}\n emoji={emoji}\n key={emoji}\n onHidePopup={handleHidePopup}\n onSelect={onSelect}\n overlayPosition={skinTonePopupOverlayPosition}\n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kinTonePopupOverlay = exports.StyledSkinTonePopupContentEmoji = exports.StyledSkinTonePopupContent = exports.StyledMotionSkinTonePopup = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = require("motion/react");
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
var _alignment = require("../../../../../constants/alignment");
|
|
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); }
|
|
11
11
|
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; }
|
|
12
|
-
const StyledMotionSkinTonePopup = exports.StyledMotionSkinTonePopup = (0, _styledComponents.default)(
|
|
12
|
+
const StyledMotionSkinTonePopup = exports.StyledMotionSkinTonePopup = (0, _styledComponents.default)(_react.motion.div)`
|
|
13
13
|
z-index: 1;
|
|
14
14
|
`;
|
|
15
15
|
const skinTonePopupContentSize = exports.skinTonePopupContentSize = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkinTonePopup.styles.js","names":["
|
|
1
|
+
{"version":3,"file":"SkinTonePopup.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_alignment","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","StyledMotionSkinTonePopup","exports","styled","motion","div","skinTonePopupContentSize","height","width","StyledSkinTonePopupContent","theme","$anchorAlignment","$anchorOffset","AnchorAlignment","Bottom","css","Top","undefined","StyledSkinTonePopupContentEmoji","$isSelected","StyledSkinTonePopupOverlay"],"sources":["../../../../../../../src/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix, WithTheme } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { AnchorAlignment } from '../../../../../constants/alignment';\n\nexport const StyledMotionSkinTonePopup = styled(motion.div)<FramerMotionBugFix>`\n z-index: 1;\n`;\n\nexport const skinTonePopupContentSize = {\n height: 48,\n width: 200,\n};\n\ntype StyledSkinTonePopupContentProps = WithTheme<{\n $anchorAlignment: AnchorAlignment;\n $anchorOffset: number;\n}>;\n\nexport const StyledSkinTonePopupContent = styled.div<StyledSkinTonePopupContentProps>`\n align-items: stretch;\n background-color: ${({ theme }: StyledSkinTonePopupContentProps) => theme['001']};\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);\n display: flex;\n height: ${skinTonePopupContentSize.height}px;\n justify-content: stretch;\n position: absolute;\n width: ${skinTonePopupContentSize.width}px;\n z-index: 2;\n\n &::after {\n background-color: inherit;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n border-bottom-right-radius: 3px;\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);\n content: '';\n height: 14px;\n position: absolute;\n width: 14px;\n z-index: -2;\n\n ${({ $anchorAlignment, $anchorOffset }) => {\n switch ($anchorAlignment) {\n case AnchorAlignment.Bottom:\n return css`\n bottom: -7px;\n left: calc(50% - 7px + ${$anchorOffset}px);\n transform: rotate(45deg);\n `;\n case AnchorAlignment.Top:\n return css`\n top: -7px;\n left: calc(50% - 7px + ${$anchorOffset}px);\n transform: rotate(225deg);\n `;\n default:\n return undefined;\n }\n }}\n }\n\n &::before {\n background-color: inherit;\n bottom: 0;\n content: '';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n }\n`;\n\ntype StyledSkinTonePopupContentEmojiProps = WithTheme<{\n $isSelected: boolean;\n}>;\n\nexport const StyledSkinTonePopupContentEmoji = styled.div<StyledSkinTonePopupContentEmojiProps>`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n font-size: 24px;\n justify-content: center;\n background-color: ${({ theme, $isSelected }: StyledSkinTonePopupContentEmojiProps) =>\n $isSelected ? theme['secondary-102'] : 'none'};\n`;\n\nexport const StyledSkinTonePopupOverlay = styled.div`\n cursor: default;\n height: 100%;\n left: 0;\n position: absolute;\n width: 100%;\n z-index: 1;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAqE,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,E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;AACA,qBAAqB;IACL;MACI,OAAOK,SAAS;EACxB;AACJ,CAAC;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAMM,MAAMC,+BAA+B,GAAAhB,OAAA,CAAAgB,+BAAA,GAAGf,yBAAM,CAACE,GAAyC;AAC/F;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEK,KAAK;EAAES;AAAkD,CAAC,KAC7EA,WAAW,GAAGT,KAAK,CAAC,eAAe,CAAC,GAAG,MAAM;AACrD,CAAC;AAEM,MAAMU,0BAA0B,GAAAlB,OAAA,CAAAkB,0BAAA,GAAGjB,yBAAM,CAACE,GAAG;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AreaContext, getIsTouch } from '@chayns-components/core';
|
|
2
2
|
import { getDevice } from 'chayns-api';
|
|
3
|
-
import { AnimatePresence } from '
|
|
3
|
+
import { AnimatePresence } from 'motion/react';
|
|
4
4
|
import React, { forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { convertEmojisToUnicode, escapeHTML } from '../../utils/emoji';
|
|
6
6
|
import { insertTextAtCursorPosition, replaceText } from '../../utils/insert';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiInput.js","names":["AreaContext","getIsTouch","getDevice","AnimatePresence","React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","convertEmojisToUnicode","escapeHTML","insertTextAtCursorPosition","replaceText","getCharCodeThatWillBeDeleted","insertInvisibleCursorMarker","restoreSelection","saveSelection","convertHTMLToText","convertTextToHTML","EmojiPickerPopup","StyledEmojiInput","StyledEmojiInputContent","StyledEmojiInputLabel","StyledEmojiInputRightWrapper","StyledMotionEmojiInputEditor","StyledMotionEmojiInputProgress","PrefixElement","useIsomorphicLayoutEffect","window","EmojiInput","_ref","ref","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPrefixElementRemove","onPopupVisibilityChange","personId","placeholder","popupAlignment","prefixElement","rightElement","shouldHidePlaceholderOnFocus","shouldPreventEmojiPicker","value","isTouch","plainTextValue","setPlainTextValue","hasFocus","setHasFocus","progressDuration","setProgressDuration","labelWidth","setLabelWidth","isPopupVisible","setIsPopupVisible","isPrefixAnimationFinished","setIsPrefixAnimationFinished","prefixElementWidth","setPrefixElementWidth","textLength","setTextLength","areaProvider","editorRef","prefixElementRef","hasPrefixRendered","hasPrefixChanged","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","browser","shouldChangeColor","handleUpdateHTML","html","current","newInnerHTML","innerHTML","shouldIgnoreEmptyTextNodes","handleBeforeInput","event","preventDefault","stopPropagation","data","type","nativeEvent","includes","text","editorElement","newEvent","Event","bubbles","dispatchEvent","handleInput","document","execCommand","handleKeyDown","key","isPropagationStopped","charCodeThatWillBeDeleted","handlePopupVisibility","isVisible","handlePaste","clipboardData","getData","handleDrop","dataTransfer","handlePopupSelect","emoji","shouldUseSavedSelection","convertedText","replace","convertedPrefix","length","handleInsertTextAtCursorPosition","handleReplaceText","searchText","pasteText","handleStartProgress","duration","handleStopProgress","startProgress","stopProgress","handlePreventLoseFocus","element","target","classList","contains","parentElement","body","addEventListener","removeEventListener","shouldShowPlaceholder","isJustPrefixElement","shouldRenderPlaceholder","handleFocus","handleBlur","offsetWidth","undefined","handleResize","resizeObserver","ResizeObserver","observe","disconnect","blurElement","activeElement","blur","createElement","$isDisabled","$shouldChangeColor","initial","animate","width","exit","opacity","transition","ease","$browser","name","minHeight","contentEditable","id","onBeforeInput","onPaste","onDrop","$shouldShowContent","$maxWidth","$offsetWidth","onSelect","displayName"],"sources":["../../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import { AreaContext, BrowserName, getIsTouch } from '@chayns-components/core';\nimport { getDevice } from 'chayns-api';\nimport { AnimatePresence } from '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,SAASA,WAAW,EAAeC,UAAU,QAAQ,yBAAyB;AAC9E,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,eAAe,QAAQ,eAAe;AAC/C,OAAOC,KAAK,IAMRC,UAAU,EAKVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEL,OAAO;AAEd,SAASC,sBAAsB,EAAEC,UAAU,QAAQ,mBAAmB;AACtE,SAASC,0BAA0B,EAAEC,WAAW,QAAQ,oBAAoB;AAC5E,SACIC,4BAA4B,EAC5BC,2BAA2B,EAC3BC,gBAAgB,EAChBC,aAAa,QACV,uBAAuB;AAC9B,SAASC,iBAAiB,EAAEC,iBAAiB,QAAQ,kBAAkB;AACvE,OAAOC,gBAAgB,MAAM,wCAAwC;AACrE,SACIC,gBAAgB,EAChBC,uBAAuB,EACvBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,8BAA8B,QAC3B,qBAAqB;AAC5B,OAAOC,aAAa,MAAM,gCAAgC;AAE1D,MAAMC,yBAAyB,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGvB,eAAe,GAAGF,SAAS;AA8F7F,MAAM0B,UAAU,gBAAG7B,UAAU,CACzB,CAAA8B,IAAA,EAsBIC,GAAG,KACF;E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AAIG,SAAS;MAAEgI,SAAS,EAAEnI,MAAM,IAAI;IAAO,CAAE;IACzEoI,eAAe;IACfC,EAAE,EAAEpI,OAAQ;IACZqI,aAAa,EAAEnF,iBAAkB;IACjC/C,MAAM,EAAEwG,UAAW;IACnBvG,OAAO,EAAEsG,WAAY;IACrBrG,OAAO,EAAE2D,WAAY;IACrB1D,SAAS,EAAE6D,aAAc;IACzBmE,OAAO,EAAE7D,WAAY;IACrB8D,MAAM,EAAE3D,UAAW;IACnB/E,GAAG,EAAEsC,SAAU;IACfqG,kBAAkB,EAAE5G,yBAA0B;IAC9CkG,UAAU,EAAE;MAAEvE,IAAI,EAAE,OAAO;MAAEmC,QAAQ,EAAE;IAAI;EAAE,CAChD,CAAC,EAEDa,qBAAqB,iBAClB1I,KAAA,CAAAyJ,aAAA,CAAClI,qBAAqB;IAClBqJ,SAAS,EAAEjH,UAAW;IACtBkH,YAAY,EAAE5G;EAAmB,GAEhCpB,WACkB,CAC1B,EACA,CAACO,OAAO,IAAI,CAACF,wBAAwB,iBAClClD,KAAA,CAAAyJ,aAAA,CAACrI,gBAAgB;IACba,WAAW,EAAEA,WAAY;IACzB6I,QAAQ,EAAE7D,iBAAkB;IAC5BtE,uBAAuB,EAAE+D,qBAAsB;IAC/C9D,QAAQ,EAAEA;EAAS,CACtB,CAEgB,CAAC,EACzBI,YAAY,iBACThD,KAAA,CAAAyJ,aAAA,CAACjI,4BAA4B,QAAEwB,YAA2C,CAEhE,CAAC;AAE3B,CACJ,CAAC;AAEDlB,UAAU,CAACiJ,WAAW,GAAG,YAAY;AAErC,eAAejJ,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"EmojiInput.js","names":["AreaContext","getIsTouch","getDevice","AnimatePresence","React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","convertEmojisToUnicode","escapeHTML","insertTextAtCursorPosition","replaceText","getCharCodeThatWillBeDeleted","insertInvisibleCursorMarker","restoreSelection","saveSelection","convertHTMLToText","convertTextToHTML","EmojiPickerPopup","StyledEmojiInput","StyledEmojiInputContent","StyledEmojiInputLabel","StyledEmojiInputRightWrapper","StyledMotionEmojiInputEditor","StyledMotionEmojiInputProgress","PrefixElement","useIsomorphicLayoutEffect","window","EmojiInput","_ref","ref","accessToken","height","inputId","isDisabled","maxHeight","onBlur","onFocus","onInput","onKeyDown","onPrefixElementRemove","onPopupVisibilityChange","personId","placeholder","popupAlignment","prefixElement","rightElement","shouldHidePlaceholderOnFocus","shouldPreventEmojiPicker","value","isTouch","plainTextValue","setPlainTextValue","hasFocus","setHasFocus","progressDuration","setProgressDuration","labelWidth","setLabelWidth","isPopupVisible","setIsPopupVisible","isPrefixAnimationFinished","setIsPrefixAnimationFinished","prefixElementWidth","setPrefixElementWidth","textLength","setTextLength","areaProvider","editorRef","prefixElementRef","hasPrefixRendered","hasPrefixChanged","shouldDeleteOneMoreBackwards","shouldDeleteOneMoreForwards","valueRef","browser","shouldChangeColor","handleUpdateHTML","html","current","newInnerHTML","innerHTML","shouldIgnoreEmptyTextNodes","handleBeforeInput","event","preventDefault","stopPropagation","data","type","nativeEvent","includes","text","editorElement","newEvent","Event","bubbles","dispatchEvent","handleInput","document","execCommand","handleKeyDown","key","isPropagationStopped","charCodeThatWillBeDeleted","handlePopupVisibility","isVisible","handlePaste","clipboardData","getData","handleDrop","dataTransfer","handlePopupSelect","emoji","shouldUseSavedSelection","convertedText","replace","convertedPrefix","length","handleInsertTextAtCursorPosition","handleReplaceText","searchText","pasteText","handleStartProgress","duration","handleStopProgress","startProgress","stopProgress","handlePreventLoseFocus","element","target","classList","contains","parentElement","body","addEventListener","removeEventListener","shouldShowPlaceholder","isJustPrefixElement","shouldRenderPlaceholder","handleFocus","handleBlur","offsetWidth","undefined","handleResize","resizeObserver","ResizeObserver","observe","disconnect","blurElement","activeElement","blur","createElement","$isDisabled","$shouldChangeColor","initial","animate","width","exit","opacity","transition","ease","$browser","name","minHeight","contentEditable","id","onBeforeInput","onPaste","onDrop","$shouldShowContent","$maxWidth","$offsetWidth","onSelect","displayName"],"sources":["../../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import { AreaContext, BrowserName, getIsTouch } from '@chayns-components/core';\nimport { getDevice } from 'chayns-api';\nimport { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEvent,\n ClipboardEvent,\n CSSProperties,\n FocusEvent,\n FocusEventHandler,\n forwardRef,\n KeyboardEvent as TmpKeyboardEvent,\n KeyboardEventHandler,\n ReactElement,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type FormEvent,\n} from 'react';\nimport type { PopupAlignment } from '../../constants/alignment';\nimport { convertEmojisToUnicode, escapeHTML } from '../../utils/emoji';\nimport { insertTextAtCursorPosition, replaceText } from '../../utils/insert';\nimport {\n getCharCodeThatWillBeDeleted,\n insertInvisibleCursorMarker,\n restoreSelection,\n saveSelection,\n} from '../../utils/selection';\nimport { convertHTMLToText, convertTextToHTML } from '../../utils/text';\nimport EmojiPickerPopup from '../emoji-picker-popup/EmojiPickerPopup';\nimport {\n StyledEmojiInput,\n StyledEmojiInputContent,\n StyledEmojiInputLabel,\n StyledEmojiInputRightWrapper,\n StyledMotionEmojiInputEditor,\n StyledMotionEmojiInputProgress,\n} from './EmojiInput.styles';\nimport PrefixElement from './prefix-element/PrefixElement';\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\nexport type EmojiInputProps = {\n /**\n * Access token of the logged-in user. Is needed to load and save the history of the emojis.\n */\n accessToken?: string;\n /**\n * Sets the height of the input field to a fixed value. If this value is not set, the component will use the needed height until the maximum height is reached.\n */\n height?: CSSProperties['height'];\n /**\n * HTML id of the input element\n */\n inputId?: string;\n /**\n * Disables the input so that it cannot be changed anymore\n */\n isDisabled?: boolean;\n /**\n * Sets the maximum height of the input field.\n */\n maxHeight?: CSSProperties['maxHeight'];\n /**\n * Function that is executed when the input field loses focus.\n */\n onBlur?: FocusEventHandler<HTMLDivElement>;\n /**\n * Function that is executed when the input field gets the focus.\n */\n onFocus?: FocusEventHandler<HTMLDivElement>;\n /**\n * Function that is executed when the text of the input changes. In addition to the original\n * event, the original text is returned as second parameter, in which the internally used HTML\n * elements have been converted back to BB codes.\n */\n onInput?: (event: ChangeEvent<HTMLDivElement>, originalText: string) => void;\n /**\n * Function that is executed when a key is pressed down.\n */\n onKeyDown?: KeyboardEventHandler<HTMLDivElement>;\n /**\n * Function to be executed if the prefixElement is removed.\n */\n onPrefixElementRemove?: () => void;\n /**\n * Function that is executed when the visibility of the popup changes.\n * @param {boolean} isVisible - Whether the popup is visible or not\n */\n onPopupVisibilityChange?: (isVisible: boolean) => void;\n /**\n * Person id of the logged-in user. Is needed to load and save the history of the emojis.\n */\n personId?: string;\n /**\n * Placeholder for the input field\n */\n placeholder?: string | ReactElement;\n /**\n * Sets the alignment of the popup to a fixed value. If this value is not set, the component\n * calculates the best position on its own. Use the imported 'PopupAlignment' enum to set this\n * value.\n */\n popupAlignment?: PopupAlignment;\n /**\n * Element that is rendered before the input field but the placeholder is still visible.\n */\n prefixElement?: string;\n /**\n * Element that is rendered inside the EmojiInput on the right side.\n */\n rightElement?: ReactNode;\n /**\n * Whether the placeholder should be shown after the input has focus.\n */\n shouldHidePlaceholderOnFocus?: boolean;\n /**\n * Prevents the EmojiPickerPopup icon from being displayed\n */\n shouldPreventEmojiPicker?: boolean;\n /**\n * The plain text value of the input field. Instead of HTML elements BB codes must be used at\n * this point. These are then converted by the input field into corresponding HTML elements.\n */\n value: string;\n};\n\nexport type EmojiInputRef = {\n insertTextAtCursorPosition: (text: string) => void;\n replaceText: (searchText: string, replaceText: string) => void;\n startProgress: (durationInSeconds: number) => void;\n stopProgress: () => void;\n};\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,SAASA,WAAW,EAAeC,UAAU,QAAQ,yBAAyB;AAC9E,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAMRC,UAAU,EAKVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAEL,OAAO;AAEd,SAASC,sBAAsB,EAAEC,UAAU,QAAQ,mBAAmB;AACtE,SAASC,0BAA0B,EAAEC,WAAW,QAAQ,oBAAoB;AAC5E,SACIC,4BAA4B,EAC5BC,2BAA2B,EAC3BC,gBAAgB,EAChBC,aAAa,QACV,uBAAuB;AAC9B,SAASC,iBAAiB,EAAEC,iBAAiB,QAAQ,kBAAkB;AACvE,OAAOC,gBAAgB,MAAM,wCAAwC;AACrE,SACIC,gBAAgB,EAChBC,uBAAuB,EACvBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,8BAA8B,QAC3B,qBAAqB;AAC5B,OAAOC,aAAa,MAAM,gCAAgC;AAE1D,MAA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getFontFamily","StyledEmojiInput","div","_ref","theme","$shouldChangeColor","colorMode","_ref2","$isDisabled","_ref3","StyledMotionEmojiInputProgress","_ref4","StyledEmojiInputContent","StyledMotionEmojiInputEditor","_ref5","$shouldShowContent","text","_ref6","$browser","StyledEmojiInputRightWrapper","StyledEmojiInputLabel","label","_ref7","_ref8","$offsetWidth","_ref9","$maxWidth"],"sources":["../../../../src/components/emoji-input/EmojiInput.styles.ts"],"sourcesContent":["import type { BrowserName, WithTheme } from '@chayns-components/core';\nimport { motion } from '
|
|
1
|
+
{"version":3,"file":"EmojiInput.styles.js","names":["motion","styled","css","getFontFamily","StyledEmojiInput","div","_ref","theme","$shouldChangeColor","colorMode","_ref2","$isDisabled","_ref3","StyledMotionEmojiInputProgress","_ref4","StyledEmojiInputContent","StyledMotionEmojiInputEditor","_ref5","$shouldShowContent","text","_ref6","$browser","StyledEmojiInputRightWrapper","StyledEmojiInputLabel","label","_ref7","_ref8","$offsetWidth","_ref9","$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,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,aAAa,QAAQ,kBAAkB;AAIhD,OAAO,MAAMC,gBAAgB,GAAGH,MAAM,CAACI,GAA0B;AACjE;AACA,wBAAwBC,IAAA;EAAA,IAAC;IAAEC,KAAK;IAAEC;EAA0C,CAAC,GAAAF,IAAA;EAAA,OACrEC,KAAK,CAACE,SAAS,KAAK,SAAS,IAAID,kBAAkB,GAAGD,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAAC,KAAK,CAAC;AAAA;AACzF;AACA;AACA;AACA;AACA,eAAeG,KAAA;EAAA,IAAC;IAAEC;EAAY,CAAC,GAAAD,KAAA;EAAA,OAAMC,WAAW,GAAG,GAAG,GAAG,CAAC;AAAA,CAAC;AAC3D,sBAAsBC,KAAA;EAAA,IAAC;IAAED;EAAY,CAAC,GAAAC,KAAA;EAAA,OAAMD,WAAW,GAAG,MAAM,GAAG,SAAS;AAAA,CAAC;AAC7E;AACA;AACA,CAAC;AAID,OAAO,MAAME,8BAA8B,GAAGZ,MAAM,CAChDD,MAAM,CAACK,GACX,CAAsC;AACtC,wBAAwBS,KAAA;EAAA,IAAC;IAAEP;EAA2C,CAAC,GAAAO,KAAA;EAAA,OAAKP,KAAK,CAAC,KAAK,CAAC;AAAA;AACxF;AACA;AACA;AACA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBC,KAAA;EAAA,IAAC;IAAEC,SAAS;IAAEF;EAAa,CAAC,GAAAC,KAAA;EAAA,OAAK,GAAGC,SAAS,IAAIF,YAAY,IAAI,CAAC,CAAC,IAAI;AAAA;AACxF;AACA,CAAC","ignoreList":[]}
|
package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiPickerCategories.styles.js","names":["motion","styled","getFontFamily","StyledEmojiPickerCategories","div","StyledMotionEmojiPickerCategory"],"sources":["../../../../../src/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix } from '@chayns-components/core';\nimport { motion } from '
|
|
1
|
+
{"version":3,"file":"EmojiPickerCategories.styles.js","names":["motion","styled","getFontFamily","StyledEmojiPickerCategories","div","StyledMotionEmojiPickerCategory"],"sources":["../../../../../src/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled from 'styled-components';\nimport { getFontFamily } from '../../../utils/font';\n\nexport const StyledEmojiPickerCategories = styled.div`\n align-items: center;\n border-top: 1px solid rgba(160, 160, 160, 0.3);\n display: flex;\n flex: 0 0 auto;\n justify-content: space-between;\n padding-top: 10px;\n width: 100%;\n`;\n\nexport const StyledMotionEmojiPickerCategory = styled(motion.div)<FramerMotionBugFix>`\n cursor: pointer;\n font-family: ${getFontFamily};\n font-size: 20px;\n`;\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,aAAa,QAAQ,qBAAqB;AAEnD,OAAO,MAAMC,2BAA2B,GAAGF,MAAM,CAACG,GAAG;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,+BAA+B,GAAGJ,MAAM,CAACD,MAAM,CAACI,GAAG,CAAqB;AACrF;AACA,mBAAmBF,aAAa;AAChC;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnimatePresence } from '
|
|
1
|
+
import { AnimatePresence } from 'motion/react';
|
|
2
2
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { AnchorAlignment } from '../../../../constants/alignment';
|
|
4
4
|
import { StyledEmoji } from './Emoji.styles';
|