@chayns-components/emoji-input 5.0.0-beta.95 → 5.0.0-beta.952

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +4 -15
  2. package/lib/{api → cjs/api}/item-storage/get.js +4 -5
  3. package/lib/cjs/api/item-storage/get.js.map +1 -0
  4. package/lib/{api → cjs/api}/item-storage/put.js +5 -6
  5. package/lib/cjs/api/item-storage/put.js.map +1 -0
  6. package/lib/cjs/components/emoji-input/EmojiInput.js +510 -0
  7. package/lib/cjs/components/emoji-input/EmojiInput.js.map +1 -0
  8. package/lib/cjs/components/emoji-input/EmojiInput.styles.js +132 -0
  9. package/lib/cjs/components/emoji-input/EmojiInput.styles.js.map +1 -0
  10. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js +45 -0
  11. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
  12. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js +65 -0
  13. package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
  14. package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.js +9 -11
  15. package/lib/cjs/components/emoji-picker/EmojiPicker.js.map +1 -0
  16. package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.styles.js +3 -5
  17. package/lib/cjs/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
  18. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +102 -0
  19. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
  20. package/lib/{components → cjs/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +5 -6
  21. package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
  22. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
  23. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
  24. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +69 -0
  25. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
  26. package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +49 -21
  27. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
  28. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +24 -0
  29. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
  30. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +130 -0
  31. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
  32. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +99 -0
  33. package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
  34. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js +52 -0
  35. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
  36. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js +15 -0
  37. package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
  38. package/lib/{constants → cjs/constants}/alignment.js +6 -8
  39. package/lib/cjs/constants/alignment.js.map +1 -0
  40. package/lib/{constants → cjs/constants}/categories.js +1 -2
  41. package/lib/cjs/constants/categories.js.map +1 -0
  42. package/lib/cjs/constants/emoji.js +3804 -0
  43. package/lib/cjs/constants/emoji.js.map +1 -0
  44. package/lib/cjs/constants/externalServerUrl.js +8 -0
  45. package/lib/cjs/constants/externalServerUrl.js.map +1 -0
  46. package/lib/cjs/constants/regex.js +15 -0
  47. package/lib/cjs/constants/regex.js.map +1 -0
  48. package/lib/{hooks → cjs/hooks}/emojiHistory.js +13 -15
  49. package/lib/cjs/hooks/emojiHistory.js.map +1 -0
  50. package/lib/{index.js → cjs/index.js} +1 -1
  51. package/lib/cjs/index.js.map +1 -0
  52. package/lib/cjs/types/api.js +2 -0
  53. package/lib/cjs/types/api.js.map +1 -0
  54. package/lib/cjs/types/category.js +2 -0
  55. package/lib/cjs/types/category.js.map +1 -0
  56. package/lib/cjs/utils/emoji.js +104 -0
  57. package/lib/cjs/utils/emoji.js.map +1 -0
  58. package/lib/{utils → cjs/utils}/environment.js +6 -4
  59. package/lib/cjs/utils/environment.js.map +1 -0
  60. package/lib/cjs/utils/font.js +17 -0
  61. package/lib/cjs/utils/font.js.map +1 -0
  62. package/lib/cjs/utils/insert.js +110 -0
  63. package/lib/cjs/utils/insert.js.map +1 -0
  64. package/lib/cjs/utils/number.js +17 -0
  65. package/lib/cjs/utils/number.js.map +1 -0
  66. package/lib/cjs/utils/selection.js +255 -0
  67. package/lib/cjs/utils/selection.js.map +1 -0
  68. package/lib/cjs/utils/text.js +57 -0
  69. package/lib/cjs/utils/text.js.map +1 -0
  70. package/lib/esm/api/item-storage/get.js +30 -0
  71. package/lib/esm/api/item-storage/get.js.map +1 -0
  72. package/lib/esm/api/item-storage/put.js +35 -0
  73. package/lib/esm/api/item-storage/put.js.map +1 -0
  74. package/lib/esm/components/emoji-input/EmojiInput.js +497 -0
  75. package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -0
  76. package/lib/esm/components/emoji-input/EmojiInput.styles.js +151 -0
  77. package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -0
  78. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js +38 -0
  79. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
  80. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js +69 -0
  81. package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
  82. package/lib/esm/components/emoji-picker/EmojiPicker.js +40 -0
  83. package/lib/esm/components/emoji-picker/EmojiPicker.js.map +1 -0
  84. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js +16 -0
  85. package/lib/esm/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
  86. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +96 -0
  87. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
  88. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +18 -0
  89. package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
  90. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
  91. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
  92. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +76 -0
  93. package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
  94. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +136 -0
  95. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
  96. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +20 -0
  97. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
  98. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +121 -0
  99. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
  100. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
  101. package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
  102. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js +43 -0
  103. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
  104. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js +8 -0
  105. package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
  106. package/lib/esm/constants/alignment.js +13 -0
  107. package/lib/esm/constants/alignment.js.map +1 -0
  108. package/lib/esm/constants/categories.js +13 -0
  109. package/lib/esm/constants/categories.js.map +1 -0
  110. package/lib/esm/constants/emoji-de-DE.json +3827 -0
  111. package/lib/esm/constants/emoji.js +3798 -0
  112. package/lib/esm/constants/emoji.js.map +1 -0
  113. package/lib/esm/constants/externalServerUrl.js +2 -0
  114. package/lib/esm/constants/externalServerUrl.js.map +1 -0
  115. package/lib/esm/constants/regex.js +9 -0
  116. package/lib/esm/constants/regex.js.map +1 -0
  117. package/lib/esm/hooks/emojiHistory.js +83 -0
  118. package/lib/esm/hooks/emojiHistory.js.map +1 -0
  119. package/lib/{index.d.ts → esm/index.js} +1 -0
  120. package/lib/esm/index.js.map +1 -0
  121. package/lib/esm/types/api.js +2 -0
  122. package/lib/esm/types/api.js.map +1 -0
  123. package/lib/esm/types/category.js +2 -0
  124. package/lib/esm/types/category.js.map +1 -0
  125. package/lib/esm/utils/emoji.js +92 -0
  126. package/lib/esm/utils/emoji.js.map +1 -0
  127. package/lib/esm/utils/environment.js +24 -0
  128. package/lib/esm/utils/environment.js.map +1 -0
  129. package/lib/esm/utils/font.js +10 -0
  130. package/lib/esm/utils/font.js.map +1 -0
  131. package/lib/esm/utils/insert.js +104 -0
  132. package/lib/esm/utils/insert.js.map +1 -0
  133. package/lib/esm/utils/number.js +10 -0
  134. package/lib/esm/utils/number.js.map +1 -0
  135. package/lib/esm/utils/selection.js +237 -0
  136. package/lib/esm/utils/selection.js.map +1 -0
  137. package/lib/esm/utils/text.js +48 -0
  138. package/lib/esm/utils/text.js.map +1 -0
  139. package/lib/types/components/emoji-input/EmojiInput.d.ts +94 -0
  140. package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +549 -0
  141. package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
  142. package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
  143. package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
  144. package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +267 -0
  145. package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +10 -0
  146. package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +5 -0
  147. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
  148. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +283 -0
  149. package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +0 -13
  150. package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
  151. package/lib/types/constants/emoji.d.ts +8 -0
  152. package/lib/types/constants/regex.d.ts +8 -0
  153. package/lib/types/index.d.ts +6 -0
  154. package/lib/{utils → types/utils}/emoji.d.ts +2 -0
  155. package/lib/{utils → types/utils}/environment.d.ts +1 -0
  156. package/lib/types/utils/font.d.ts +1 -0
  157. package/lib/{utils → types/utils}/insert.d.ts +8 -1
  158. package/lib/types/utils/number.d.ts +1 -0
  159. package/lib/types/utils/selection.d.ts +23 -0
  160. package/lib/types/utils/text.d.ts +3 -0
  161. package/package.json +48 -30
  162. package/lib/api/item-storage/get.js.map +0 -1
  163. package/lib/api/item-storage/put.js.map +0 -1
  164. package/lib/components/emoji-input/EmojiInput.d.ts +0 -49
  165. package/lib/components/emoji-input/EmojiInput.js +0 -161
  166. package/lib/components/emoji-input/EmojiInput.js.map +0 -1
  167. package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -16
  168. package/lib/components/emoji-input/EmojiInput.styles.js +0 -153
  169. package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
  170. package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
  171. package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
  172. package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
  173. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -51
  174. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
  175. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
  176. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
  177. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -131
  178. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
  179. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -7
  180. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -99
  181. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
  182. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +0 -1
  183. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +0 -1
  184. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +0 -20
  185. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +0 -1
  186. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +0 -74
  187. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +0 -1
  188. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +0 -11
  189. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +0 -104
  190. package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +0 -1
  191. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -150
  192. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
  193. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
  194. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -97
  195. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
  196. package/lib/constants/alignment.js.map +0 -1
  197. package/lib/constants/categories.js.map +0 -1
  198. package/lib/constants/externalServerUrl.js +0 -9
  199. package/lib/constants/externalServerUrl.js.map +0 -1
  200. package/lib/hooks/emojiHistory.js.map +0 -1
  201. package/lib/index.js.map +0 -1
  202. package/lib/types/api.js +0 -6
  203. package/lib/types/api.js.map +0 -1
  204. package/lib/types/category.js +0 -6
  205. package/lib/types/category.js.map +0 -1
  206. package/lib/utils/emoji.js +0 -223
  207. package/lib/utils/emoji.js.map +0 -1
  208. package/lib/utils/environment.js.map +0 -1
  209. package/lib/utils/font.d.ts +0 -1
  210. package/lib/utils/font.js +0 -15
  211. package/lib/utils/font.js.map +0 -1
  212. package/lib/utils/insert.js +0 -50
  213. package/lib/utils/insert.js.map +0 -1
  214. package/lib/utils/selection.d.ts +0 -2
  215. package/lib/utils/selection.js +0 -43
  216. package/lib/utils/selection.js.map +0 -1
  217. /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
  218. /package/lib/{api → types/api}/item-storage/get.d.ts +0 -0
  219. /package/lib/{api → types/api}/item-storage/put.d.ts +0 -0
  220. /package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +0 -0
  221. /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
  222. /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +0 -0
  223. /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +0 -0
  224. /package/lib/{constants → types/constants}/alignment.d.ts +0 -0
  225. /package/lib/{constants → types/constants}/categories.d.ts +0 -0
  226. /package/lib/{constants → types/constants}/externalServerUrl.d.ts +0 -0
  227. /package/lib/{hooks → types/hooks}/emojiHistory.d.ts +0 -0
  228. /package/lib/types/{api.d.ts → types/api.d.ts} +0 -0
  229. /package/lib/types/{category.d.ts → types/category.d.ts} +0 -0
package/README.md CHANGED
@@ -15,14 +15,14 @@
15
15
 
16
16
  ## Installation
17
17
 
18
- First you need to install the typewriter part of the chayns-components.
18
+ First you need to install the emoji input part of the chayns-components.
19
19
 
20
20
  ```bash
21
21
  # NPM
22
- npm install @chayns-components/typewriter
22
+ npm install @chayns-components/emoji-input
23
23
 
24
24
  # Yarn
25
- yarn add @chayns-components/typewriter
25
+ yarn add @chayns-components/emoji-input
26
26
  ```
27
27
 
28
28
  > **Information:** Since the components have now been implemented with the styled-components
@@ -31,15 +31,4 @@ yarn add @chayns-components/typewriter
31
31
 
32
32
  ## Usage
33
33
 
34
- You can use the components in your project as in the following example.
35
-
36
- ```typescript jsx
37
- import { Typewriter } from '@chayns-components/typewriter';
38
-
39
- <Typewriter>
40
- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
41
- ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
42
- dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est. Lorem ipsum dolor
43
- sit amet.
44
- </Typewriter>;
45
- ```
34
+ For detailed usage visit the [storybook](https://components.chayns.site/storybook).
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getEmojiHistory = void 0;
7
7
  var _externalServerUrl = require("../../constants/externalServerUrl");
8
- const getEmojiHistory = async _ref => {
9
- let {
10
- accessToken,
11
- personId
12
- } = _ref;
8
+ const getEmojiHistory = async ({
9
+ accessToken,
10
+ personId
11
+ }) => {
13
12
  const requestInit = {
14
13
  headers: {
15
14
  Authorization: `Bearer ${accessToken}`
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","names":["_externalServerUrl","require","getEmojiHistory","accessToken","personId","requestInit","headers","Authorization","method","url","ITEM_STORAGE_BASE_URL","response","fetch","status","data","json","value","e","exports"],"sources":["../../../../src/api/item-storage/get.ts"],"sourcesContent":["import { ITEM_STORAGE_BASE_URL } from '../../constants/externalServerUrl';\nimport type { HistoryItem } from '../../hooks/emojiHistory';\nimport type { ApiFunctionResult } from '../../types/api';\n\ninterface GetEmojiHistoryOptions {\n accessToken: string;\n personId: string;\n}\n\ninterface GetEmojiHistoryResponseData {\n key: string;\n personId: string;\n schemeId: string;\n value: HistoryItem[];\n}\n\nexport const getEmojiHistory = async ({\n accessToken,\n personId,\n}: GetEmojiHistoryOptions): Promise<ApiFunctionResult<HistoryItem[]>> => {\n const requestInit: RequestInit = {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n },\n method: 'GET',\n };\n\n const url = `${ITEM_STORAGE_BASE_URL}/7/users/${personId}/keys/emojis`;\n\n const response = await fetch(url, requestInit);\n\n if (response.status === 200) {\n try {\n const data = (await response.json()) as GetEmojiHistoryResponseData;\n\n return { data: data.value, status: 200 };\n } catch (e) {\n // Do nothing\n }\n }\n\n return { status: response.status };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAgBO,MAAMC,eAAe,GAAG,MAAAA,CAAO;EAClCC,WAAW;EACXC;AACoB,CAAC,KAAgD;EACrE,MAAMC,WAAwB,GAAG;IAC7BC,OAAO,EAAE;MACLC,aAAa,EAAE,UAAUJ,WAAW;IACxC,CAAC;IACDK,MAAM,EAAE;EACZ,CAAC;EAED,MAAMC,GAAG,GAAG,GAAGC,wCAAqB,YAAYN,QAAQ,cAAc;EAEtE,MAAMO,QAAQ,GAAG,MAAMC,KAAK,CAACH,GAAG,EAAEJ,WAAW,CAAC;EAE9C,IAAIM,QAAQ,CAACE,MAAM,KAAK,GAAG,EAAE;IACzB,IAAI;MACA,MAAMC,IAAI,GAAI,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAiC;MAEnE,OAAO;QAAED,IAAI,EAAEA,IAAI,CAACE,KAAK;QAAEH,MAAM,EAAE;MAAI,CAAC;IAC5C,CAAC,CAAC,OAAOI,CAAC,EAAE;MACR;IAAA;EAER;EAEA,OAAO;IAAEJ,MAAM,EAAEF,QAAQ,CAACE;EAAO,CAAC;AACtC,CAAC;AAACK,OAAA,CAAAhB,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -5,12 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.putEmojiHistory = void 0;
7
7
  var _externalServerUrl = require("../../constants/externalServerUrl");
8
- const putEmojiHistory = async _ref => {
9
- let {
10
- accessToken,
11
- personId,
12
- value
13
- } = _ref;
8
+ const putEmojiHistory = async ({
9
+ accessToken,
10
+ personId,
11
+ value
12
+ }) => {
14
13
  const requestInit = {
15
14
  body: JSON.stringify({
16
15
  value
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put.js","names":["_externalServerUrl","require","putEmojiHistory","accessToken","personId","value","requestInit","body","JSON","stringify","headers","Authorization","method","url","ITEM_STORAGE_BASE_URL","response","fetch","status","data","json","e","exports"],"sources":["../../../../src/api/item-storage/put.ts"],"sourcesContent":["import { ITEM_STORAGE_BASE_URL } from '../../constants/externalServerUrl';\nimport type { HistoryItem } from '../../hooks/emojiHistory';\nimport type { ApiFunctionResult } from '../../types/api';\n\ninterface PutEmojiHistoryOptions {\n accessToken: string;\n personId: string;\n value: HistoryItem[];\n}\n\ninterface PutEmojiHistoryResponseData {\n key: string;\n personId: string;\n schemeId: string;\n value: HistoryItem[];\n}\n\nexport const putEmojiHistory = async ({\n accessToken,\n personId,\n value,\n}: PutEmojiHistoryOptions): Promise<ApiFunctionResult<HistoryItem[]>> => {\n const requestInit: RequestInit = {\n body: JSON.stringify({ value }),\n headers: {\n Authorization: `Bearer ${accessToken}`,\n 'Content-Type': 'application/json',\n },\n method: 'PUT',\n };\n\n const url = `${ITEM_STORAGE_BASE_URL}/7/users/${personId}/keys/emojis`;\n\n const response = await fetch(url, requestInit);\n\n if (response.status === 201) {\n try {\n const data = (await response.json()) as PutEmojiHistoryResponseData;\n\n return { data: data.value, status: 200 };\n } catch (e) {\n // Do nothing\n }\n }\n\n return { status: response.status };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAiBO,MAAMC,eAAe,GAAG,MAAAA,CAAO;EAClCC,WAAW;EACXC,QAAQ;EACRC;AACoB,CAAC,KAAgD;EACrE,MAAMC,WAAwB,GAAG;IAC7BC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;MAAEJ;IAAM,CAAC,CAAC;IAC/BK,OAAO,EAAE;MACLC,aAAa,EAAE,UAAUR,WAAW,EAAE;MACtC,cAAc,EAAE;IACpB,CAAC;IACDS,MAAM,EAAE;EACZ,CAAC;EAED,MAAMC,GAAG,GAAG,GAAGC,wCAAqB,YAAYV,QAAQ,cAAc;EAEtE,MAAMW,QAAQ,GAAG,MAAMC,KAAK,CAACH,GAAG,EAAEP,WAAW,CAAC;EAE9C,IAAIS,QAAQ,CAACE,MAAM,KAAK,GAAG,EAAE;IACzB,IAAI;MACA,MAAMC,IAAI,GAAI,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAiC;MAEnE,OAAO;QAAED,IAAI,EAAEA,IAAI,CAACb,KAAK;QAAEY,MAAM,EAAE;MAAI,CAAC;IAC5C,CAAC,CAAC,OAAOG,CAAC,EAAE;MACR;IAAA;EAER;EAEA,OAAO;IAAEH,MAAM,EAAEF,QAAQ,CAACE;EAAO,CAAC;AACtC,CAAC;AAACI,OAAA,CAAAnB,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,510 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _core = require("@chayns-components/core");
8
+ var _chaynsApi = require("chayns-api");
9
+ var _framerMotion = require("framer-motion");
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _emoji = require("../../utils/emoji");
12
+ var _insert = require("../../utils/insert");
13
+ var _selection = require("../../utils/selection");
14
+ var _text = require("../../utils/text");
15
+ var _EmojiPickerPopup = _interopRequireDefault(require("../emoji-picker-popup/EmojiPickerPopup"));
16
+ var _EmojiInput = require("./EmojiInput.styles");
17
+ var _PrefixElement = _interopRequireDefault(require("./prefix-element/PrefixElement"));
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
+ 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' ? _react.useLayoutEffect : _react.useEffect;
22
+ const EmojiInput = /*#__PURE__*/(0, _react.forwardRef)(({
23
+ accessToken,
24
+ height,
25
+ inputId,
26
+ isDisabled,
27
+ maxHeight = '190px',
28
+ onBlur,
29
+ onFocus,
30
+ onInput,
31
+ onKeyDown,
32
+ onPrefixElementRemove,
33
+ onPopupVisibilityChange,
34
+ personId,
35
+ placeholder,
36
+ popupAlignment,
37
+ prefixElement,
38
+ rightElement,
39
+ shouldHidePlaceholderOnFocus = true,
40
+ shouldPreventEmojiPicker,
41
+ value
42
+ }, ref) => {
43
+ const [isTouch] = (0, _react.useState)((0, _core.getIsTouch)());
44
+ const [plainTextValue, setPlainTextValue] = (0, _react.useState)(value);
45
+ const [hasFocus, setHasFocus] = (0, _react.useState)(false);
46
+ const [progressDuration, setProgressDuration] = (0, _react.useState)(0);
47
+ const [labelWidth, setLabelWidth] = (0, _react.useState)(0);
48
+ const [isPopupVisible, setIsPopupVisible] = (0, _react.useState)(false);
49
+ const [isPrefixAnimationFinished, setIsPrefixAnimationFinished] = (0, _react.useState)(!prefixElement);
50
+ const [prefixElementWidth, setPrefixElementWidth] = (0, _react.useState)();
51
+ const [textLength, setTextLength] = (0, _react.useState)(0);
52
+ const areaProvider = (0, _react.useContext)(_core.AreaContext);
53
+ const editorRef = (0, _react.useRef)(null);
54
+ const prefixElementRef = (0, _react.useRef)(null);
55
+ const hasPrefixRendered = (0, _react.useRef)(false);
56
+ const hasPrefixChanged = (0, _react.useRef)(false);
57
+ const shouldDeleteOneMoreBackwards = (0, _react.useRef)(false);
58
+ const shouldDeleteOneMoreForwards = (0, _react.useRef)(false);
59
+ const valueRef = (0, _react.useRef)(value);
60
+ const {
61
+ browser
62
+ } = (0, _chaynsApi.getDevice)();
63
+ const shouldChangeColor = (0, _react.useMemo)(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]);
64
+
65
+ /**
66
+ * This function updates the content of the 'contentEditable' element if the new text is
67
+ * different from the previous content. So this is only true if, for example, a text like ":-)"
68
+ * has been replaced to the corresponding emoji.
69
+ *
70
+ * When updating the HTML, the current cursor position is saved before replacing the content, so
71
+ * that it can be set again afterward.
72
+ */
73
+ const handleUpdateHTML = (0, _react.useCallback)(html => {
74
+ if (!editorRef.current) {
75
+ return;
76
+ }
77
+ let newInnerHTML = (0, _emoji.convertEmojisToUnicode)(html);
78
+ newInnerHTML = (0, _text.convertTextToHTML)(newInnerHTML);
79
+ if (newInnerHTML !== editorRef.current.innerHTML) {
80
+ (0, _selection.saveSelection)(editorRef.current, {
81
+ shouldIgnoreEmptyTextNodes: true
82
+ });
83
+ editorRef.current.innerHTML = newInnerHTML;
84
+ (0, _selection.restoreSelection)(editorRef.current);
85
+ }
86
+ }, []);
87
+ const handleBeforeInput = (0, _react.useCallback)(event => {
88
+ if (!editorRef.current) {
89
+ return;
90
+ }
91
+ if (isDisabled) {
92
+ event.preventDefault();
93
+ event.stopPropagation();
94
+ return;
95
+ }
96
+ const {
97
+ data,
98
+ type
99
+ } = event.nativeEvent;
100
+ if (type === 'textInput' && data && data.includes('\n')) {
101
+ event.preventDefault();
102
+ event.stopPropagation();
103
+ const text = (0, _emoji.convertEmojisToUnicode)(data);
104
+ (0, _insert.insertTextAtCursorPosition)({
105
+ editorElement: editorRef.current,
106
+ text
107
+ });
108
+ const newEvent = new Event('input', {
109
+ bubbles: true
110
+ });
111
+ editorRef.current.dispatchEvent(newEvent);
112
+ }
113
+ }, [isDisabled]);
114
+
115
+ /**
116
+ * This function handles the 'input' events of the 'contentEditable' element and also passes the
117
+ * respective event up accordingly if the 'onInput' property is a function.
118
+ */
119
+ const handleInput = (0, _react.useCallback)(event => {
120
+ if (!editorRef.current) {
121
+ return;
122
+ }
123
+ if (isDisabled) {
124
+ event.stopPropagation();
125
+ event.preventDefault();
126
+ }
127
+ if (shouldDeleteOneMoreBackwards.current) {
128
+ shouldDeleteOneMoreBackwards.current = false;
129
+ shouldDeleteOneMoreForwards.current = false;
130
+ event.preventDefault();
131
+ event.stopPropagation();
132
+
133
+ // Remove content and set cursor to the right position
134
+ (0, _selection.insertInvisibleCursorMarker)();
135
+ return;
136
+ }
137
+ if (shouldDeleteOneMoreForwards.current) {
138
+ shouldDeleteOneMoreBackwards.current = false;
139
+ shouldDeleteOneMoreForwards.current = false;
140
+ event.preventDefault();
141
+ event.stopPropagation();
142
+
143
+ // noinspection JSDeprecatedSymbols
144
+ document.execCommand('forwardDelete', false);
145
+ return;
146
+ }
147
+ handleUpdateHTML(editorRef.current.innerHTML);
148
+ const text = (0, _text.convertHTMLToText)(editorRef.current.innerHTML);
149
+ setPlainTextValue(text);
150
+ if (typeof onInput === 'function') {
151
+ onInput(event, text);
152
+ }
153
+ }, [handleUpdateHTML, isDisabled, onInput]);
154
+ const handleKeyDown = (0, _react.useCallback)(event => {
155
+ if (isDisabled) {
156
+ event.preventDefault();
157
+ event.stopPropagation();
158
+ return;
159
+ }
160
+ if (event.key === 'Enter' && isPopupVisible) {
161
+ event.preventDefault();
162
+ return;
163
+ }
164
+ if (typeof onKeyDown === 'function') {
165
+ onKeyDown(event);
166
+ }
167
+ if (event.key === 'Enter' && !event.isPropagationStopped() && editorRef.current) {
168
+ event.preventDefault();
169
+
170
+ // noinspection JSDeprecatedSymbols
171
+ document.execCommand('insertLineBreak', false);
172
+ }
173
+ if (event.key === 'Backspace' || event.key === 'Delete' || event.key === 'Unidentified') {
174
+ const charCodeThatWillBeDeleted = (0, _selection.getCharCodeThatWillBeDeleted)(event);
175
+ if (charCodeThatWillBeDeleted === 8203) {
176
+ if (event.key === 'Backspace' || event.key === 'Unidentified') {
177
+ shouldDeleteOneMoreBackwards.current = true;
178
+ } else {
179
+ shouldDeleteOneMoreForwards.current = true;
180
+ }
181
+ }
182
+ }
183
+ }, [isDisabled, isPopupVisible, onKeyDown]);
184
+ const handlePopupVisibility = (0, _react.useCallback)(isVisible => {
185
+ setIsPopupVisible(isVisible);
186
+ if (editorRef.current && isVisible) {
187
+ (0, _selection.saveSelection)(editorRef.current);
188
+ }
189
+ if (typeof onPopupVisibilityChange === 'function') {
190
+ onPopupVisibilityChange(isVisible);
191
+ }
192
+ }, [onPopupVisibilityChange]);
193
+
194
+ /**
195
+ * This function prevents formatting from being adopted when texts are inserted. To do this, the
196
+ * plain text is read from the event after the default behavior has been prevented. The plain
197
+ * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
198
+ */
199
+ const handlePaste = (0, _react.useCallback)(event => {
200
+ if (editorRef.current) {
201
+ event.preventDefault();
202
+ if (isDisabled) {
203
+ event.stopPropagation();
204
+ return;
205
+ }
206
+ let text = event.clipboardData.getData('text/plain');
207
+ text = (0, _emoji.convertEmojisToUnicode)(text);
208
+
209
+ // This deprecated function is used, because it causes the inserted content to be added to the undo stack.
210
+ // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.
211
+ // In that case on CTRL+Z the inserted text would not be removed.
212
+ document.execCommand('insertHTML', false, text);
213
+ const newEvent = new Event('input', {
214
+ bubbles: true
215
+ });
216
+ editorRef.current.dispatchEvent(newEvent);
217
+ }
218
+ }, [isDisabled]);
219
+
220
+ /**
221
+ * This function prevents formatting from being adopted when texts are dropped. To do this, the
222
+ * plain text is read from the event after the default behavior has been prevented. The plain
223
+ * text is then inserted at the correct position in the input field using document.execCommand('insertHTML')
224
+ */
225
+ const handleDrop = (0, _react.useCallback)(event => {
226
+ if (editorRef.current) {
227
+ var _event$dataTransfer;
228
+ event.preventDefault();
229
+ if (isDisabled) {
230
+ event.stopPropagation();
231
+ return;
232
+ }
233
+ let text = (_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.getData('text');
234
+ if (!text) {
235
+ return;
236
+ }
237
+ text = (0, _emoji.convertEmojisToUnicode)(text);
238
+
239
+ // This deprecated function is used, because it causes the inserted content to be added to the undo stack.
240
+ // If the text were to be inserted directly into the 'innerHTML' of the editor element, the undo stack would not be updated.
241
+ // In that case on CTRL+Z the inserted text would not be removed.
242
+ document.execCommand('insertHTML', false, text);
243
+ const newEvent = new Event('input', {
244
+ bubbles: true
245
+ });
246
+ editorRef.current.dispatchEvent(newEvent);
247
+ }
248
+ }, [isDisabled]);
249
+
250
+ /**
251
+ * This function uses the 'insertTextAtCursorPosition' function to insert the emoji at the
252
+ * correct position in the editor element.
253
+ *
254
+ * At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,
255
+ * which in turn executes the 'onInput' function from the props. So this serves to ensure that
256
+ * the event is also passed through to the top when inserting via the popup.
257
+ */
258
+ const handlePopupSelect = (0, _react.useCallback)(emoji => {
259
+ if (editorRef.current) {
260
+ (0, _insert.insertTextAtCursorPosition)({
261
+ editorElement: editorRef.current,
262
+ text: emoji,
263
+ shouldUseSavedSelection: true
264
+ });
265
+ const event = new Event('input', {
266
+ bubbles: true
267
+ });
268
+ editorRef.current.dispatchEvent(event);
269
+ }
270
+ }, []);
271
+ (0, _react.useEffect)(() => {
272
+ var _editorRef$current;
273
+ if (typeof onPrefixElementRemove !== 'function') {
274
+ return;
275
+ }
276
+ if (!hasPrefixRendered.current) {
277
+ return;
278
+ }
279
+ const convertedText = (0, _text.convertHTMLToText)(((_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.innerHTML) ?? '').replace('&nbsp;', ' ');
280
+ const convertedPrefix = prefixElement && prefixElement.replace('&nbsp;', ' ');
281
+ if (convertedPrefix && convertedText.includes(convertedPrefix) && convertedText.length > convertedPrefix.length || convertedPrefix === convertedText) {
282
+ return;
283
+ }
284
+ if (hasPrefixChanged.current) {
285
+ hasPrefixChanged.current = false;
286
+ return;
287
+ }
288
+ onPrefixElementRemove();
289
+ hasPrefixRendered.current = false;
290
+ }, [onPrefixElementRemove, plainTextValue.length, prefixElement]);
291
+ (0, _react.useEffect)(() => {
292
+ if (typeof prefixElement === 'string') {
293
+ hasPrefixChanged.current = true;
294
+ }
295
+ }, [prefixElement]);
296
+ (0, _react.useEffect)(() => {
297
+ if (value !== plainTextValue) {
298
+ setPlainTextValue(value);
299
+ handleUpdateHTML(value);
300
+ }
301
+ }, [handleUpdateHTML, plainTextValue, value]);
302
+
303
+ // This effect is used to call the 'handleUpdateHTML' function once after the component has been
304
+ // rendered. This is necessary because the 'contentEditable' element otherwise does not display
305
+ // the HTML content correctly when the component is rendered for the first time.
306
+ useIsomorphicLayoutEffect(() => {
307
+ handleUpdateHTML(valueRef.current);
308
+ }, [handleUpdateHTML]);
309
+ const handleInsertTextAtCursorPosition = (0, _react.useCallback)(text => {
310
+ if (editorRef.current) {
311
+ (0, _insert.insertTextAtCursorPosition)({
312
+ editorElement: editorRef.current,
313
+ text
314
+ });
315
+ const newEvent = new Event('input', {
316
+ bubbles: true
317
+ });
318
+ editorRef.current.dispatchEvent(newEvent);
319
+ }
320
+ }, []);
321
+ const handleReplaceText = (0, _react.useCallback)((searchText, pasteText) => {
322
+ if (editorRef.current) {
323
+ (0, _insert.replaceText)({
324
+ editorElement: editorRef.current,
325
+ searchText,
326
+ pasteText
327
+ });
328
+ const newEvent = new Event('input', {
329
+ bubbles: true
330
+ });
331
+ editorRef.current.dispatchEvent(newEvent);
332
+ }
333
+ }, []);
334
+ const handleStartProgress = (0, _react.useCallback)(duration => {
335
+ setProgressDuration(duration);
336
+ }, []);
337
+ const handleStopProgress = (0, _react.useCallback)(() => {
338
+ setProgressDuration(0);
339
+ }, []);
340
+ (0, _react.useImperativeHandle)(ref, () => ({
341
+ insertTextAtCursorPosition: handleInsertTextAtCursorPosition,
342
+ replaceText: handleReplaceText,
343
+ startProgress: handleStartProgress,
344
+ stopProgress: handleStopProgress
345
+ }), [handleInsertTextAtCursorPosition, handleReplaceText, handleStartProgress, handleStopProgress]);
346
+ (0, _react.useEffect)(() => {
347
+ /**
348
+ * This function ensures that the input field does not lose focus when the popup is opened
349
+ * or an emoji is selected in it. For this purpose the corresponding elements get the class
350
+ * 'prevent-lose-focus'.
351
+ *
352
+ * The class can also be set to any other elements that should also not cause the input
353
+ * field to lose focus.
354
+ */
355
+ const handlePreventLoseFocus = event => {
356
+ var _element$parentElemen, _element$parentElemen2;
357
+ const element = event.target;
358
+ if (element.classList.contains('prevent-lose-focus') || (_element$parentElemen = element.parentElement) !== null && _element$parentElemen !== void 0 && _element$parentElemen.classList.contains('prevent-lose-focus') || (_element$parentElemen2 = element.parentElement) !== null && _element$parentElemen2 !== void 0 && (_element$parentElemen2 = _element$parentElemen2.parentElement) !== null && _element$parentElemen2 !== void 0 && _element$parentElemen2.classList.contains('prevent-lose-focus')) {
359
+ event.preventDefault();
360
+ event.stopPropagation();
361
+ }
362
+ };
363
+ document.body.addEventListener('mousedown', handlePreventLoseFocus);
364
+ return () => {
365
+ document.body.removeEventListener('mousedown', handlePreventLoseFocus);
366
+ };
367
+ }, []);
368
+ const shouldShowPlaceholder = (0, _react.useMemo)(() => {
369
+ var _editorRef$current2;
370
+ if (!isPrefixAnimationFinished) {
371
+ return false;
372
+ }
373
+ const isJustPrefixElement = prefixElement && (0, _text.convertTextToHTML)(prefixElement) === ((_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : _editorRef$current2.innerHTML);
374
+ const shouldRenderPlaceholder = prefixElement && !plainTextValue || (prefixElement ? prefixElementWidth && prefixElementWidth > 0 : true);
375
+ switch (true) {
376
+ case (!plainTextValue || isJustPrefixElement) && shouldHidePlaceholderOnFocus && !hasFocus:
377
+ case (!plainTextValue || isJustPrefixElement) && !shouldHidePlaceholderOnFocus:
378
+ return shouldRenderPlaceholder;
379
+ case (!plainTextValue || isJustPrefixElement) && shouldHidePlaceholderOnFocus && hasFocus:
380
+ return false;
381
+ default:
382
+ return false;
383
+ }
384
+ }, [isPrefixAnimationFinished, hasFocus, plainTextValue, prefixElement, shouldHidePlaceholderOnFocus, prefixElementWidth]);
385
+ (0, _react.useEffect)(() => {
386
+ if (prefixElement) {
387
+ setIsPrefixAnimationFinished(false);
388
+ }
389
+ }, [prefixElement]);
390
+ const handleFocus = event => {
391
+ if (typeof onFocus === 'function' && !isDisabled) {
392
+ onFocus(event);
393
+ }
394
+ setHasFocus(true);
395
+ };
396
+ const handleBlur = event => {
397
+ if (typeof onBlur === 'function' && !isDisabled) {
398
+ onBlur(event);
399
+ }
400
+ setHasFocus(false);
401
+ };
402
+ (0, _react.useEffect)(() => {
403
+ if (editorRef.current && prefixElement) {
404
+ const text = (0, _emoji.convertEmojisToUnicode)(prefixElement);
405
+ (0, _insert.insertTextAtCursorPosition)({
406
+ editorElement: editorRef.current,
407
+ text
408
+ });
409
+ handleUpdateHTML(prefixElement);
410
+ hasPrefixRendered.current = true;
411
+ }
412
+ }, [handleUpdateHTML, prefixElement]);
413
+ (0, _react.useEffect)(() => {
414
+ var _editorRef$current3;
415
+ if (prefixElementRef.current && prefixElement && (0, _text.convertTextToHTML)(prefixElement) === ((_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.innerHTML)) {
416
+ setPrefixElementWidth(prefixElementRef.current.offsetWidth + 2);
417
+ } else {
418
+ setPrefixElementWidth(undefined);
419
+ }
420
+ }, [plainTextValue, prefixElement]);
421
+ (0, _react.useEffect)(() => {
422
+ const handleResize = () => {
423
+ if (editorRef.current) {
424
+ setLabelWidth(editorRef.current.offsetWidth);
425
+ }
426
+ };
427
+ const resizeObserver = new ResizeObserver(handleResize);
428
+ if (editorRef.current) {
429
+ resizeObserver.observe(editorRef.current);
430
+ }
431
+ return () => {
432
+ resizeObserver.disconnect();
433
+ };
434
+ }, []);
435
+ (0, _react.useEffect)(() => {
436
+ const blurElement = () => {
437
+ if (editorRef.current && document.activeElement === editorRef.current && isDisabled) {
438
+ editorRef.current.blur();
439
+ }
440
+ };
441
+ document.addEventListener('focus', blurElement, true);
442
+ return () => {
443
+ document.removeEventListener('focus', blurElement, true);
444
+ };
445
+ }, [isDisabled]);
446
+ return /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInput, {
447
+ $isDisabled: isDisabled,
448
+ $shouldChangeColor: shouldChangeColor
449
+ }, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
450
+ initial: true
451
+ }, progressDuration > 0 && /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledMotionEmojiInputProgress, {
452
+ animate: {
453
+ width: '100%'
454
+ },
455
+ exit: {
456
+ opacity: 0
457
+ },
458
+ initial: {
459
+ opacity: 1,
460
+ width: '0%'
461
+ },
462
+ transition: {
463
+ width: {
464
+ ease: 'linear',
465
+ duration: progressDuration
466
+ },
467
+ opacity: {
468
+ type: 'tween',
469
+ duration: 0.3
470
+ }
471
+ }
472
+ })), /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputContent, null, prefixElement && /*#__PURE__*/_react.default.createElement(_PrefixElement.default, {
473
+ key: prefixElement,
474
+ element: prefixElement,
475
+ prefixElementRef: prefixElementRef,
476
+ setIsPrefixAnimationFinished: setIsPrefixAnimationFinished
477
+ }), /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledMotionEmojiInputEditor, {
478
+ $browser: browser === null || browser === void 0 ? void 0 : browser.name,
479
+ animate: {
480
+ maxHeight: height ?? maxHeight,
481
+ minHeight: height ?? '26px'
482
+ },
483
+ contentEditable: true,
484
+ id: inputId,
485
+ onBeforeInput: handleBeforeInput,
486
+ onBlur: handleBlur,
487
+ onFocus: handleFocus,
488
+ onInput: handleInput,
489
+ onKeyDown: handleKeyDown,
490
+ onPaste: handlePaste,
491
+ onDrop: handleDrop,
492
+ ref: editorRef,
493
+ $shouldShowContent: isPrefixAnimationFinished,
494
+ transition: {
495
+ type: 'tween',
496
+ duration: 0.2
497
+ }
498
+ }), shouldShowPlaceholder && /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputLabel, {
499
+ $maxWidth: labelWidth,
500
+ $offsetWidth: prefixElementWidth
501
+ }, placeholder), !isTouch && !shouldPreventEmojiPicker && /*#__PURE__*/_react.default.createElement(_EmojiPickerPopup.default, {
502
+ accessToken: accessToken,
503
+ onSelect: handlePopupSelect,
504
+ onPopupVisibilityChange: handlePopupVisibility,
505
+ personId: personId
506
+ })), rightElement && /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputRightWrapper, null, rightElement));
507
+ });
508
+ EmojiInput.displayName = 'EmojiInput';
509
+ var _default = exports.default = EmojiInput;
510
+ //# sourceMappingURL=EmojiInput.js.map