@chayns-components/emoji-input 5.0.0-beta.96 → 5.0.0-beta.965
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -15
- package/lib/{api → cjs/api}/item-storage/get.js +4 -5
- package/lib/cjs/api/item-storage/get.js.map +1 -0
- package/lib/{api → cjs/api}/item-storage/put.js +5 -6
- package/lib/cjs/api/item-storage/put.js.map +1 -0
- package/lib/cjs/components/emoji-input/EmojiInput.js +510 -0
- package/lib/cjs/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js +132 -0
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js +45 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js +65 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.js +9 -11
- package/lib/cjs/components/emoji-picker/EmojiPicker.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.styles.js +3 -5
- package/lib/cjs/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +102 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +5 -6
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +69 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +49 -21
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +24 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +130 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +99 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js +52 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js +15 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/{constants → cjs/constants}/alignment.js +6 -8
- package/lib/cjs/constants/alignment.js.map +1 -0
- package/lib/{constants → cjs/constants}/categories.js +1 -2
- package/lib/cjs/constants/categories.js.map +1 -0
- package/lib/{constants → cjs/constants}/emoji.js +4 -8
- package/lib/cjs/constants/emoji.js.map +1 -0
- package/lib/cjs/constants/externalServerUrl.js +8 -0
- package/lib/cjs/constants/externalServerUrl.js.map +1 -0
- package/lib/cjs/constants/regex.js +15 -0
- package/lib/cjs/constants/regex.js.map +1 -0
- package/lib/{hooks → cjs/hooks}/emojiHistory.js +13 -15
- package/lib/cjs/hooks/emojiHistory.js.map +1 -0
- package/lib/{index.js → cjs/index.js} +1 -1
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types/api.js +2 -0
- package/lib/cjs/types/api.js.map +1 -0
- package/lib/cjs/types/category.js +2 -0
- package/lib/cjs/types/category.js.map +1 -0
- package/lib/{utils → cjs/utils}/emoji.js +16 -6
- package/lib/cjs/utils/emoji.js.map +1 -0
- package/lib/{utils → cjs/utils}/environment.js +6 -4
- package/lib/cjs/utils/environment.js.map +1 -0
- package/lib/cjs/utils/font.js +17 -0
- package/lib/cjs/utils/font.js.map +1 -0
- package/lib/cjs/utils/insert.js +110 -0
- package/lib/cjs/utils/insert.js.map +1 -0
- package/lib/cjs/utils/number.js +17 -0
- package/lib/cjs/utils/number.js.map +1 -0
- package/lib/cjs/utils/selection.js +255 -0
- package/lib/cjs/utils/selection.js.map +1 -0
- package/lib/cjs/utils/text.js +57 -0
- package/lib/cjs/utils/text.js.map +1 -0
- package/lib/esm/api/item-storage/get.js +30 -0
- package/lib/esm/api/item-storage/get.js.map +1 -0
- package/lib/esm/api/item-storage/put.js +35 -0
- package/lib/esm/api/item-storage/put.js.map +1 -0
- package/lib/esm/components/emoji-input/EmojiInput.js +497 -0
- package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/esm/components/emoji-input/EmojiInput.styles.js +151 -0
- package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js +38 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js +69 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.js +40 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.js.map +1 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.styles.js +16 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +96 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +18 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +76 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +136 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +20 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +121 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js +43 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js +8 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/esm/constants/alignment.js +13 -0
- package/lib/esm/constants/alignment.js.map +1 -0
- package/lib/esm/constants/categories.js +13 -0
- package/lib/esm/constants/categories.js.map +1 -0
- package/lib/esm/constants/emoji-de-DE.json +3827 -0
- package/lib/esm/constants/emoji.js +3798 -0
- package/lib/esm/constants/emoji.js.map +1 -0
- package/lib/esm/constants/externalServerUrl.js +2 -0
- package/lib/esm/constants/externalServerUrl.js.map +1 -0
- package/lib/esm/constants/regex.js +9 -0
- package/lib/esm/constants/regex.js.map +1 -0
- package/lib/esm/hooks/emojiHistory.js +83 -0
- package/lib/esm/hooks/emojiHistory.js.map +1 -0
- package/lib/{index.d.ts → esm/index.js} +1 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types/api.js +2 -0
- package/lib/esm/types/api.js.map +1 -0
- package/lib/esm/types/category.js +2 -0
- package/lib/esm/types/category.js.map +1 -0
- package/lib/esm/utils/emoji.js +92 -0
- package/lib/esm/utils/emoji.js.map +1 -0
- package/lib/esm/utils/environment.js +24 -0
- package/lib/esm/utils/environment.js.map +1 -0
- package/lib/esm/utils/font.js +10 -0
- package/lib/esm/utils/font.js.map +1 -0
- package/lib/esm/utils/insert.js +104 -0
- package/lib/esm/utils/insert.js.map +1 -0
- package/lib/esm/utils/number.js +10 -0
- package/lib/esm/utils/number.js.map +1 -0
- package/lib/esm/utils/selection.js +237 -0
- package/lib/esm/utils/selection.js.map +1 -0
- package/lib/esm/utils/text.js +48 -0
- package/lib/esm/utils/text.js.map +1 -0
- package/lib/types/components/emoji-input/EmojiInput.d.ts +94 -0
- package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +549 -0
- package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
- package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
- package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
- package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +267 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +10 -0
- package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +5 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +283 -0
- package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +0 -13
- package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
- package/lib/types/constants/regex.d.ts +8 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/{utils → types/utils}/emoji.d.ts +2 -0
- package/lib/{utils → types/utils}/environment.d.ts +1 -0
- package/lib/types/utils/font.d.ts +1 -0
- package/lib/{utils → types/utils}/insert.d.ts +8 -1
- package/lib/types/utils/number.d.ts +1 -0
- package/lib/types/utils/selection.d.ts +23 -0
- package/lib/types/utils/text.d.ts +3 -0
- package/package.json +48 -30
- package/lib/api/item-storage/get.js.map +0 -1
- package/lib/api/item-storage/put.js.map +0 -1
- package/lib/components/emoji-input/EmojiInput.d.ts +0 -49
- package/lib/components/emoji-input/EmojiInput.js +0 -161
- package/lib/components/emoji-input/EmojiInput.js.map +0 -1
- package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -16
- package/lib/components/emoji-input/EmojiInput.styles.js +0 -153
- package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
- package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
- package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
- package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -51
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -131
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -7
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -99
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +0 -20
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +0 -74
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +0 -11
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +0 -104
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +0 -1
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -150
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -97
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
- package/lib/constants/alignment.js.map +0 -1
- package/lib/constants/categories.js.map +0 -1
- package/lib/constants/emoji.js.map +0 -1
- package/lib/constants/externalServerUrl.js +0 -9
- package/lib/constants/externalServerUrl.js.map +0 -1
- package/lib/hooks/emojiHistory.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types/api.js +0 -6
- package/lib/types/api.js.map +0 -1
- package/lib/types/category.js +0 -6
- package/lib/types/category.js.map +0 -1
- package/lib/utils/emoji.js.map +0 -1
- package/lib/utils/environment.js.map +0 -1
- package/lib/utils/font.d.ts +0 -1
- package/lib/utils/font.js +0 -15
- package/lib/utils/font.js.map +0 -1
- package/lib/utils/insert.js +0 -50
- package/lib/utils/insert.js.map +0 -1
- package/lib/utils/selection.d.ts +0 -2
- package/lib/utils/selection.js +0 -43
- package/lib/utils/selection.js.map +0 -1
- /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
- /package/lib/{api → types/api}/item-storage/get.d.ts +0 -0
- /package/lib/{api → types/api}/item-storage/put.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +0 -0
- /package/lib/{constants → types/constants}/alignment.d.ts +0 -0
- /package/lib/{constants → types/constants}/categories.d.ts +0 -0
- /package/lib/{constants → types/constants}/emoji.d.ts +0 -0
- /package/lib/{constants → types/constants}/externalServerUrl.d.ts +0 -0
- /package/lib/{hooks → types/hooks}/emojiHistory.d.ts +0 -0
- /package/lib/types/{api.d.ts → types/api.d.ts} +0 -0
- /package/lib/types/{category.d.ts → types/category.d.ts} +0 -0
|
@@ -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,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';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
export declare const unescapeHTML: (text: string) => string;
|
|
2
|
+
export declare const escapeHTML: (text: string) => string;
|
|
1
3
|
export declare const convertEmojisToUnicode: (text: string) => string;
|
|
2
4
|
export declare const addSkinToneToEmoji: (emoji: string, skinTone: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getFontFamily: () => string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface InsertTextAtCursorPositionOptions {
|
|
2
2
|
editorElement: HTMLDivElement;
|
|
3
3
|
text: string;
|
|
4
|
+
shouldUseSavedSelection?: boolean;
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
7
|
* This function inserts the passed text at the correct position in the editor element. If the
|
|
@@ -15,5 +16,11 @@ interface InsertTextAtCursorPositionOptions {
|
|
|
15
16
|
* @param {HTMLDivElement} options.editorElement - Element to insert text into
|
|
16
17
|
* @param {string} options.text - Text to insert into element
|
|
17
18
|
*/
|
|
18
|
-
export declare const insertTextAtCursorPosition: ({ editorElement, text, }: InsertTextAtCursorPositionOptions) => void;
|
|
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;
|
|
19
26
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 insertInvisibleCursorMarker: () => void;
|
|
8
|
+
export declare const moveSelectionOffset: (distance: number) => void;
|
|
9
|
+
export declare const setChildIndex: (index: number) => void;
|
|
10
|
+
/**
|
|
11
|
+
* This function returns the code of the character that will be removed by the KeyDown event in the
|
|
12
|
+
* next step, if the "Backspace" or "Delete" key was pressed and there is no selection of multiple
|
|
13
|
+
* characters.
|
|
14
|
+
*
|
|
15
|
+
* @param event - Keyboard event from "onKeyDown"
|
|
16
|
+
*/
|
|
17
|
+
export declare const getCharCodeThatWillBeDeleted: (event: KeyboardEvent<HTMLDivElement>) => number | null | undefined;
|
|
18
|
+
interface FindAndSelectTextOptions {
|
|
19
|
+
editorElement: HTMLDivElement;
|
|
20
|
+
searchText: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const findAndSelectText: ({ editorElement, searchText, }: FindAndSelectTextOptions) => Range | null;
|
|
23
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/emoji-input",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.965",
|
|
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
|
-
"
|
|
17
|
-
"
|
|
23
|
+
"types": "lib/types/index.d.ts",
|
|
24
|
+
"main": "lib/cjs/index.js",
|
|
25
|
+
"module": "lib/esm/index.js",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./lib/types/index.d.ts",
|
|
29
|
+
"require": "./lib/cjs/index.js",
|
|
30
|
+
"import": "./lib/esm/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
18
33
|
"directories": {
|
|
19
34
|
"lib": "lib",
|
|
20
35
|
"test": "__tests__"
|
|
@@ -27,46 +42,49 @@
|
|
|
27
42
|
"url": "git+https://github.com/TobitSoftware/chayns-components.git"
|
|
28
43
|
},
|
|
29
44
|
"scripts": {
|
|
30
|
-
"build": "npm run build:
|
|
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",
|
|
33
|
-
"
|
|
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",
|
|
49
|
+
"prepublishOnly": "npm run build",
|
|
50
|
+
"watch:js": "npm run build:esm -- --watch",
|
|
51
|
+
"link": "npm link && npm run watch:js"
|
|
34
52
|
},
|
|
35
53
|
"bugs": {
|
|
36
54
|
"url": "https://github.com/TobitSoftware/chayns-components/issues"
|
|
37
55
|
},
|
|
38
56
|
"devDependencies": {
|
|
39
|
-
"@babel/cli": "^7.
|
|
40
|
-
"@babel/core": "^7.
|
|
41
|
-
"@babel/preset-env": "^7.
|
|
42
|
-
"@babel/preset-react": "^7.
|
|
43
|
-
"@babel/preset-typescript": "^7.
|
|
44
|
-
"@types/react": "^
|
|
45
|
-
"@types/react-dom": "^
|
|
46
|
-
"@types/styled-components": "^5.1.
|
|
47
|
-
"@types/uuid": "^
|
|
48
|
-
"babel-loader": "^
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"react
|
|
52
|
-
"
|
|
57
|
+
"@babel/cli": "^7.26.4",
|
|
58
|
+
"@babel/core": "^7.26.0",
|
|
59
|
+
"@babel/preset-env": "^7.26.0",
|
|
60
|
+
"@babel/preset-react": "^7.26.3",
|
|
61
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
62
|
+
"@types/react": "^18.3.18",
|
|
63
|
+
"@types/react-dom": "^18.3.5",
|
|
64
|
+
"@types/styled-components": "^5.1.34",
|
|
65
|
+
"@types/uuid": "^10.0.0",
|
|
66
|
+
"babel-loader": "^9.2.1",
|
|
67
|
+
"cross-env": "^7.0.3",
|
|
68
|
+
"lerna": "^8.1.9",
|
|
69
|
+
"react": "^18.3.1",
|
|
70
|
+
"react-dom": "^18.3.1",
|
|
71
|
+
"styled-components": "^6.1.13",
|
|
72
|
+
"typescript": "^5.7.2"
|
|
53
73
|
},
|
|
54
74
|
"dependencies": {
|
|
55
|
-
"@chayns-components/core": "^5.0.0-beta.
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"emojilib": "^3.0.8",
|
|
59
|
-
"framer-motion": "^6.5.1",
|
|
60
|
-
"styled-components": "^5.3.8",
|
|
61
|
-
"unicode-emoji-json": "^0.5.0",
|
|
62
|
-
"uuid": "^9.0.0"
|
|
75
|
+
"@chayns-components/core": "^5.0.0-beta.965",
|
|
76
|
+
"emojilib": "^3.0.12",
|
|
77
|
+
"unicode-emoji-json": "^0.8.0"
|
|
63
78
|
},
|
|
64
79
|
"peerDependencies": {
|
|
80
|
+
"chayns-api": ">=1.0.73",
|
|
81
|
+
"framer-motion": ">=10.18.0",
|
|
65
82
|
"react": ">=16.14.0",
|
|
66
|
-
"react-dom": ">=16.14.0"
|
|
83
|
+
"react-dom": ">=16.14.0",
|
|
84
|
+
"styled-components": ">=5.3.11"
|
|
67
85
|
},
|
|
68
86
|
"publishConfig": {
|
|
69
87
|
"access": "public"
|
|
70
88
|
},
|
|
71
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "3d17e9e2dd344cc77c2e96e4db2ac6c03c76b2f3"
|
|
72
90
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","names":["_externalServerUrl","require","getEmojiHistory","_ref","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,MAAAC,IAAA,IAG0C;EAAA,IAHnC;IAClCC,WAAW;IACXC;EACoB,CAAC,GAAAF,IAAA;EACrB,MAAMG,WAAwB,GAAG;IAC7BC,OAAO,EAAE;MACLC,aAAa,EAAG,UAASJ,WAAY;IACzC,CAAC;IACDK,MAAM,EAAE;EACZ,CAAC;EAED,MAAMC,GAAG,GAAI,GAAEC,wCAAsB,YAAWN,QAAS,cAAa;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,EAAkC;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,CAAAjB,eAAA,GAAAA,eAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"put.js","names":["_externalServerUrl","require","putEmojiHistory","_ref","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,MAAAC,IAAA,IAI0C;EAAA,IAJnC;IAClCC,WAAW;IACXC,QAAQ;IACRC;EACoB,CAAC,GAAAH,IAAA;EACrB,MAAMI,WAAwB,GAAG;IAC7BC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;MAAEJ;IAAM,CAAC,CAAC;IAC/BK,OAAO,EAAE;MACLC,aAAa,EAAG,UAASR,WAAY,EAAC;MACtC,cAAc,EAAE;IACpB,CAAC;IACDS,MAAM,EAAE;EACZ,CAAC;EAED,MAAMC,GAAG,GAAI,GAAEC,wCAAsB,YAAWV,QAAS,cAAa;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,EAAkC;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,CAAApB,eAAA,GAAAA,eAAA"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ChangeEventHandler, FC, KeyboardEventHandler, ReactNode } from 'react';
|
|
2
|
-
import type { PopupAlignment } from '../../constants/alignment';
|
|
3
|
-
export type EmojiInputProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Access token of the logged-in user. Is needed to load and save the history of the emojis.
|
|
6
|
-
*/
|
|
7
|
-
accessToken?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Disables the input so that it cannot be changed anymore
|
|
10
|
-
*/
|
|
11
|
-
isDisabled?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Function that is executed when the text of the input changes
|
|
14
|
-
*/
|
|
15
|
-
onInput?: ChangeEventHandler<HTMLDivElement>;
|
|
16
|
-
/**
|
|
17
|
-
* Function that is executed when a key is pressed down.
|
|
18
|
-
*/
|
|
19
|
-
onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
|
|
20
|
-
/**
|
|
21
|
-
* Function that is executed when the visibility of the popup changes.
|
|
22
|
-
* @param {boolean} isVisible - Whether the popup is visible or not
|
|
23
|
-
*/
|
|
24
|
-
onPopupVisibilityChange?: (isVisible: boolean) => void;
|
|
25
|
-
/**
|
|
26
|
-
* Person id of the logged-in user. Is needed to load and save the history of the emojis.
|
|
27
|
-
*/
|
|
28
|
-
personId?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Placeholder for the input field
|
|
31
|
-
*/
|
|
32
|
-
placeholder?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Sets the alignment of the popup to a fixed value. If this value is not set, the component
|
|
35
|
-
* calculates the best position on its own. Use the imported 'PopupAlignment' enum to set this
|
|
36
|
-
* value.
|
|
37
|
-
*/
|
|
38
|
-
popupAlignment?: PopupAlignment;
|
|
39
|
-
/**
|
|
40
|
-
* Element that is rendered inside the EmojiInput on the right side.
|
|
41
|
-
*/
|
|
42
|
-
rightElement?: ReactNode;
|
|
43
|
-
/**
|
|
44
|
-
* Value of the input field
|
|
45
|
-
*/
|
|
46
|
-
value: string;
|
|
47
|
-
};
|
|
48
|
-
declare const EmojiInput: FC<EmojiInputProps>;
|
|
49
|
-
export default EmojiInput;
|
|
@@ -1,161 +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 _font = require("../../utils/font");
|
|
11
|
-
var _insert = require("../../utils/insert");
|
|
12
|
-
var _selection = require("../../utils/selection");
|
|
13
|
-
var _EmojiPickerPopup = _interopRequireDefault(require("../emoji-picker-popup/EmojiPickerPopup"));
|
|
14
|
-
var _EmojiInput = require("./EmojiInput.styles");
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
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); }
|
|
17
|
-
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; }
|
|
18
|
-
const EmojiInput = _ref => {
|
|
19
|
-
let {
|
|
20
|
-
accessToken,
|
|
21
|
-
isDisabled,
|
|
22
|
-
onInput,
|
|
23
|
-
onKeyDown,
|
|
24
|
-
onPopupVisibilityChange,
|
|
25
|
-
personId,
|
|
26
|
-
placeholder,
|
|
27
|
-
popupAlignment,
|
|
28
|
-
rightElement,
|
|
29
|
-
value
|
|
30
|
-
} = _ref;
|
|
31
|
-
const [isMobile] = (0, _react.useState)((0, _environment.getIsMobile)());
|
|
32
|
-
const [rootFontFamily] = (0, _react.useState)((0, _font.getRootFontFamily)());
|
|
33
|
-
const editorRef = (0, _react.useRef)(null);
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* This function updates the content of the 'contentEditable' element if the new text is
|
|
37
|
-
* different from the previous content. So this is only true if, for example, a text like ":-)"
|
|
38
|
-
* has been replaced to the corresponding emoji.
|
|
39
|
-
*
|
|
40
|
-
* When updating the HTML, the current cursor position is saved before replacing the content, so
|
|
41
|
-
* that it can be set again afterward.
|
|
42
|
-
*/
|
|
43
|
-
const handleUpdateText = (0, _react.useCallback)(text => {
|
|
44
|
-
if (!editorRef.current) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const newInnerText = (0, _emoji.convertEmojisToUnicode)(text);
|
|
48
|
-
if (newInnerText !== editorRef.current.innerText) {
|
|
49
|
-
(0, _selection.saveSelection)(editorRef.current);
|
|
50
|
-
editorRef.current.innerText = newInnerText;
|
|
51
|
-
(0, _selection.restoreSelection)(editorRef.current);
|
|
52
|
-
}
|
|
53
|
-
}, []);
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* This function handles the 'input' events of the 'contentEditable' element and also passes the
|
|
57
|
-
* respective event up accordingly if the 'onInput' property is a function.
|
|
58
|
-
*/
|
|
59
|
-
const handleInput = (0, _react.useCallback)(event => {
|
|
60
|
-
if (!editorRef.current) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
handleUpdateText(editorRef.current.innerText);
|
|
64
|
-
if (typeof onInput === 'function') {
|
|
65
|
-
onInput(event);
|
|
66
|
-
}
|
|
67
|
-
}, [handleUpdateText, onInput]);
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* This function prevents formatting from being adopted when texts are inserted. To do this, the
|
|
71
|
-
* plain text is read from the event after the default behavior has been prevented. The plain
|
|
72
|
-
* text is then inserted at the correct position in the input field using the
|
|
73
|
-
* 'insertTextAtCursorPosition' function.
|
|
74
|
-
*/
|
|
75
|
-
const handlePaste = (0, _react.useCallback)(event => {
|
|
76
|
-
if (editorRef.current) {
|
|
77
|
-
event.preventDefault();
|
|
78
|
-
let text = event.clipboardData.getData('text/plain');
|
|
79
|
-
text = (0, _emoji.convertEmojisToUnicode)(text);
|
|
80
|
-
(0, _insert.insertTextAtCursorPosition)({
|
|
81
|
-
editorElement: editorRef.current,
|
|
82
|
-
text
|
|
83
|
-
});
|
|
84
|
-
const newEvent = new Event('input', {
|
|
85
|
-
bubbles: true
|
|
86
|
-
});
|
|
87
|
-
editorRef.current.dispatchEvent(newEvent);
|
|
88
|
-
}
|
|
89
|
-
}, []);
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* This function uses the 'insertTextAtCursorPosition' function to insert the emoji at the
|
|
93
|
-
* correct position in the editor element.
|
|
94
|
-
*
|
|
95
|
-
* At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,
|
|
96
|
-
* which in turn executes the 'onInput' function from the props. So this serves to ensure that
|
|
97
|
-
* the event is also passed through to the top when inserting via the popup.
|
|
98
|
-
*/
|
|
99
|
-
const handlePopupSelect = (0, _react.useCallback)(emoji => {
|
|
100
|
-
if (editorRef.current) {
|
|
101
|
-
(0, _insert.insertTextAtCursorPosition)({
|
|
102
|
-
editorElement: editorRef.current,
|
|
103
|
-
text: emoji
|
|
104
|
-
});
|
|
105
|
-
const event = new Event('input', {
|
|
106
|
-
bubbles: true
|
|
107
|
-
});
|
|
108
|
-
editorRef.current.dispatchEvent(event);
|
|
109
|
-
}
|
|
110
|
-
}, []);
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* This function ensures that the input field does not lose focus when the popup is opened or an
|
|
114
|
-
* emoji is selected in it. For this purpose the corresponding elements get the class
|
|
115
|
-
* 'prevent-lose-focus'.
|
|
116
|
-
*
|
|
117
|
-
* The class can also be set to any other elements that should also not cause the input field to
|
|
118
|
-
* lose focus.
|
|
119
|
-
*/
|
|
120
|
-
const handlePreventLoseFocus = (0, _react.useCallback)(event => {
|
|
121
|
-
var _element$parentElemen;
|
|
122
|
-
const element = event.target;
|
|
123
|
-
if (element.classList.contains('prevent-lose-focus') || (_element$parentElemen = element.parentElement) !== null && _element$parentElemen !== void 0 && _element$parentElemen.classList.contains('prevent-lose-focus')) {
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
event.stopPropagation();
|
|
126
|
-
}
|
|
127
|
-
}, []);
|
|
128
|
-
(0, _react.useEffect)(() => {
|
|
129
|
-
handleUpdateText(value);
|
|
130
|
-
}, [handleUpdateText, value]);
|
|
131
|
-
(0, _react.useEffect)(() => {
|
|
132
|
-
document.body.addEventListener('mousedown', handlePreventLoseFocus);
|
|
133
|
-
return () => {
|
|
134
|
-
document.body.removeEventListener('mousedown', handlePreventLoseFocus);
|
|
135
|
-
};
|
|
136
|
-
}, [handlePreventLoseFocus]);
|
|
137
|
-
return /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInput, {
|
|
138
|
-
isDisabled: isDisabled
|
|
139
|
-
}, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputContent, {
|
|
140
|
-
isRightElementGiven: !!rightElement
|
|
141
|
-
}, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputEditor, {
|
|
142
|
-
contentEditable: !isDisabled,
|
|
143
|
-
isMobile: isMobile,
|
|
144
|
-
onInput: handleInput,
|
|
145
|
-
onKeyDown: onKeyDown,
|
|
146
|
-
onPaste: handlePaste,
|
|
147
|
-
placeholder: placeholder,
|
|
148
|
-
ref: editorRef,
|
|
149
|
-
rootFontFamily: rootFontFamily
|
|
150
|
-
}), !isMobile && /*#__PURE__*/_react.default.createElement(_EmojiPickerPopup.default, {
|
|
151
|
-
accessToken: accessToken,
|
|
152
|
-
alignment: popupAlignment,
|
|
153
|
-
onSelect: handlePopupSelect,
|
|
154
|
-
onPopupVisibilityChange: onPopupVisibilityChange,
|
|
155
|
-
personId: personId
|
|
156
|
-
})), rightElement && /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputRightWrapper, null, rightElement));
|
|
157
|
-
};
|
|
158
|
-
EmojiInput.displayName = 'EmojiInput';
|
|
159
|
-
var _default = EmojiInput;
|
|
160
|
-
exports.default = _default;
|
|
161
|
-
//# sourceMappingURL=EmojiInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmojiInput.js","names":["_react","_interopRequireWildcard","require","_emoji","_environment","_font","_insert","_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","accessToken","isDisabled","onInput","onKeyDown","onPopupVisibilityChange","personId","placeholder","popupAlignment","rightElement","value","isMobile","useState","getIsMobile","rootFontFamily","getRootFontFamily","editorRef","useRef","handleUpdateText","useCallback","text","current","newInnerText","convertEmojisToUnicode","innerText","saveSelection","restoreSelection","handleInput","event","handlePaste","preventDefault","clipboardData","getData","insertTextAtCursorPosition","editorElement","newEvent","Event","bubbles","dispatchEvent","handlePopupSelect","emoji","handlePreventLoseFocus","_element$parentElemen","element","target","classList","contains","parentElement","stopPropagation","useEffect","document","body","addEventListener","removeEventListener","createElement","StyledEmojiInput","StyledEmojiInputContent","isRightElementGiven","StyledEmojiInputEditor","contentEditable","onPaste","ref","alignment","onSelect","StyledEmojiInputRightWrapper","displayName","_default","exports"],"sources":["../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n ClipboardEvent,\n FC,\n KeyboardEventHandler,\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport type { PopupAlignment } from '../../constants/alignment';\nimport { convertEmojisToUnicode } from '../../utils/emoji';\nimport { getIsMobile } from '../../utils/environment';\nimport { getRootFontFamily } from '../../utils/font';\nimport { insertTextAtCursorPosition } from '../../utils/insert';\nimport { restoreSelection, saveSelection } from '../../utils/selection';\nimport EmojiPickerPopup from '../emoji-picker-popup/EmojiPickerPopup';\nimport {\n StyledEmojiInput,\n StyledEmojiInputContent,\n StyledEmojiInputEditor,\n StyledEmojiInputRightWrapper,\n} from './EmojiInput.styles';\n\nexport type EmojiInputProps = {\n /**\n * Access token of the logged-in user. Is needed to load and save the history of the emojis.\n */\n accessToken?: string;\n /**\n * 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 a key is pressed down.\n */\n onKeyDown?: KeyboardEventHandler<HTMLDivElement>;\n /**\n * Function that is executed when the visibility of the popup changes.\n * @param {boolean} isVisible - Whether the popup is visible or not\n */\n onPopupVisibilityChange?: (isVisible: boolean) => void;\n /**\n * Person id of the logged-in user. Is needed to load and save the history of the emojis.\n */\n personId?: string;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Sets the alignment of the popup to a fixed value. If this value is not set, the component\n * calculates the best position on its own. Use the imported 'PopupAlignment' enum to set this\n * value.\n */\n popupAlignment?: PopupAlignment;\n /**\n * Element that is rendered inside the EmojiInput on the right side.\n */\n rightElement?: ReactNode;\n /**\n * Value of the input field\n */\n value: string;\n};\n\nconst EmojiInput: FC<EmojiInputProps> = ({\n accessToken,\n isDisabled,\n onInput,\n onKeyDown,\n onPopupVisibilityChange,\n personId,\n placeholder,\n popupAlignment,\n rightElement,\n value,\n}) => {\n const [isMobile] = useState(getIsMobile());\n const [rootFontFamily] = useState(getRootFontFamily());\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 newInnerText = convertEmojisToUnicode(text);\n\n if (newInnerText !== editorRef.current.innerText) {\n saveSelection(editorRef.current);\n\n editorRef.current.innerText = newInnerText;\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.innerText);\n\n if (typeof onInput === 'function') {\n onInput(event);\n }\n },\n [handleUpdateText, onInput]\n );\n\n /**\n * This function prevents formatting from being adopted when texts are inserted. To do this, the\n * plain text is read from the event after the default behavior has been prevented. The plain\n * text is then inserted at the correct position in the input field using the\n * 'insertTextAtCursorPosition' function.\n */\n const handlePaste = useCallback((event: ClipboardEvent<HTMLDivElement>) => {\n if (editorRef.current) {\n event.preventDefault();\n\n let text = event.clipboardData.getData('text/plain');\n\n text = convertEmojisToUnicode(text);\n\n insertTextAtCursorPosition({ editorElement: editorRef.current, text });\n\n const newEvent = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(newEvent);\n }\n }, []);\n\n /**\n * This function uses the 'insertTextAtCursorPosition' function to insert the emoji at the\n * correct position in the editor element.\n *\n * At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,\n * which in turn executes the 'onInput' function from the props. So this serves to ensure that\n * the event is also passed through to the top when inserting via the popup.\n */\n const handlePopupSelect = useCallback((emoji: string) => {\n if (editorRef.current) {\n insertTextAtCursorPosition({ editorElement: editorRef.current, text: emoji });\n\n const event = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(event);\n }\n }, []);\n\n /**\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 isRightElementGiven={!!rightElement}>\n <StyledEmojiInputEditor\n contentEditable={!isDisabled}\n isMobile={isMobile}\n onInput={handleInput}\n onKeyDown={onKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n ref={editorRef}\n rootFontFamily={rootFontFamily}\n />\n {!isMobile && (\n <EmojiPickerPopup\n accessToken={accessToken}\n alignment={popupAlignment}\n onSelect={handlePopupSelect}\n onPopupVisibilityChange={onPopupVisibilityChange}\n personId={personId}\n />\n )}\n </StyledEmojiInputContent>\n {rightElement && (\n <StyledEmojiInputR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AAC,CAAChD;EAAa,gBACzD3C,MAAA,CAAAa,OAAA,CAAA2E,aAAA,CAAC9E,WAAA,CAAAkF,sBAAsB;IACnBC,eAAe,EAAE,CAACzD,UAAW;IAC7BS,QAAQ,EAAEA,QAAS;IACnBR,OAAO,EAAEwB,WAAY;IACrBvB,SAAS,EAAEA,SAAU;IACrBwD,OAAO,EAAE/B,WAAY;IACrBtB,WAAW,EAAEA,WAAY;IACzBsD,GAAG,EAAE7C,SAAU;IACfF,cAAc,EAAEA;EAAe,EACjC,EACD,CAACH,QAAQ,iBACN7C,MAAA,CAAAa,OAAA,CAAA2E,aAAA,CAAChF,iBAAA,CAAAK,OAAgB;IACbsB,WAAW,EAAEA,WAAY;IACzB6D,SAAS,EAAEtD,cAAe;IAC1BuD,QAAQ,EAAExB,iBAAkB;IAC5BlC,uBAAuB,EAAEA,uBAAwB;IACjDC,QAAQ,EAAEA;EAAS,EAE1B,CACqB,EACzBG,YAAY,iBACT3C,MAAA,CAAAa,OAAA,CAAA2E,aAAA,CAAC9E,WAAA,CAAAwF,4BAA4B,QAAEvD,YAAY,CAC9C,CACc;AAE3B,CAAC;AAEDV,UAAU,CAACkE,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAEvBnE,UAAU;AAAAoE,OAAA,CAAAxF,OAAA,GAAAuF,QAAA"}
|
|
@@ -1,16 +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
|
-
type StyledEmojiInputContentProps = {
|
|
6
|
-
isRightElementGiven: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const StyledEmojiInputContent: import("styled-components").StyledComponent<"div", any, StyledEmojiInputContentProps, never>;
|
|
9
|
-
export declare const StyledEmojiInputEditor: import("styled-components").StyledComponent<"div", any, Pick<EmojiInputProps, "placeholder"> & {
|
|
10
|
-
theme: import("@chayns-components/core/lib/components/color-scheme-provider/ColorSchemeProvider").Theme;
|
|
11
|
-
} & {
|
|
12
|
-
isMobile: boolean;
|
|
13
|
-
rootFontFamily: string;
|
|
14
|
-
}, never>;
|
|
15
|
-
export declare const StyledEmojiInputRightWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
16
|
-
export {};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StyledEmojiInputRightWrapper = exports.StyledEmojiInputEditor = exports.StyledEmojiInputContent = exports.StyledEmojiInput = void 0;
|
|
7
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
-
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); }
|
|
9
|
-
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; }
|
|
10
|
-
const StyledEmojiInput = _styledComponents.default.div`
|
|
11
|
-
align-items: center;
|
|
12
|
-
background-color: ${_ref => {
|
|
13
|
-
let {
|
|
14
|
-
theme
|
|
15
|
-
} = _ref;
|
|
16
|
-
return theme['100'];
|
|
17
|
-
}};
|
|
18
|
-
border-radius: 3px;
|
|
19
|
-
display: flex;
|
|
20
|
-
min-height: 42px;
|
|
21
|
-
opacity: ${_ref2 => {
|
|
22
|
-
let {
|
|
23
|
-
isDisabled
|
|
24
|
-
} = _ref2;
|
|
25
|
-
return isDisabled ? 0.5 : 1;
|
|
26
|
-
}};
|
|
27
|
-
pointer-events: ${_ref3 => {
|
|
28
|
-
let {
|
|
29
|
-
isDisabled
|
|
30
|
-
} = _ref3;
|
|
31
|
-
return isDisabled ? 'none' : 'initial';
|
|
32
|
-
}};
|
|
33
|
-
position: relative;
|
|
34
|
-
transition: opacity 0.3s ease;
|
|
35
|
-
`;
|
|
36
|
-
exports.StyledEmojiInput = StyledEmojiInput;
|
|
37
|
-
const StyledEmojiInputContent = _styledComponents.default.div`
|
|
38
|
-
align-items: end;
|
|
39
|
-
border: 1px solid rgba(160, 160, 160, 0.3);
|
|
40
|
-
border-radius: 3px;
|
|
41
|
-
display: flex;
|
|
42
|
-
flex: 1 1 auto;
|
|
43
|
-
gap: 10px;
|
|
44
|
-
padding: 8px 10px;
|
|
45
|
-
|
|
46
|
-
${_ref4 => {
|
|
47
|
-
let {
|
|
48
|
-
isRightElementGiven
|
|
49
|
-
} = _ref4;
|
|
50
|
-
return isRightElementGiven && (0, _styledComponents.css)`
|
|
51
|
-
border-top-right-radius: 0;
|
|
52
|
-
border-bottom-right-radius: 0;
|
|
53
|
-
border-right-width: 0;
|
|
54
|
-
`;
|
|
55
|
-
}}
|
|
56
|
-
`;
|
|
57
|
-
exports.StyledEmojiInputContent = StyledEmojiInputContent;
|
|
58
|
-
const StyledEmojiInputEditor = _styledComponents.default.div`
|
|
59
|
-
color: ${_ref5 => {
|
|
60
|
-
let {
|
|
61
|
-
theme
|
|
62
|
-
} = _ref5;
|
|
63
|
-
return theme.text;
|
|
64
|
-
}};
|
|
65
|
-
flex: 1 1 auto;
|
|
66
|
-
max-height: 210px;
|
|
67
|
-
overflow-y: scroll;
|
|
68
|
-
word-break: break-word;
|
|
69
|
-
|
|
70
|
-
${_ref6 => {
|
|
71
|
-
let {
|
|
72
|
-
isMobile,
|
|
73
|
-
rootFontFamily
|
|
74
|
-
} = _ref6;
|
|
75
|
-
if (isMobile) {
|
|
76
|
-
return (0, _styledComponents.css)`
|
|
77
|
-
font-family: ${rootFontFamily};
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
return (0, _styledComponents.css)`
|
|
81
|
-
font-family: ${rootFontFamily}, 'Noto Color Emoji';
|
|
82
|
-
`;
|
|
83
|
-
}}
|
|
84
|
-
|
|
85
|
-
&:empty:not(:focus):before {
|
|
86
|
-
content: '${_ref7 => {
|
|
87
|
-
let {
|
|
88
|
-
placeholder
|
|
89
|
-
} = _ref7;
|
|
90
|
-
return placeholder;
|
|
91
|
-
}}';
|
|
92
|
-
color: ${_ref8 => {
|
|
93
|
-
let {
|
|
94
|
-
theme
|
|
95
|
-
} = _ref8;
|
|
96
|
-
return theme['006'];
|
|
97
|
-
}};
|
|
98
|
-
pointer-events: none;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Styles for custom scrollbar
|
|
102
|
-
::-webkit-scrollbar {
|
|
103
|
-
width: 5px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
::-webkit-scrollbar-track {
|
|
107
|
-
background-color: transparent;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
::-webkit-scrollbar-button {
|
|
111
|
-
background-color: transparent;
|
|
112
|
-
height: 5px;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
::-webkit-scrollbar-thumb {
|
|
116
|
-
background-color: rgba(
|
|
117
|
-
${_ref9 => {
|
|
118
|
-
let {
|
|
119
|
-
theme
|
|
120
|
-
} = _ref9;
|
|
121
|
-
return theme['text-rgb'];
|
|
122
|
-
}},
|
|
123
|
-
0.15
|
|
124
|
-
);
|
|
125
|
-
border-radius: 20px;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are
|
|
129
|
-
// only supported in Firefox:
|
|
130
|
-
* {
|
|
131
|
-
scrollbar-color: rgba(
|
|
132
|
-
${_ref10 => {
|
|
133
|
-
let {
|
|
134
|
-
theme
|
|
135
|
-
} = _ref10;
|
|
136
|
-
return theme['text-rgb'];
|
|
137
|
-
}},
|
|
138
|
-
0.15
|
|
139
|
-
)
|
|
140
|
-
transparent;
|
|
141
|
-
scrollbar-width: thin;
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
exports.StyledEmojiInputEditor = StyledEmojiInputEditor;
|
|
145
|
-
const StyledEmojiInputRightWrapper = _styledComponents.default.div`
|
|
146
|
-
align-self: stretch;
|
|
147
|
-
border-bottom-right-radius: 3px;
|
|
148
|
-
border-top-right-radius: 3px;
|
|
149
|
-
flex: 0 0 auto;
|
|
150
|
-
overflow: hidden;
|
|
151
|
-
`;
|
|
152
|
-
exports.StyledEmojiInputRightWrapper = StyledEmojiInputRightWrapper;
|
|
153
|
-
//# sourceMappingURL=EmojiInput.styles.js.map
|