@chayns-components/emoji-input 5.0.0-beta.100
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/LICENSE +21 -0
- package/README.md +45 -0
- package/lib/api/item-storage/get.d.ts +8 -0
- package/lib/api/item-storage/get.js +37 -0
- package/lib/api/item-storage/get.js.map +1 -0
- package/lib/api/item-storage/put.d.ts +9 -0
- package/lib/api/item-storage/put.js +42 -0
- package/lib/api/item-storage/put.js.map +1 -0
- package/lib/components/emoji-input/EmojiInput.d.ts +49 -0
- package/lib/components/emoji-input/EmojiInput.js +157 -0
- package/lib/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/components/emoji-input/EmojiInput.styles.d.ts +13 -0
- package/lib/components/emoji-input/EmojiInput.styles.js +145 -0
- package/lib/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/components/emoji-picker/EmojiPicker.d.ts +18 -0
- package/lib/components/emoji-picker/EmojiPicker.js +51 -0
- package/lib/components/emoji-picker/EmojiPicker.js.map +1 -0
- package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
- package/lib/components/emoji-picker/EmojiPicker.styles.js +25 -0
- package/lib/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +9 -0
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +51 -0
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +2 -0
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +27 -0
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +11 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +131 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +7 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +99 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +9 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +116 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +1 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +21 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +18 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +74 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +11 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +104 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.d.ts +36 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +150 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +7 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +97 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/constants/alignment.d.ts +10 -0
- package/lib/constants/alignment.js +21 -0
- package/lib/constants/alignment.js.map +1 -0
- package/lib/constants/categories.d.ts +12 -0
- package/lib/constants/categories.js +20 -0
- package/lib/constants/categories.js.map +1 -0
- package/lib/constants/emoji-de-DE.json +3827 -0
- package/lib/constants/emoji.d.ts +8 -0
- package/lib/constants/emoji.js +3808 -0
- package/lib/constants/emoji.js.map +1 -0
- package/lib/constants/externalServerUrl.d.ts +1 -0
- package/lib/constants/externalServerUrl.js +9 -0
- package/lib/constants/externalServerUrl.js.map +1 -0
- package/lib/hooks/emojiHistory.d.ts +22 -0
- package/lib/hooks/emojiHistory.js +91 -0
- package/lib/hooks/emojiHistory.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +42 -0
- package/lib/index.js.map +1 -0
- package/lib/types/api.d.ts +4 -0
- package/lib/types/api.js +6 -0
- package/lib/types/api.js.map +1 -0
- package/lib/types/category.d.ts +1 -0
- package/lib/types/category.js +6 -0
- package/lib/types/category.js.map +1 -0
- package/lib/utils/emoji.d.ts +2 -0
- package/lib/utils/emoji.js +96 -0
- package/lib/utils/emoji.js.map +1 -0
- package/lib/utils/environment.d.ts +9 -0
- package/lib/utils/environment.js +33 -0
- package/lib/utils/environment.js.map +1 -0
- package/lib/utils/font.d.ts +1 -0
- package/lib/utils/font.js +17 -0
- package/lib/utils/font.js.map +1 -0
- package/lib/utils/insert.d.ts +19 -0
- package/lib/utils/insert.js +50 -0
- package/lib/utils/insert.js.map +1 -0
- package/lib/utils/selection.d.ts +2 -0
- package/lib/utils/selection.js +43 -0
- package/lib/utils/selection.js.map +1 -0
- package/package.json +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Tobit Laboratories AG
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>
|
|
3
|
+
<img src="https://raw.githubusercontent.com/TobitSoftware/chayns-components/master/assets/logo.png" width="600px" alt="chayns-components" />
|
|
4
|
+
</h1>
|
|
5
|
+
<p>A set of beautiful React components for developing your own applications with chayns.</p>
|
|
6
|
+
<div>
|
|
7
|
+
<img src="https://img.shields.io/npm/dm/@chayns-components/typewriter.svg?style=for-the-badge" alt="" />
|
|
8
|
+
<img src="https://img.shields.io/npm/v/@chayns-components/typewriter?style=for-the-badge" alt="" />
|
|
9
|
+
<img src="https://img.shields.io/github/license/TobitSoftware/chayns-components?style=for-the-badge" alt="" />
|
|
10
|
+
<img src="https://img.shields.io/github/contributors/TobitSoftware/chayns-components?style=for-the-badge" alt="" />
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
First you need to install the typewriter part of the chayns-components.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# NPM
|
|
22
|
+
npm install @chayns-components/typewriter
|
|
23
|
+
|
|
24
|
+
# Yarn
|
|
25
|
+
yarn add @chayns-components/typewriter
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> **Information:** Since the components have now been implemented with the styled-components
|
|
29
|
+
> library, the styles are delivered directly with the components. There is no need to load an extra
|
|
30
|
+
> stylesheet anymore.
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
You can use the components in your project as in the following example.
|
|
35
|
+
|
|
36
|
+
```typescript jsx
|
|
37
|
+
import { Typewriter } from '@chayns-components/typewriter';
|
|
38
|
+
|
|
39
|
+
<Typewriter>
|
|
40
|
+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt
|
|
41
|
+
ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
|
|
42
|
+
dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est. Lorem ipsum dolor
|
|
43
|
+
sit amet.
|
|
44
|
+
</Typewriter>;
|
|
45
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HistoryItem } from '../../hooks/emojiHistory';
|
|
2
|
+
import type { ApiFunctionResult } from '../../types/api';
|
|
3
|
+
interface GetEmojiHistoryOptions {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
personId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getEmojiHistory: ({ accessToken, personId, }: GetEmojiHistoryOptions) => Promise<ApiFunctionResult<HistoryItem[]>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getEmojiHistory = void 0;
|
|
7
|
+
var _externalServerUrl = require("../../constants/externalServerUrl");
|
|
8
|
+
const getEmojiHistory = async _ref => {
|
|
9
|
+
let {
|
|
10
|
+
accessToken,
|
|
11
|
+
personId
|
|
12
|
+
} = _ref;
|
|
13
|
+
const requestInit = {
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${accessToken}`
|
|
16
|
+
},
|
|
17
|
+
method: 'GET'
|
|
18
|
+
};
|
|
19
|
+
const url = `${_externalServerUrl.ITEM_STORAGE_BASE_URL}/7/users/${personId}/keys/emojis`;
|
|
20
|
+
const response = await fetch(url, requestInit);
|
|
21
|
+
if (response.status === 200) {
|
|
22
|
+
try {
|
|
23
|
+
const data = await response.json();
|
|
24
|
+
return {
|
|
25
|
+
data: data.value,
|
|
26
|
+
status: 200
|
|
27
|
+
};
|
|
28
|
+
} catch (e) {
|
|
29
|
+
// Do nothing
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
status: response.status
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.getEmojiHistory = getEmojiHistory;
|
|
37
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HistoryItem } from '../../hooks/emojiHistory';
|
|
2
|
+
import type { ApiFunctionResult } from '../../types/api';
|
|
3
|
+
interface PutEmojiHistoryOptions {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
personId: string;
|
|
6
|
+
value: HistoryItem[];
|
|
7
|
+
}
|
|
8
|
+
export declare const putEmojiHistory: ({ accessToken, personId, value, }: PutEmojiHistoryOptions) => Promise<ApiFunctionResult<HistoryItem[]>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.putEmojiHistory = void 0;
|
|
7
|
+
var _externalServerUrl = require("../../constants/externalServerUrl");
|
|
8
|
+
const putEmojiHistory = async _ref => {
|
|
9
|
+
let {
|
|
10
|
+
accessToken,
|
|
11
|
+
personId,
|
|
12
|
+
value
|
|
13
|
+
} = _ref;
|
|
14
|
+
const requestInit = {
|
|
15
|
+
body: JSON.stringify({
|
|
16
|
+
value
|
|
17
|
+
}),
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${accessToken}`,
|
|
20
|
+
'Content-Type': 'application/json'
|
|
21
|
+
},
|
|
22
|
+
method: 'PUT'
|
|
23
|
+
};
|
|
24
|
+
const url = `${_externalServerUrl.ITEM_STORAGE_BASE_URL}/7/users/${personId}/keys/emojis`;
|
|
25
|
+
const response = await fetch(url, requestInit);
|
|
26
|
+
if (response.status === 201) {
|
|
27
|
+
try {
|
|
28
|
+
const data = await response.json();
|
|
29
|
+
return {
|
|
30
|
+
data: data.value,
|
|
31
|
+
status: 200
|
|
32
|
+
};
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Do nothing
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
status: response.status
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.putEmojiHistory = putEmojiHistory;
|
|
42
|
+
//# sourceMappingURL=put.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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;
|
|
@@ -0,0 +1,157 @@
|
|
|
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 _insert = require("../../utils/insert");
|
|
11
|
+
var _selection = require("../../utils/selection");
|
|
12
|
+
var _EmojiPickerPopup = _interopRequireDefault(require("../emoji-picker-popup/EmojiPickerPopup"));
|
|
13
|
+
var _EmojiInput = require("./EmojiInput.styles");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
const EmojiInput = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
accessToken,
|
|
20
|
+
isDisabled,
|
|
21
|
+
onInput,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
onPopupVisibilityChange,
|
|
24
|
+
personId,
|
|
25
|
+
placeholder,
|
|
26
|
+
popupAlignment,
|
|
27
|
+
rightElement,
|
|
28
|
+
value
|
|
29
|
+
} = _ref;
|
|
30
|
+
const [isMobile] = (0, _react.useState)((0, _environment.getIsMobile)());
|
|
31
|
+
const editorRef = (0, _react.useRef)(null);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* This function updates the content of the 'contentEditable' element if the new text is
|
|
35
|
+
* different from the previous content. So this is only true if, for example, a text like ":-)"
|
|
36
|
+
* has been replaced to the corresponding emoji.
|
|
37
|
+
*
|
|
38
|
+
* When updating the HTML, the current cursor position is saved before replacing the content, so
|
|
39
|
+
* that it can be set again afterward.
|
|
40
|
+
*/
|
|
41
|
+
const handleUpdateText = (0, _react.useCallback)(text => {
|
|
42
|
+
if (!editorRef.current) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const newInnerText = (0, _emoji.convertEmojisToUnicode)(text);
|
|
46
|
+
if (newInnerText !== editorRef.current.innerText) {
|
|
47
|
+
(0, _selection.saveSelection)(editorRef.current);
|
|
48
|
+
editorRef.current.innerText = newInnerText;
|
|
49
|
+
(0, _selection.restoreSelection)(editorRef.current);
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* This function handles the 'input' events of the 'contentEditable' element and also passes the
|
|
55
|
+
* respective event up accordingly if the 'onInput' property is a function.
|
|
56
|
+
*/
|
|
57
|
+
const handleInput = (0, _react.useCallback)(event => {
|
|
58
|
+
if (!editorRef.current) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
handleUpdateText(editorRef.current.innerText);
|
|
62
|
+
if (typeof onInput === 'function') {
|
|
63
|
+
onInput(event);
|
|
64
|
+
}
|
|
65
|
+
}, [handleUpdateText, onInput]);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* This function prevents formatting from being adopted when texts are inserted. To do this, the
|
|
69
|
+
* plain text is read from the event after the default behavior has been prevented. The plain
|
|
70
|
+
* text is then inserted at the correct position in the input field using the
|
|
71
|
+
* 'insertTextAtCursorPosition' function.
|
|
72
|
+
*/
|
|
73
|
+
const handlePaste = (0, _react.useCallback)(event => {
|
|
74
|
+
if (editorRef.current) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
let text = event.clipboardData.getData('text/plain');
|
|
77
|
+
text = (0, _emoji.convertEmojisToUnicode)(text);
|
|
78
|
+
(0, _insert.insertTextAtCursorPosition)({
|
|
79
|
+
editorElement: editorRef.current,
|
|
80
|
+
text
|
|
81
|
+
});
|
|
82
|
+
const newEvent = new Event('input', {
|
|
83
|
+
bubbles: true
|
|
84
|
+
});
|
|
85
|
+
editorRef.current.dispatchEvent(newEvent);
|
|
86
|
+
}
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* This function uses the 'insertTextAtCursorPosition' function to insert the emoji at the
|
|
91
|
+
* correct position in the editor element.
|
|
92
|
+
*
|
|
93
|
+
* At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,
|
|
94
|
+
* which in turn executes the 'onInput' function from the props. So this serves to ensure that
|
|
95
|
+
* the event is also passed through to the top when inserting via the popup.
|
|
96
|
+
*/
|
|
97
|
+
const handlePopupSelect = (0, _react.useCallback)(emoji => {
|
|
98
|
+
if (editorRef.current) {
|
|
99
|
+
(0, _insert.insertTextAtCursorPosition)({
|
|
100
|
+
editorElement: editorRef.current,
|
|
101
|
+
text: emoji
|
|
102
|
+
});
|
|
103
|
+
const event = new Event('input', {
|
|
104
|
+
bubbles: true
|
|
105
|
+
});
|
|
106
|
+
editorRef.current.dispatchEvent(event);
|
|
107
|
+
}
|
|
108
|
+
}, []);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* This function ensures that the input field does not lose focus when the popup is opened or an
|
|
112
|
+
* emoji is selected in it. For this purpose the corresponding elements get the class
|
|
113
|
+
* 'prevent-lose-focus'.
|
|
114
|
+
*
|
|
115
|
+
* The class can also be set to any other elements that should also not cause the input field to
|
|
116
|
+
* lose focus.
|
|
117
|
+
*/
|
|
118
|
+
const handlePreventLoseFocus = (0, _react.useCallback)(event => {
|
|
119
|
+
var _element$parentElemen;
|
|
120
|
+
const element = event.target;
|
|
121
|
+
if (element.classList.contains('prevent-lose-focus') || (_element$parentElemen = element.parentElement) !== null && _element$parentElemen !== void 0 && _element$parentElemen.classList.contains('prevent-lose-focus')) {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
event.stopPropagation();
|
|
124
|
+
}
|
|
125
|
+
}, []);
|
|
126
|
+
(0, _react.useEffect)(() => {
|
|
127
|
+
handleUpdateText(value);
|
|
128
|
+
}, [handleUpdateText, value]);
|
|
129
|
+
(0, _react.useEffect)(() => {
|
|
130
|
+
document.body.addEventListener('mousedown', handlePreventLoseFocus);
|
|
131
|
+
return () => {
|
|
132
|
+
document.body.removeEventListener('mousedown', handlePreventLoseFocus);
|
|
133
|
+
};
|
|
134
|
+
}, [handlePreventLoseFocus]);
|
|
135
|
+
return /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInput, {
|
|
136
|
+
isDisabled: isDisabled
|
|
137
|
+
}, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputContent, {
|
|
138
|
+
isRightElementGiven: !!rightElement
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputEditor, {
|
|
140
|
+
contentEditable: !isDisabled,
|
|
141
|
+
onInput: handleInput,
|
|
142
|
+
onKeyDown: onKeyDown,
|
|
143
|
+
onPaste: handlePaste,
|
|
144
|
+
placeholder: placeholder,
|
|
145
|
+
ref: editorRef
|
|
146
|
+
}), !isMobile && /*#__PURE__*/_react.default.createElement(_EmojiPickerPopup.default, {
|
|
147
|
+
accessToken: accessToken,
|
|
148
|
+
alignment: popupAlignment,
|
|
149
|
+
onSelect: handlePopupSelect,
|
|
150
|
+
onPopupVisibilityChange: onPopupVisibilityChange,
|
|
151
|
+
personId: personId
|
|
152
|
+
})), rightElement && /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputRightWrapper, null, rightElement));
|
|
153
|
+
};
|
|
154
|
+
EmojiInput.displayName = 'EmojiInput';
|
|
155
|
+
var _default = EmojiInput;
|
|
156
|
+
exports.default = _default;
|
|
157
|
+
//# sourceMappingURL=EmojiInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiInput.js","names":["_react","_interopRequireWildcard","require","_emoji","_environment","_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","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 { 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\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 onInput={handleInput}\n onKeyDown={onKeyDown}\n onPaste={handlePaste}\n placeholder={placeholder}\n ref={editorRef}\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 <StyledEmojiInputRightWrapper>{rightElement}</StyledEmojiInputRightWrapper>\n )}\n </StyledEmojiInput>\n );\n};\n\nEmojiInput.displayName = 'EmojiInput';\n\nexport default EmojiInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAaA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAK6B,SAAAM,uBAAAE,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,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAb,wBAAAS,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,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ACnBC,eAAe,EAAE,CAACvD,UAAW;IAC7BC,OAAO,EAAEsB,WAAY;IACrBrB,SAAS,EAAEA,SAAU;IACrBsD,OAAO,EAAE/B,WAAY;IACrBpB,WAAW,EAAEA,WAAY;IACzBoD,GAAG,EAAE7C;EAAU,EACjB,EACD,CAACH,QAAQ,iBACN5C,MAAA,CAAAY,OAAA,CAAAyE,aAAA,CAAC9E,iBAAA,CAAAK,OAAgB;IACbsB,WAAW,EAAEA,WAAY;IACzB2D,SAAS,EAAEpD,cAAe;IAC1BqD,QAAQ,EAAExB,iBAAkB;IAC5BhC,uBAAuB,EAAEA,uBAAwB;IACjDC,QAAQ,EAAEA;EAAS,EAE1B,CACqB,EACzBG,YAAY,iBACT1C,MAAA,CAAAY,OAAA,CAAAyE,aAAA,CAAC5E,WAAA,CAAAsF,4BAA4B,QAAErD,YAAY,CAC9C,CACc;AAE3B,CAAC;AAEDV,UAAU,CAACgE,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAEvBjE,UAAU;AAAAkE,OAAA,CAAAtF,OAAA,GAAAqF,QAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}, never>;
|
|
12
|
+
export declare const StyledEmojiInputRightWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
var _font = require("../../utils/font");
|
|
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-radius: 3px;
|
|
20
|
+
display: flex;
|
|
21
|
+
min-height: 42px;
|
|
22
|
+
opacity: ${_ref2 => {
|
|
23
|
+
let {
|
|
24
|
+
isDisabled
|
|
25
|
+
} = _ref2;
|
|
26
|
+
return isDisabled ? 0.5 : 1;
|
|
27
|
+
}};
|
|
28
|
+
pointer-events: ${_ref3 => {
|
|
29
|
+
let {
|
|
30
|
+
isDisabled
|
|
31
|
+
} = _ref3;
|
|
32
|
+
return isDisabled ? 'none' : 'initial';
|
|
33
|
+
}};
|
|
34
|
+
position: relative;
|
|
35
|
+
transition: opacity 0.3s ease;
|
|
36
|
+
`;
|
|
37
|
+
exports.StyledEmojiInput = StyledEmojiInput;
|
|
38
|
+
const StyledEmojiInputContent = _styledComponents.default.div`
|
|
39
|
+
align-items: end;
|
|
40
|
+
border: 1px solid rgba(160, 160, 160, 0.3);
|
|
41
|
+
border-radius: 3px;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex: 1 1 auto;
|
|
44
|
+
gap: 10px;
|
|
45
|
+
padding: 8px 10px;
|
|
46
|
+
|
|
47
|
+
${_ref4 => {
|
|
48
|
+
let {
|
|
49
|
+
isRightElementGiven
|
|
50
|
+
} = _ref4;
|
|
51
|
+
return isRightElementGiven && (0, _styledComponents.css)`
|
|
52
|
+
border-top-right-radius: 0;
|
|
53
|
+
border-bottom-right-radius: 0;
|
|
54
|
+
border-right-width: 0;
|
|
55
|
+
`;
|
|
56
|
+
}}
|
|
57
|
+
`;
|
|
58
|
+
exports.StyledEmojiInputContent = StyledEmojiInputContent;
|
|
59
|
+
const StyledEmojiInputEditor = _styledComponents.default.div`
|
|
60
|
+
color: ${_ref5 => {
|
|
61
|
+
let {
|
|
62
|
+
theme
|
|
63
|
+
} = _ref5;
|
|
64
|
+
return theme.text;
|
|
65
|
+
}};
|
|
66
|
+
flex: 1 1 auto;
|
|
67
|
+
font-family: ${_font.getFontFamily};
|
|
68
|
+
max-height: 210px;
|
|
69
|
+
overflow-y: scroll;
|
|
70
|
+
word-break: break-word;
|
|
71
|
+
|
|
72
|
+
// This fixes a bug where the field is not editable in certain browsers.
|
|
73
|
+
// This is for example the case on iOS 15 or older.
|
|
74
|
+
-webkit-user-modify: read-write;
|
|
75
|
+
-webkit-user-select: text;
|
|
76
|
+
|
|
77
|
+
&:empty:not(:focus):before {
|
|
78
|
+
content: '${_ref6 => {
|
|
79
|
+
let {
|
|
80
|
+
placeholder
|
|
81
|
+
} = _ref6;
|
|
82
|
+
return placeholder;
|
|
83
|
+
}}';
|
|
84
|
+
color: ${_ref7 => {
|
|
85
|
+
let {
|
|
86
|
+
theme
|
|
87
|
+
} = _ref7;
|
|
88
|
+
return theme['006'];
|
|
89
|
+
}};
|
|
90
|
+
pointer-events: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Styles for custom scrollbar
|
|
94
|
+
::-webkit-scrollbar {
|
|
95
|
+
width: 5px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
::-webkit-scrollbar-track {
|
|
99
|
+
background-color: transparent;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
::-webkit-scrollbar-button {
|
|
103
|
+
background-color: transparent;
|
|
104
|
+
height: 5px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
::-webkit-scrollbar-thumb {
|
|
108
|
+
background-color: rgba(
|
|
109
|
+
${_ref8 => {
|
|
110
|
+
let {
|
|
111
|
+
theme
|
|
112
|
+
} = _ref8;
|
|
113
|
+
return theme['text-rgb'];
|
|
114
|
+
}},
|
|
115
|
+
0.15
|
|
116
|
+
);
|
|
117
|
+
border-radius: 20px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are
|
|
121
|
+
// only supported in Firefox:
|
|
122
|
+
* {
|
|
123
|
+
scrollbar-color: rgba(
|
|
124
|
+
${_ref9 => {
|
|
125
|
+
let {
|
|
126
|
+
theme
|
|
127
|
+
} = _ref9;
|
|
128
|
+
return theme['text-rgb'];
|
|
129
|
+
}},
|
|
130
|
+
0.15
|
|
131
|
+
)
|
|
132
|
+
transparent;
|
|
133
|
+
scrollbar-width: thin;
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
exports.StyledEmojiInputEditor = StyledEmojiInputEditor;
|
|
137
|
+
const StyledEmojiInputRightWrapper = _styledComponents.default.div`
|
|
138
|
+
align-self: stretch;
|
|
139
|
+
border-bottom-right-radius: 3px;
|
|
140
|
+
border-top-right-radius: 3px;
|
|
141
|
+
flex: 0 0 auto;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
`;
|
|
144
|
+
exports.StyledEmojiInputRightWrapper = StyledEmojiInputRightWrapper;
|
|
145
|
+
//# sourceMappingURL=EmojiInput.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiInput.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_font","_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","_ref4","isRightElementGiven","css","StyledEmojiInputEditor","_ref5","text","getFontFamily","_ref6","placeholder","_ref7","_ref8","_ref9","StyledEmojiInputRightWrapper"],"sources":["../../../src/components/emoji-input/EmojiInput.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled, { css } from 'styled-components';\nimport { getFontFamily } from '../../utils/font';\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-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\ntype StyledEmojiInputContentProps = {\n isRightElementGiven: boolean;\n};\n\nexport const StyledEmojiInputContent = styled.div<StyledEmojiInputContentProps>`\n align-items: end;\n border: 1px solid rgba(160, 160, 160, 0.3);\n border-radius: 3px;\n display: flex;\n flex: 1 1 auto;\n gap: 10px;\n padding: 8px 10px;\n\n ${({ isRightElementGiven }) =>\n isRightElementGiven &&\n css`\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right-width: 0;\n `}\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 font-family: ${getFontFamily};\n max-height: 210px;\n overflow-y: scroll;\n word-break: break-word;\n\n // This fixes a bug where the field is not editable in certain browsers.\n // This is for example the case on iOS 15 or older.\n -webkit-user-modify: read-write;\n -webkit-user-select: text;\n\n &:empty:not(:focus):before {\n content: '${({ placeholder }) => placeholder}';\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme['006']};\n pointer-events: none;\n }\n\n // Styles for custom scrollbar\n ::-webkit-scrollbar {\n width: 5px;\n }\n\n ::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n ::-webkit-scrollbar-button {\n background-color: transparent;\n height: 5px;\n }\n\n ::-webkit-scrollbar-thumb {\n background-color: rgba(\n ${({ theme }: StyledEmojiInputEditorProps) => theme['text-rgb']},\n 0.15\n );\n border-radius: 20px;\n }\n\n // Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are\n // only supported in Firefox:\n * {\n scrollbar-color: rgba(\n ${({ theme }: StyledEmojiInputEditorProps) => theme['text-rgb']},\n 0.15\n )\n transparent;\n scrollbar-width: thin;\n }\n`;\n\nexport const StyledEmojiInputRightWrapper = styled.div`\n align-self: stretch;\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K,CAAC,KAAK,CAAC;AAAA,CAAC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcgB,KAAA;EAAA,IAAC;IAAEhB;EAAmC,CAAC,GAAAgB,KAAA;EAAA,OAAKhB,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkBiB,KAAA;EAAA,IAAC;IAAEjB;EAAmC,CAAC,GAAAiB,KAAA;EAAA,OAAKjB,KAAK,CAAC,UAAU,CAAC;AAAA,CAAC;AAChF;AACA;AACA;AACA;AACA;AACA,CAAC;AAACI,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AAEK,MAAMS,4BAA4B,GAAGrB,yBAAM,CAACC,GAAI;AACvD;AACA;AACA;AACA;AACA;AACA,CAAC;AAACM,OAAA,CAAAc,4BAAA,GAAAA,4BAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export type EmojiPickerProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Access token of the logged-in user. Is needed to load and save the history of the emojis.
|
|
5
|
+
*/
|
|
6
|
+
accessToken?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Function executed when an emoji is selected in the popup
|
|
9
|
+
* @param {string} emoji - Emoji that was selected
|
|
10
|
+
*/
|
|
11
|
+
onSelect: (emoji: string) => 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;
|
|
16
|
+
};
|
|
17
|
+
declare const EmojiPicker: FC<EmojiPickerProps>;
|
|
18
|
+
export default EmojiPicker;
|