@chayns-components/emoji-input 5.0.0-beta.73 → 5.0.0-beta.730

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 (214) hide show
  1. package/README.md +4 -15
  2. package/lib/cjs/api/item-storage/get.js +36 -0
  3. package/lib/cjs/api/item-storage/get.js.map +1 -0
  4. package/lib/cjs/api/item-storage/put.js +41 -0
  5. package/lib/cjs/api/item-storage/put.js.map +1 -0
  6. package/lib/cjs/components/emoji-input/EmojiInput.js +531 -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 +11 -9
  15. package/lib/cjs/components/emoji-picker/EmojiPicker.js.map +1 -0
  16. package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.styles.js +5 -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/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +25 -0
  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/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +144 -0
  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/cjs/constants/alignment.js +19 -0
  39. package/lib/cjs/constants/alignment.js.map +1 -0
  40. package/lib/{constants → cjs/constants}/categories.js +2 -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/cjs/hooks/emojiHistory.js +89 -0
  49. package/lib/cjs/hooks/emojiHistory.js.map +1 -0
  50. package/lib/cjs/index.js +42 -0
  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 +214 -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 +518 -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/esm/index.js +6 -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 +197 -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/api/item-storage/get.d.ts +8 -0
  140. package/lib/types/api/item-storage/put.d.ts +9 -0
  141. package/lib/types/components/emoji-input/EmojiInput.d.ts +94 -0
  142. package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +547 -0
  143. package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
  144. package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
  145. package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +8 -0
  146. package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
  147. package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +266 -0
  148. package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +2 -0
  149. package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +10 -0
  150. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +14 -0
  151. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
  152. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +18 -0
  153. package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +282 -0
  154. package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +8 -6
  155. package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
  156. package/lib/{constants → types/constants}/alignment.d.ts +4 -0
  157. package/lib/{constants → types/constants}/categories.d.ts +1 -0
  158. package/lib/types/constants/emoji.d.ts +8 -0
  159. package/lib/types/constants/externalServerUrl.d.ts +1 -0
  160. package/lib/types/constants/regex.d.ts +8 -0
  161. package/lib/types/hooks/emojiHistory.d.ts +22 -0
  162. package/lib/types/index.d.ts +6 -0
  163. package/lib/types/types/api.d.ts +4 -0
  164. package/lib/types/types/category.d.ts +1 -0
  165. package/lib/types/utils/emoji.d.ts +4 -0
  166. package/lib/{utils → types/utils}/environment.d.ts +1 -0
  167. package/lib/types/utils/font.d.ts +1 -0
  168. package/lib/types/utils/insert.d.ts +26 -0
  169. package/lib/types/utils/number.d.ts +1 -0
  170. package/lib/types/utils/selection.d.ts +22 -0
  171. package/lib/types/utils/text.d.ts +3 -0
  172. package/package.json +45 -29
  173. package/lib/components/emoji-input/EmojiInput.d.ts +0 -30
  174. package/lib/components/emoji-input/EmojiInput.js +0 -154
  175. package/lib/components/emoji-input/EmojiInput.js.map +0 -1
  176. package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -8
  177. package/lib/components/emoji-input/EmojiInput.styles.js +0 -83
  178. package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
  179. package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
  180. package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
  181. package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
  182. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -45
  183. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
  184. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
  185. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +0 -25
  186. package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
  187. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -66
  188. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
  189. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -2
  190. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -55
  191. package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
  192. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -121
  193. package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
  194. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
  195. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -94
  196. package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
  197. package/lib/constants/alignment.js +0 -15
  198. package/lib/constants/alignment.js.map +0 -1
  199. package/lib/constants/categories.js.map +0 -1
  200. package/lib/index.d.ts +0 -1
  201. package/lib/index.js +0 -14
  202. package/lib/index.js.map +0 -1
  203. package/lib/types/category.d.ts +0 -1
  204. package/lib/types/category.js +0 -6
  205. package/lib/types/category.js.map +0 -1
  206. package/lib/utils/emoji.d.ts +0 -1
  207. package/lib/utils/emoji.js +0 -191
  208. package/lib/utils/emoji.js.map +0 -1
  209. package/lib/utils/environment.js.map +0 -1
  210. package/lib/utils/selection.d.ts +0 -2
  211. package/lib/utils/selection.js +0 -43
  212. package/lib/utils/selection.js.map +0 -1
  213. /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
  214. /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
@@ -1,21 +1,23 @@
1
1
  import { FC } from 'react';
2
2
  export type EmojiPickerPopupProps = {
3
+ /**
4
+ * Access token of the logged-in user. Is needed to load and save the history of the emojis.
5
+ */
6
+ accessToken?: string;
3
7
  /**
4
8
  * Function that is executed when the visibility of the popup changes.
5
9
  * @param {boolean} isVisible - Whether the popup is visible or not
6
10
  */
7
11
  onPopupVisibilityChange?: (isVisible: boolean) => void;
12
+ /**
13
+ * Person id of the logged-in user. Is needed to load and save the history of the emojis.
14
+ */
15
+ personId?: string;
8
16
  /**
9
17
  * Function executed when an emoji is selected in the popup
10
18
  * @param {string} emoji - Emoji that was selected
11
19
  */
12
20
  onSelect: (emoji: string) => void;
13
21
  };
14
- export type PopupPosition = {
15
- bottom?: number;
16
- left?: number;
17
- right?: number;
18
- top?: number;
19
- };
20
22
  declare const EmojiPickerPopup: FC<EmojiPickerPopupProps>;
21
23
  export default EmojiPickerPopup;
@@ -0,0 +1 @@
1
+ export declare const StyledEmojiPickerPopup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,3 +1,7 @@
1
+ export declare enum AnchorAlignment {
2
+ Bottom = 0,
3
+ Top = 1
4
+ }
1
5
  export declare enum PopupAlignment {
2
6
  TopLeft = 0,
3
7
  BottomLeft = 1,
@@ -1,4 +1,5 @@
1
1
  export declare const CATEGORY_EMOJIS: {
2
+ history: string;
2
3
  smileys_emotion: string;
3
4
  people_body: string;
4
5
  animals_nature: string;
@@ -0,0 +1,8 @@
1
+ export declare const asciiList: {
2
+ [key: string]: string;
3
+ };
4
+ export declare const regAscii: RegExp;
5
+ export declare const shortNameList: {
6
+ [key: string]: string;
7
+ };
8
+ export declare const regShortnames: RegExp;
@@ -0,0 +1 @@
1
+ export declare const ITEM_STORAGE_BASE_URL = "https://cube.tobit.cloud/item-storage/api/v1.0/schemes";
@@ -0,0 +1,8 @@
1
+ export declare const BB_LC_MENTION_REGEX: RegExp;
2
+ export declare const BB_NER_IGNORE_REGEX: RegExp;
3
+ export declare const BB_NER_REPLACE_REGEX: RegExp;
4
+ export declare const HTML_LC_MENTION_REGEX: RegExp;
5
+ export declare const HTML_NER_IGNORE_REGEX: RegExp;
6
+ export declare const HTML_NER_REPLACE_REGEX: RegExp;
7
+ export declare const HTML_BOLD_REGEX: RegExp;
8
+ export declare const HTML_A_TAG_REGEX: RegExp;
@@ -0,0 +1,22 @@
1
+ import type { Category } from '../types/category';
2
+ export interface HistoryItem {
3
+ count: number;
4
+ emoji: string;
5
+ modifiedTime: string;
6
+ name: string;
7
+ skin_tone_support: boolean;
8
+ }
9
+ interface UseEmojiHistoryOptions {
10
+ accessToken?: string;
11
+ personId?: string;
12
+ selectedCategory: Category;
13
+ }
14
+ export declare const useEmojiHistory: ({ accessToken, personId, selectedCategory, }: UseEmojiHistoryOptions) => {
15
+ addOrUpdateEmojiInHistory: ({ emoji, name, skin_tone_support, }: {
16
+ emoji: string;
17
+ name: string;
18
+ skin_tone_support: boolean;
19
+ }) => Promise<void>;
20
+ historyEmojis: HistoryItem[];
21
+ };
22
+ export {};
@@ -0,0 +1,6 @@
1
+ export { default as EmojiInput } from './components/emoji-input/EmojiInput';
2
+ export type { EmojiInputRef } from './components/emoji-input/EmojiInput';
3
+ export { default as EmojiPickerPopup } from './components/emoji-picker-popup/EmojiPickerPopup';
4
+ export { default as EmojiPicker } from './components/emoji-picker/EmojiPicker';
5
+ export { PopupAlignment } from './constants/alignment';
6
+ export { convertEmojisToUnicode } from './utils/emoji';
@@ -0,0 +1,4 @@
1
+ export interface ApiFunctionResult<T = null> {
2
+ data?: T;
3
+ status?: number;
4
+ }
@@ -0,0 +1 @@
1
+ export type Category = 'history' | 'smileys_emotion' | 'people_body' | 'animals_nature' | 'food_drink' | 'travel_places' | 'activities' | 'objects' | 'symbols' | 'flags';
@@ -0,0 +1,4 @@
1
+ export declare const unescapeHTML: (text: string) => string;
2
+ export declare const escapeHTML: (text: string) => string;
3
+ export declare const convertEmojisToUnicode: (text: string) => string;
4
+ export declare const addSkinToneToEmoji: (emoji: string, skinTone: string) => string;
@@ -4,5 +4,6 @@ declare enum DeviceType {
4
4
  Tablet = 2
5
5
  }
6
6
  export declare const getDeviceType: () => DeviceType;
7
+ export declare const getIsMacOS: () => boolean;
7
8
  export declare const getIsMobile: () => boolean;
8
9
  export {};
@@ -0,0 +1 @@
1
+ export declare const getFontFamily: () => string;
@@ -0,0 +1,26 @@
1
+ interface InsertTextAtCursorPositionOptions {
2
+ editorElement: HTMLDivElement;
3
+ text: string;
4
+ shouldUseSavedSelection?: boolean;
5
+ }
6
+ /**
7
+ * This function inserts the passed text at the correct position in the editor element. If the
8
+ * element has the focus, the new emoji is inserted at the cursor position. If not, the emoji
9
+ * will be appended to the back of the input field content.
10
+ *
11
+ * In addition, this function also sets the cursor to the correct position when the input field
12
+ * has the focus. For this purpose, the current position of the cursor or a selection is read to
13
+ * calculate the cursor position after inserting the text.
14
+ *
15
+ * @param {Object} options - Object with element and text to insert
16
+ * @param {HTMLDivElement} options.editorElement - Element to insert text into
17
+ * @param {string} options.text - Text to insert into element
18
+ */
19
+ export declare const insertTextAtCursorPosition: ({ editorElement, text, shouldUseSavedSelection, }: InsertTextAtCursorPositionOptions) => void;
20
+ export interface ReplaceTextOptions {
21
+ editorElement: HTMLDivElement;
22
+ searchText: string;
23
+ pasteText: string;
24
+ }
25
+ export declare const replaceText: ({ editorElement, searchText, pasteText }: ReplaceTextOptions) => void;
26
+ export {};
@@ -0,0 +1 @@
1
+ export declare const clamp: (value: number, min: number, max: number) => number;
@@ -0,0 +1,22 @@
1
+ import type { KeyboardEvent } from 'react';
2
+ interface SaveSelectionOptions {
3
+ shouldIgnoreEmptyTextNodes?: boolean;
4
+ }
5
+ export declare const saveSelection: (element: HTMLDivElement, { shouldIgnoreEmptyTextNodes }?: SaveSelectionOptions) => void;
6
+ export declare const restoreSelection: (element: HTMLDivElement) => void;
7
+ export declare const moveSelectionOffset: (distance: number) => void;
8
+ export declare const setChildIndex: (index: number) => void;
9
+ /**
10
+ * This function returns the code of the character that will be removed by the KeyDown event in the
11
+ * next step, if the "Backspace" or "Delete" key was pressed and there is no selection of multiple
12
+ * characters.
13
+ *
14
+ * @param event - Keyboard event from "onKeyDown"
15
+ */
16
+ export declare const getCharCodeThatWillBeDeleted: (event: KeyboardEvent<HTMLDivElement>) => number | null | undefined;
17
+ interface FindAndSelectTextOptions {
18
+ editorElement: HTMLDivElement;
19
+ searchText: string;
20
+ }
21
+ export declare const findAndSelectText: ({ editorElement, searchText, }: FindAndSelectTextOptions) => Range | null;
22
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const convertTextToHTML: (text: string) => string;
2
+ export declare const convertHTMLToText: (text: string) => string;
3
+ export declare const getElementTextLength: (element: Element) => number;
package/package.json CHANGED
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "name": "@chayns-components/emoji-input",
3
- "version": "5.0.0-beta.73",
3
+ "version": "5.0.0-beta.730",
4
4
  "description": "Input field that supports HTML elements and emojis",
5
+ "sideEffects": false,
6
+ "browserslist": [
7
+ ">0.5%",
8
+ "not dead",
9
+ "not op_mini all",
10
+ "not IE 11"
11
+ ],
5
12
  "keywords": [
6
13
  "chayns",
7
14
  "react",
@@ -13,8 +20,16 @@
13
20
  "author": "Tobit.Software",
14
21
  "homepage": "https://github.com/TobitSoftware/chayns-components/tree/main/packages/emoji-input#readme",
15
22
  "license": "MIT",
16
- "main": "lib/index.js",
17
- "types": "lib/index.d.ts",
23
+ "main": "lib/cjs/index.js",
24
+ "module": "lib/esm/index.js",
25
+ "types": "lib/types/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "require": "./lib/cjs/index.js",
29
+ "import": "./lib/esm/index.js",
30
+ "types": "./lib/types/index.d.ts"
31
+ }
32
+ },
18
33
  "directories": {
19
34
  "lib": "lib",
20
35
  "test": "__tests__"
@@ -27,46 +42,47 @@
27
42
  "url": "git+https://github.com/TobitSoftware/chayns-components.git"
28
43
  },
29
44
  "scripts": {
30
- "build": "npm run build:js && npm run build:types",
31
- "build:js": "babel src --out-dir lib --extensions=.ts,.tsx --source-maps --ignore=src/stories --copy-files",
45
+ "build": "npm run build:cjs && npm run build:esm && npm run build:types",
32
46
  "build:types": "tsc",
47
+ "build:cjs": "cross-env NODE_ENV=cjs babel src --out-dir lib/cjs --extensions=.ts,.tsx --source-maps --ignore=src/stories --copy-files",
48
+ "build:esm": "cross-env NODE_ENV=esm babel src --out-dir lib/esm --extensions=.ts,.tsx --source-maps --ignore=src/stories --copy-files",
33
49
  "prepublishOnly": "npm run build"
34
50
  },
35
51
  "bugs": {
36
52
  "url": "https://github.com/TobitSoftware/chayns-components/issues"
37
53
  },
38
54
  "devDependencies": {
39
- "@babel/cli": "^7.21.0",
40
- "@babel/core": "^7.21.0",
41
- "@babel/preset-env": "^7.20.2",
42
- "@babel/preset-react": "^7.18.6",
43
- "@babel/preset-typescript": "^7.21.0",
44
- "@types/react": "^17.0.53",
45
- "@types/react-dom": "^17.0.19",
46
- "@types/styled-components": "^5.1.26",
47
- "@types/uuid": "^9.0.0",
48
- "babel-loader": "^8.3.0",
49
- "lerna": "^6.5.1",
50
- "react": "^17.0.2",
51
- "react-dom": "^17.0.2",
52
- "typescript": "^4.9.5"
55
+ "@babel/cli": "^7.24.8",
56
+ "@babel/core": "^7.25.2",
57
+ "@babel/preset-env": "^7.25.3",
58
+ "@babel/preset-react": "^7.24.7",
59
+ "@babel/preset-typescript": "^7.24.7",
60
+ "@types/react": "^18.3.3",
61
+ "@types/react-dom": "^18.3.0",
62
+ "@types/styled-components": "^5.1.34",
63
+ "@types/uuid": "^9.0.8",
64
+ "babel-loader": "^9.1.3",
65
+ "cross-env": "^7.0.3",
66
+ "lerna": "^8.1.8",
67
+ "react": "^18.3.1",
68
+ "react-dom": "^18.3.1",
69
+ "styled-components": "^6.1.12",
70
+ "typescript": "^5.5.4"
53
71
  },
54
72
  "dependencies": {
55
- "@chayns-components/core": "^5.0.0-beta.66",
56
- "@chayns/colors": "^2.0.0",
57
- "clsx": "^1.2.1",
58
- "emojilib": "^3.0.8",
59
- "framer-motion": "^6.5.1",
60
- "styled-components": "^5.3.6",
61
- "unicode-emoji-json": "^0.5.0",
62
- "uuid": "^9.0.0"
73
+ "@chayns-components/core": "^5.0.0-beta.730",
74
+ "emojilib": "^3.0.12",
75
+ "unicode-emoji-json": "^0.6.0"
63
76
  },
64
77
  "peerDependencies": {
78
+ "chayns-api": ">=1.0.73",
79
+ "framer-motion": ">=10.18.0",
65
80
  "react": ">=16.14.0",
66
- "react-dom": ">=16.14.0"
81
+ "react-dom": ">=16.14.0",
82
+ "styled-components": ">=5.3.11"
67
83
  },
68
84
  "publishConfig": {
69
85
  "access": "public"
70
86
  },
71
- "gitHead": "1d009df70fa042027a5f7784cf3c51b94440cc8f"
87
+ "gitHead": "dcf28d137c4010b813a82af90b35d24d6be710fb"
72
88
  }
@@ -1,30 +0,0 @@
1
- import { ChangeEventHandler, FC, ReactNode } from 'react';
2
- export type EmojiInputProps = {
3
- /**
4
- * Disables the input so that it cannot be changed anymore
5
- */
6
- isDisabled: boolean;
7
- /**
8
- * Function that is executed when the text of the input changes
9
- */
10
- onInput?: ChangeEventHandler<HTMLDivElement>;
11
- /**
12
- * Function that is executed when the visibility of the popup changes.
13
- * @param {boolean} isVisible - Whether the popup is visible or not
14
- */
15
- onPopupVisibilityChange?: (isVisible: boolean) => void;
16
- /**
17
- * Placeholder for the input field
18
- */
19
- placeholder?: string;
20
- /**
21
- * Element that is rendered inside the EmojiInput on the right side.
22
- */
23
- rightElement?: ReactNode;
24
- /**
25
- * Value of the input field
26
- */
27
- value: string;
28
- };
29
- declare const EmojiInput: FC<EmojiInputProps>;
30
- export default EmojiInput;
@@ -1,154 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _emoji = require("../../utils/emoji");
9
- var _environment = require("../../utils/environment");
10
- var _selection = require("../../utils/selection");
11
- var _EmojiPickerPopup = _interopRequireDefault(require("../emoji-picker-popup/EmojiPickerPopup"));
12
- var _EmojiInput = require("./EmojiInput.styles");
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
- const EmojiInput = _ref => {
17
- let {
18
- isDisabled,
19
- onInput,
20
- onPopupVisibilityChange,
21
- placeholder,
22
- rightElement,
23
- value
24
- } = _ref;
25
- const [isMobile] = (0, _react.useState)((0, _environment.getIsMobile)());
26
- const editorRef = (0, _react.useRef)(null);
27
-
28
- /**
29
- * This function updates the content of the 'contentEditable' element if the new text is
30
- * different from the previous content. So this is only true if, for example, a text like ":-)"
31
- * has been replaced to the corresponding emoji.
32
- *
33
- * When updating the HTML, the current cursor position is saved before replacing the content, so
34
- * that it can be set again afterward.
35
- */
36
- const handleUpdateText = (0, _react.useCallback)(text => {
37
- if (!editorRef.current) {
38
- return;
39
- }
40
- const newHtml = (0, _emoji.convertAsciiToUnicode)(text);
41
- if (newHtml !== editorRef.current.innerHTML) {
42
- (0, _selection.saveSelection)(editorRef.current);
43
- editorRef.current.innerHTML = newHtml;
44
- (0, _selection.restoreSelection)(editorRef.current);
45
- }
46
- }, []);
47
-
48
- /**
49
- * This function handles the 'input' events of the 'contentEditable' element and also passes the
50
- * respective event up accordingly if the 'onInput' property is a function.
51
- */
52
- const handleInput = (0, _react.useCallback)(event => {
53
- if (!editorRef.current) {
54
- return;
55
- }
56
- handleUpdateText(editorRef.current.innerHTML);
57
- if (typeof onInput === 'function') {
58
- onInput(event);
59
- }
60
- }, [handleUpdateText, onInput]);
61
-
62
- /**
63
- * This function processes the selection of an emoji via the popup. If the 'contentEditable'
64
- * element has the focus, the new emoji is inserted at the cursor position. If not, the emoji
65
- * will be appended to the back of the input field content.
66
- *
67
- * In addition, this function also sets the cursor to the correct position when the input field
68
- * has the focus. For this purpose, the current position of the cursor or a selection is read to
69
- * calculate the cursor position after inserting the emoji.
70
- *
71
- * At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,
72
- * which in turn executes the 'onInput' function from the props. So this serves to ensure that
73
- * the event is also passed through to the top when inserting via the popup.
74
- */
75
- const handlePopupSelect = (0, _react.useCallback)(emoji => {
76
- if (!editorRef.current) {
77
- return;
78
- }
79
- const selection = window.getSelection();
80
- if (selection !== null && selection !== void 0 && selection.anchorNode && editorRef.current.contains(selection.anchorNode)) {
81
- const {
82
- endOffset,
83
- startOffset
84
- } = selection.getRangeAt(0);
85
- const rangeDistance = endOffset - startOffset;
86
- let offset = endOffset + emoji.length - rangeDistance;
87
- let {
88
- anchorNode
89
- } = selection;
90
- if (anchorNode.nodeValue) {
91
- anchorNode.nodeValue = anchorNode.nodeValue.substring(0, startOffset) + emoji + anchorNode.nodeValue.substring(endOffset);
92
- } else if (anchorNode === editorRef.current) {
93
- const newTextNode = document.createTextNode(emoji);
94
- editorRef.current.appendChild(newTextNode);
95
- anchorNode = newTextNode;
96
- }
97
- const newRange = document.createRange();
98
- if (anchorNode.nodeValue) {
99
- offset = Math.min(offset, anchorNode.nodeValue.length);
100
- }
101
- newRange.setStart(anchorNode, offset);
102
- newRange.setEnd(anchorNode, offset);
103
- selection.removeAllRanges();
104
- selection.addRange(newRange);
105
- } else {
106
- editorRef.current.innerHTML += emoji;
107
- }
108
- const event = new Event('input', {
109
- bubbles: true
110
- });
111
- editorRef.current.dispatchEvent(event);
112
- }, []);
113
-
114
- /**
115
- * This function ensures that the input field does not lose focus when the popup is opened or an
116
- * emoji is selected in it. For this purpose the corresponding elements get the class
117
- * 'prevent-lose-focus'.
118
- *
119
- * The class can also be set to any other elements that should also not cause the input field to
120
- * lose focus.
121
- */
122
- const handlePreventLoseFocus = (0, _react.useCallback)(event => {
123
- var _element$parentElemen;
124
- const element = event.target;
125
- if (element.classList.contains('prevent-lose-focus') || (_element$parentElemen = element.parentElement) !== null && _element$parentElemen !== void 0 && _element$parentElemen.classList.contains('prevent-lose-focus')) {
126
- event.preventDefault();
127
- event.stopPropagation();
128
- }
129
- }, []);
130
- (0, _react.useEffect)(() => {
131
- handleUpdateText(value);
132
- }, [handleUpdateText, value]);
133
- (0, _react.useEffect)(() => {
134
- document.body.addEventListener('mousedown', handlePreventLoseFocus);
135
- return () => {
136
- document.body.removeEventListener('mousedown', handlePreventLoseFocus);
137
- };
138
- }, [handlePreventLoseFocus]);
139
- return /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInput, {
140
- isDisabled: isDisabled
141
- }, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputContent, null, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputEditor, {
142
- contentEditable: !isDisabled,
143
- onInput: handleInput,
144
- placeholder: placeholder,
145
- ref: editorRef
146
- }), !isMobile && /*#__PURE__*/_react.default.createElement(_EmojiPickerPopup.default, {
147
- onSelect: handlePopupSelect,
148
- onPopupVisibilityChange: onPopupVisibilityChange
149
- })), rightElement);
150
- };
151
- EmojiInput.displayName = 'EmojiInput';
152
- var _default = EmojiInput;
153
- exports.default = _default;
154
- //# sourceMappingURL=EmojiInput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmojiInput.js","names":["_react","_interopRequireWildcard","require","_emoji","_environment","_selection","_EmojiPickerPopup","_interopRequireDefault","_EmojiInput","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","EmojiInput","_ref","isDisabled","onInput","onPopupVisibilityChange","placeholder","rightElement","value","isMobile","useState","getIsMobile","editorRef","useRef","handleUpdateText","useCallback","text","current","newHtml","convertAsciiToUnicode","innerHTML","saveSelection","restoreSelection","handleInput","event","handlePopupSelect","emoji","selection","window","getSelection","anchorNode","contains","endOffset","startOffset","getRangeAt","rangeDistance","offset","length","nodeValue","substring","newTextNode","document","createTextNode","appendChild","newRange","createRange","Math","min","setStart","setEnd","removeAllRanges","addRange","Event","bubbles","dispatchEvent","handlePreventLoseFocus","_element$parentElemen","element","target","classList","parentElement","preventDefault","stopPropagation","useEffect","body","addEventListener","removeEventListener","createElement","StyledEmojiInput","StyledEmojiInputContent","StyledEmojiInputEditor","contentEditable","ref","onSelect","displayName","_default","exports"],"sources":["../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { convertAsciiToUnicode } from '../../utils/emoji';\nimport { getIsMobile } from '../../utils/environment';\nimport { restoreSelection, saveSelection } from '../../utils/selection';\nimport EmojiPickerPopup from '../emoji-picker-popup/EmojiPickerPopup';\nimport {\n StyledEmojiInput,\n StyledEmojiInputContent,\n StyledEmojiInputEditor,\n} from './EmojiInput.styles';\n\nexport type EmojiInputProps = {\n /**\n * Disables the input so that it cannot be changed anymore\n */\n isDisabled: boolean;\n /**\n * Function that is executed when the text of the input changes\n */\n onInput?: ChangeEventHandler<HTMLDivElement>;\n /**\n * Function that is executed when the visibility of the popup changes.\n * @param {boolean} isVisible - Whether the popup is visible or not\n */\n onPopupVisibilityChange?: (isVisible: boolean) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Element that is rendered inside the EmojiInput on the right side.\n */\n rightElement?: ReactNode;\n /**\n * Value of the input field\n */\n value: string;\n};\n\nconst EmojiInput: FC<EmojiInputProps> = ({\n isDisabled,\n onInput,\n onPopupVisibilityChange,\n placeholder,\n rightElement,\n value,\n}) => {\n const [isMobile] = useState(getIsMobile());\n\n const editorRef = useRef<HTMLDivElement>(null);\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 handleUpdateText = useCallback((text: string) => {\n if (!editorRef.current) {\n return;\n }\n\n const newHtml = convertAsciiToUnicode(text);\n\n if (newHtml !== editorRef.current.innerHTML) {\n saveSelection(editorRef.current);\n\n editorRef.current.innerHTML = newHtml;\n\n restoreSelection(editorRef.current);\n }\n }, []);\n\n /**\n * This function handles the 'input' events of the 'contentEditable' element and also passes the\n * respective event up accordingly if the 'onInput' property is a function.\n */\n const handleInput = useCallback(\n (event: ChangeEvent<HTMLDivElement>) => {\n if (!editorRef.current) {\n return;\n }\n\n handleUpdateText(editorRef.current.innerHTML);\n\n if (typeof onInput === 'function') {\n onInput(event);\n }\n },\n [handleUpdateText, onInput]\n );\n\n /**\n * This function processes the selection of an emoji via the popup. If the 'contentEditable'\n * element has the focus, the new emoji is inserted at the cursor position. If not, the emoji\n * will be appended to the back of the input field content.\n *\n * In addition, this function also sets the cursor to the correct position when the input field\n * has the focus. For this purpose, the current position of the cursor or a selection is read to\n * calculate the cursor position after inserting the emoji.\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 return;\n }\n\n const selection = window.getSelection();\n\n if (selection?.anchorNode && editorRef.current.contains(selection.anchorNode)) {\n const { endOffset, startOffset } = selection.getRangeAt(0);\n\n const rangeDistance = endOffset - startOffset;\n\n let offset = endOffset + emoji.length - rangeDistance;\n\n let { anchorNode } = selection;\n\n if (anchorNode.nodeValue) {\n anchorNode.nodeValue =\n anchorNode.nodeValue.substring(0, startOffset) +\n emoji +\n anchorNode.nodeValue.substring(endOffset);\n } else if (anchorNode === editorRef.current) {\n const newTextNode = document.createTextNode(emoji);\n\n editorRef.current.appendChild(newTextNode);\n\n anchorNode = newTextNode;\n }\n\n const newRange = document.createRange();\n\n if (anchorNode.nodeValue) {\n offset = Math.min(offset, anchorNode.nodeValue.length);\n }\n\n newRange.setStart(anchorNode, offset);\n newRange.setEnd(anchorNode, offset);\n\n selection.removeAllRanges();\n selection.addRange(newRange);\n } else {\n editorRef.current.innerHTML += emoji;\n }\n\n const event = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(event);\n }, []);\n\n /**\n * This function ensures that the input field does not lose focus when the popup is opened or an\n * 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 field to\n * lose focus.\n */\n const handlePreventLoseFocus = useCallback((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 ) {\n event.preventDefault();\n event.stopPropagation();\n }\n }, []);\n\n useEffect(() => {\n handleUpdateText(value);\n }, [handleUpdateText, value]);\n\n useEffect(() => {\n document.body.addEventListener('mousedown', handlePreventLoseFocus);\n\n return () => {\n document.body.removeEventListener('mousedown', handlePreventLoseFocus);\n };\n }, [handlePreventLoseFocus]);\n\n return (\n <StyledEmojiInput isDisabled={isDisabled}>\n <StyledEmojiInputContent>\n <StyledEmojiInputEditor\n contentEditable={!isDisabled}\n onInput={handleInput}\n placeholder={placeholder}\n ref={editorRef}\n />\n {!isMobile && (\n <EmojiPickerPopup\n onSelect={handlePopupSelect}\n onPopupVisibilityChange={onPopupVisibilityChange}\n />\n )}\n </StyledEmojiInputContent>\n {rightElement}\n </StyledEmojiInput>\n );\n};\n\nEmojiInput.displayName = 'EmojiInput';\n\nexport default EmojiInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAUA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAC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AAA,CAAAW,OAAA,CAAAsF,aAAA,CAACzF,WAAA,CAAA0F,gBAAgB;IAACjE,UAAU,EAAEA;EAAW,gBACrCjC,MAAA,CAAAW,OAAA,CAAAsF,aAAA,CAACzF,WAAA,CAAA2F,uBAAuB,qBACpBnG,MAAA,CAAAW,OAAA,CAAAsF,aAAA,CAACzF,WAAA,CAAA4F,sBAAsB;IACnBC,eAAe,EAAE,CAACpE,UAAW;IAC7BC,OAAO,EAAEmB,WAAY;IACrBjB,WAAW,EAAEA,WAAY;IACzBkE,GAAG,EAAE5D;EAAU,EACjB,EACD,CAACH,QAAQ,iBACNvC,MAAA,CAAAW,OAAA,CAAAsF,aAAA,CAAC3F,iBAAA,CAAAK,OAAgB;IACb4F,QAAQ,EAAEhD,iBAAkB;IAC5BpB,uBAAuB,EAAEA;EAAwB,EAExD,CACqB,EACzBE,YAAY,CACE;AAE3B,CAAC;AAEDN,UAAU,CAACyE,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAEvB1E,UAAU;AAAA2E,OAAA,CAAA/F,OAAA,GAAA8F,QAAA"}
@@ -1,8 +0,0 @@
1
- import type { EmojiInputProps } from './EmojiInput';
2
- export declare const StyledEmojiInput: import("styled-components").StyledComponent<"div", any, Pick<EmojiInputProps, "isDisabled"> & {
3
- theme: import("@chayns-components/core/lib/components/color-scheme-provider/ColorSchemeProvider").Theme;
4
- }, never>;
5
- export declare const StyledEmojiInputContent: import("styled-components").StyledComponent<"div", any, {}, never>;
6
- export declare const StyledEmojiInputEditor: import("styled-components").StyledComponent<"div", any, Pick<EmojiInputProps, "placeholder"> & {
7
- theme: import("@chayns-components/core/lib/components/color-scheme-provider/ColorSchemeProvider").Theme;
8
- }, never>;
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StyledEmojiInputEditor = exports.StyledEmojiInputContent = exports.StyledEmojiInput = void 0;
7
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
- var _environment = require("../../utils/environment");
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- const StyledEmojiInput = _styledComponents.default.div`
12
- align-items: center;
13
- background-color: ${_ref => {
14
- let {
15
- theme
16
- } = _ref;
17
- return theme['100'];
18
- }};
19
- border: 1px solid rgba(160, 160, 160, 0.3);
20
- border-radius: 3px;
21
- display: flex;
22
- min-height: 42px;
23
- opacity: ${_ref2 => {
24
- let {
25
- isDisabled
26
- } = _ref2;
27
- return isDisabled ? 0.5 : 1;
28
- }};
29
- pointer-events: ${_ref3 => {
30
- let {
31
- isDisabled
32
- } = _ref3;
33
- return isDisabled ? 'none' : 'initial';
34
- }};
35
- position: relative;
36
- transition: opacity 0.3s ease;
37
- `;
38
- exports.StyledEmojiInput = StyledEmojiInput;
39
- const StyledEmojiInputContent = _styledComponents.default.div`
40
- display: flex;
41
- flex: 1 1 auto;
42
- gap: 10px;
43
- padding: 8px 10px;
44
- `;
45
- exports.StyledEmojiInputContent = StyledEmojiInputContent;
46
- const StyledEmojiInputEditor = _styledComponents.default.div`
47
- color: ${_ref4 => {
48
- let {
49
- theme
50
- } = _ref4;
51
- return theme.text;
52
- }};
53
- flex: 1 1 auto;
54
- word-break: break-word;
55
-
56
- ${() => {
57
- if ((0, _environment.getIsMobile)()) {
58
- return (0, _styledComponents.css)`
59
- font-family: 'Roboto Regular', 'Tahoma', serif;
60
- `;
61
- }
62
- return (0, _styledComponents.css)`
63
- font-family: 'Noto Color Emoji', 'Roboto Regular', 'Tahoma', serif;
64
- `;
65
- }}
66
-
67
- &:empty:not(:focus):before {
68
- content: '${_ref5 => {
69
- let {
70
- placeholder
71
- } = _ref5;
72
- return placeholder;
73
- }}';
74
- color: ${_ref6 => {
75
- let {
76
- theme
77
- } = _ref6;
78
- return theme['006'];
79
- }};
80
- }
81
- `;
82
- exports.StyledEmojiInputEditor = StyledEmojiInputEditor;
83
- //# sourceMappingURL=EmojiInput.styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmojiInput.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_environment","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledEmojiInput","styled","div","_ref","theme","_ref2","isDisabled","_ref3","exports","StyledEmojiInputContent","StyledEmojiInputEditor","_ref4","text","getIsMobile","css","_ref5","placeholder","_ref6"],"sources":["../../../src/components/emoji-input/EmojiInput.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled, { css } from 'styled-components';\nimport { getIsMobile } from '../../utils/environment';\nimport type { EmojiInputProps } from './EmojiInput';\n\ntype StyledEmojiInputProps = WithTheme<Pick<EmojiInputProps, 'isDisabled'>>;\n\nexport const StyledEmojiInput = styled.div<StyledEmojiInputProps>`\n align-items: center;\n background-color: ${({ theme }: StyledEmojiInputProps) => theme['100']};\n border: 1px solid rgba(160, 160, 160, 0.3);\n border-radius: 3px;\n display: flex;\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\nexport const StyledEmojiInputContent = styled.div`\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n padding: 8px 10px;\n`;\n\ntype StyledEmojiInputEditorProps = WithTheme<Pick<EmojiInputProps, 'placeholder'>>;\n\nexport const StyledEmojiInputEditor = styled.div<StyledEmojiInputEditorProps>`\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme.text};\n flex: 1 1 auto;\n word-break: break-word;\n\n ${() => {\n if (getIsMobile()) {\n return css`\n font-family: 'Roboto Regular', 'Tahoma', serif;\n `;\n }\n\n return css`\n font-family: 'Noto Color Emoji', 'Roboto Regular', 'Tahoma', serif;\n `;\n }}\n\n &:empty:not(:focus):before {\n content: '${({ placeholder }) => placeholder}';\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme['006']};\n }\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAsD,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAA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AAsB,GAAGT,yBAAM,CAACC,GAAiC;AAC9E,aAAaS,KAAA;EAAA,IAAC;IAAEP;EAAmC,CAAC,GAAAO,KAAA;EAAA,OAAKP,KAAK,CAACQ,IAAI;AAAA,CAAC;AACpE;AACA;AACA;AACA,MAAM,MAAM;EACJ,IAAI,IAAAC,wBAAW,GAAE,EAAE;IACf,OAAO,IAAAC,qBAAG,CAAC;AACvB;AACA,aAAa;EACL;EAEA,OAAO,IAAAA,qBAAG,CAAC;AACnB;AACA,SAAS;AACL,CAAE;AACN;AACA;AACA,oBAAoBC,KAAA;EAAA,IAAC;IAAEC;EAAY,CAAC,GAAAD,KAAA;EAAA,OAAKC,WAAW;AAAA,CAAC;AACrD,iBAAiBC,KAAA;EAAA,IAAC;IAAEb;EAAmC,CAAC,GAAAa,KAAA;EAAA,OAAKb,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AAC1E;AACA,CAAC;AAACI,OAAA,CAAAE,sBAAA,GAAAA,sBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmojiPicker.js","names":["_core","require","_react","_interopRequireWildcard","_dataByGroup","_interopRequireDefault","_EmojiPickerCategories","_EmojiPickerEmojis","_EmojiPicker","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","EmojiPicker","_ref","_emojiCategories$","onSelect","searchString","setSearchString","useState","selectedCategory","setSelectedCategory","emojiCategories","slug","handleCategorySelect","useCallback","category","handleSearchChange","event","target","value","createElement","StyledEmojiPicker","Input","onChange","placeholder","displayName","_default","exports"],"sources":["../../../src/components/emoji-picker/EmojiPicker.tsx"],"sourcesContent":["import { Input } from '@chayns-components/core';\nimport React, { ChangeEvent, FC, useCallback, useState } from 'react';\nimport emojiCategories from 'unicode-emoji-json/data-by-group.json';\nimport type { Category } from '../../types/category';\nimport EmojiPickerCategories from './emoji-picker-categories/EmojiPickerCategories';\nimport EmojiPickerEmojis from './emoji-picker-emojis/EmojiPickerEmojis';\nimport { StyledEmojiPicker } from './EmojiPicker.styles';\n\nexport type EmojiPickerProps = {\n /**\n * Function executed when an emoji is selected in the popup\n * @param {string} emoji - Emoji that was selected\n */\n onSelect: (emoji: string) => void;\n};\nconst EmojiPicker: FC<EmojiPickerProps> = ({ onSelect }) => {\n const [searchString, setSearchString] = useState('');\n const [selectedCategory, setSelectedCategory] = useState(emojiCategories[0]?.slug as Category);\n\n const handleCategorySelect = useCallback((category: Category) => {\n setSearchString('');\n setSelectedCategory(category);\n }, []);\n\n const handleSearchChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n setSearchString(event.target.value);\n }, []);\n\n return (\n <StyledEmojiPicker>\n <Input onChange={handleSearchChange} placeholder=\"Suchen\" value={searchString} />\n <EmojiPickerEmojis\n onSelect={onSelect}\n searchString={searchString}\n selectedCategory={selectedCategory}\n />\n <EmojiPickerCategories\n onSelect={handleCategorySelect}\n searchString={searchString}\n selectedCategory={selectedCategory}\n />\n </StyledEmojiPicker>\n );\n};\n\nEmojiPicker.displayName = 'EmojiPicker';\n\nexport default EmojiPicker;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,sBAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,kBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAAyD,SAAAI,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,w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