@chayns-components/emoji-input 5.0.0-beta.66
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/components/emoji-input/EmojiInput.d.ts +21 -0
- package/lib/components/emoji-input/EmojiInput.js +145 -0
- package/lib/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/components/emoji-input/EmojiInput.styles.d.ts +7 -0
- package/lib/components/emoji-input/EmojiInput.styles.js +60 -0
- package/lib/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/components/emoji-picker/EmojiPicker.d.ts +6 -0
- package/lib/components/emoji-picker/EmojiPicker.js +47 -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 +23 -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 +46 -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 +25 -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 +9 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +66 -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 +2 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +55 -0
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.d.ts +12 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +115 -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 +94 -0
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/constants/alignment.d.ts +6 -0
- package/lib/constants/alignment.js +15 -0
- package/lib/constants/alignment.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +14 -0
- package/lib/index.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 +1 -0
- package/lib/utils/emoji.js +191 -0
- package/lib/utils/emoji.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,21 @@
|
|
|
1
|
+
import { ChangeEventHandler, FC } from 'react';
|
|
2
|
+
export type EmojiInputProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Disables the input so that it cannot be changed anymore
|
|
5
|
+
*/
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Function that is executed when the text of the input changes
|
|
9
|
+
*/
|
|
10
|
+
onInput?: ChangeEventHandler<HTMLDivElement>;
|
|
11
|
+
/**
|
|
12
|
+
* Placeholder for the input field
|
|
13
|
+
*/
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Value of the input field
|
|
17
|
+
*/
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
declare const EmojiInput: FC<EmojiInputProps>;
|
|
21
|
+
export default EmojiInput;
|
|
@@ -0,0 +1,145 @@
|
|
|
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 _selection = require("../../utils/selection");
|
|
10
|
+
var _EmojiPickerPopup = _interopRequireDefault(require("../emoji-picker-popup/EmojiPickerPopup"));
|
|
11
|
+
var _EmojiInput = require("./EmojiInput.styles");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
const EmojiInput = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
isDisabled,
|
|
18
|
+
onInput,
|
|
19
|
+
placeholder,
|
|
20
|
+
value
|
|
21
|
+
} = _ref;
|
|
22
|
+
const editorRef = (0, _react.useRef)(null);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This function updates the content of the 'contentEditable' element if the new text is
|
|
26
|
+
* different from the previous content. So this is only true if, for example, a text like ":-)"
|
|
27
|
+
* has been replaced to the corresponding emoji.
|
|
28
|
+
*
|
|
29
|
+
* When updating the HTML, the current cursor position is saved before replacing the content, so
|
|
30
|
+
* that it can be set again afterward.
|
|
31
|
+
*/
|
|
32
|
+
const handleUpdateText = (0, _react.useCallback)(text => {
|
|
33
|
+
if (!editorRef.current) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const newHtml = (0, _emoji.convertAsciiToUnicode)(text);
|
|
37
|
+
if (newHtml !== editorRef.current.innerHTML) {
|
|
38
|
+
(0, _selection.saveSelection)(editorRef.current);
|
|
39
|
+
editorRef.current.innerHTML = newHtml;
|
|
40
|
+
(0, _selection.restoreSelection)(editorRef.current);
|
|
41
|
+
}
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* This function handles the 'input' events of the 'contentEditable' element and also passes the
|
|
46
|
+
* respective event up accordingly if the 'onInput' property is a function.
|
|
47
|
+
*/
|
|
48
|
+
const handleInput = (0, _react.useCallback)(event => {
|
|
49
|
+
if (!editorRef.current) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
handleUpdateText(editorRef.current.innerHTML);
|
|
53
|
+
if (typeof onInput === 'function') {
|
|
54
|
+
onInput(event);
|
|
55
|
+
}
|
|
56
|
+
}, [handleUpdateText, onInput]);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* This function processes the selection of an emoji via the popup. If the 'contentEditable'
|
|
60
|
+
* element has the focus, the new emoji is inserted at the cursor position. If not, the emoji
|
|
61
|
+
* will be appended to the back of the input field content.
|
|
62
|
+
*
|
|
63
|
+
* In addition, this function also sets the cursor to the correct position when the input field
|
|
64
|
+
* has the focus. For this purpose, the current position of the cursor or a selection is read to
|
|
65
|
+
* calculate the cursor position after inserting the emoji.
|
|
66
|
+
*
|
|
67
|
+
* At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,
|
|
68
|
+
* which in turn executes the 'onInput' function from the props. So this serves to ensure that
|
|
69
|
+
* the event is also passed through to the top when inserting via the popup.
|
|
70
|
+
*/
|
|
71
|
+
const handlePopupSelect = (0, _react.useCallback)(emoji => {
|
|
72
|
+
if (!editorRef.current) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const selection = window.getSelection();
|
|
76
|
+
if (selection !== null && selection !== void 0 && selection.anchorNode && editorRef.current.contains(selection.anchorNode)) {
|
|
77
|
+
const {
|
|
78
|
+
endOffset,
|
|
79
|
+
startOffset
|
|
80
|
+
} = selection.getRangeAt(0);
|
|
81
|
+
const rangeDistance = endOffset - startOffset;
|
|
82
|
+
let offset = endOffset + emoji.length - rangeDistance;
|
|
83
|
+
const {
|
|
84
|
+
anchorNode
|
|
85
|
+
} = selection;
|
|
86
|
+
if (anchorNode.nodeValue) {
|
|
87
|
+
anchorNode.nodeValue = anchorNode.nodeValue.substring(0, startOffset) + emoji + anchorNode.nodeValue.substring(endOffset);
|
|
88
|
+
}
|
|
89
|
+
const newRange = document.createRange();
|
|
90
|
+
if (anchorNode.nodeValue) {
|
|
91
|
+
offset = Math.min(offset, anchorNode.nodeValue.length);
|
|
92
|
+
}
|
|
93
|
+
newRange.setStart(anchorNode, offset);
|
|
94
|
+
newRange.setEnd(anchorNode, offset);
|
|
95
|
+
selection.removeAllRanges();
|
|
96
|
+
selection.addRange(newRange);
|
|
97
|
+
} else {
|
|
98
|
+
editorRef.current.innerHTML += emoji;
|
|
99
|
+
}
|
|
100
|
+
const event = new Event('input', {
|
|
101
|
+
bubbles: true
|
|
102
|
+
});
|
|
103
|
+
editorRef.current.dispatchEvent(event);
|
|
104
|
+
}, []);
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* This function ensures that the input field does not lose focus when the popup is opened or an
|
|
108
|
+
* emoji is selected in it. For this purpose the corresponding elements get the class
|
|
109
|
+
* 'prevent-lose-focus'.
|
|
110
|
+
*
|
|
111
|
+
* The class can also be set to any other elements that should also not cause the input field to
|
|
112
|
+
* lose focus.
|
|
113
|
+
*/
|
|
114
|
+
const handlePreventLoseFocus = (0, _react.useCallback)(event => {
|
|
115
|
+
var _element$parentElemen;
|
|
116
|
+
const element = event.target;
|
|
117
|
+
if (element.classList.contains('prevent-lose-focus') || (_element$parentElemen = element.parentElement) !== null && _element$parentElemen !== void 0 && _element$parentElemen.classList.contains('prevent-lose-focus')) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
event.stopPropagation();
|
|
120
|
+
}
|
|
121
|
+
}, []);
|
|
122
|
+
(0, _react.useEffect)(() => {
|
|
123
|
+
handleUpdateText(value);
|
|
124
|
+
}, [handleUpdateText, value]);
|
|
125
|
+
(0, _react.useEffect)(() => {
|
|
126
|
+
document.body.addEventListener('mousedown', handlePreventLoseFocus);
|
|
127
|
+
return () => {
|
|
128
|
+
document.body.removeEventListener('mousedown', handlePreventLoseFocus);
|
|
129
|
+
};
|
|
130
|
+
}, [handlePreventLoseFocus]);
|
|
131
|
+
return /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInput, {
|
|
132
|
+
isDisabled: isDisabled
|
|
133
|
+
}, /*#__PURE__*/_react.default.createElement(_EmojiInput.StyledEmojiInputEditor, {
|
|
134
|
+
contentEditable: !isDisabled,
|
|
135
|
+
onInput: handleInput,
|
|
136
|
+
placeholder: placeholder,
|
|
137
|
+
ref: editorRef
|
|
138
|
+
}), /*#__PURE__*/_react.default.createElement(_EmojiPickerPopup.default, {
|
|
139
|
+
onSelect: handlePopupSelect
|
|
140
|
+
}));
|
|
141
|
+
};
|
|
142
|
+
EmojiInput.displayName = 'EmojiInput';
|
|
143
|
+
var _default = EmojiInput;
|
|
144
|
+
exports.default = _default;
|
|
145
|
+
//# sourceMappingURL=EmojiInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiInput.js","names":["_react","_interopRequireWildcard","require","_emoji","_selection","_EmojiPickerPopup","_interopRequireDefault","_EmojiInput","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","EmojiInput","_ref","isDisabled","onInput","placeholder","value","editorRef","useRef","handleUpdateText","useCallback","text","current","newHtml","convertAsciiToUnicode","innerHTML","saveSelection","restoreSelection","handleInput","event","handlePopupSelect","emoji","selection","window","getSelection","anchorNode","contains","endOffset","startOffset","getRangeAt","rangeDistance","offset","length","nodeValue","substring","newRange","document","createRange","Math","min","setStart","setEnd","removeAllRanges","addRange","Event","bubbles","dispatchEvent","handlePreventLoseFocus","_element$parentElemen","element","target","classList","parentElement","preventDefault","stopPropagation","useEffect","body","addEventListener","removeEventListener","createElement","StyledEmojiInput","StyledEmojiInputEditor","contentEditable","ref","onSelect","displayName","_default","exports"],"sources":["../../../src/components/emoji-input/EmojiInput.tsx"],"sourcesContent":["import React, { ChangeEvent, ChangeEventHandler, FC, useCallback, useEffect, useRef } from 'react';\nimport { convertAsciiToUnicode } from '../../utils/emoji';\nimport { restoreSelection, saveSelection } from '../../utils/selection';\nimport EmojiPickerPopup from '../emoji-picker-popup/EmojiPickerPopup';\nimport { StyledEmojiInput, StyledEmojiInputEditor } from './EmojiInput.styles';\n\nexport type EmojiInputProps = {\n /**\n * Disables the input so that it cannot be changed anymore\n */\n isDisabled: boolean;\n /**\n * Function that is executed when the text of the input changes\n */\n onInput?: ChangeEventHandler<HTMLDivElement>;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Value of the input field\n */\n value: string;\n};\n\nconst EmojiInput: FC<EmojiInputProps> = ({ isDisabled, onInput, placeholder, value }) => {\n const editorRef = useRef<HTMLDivElement>(null);\n\n /**\n * This function updates the content of the 'contentEditable' element if the new text is\n * different from the previous content. So this is only true if, for example, a text like \":-)\"\n * has been replaced to the corresponding emoji.\n *\n * When updating the HTML, the current cursor position is saved before replacing the content, so\n * that it can be set again afterward.\n */\n const handleUpdateText = useCallback((text: string) => {\n if (!editorRef.current) {\n return;\n }\n\n const newHtml = convertAsciiToUnicode(text);\n\n if (newHtml !== editorRef.current.innerHTML) {\n saveSelection(editorRef.current);\n\n editorRef.current.innerHTML = newHtml;\n\n restoreSelection(editorRef.current);\n }\n }, []);\n\n /**\n * This function handles the 'input' events of the 'contentEditable' element and also passes the\n * respective event up accordingly if the 'onInput' property is a function.\n */\n const handleInput = useCallback(\n (event: ChangeEvent<HTMLDivElement>) => {\n if (!editorRef.current) {\n return;\n }\n\n handleUpdateText(editorRef.current.innerHTML);\n\n if (typeof onInput === 'function') {\n onInput(event);\n }\n },\n [handleUpdateText, onInput]\n );\n\n /**\n * This function processes the selection of an emoji via the popup. If the 'contentEditable'\n * element has the focus, the new emoji is inserted at the cursor position. If not, the emoji\n * will be appended to the back of the input field content.\n *\n * In addition, this function also sets the cursor to the correct position when the input field\n * has the focus. For this purpose, the current position of the cursor or a selection is read to\n * calculate the cursor position after inserting the emoji.\n *\n * At the end an 'input' event is dispatched, so that the function 'handleInput' is triggered,\n * which in turn executes the 'onInput' function from the props. So this serves to ensure that\n * the event is also passed through to the top when inserting via the popup.\n */\n const handlePopupSelect = useCallback((emoji: string) => {\n if (!editorRef.current) {\n return;\n }\n\n const selection = window.getSelection();\n\n if (selection?.anchorNode && editorRef.current.contains(selection.anchorNode)) {\n const { endOffset, startOffset } = selection.getRangeAt(0);\n\n const rangeDistance = endOffset - startOffset;\n\n let offset = endOffset + emoji.length - rangeDistance;\n\n const { anchorNode } = selection;\n\n if (anchorNode.nodeValue) {\n anchorNode.nodeValue =\n anchorNode.nodeValue.substring(0, startOffset) +\n emoji +\n anchorNode.nodeValue.substring(endOffset);\n }\n\n const newRange = document.createRange();\n\n if (anchorNode.nodeValue) {\n offset = Math.min(offset, anchorNode.nodeValue.length);\n }\n\n newRange.setStart(anchorNode, offset);\n newRange.setEnd(anchorNode, offset);\n\n selection.removeAllRanges();\n selection.addRange(newRange);\n } else {\n editorRef.current.innerHTML += emoji;\n }\n\n const event = new Event('input', { bubbles: true });\n\n editorRef.current.dispatchEvent(event);\n }, []);\n\n /**\n * This function ensures that the input field does not lose focus when the popup is opened or an\n * emoji is selected in it. For this purpose the corresponding elements get the class\n * 'prevent-lose-focus'.\n *\n * The class can also be set to any other elements that should also not cause the input field to\n * lose focus.\n */\n const handlePreventLoseFocus = useCallback((event: MouseEvent) => {\n const element = event.target as Element;\n\n if (\n element.classList.contains('prevent-lose-focus') ||\n element.parentElement?.classList.contains('prevent-lose-focus')\n ) {\n event.preventDefault();\n event.stopPropagation();\n }\n }, []);\n\n useEffect(() => {\n handleUpdateText(value);\n }, [handleUpdateText, value]);\n\n useEffect(() => {\n document.body.addEventListener('mousedown', handlePreventLoseFocus);\n\n return () => {\n document.body.removeEventListener('mousedown', handlePreventLoseFocus);\n };\n }, [handlePreventLoseFocus]);\n\n return (\n <StyledEmojiInput isDisabled={isDisabled}>\n <StyledEmojiInputEditor\n contentEditable={!isDisabled}\n onInput={handleInput}\n placeholder={placeholder}\n ref={editorRef}\n />\n <EmojiPickerPopup onSelect={handlePopupSelect} />\n </StyledEmojiInput>\n );\n};\n\nEmojiInput.displayName = 'EmojiInput';\n\nexport default EmojiInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAA+E,SAAAI,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,SAAAX,wBAAAO,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GA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AAK,CAACkC,cAAc,EAAE;MACtBlC,KAAK,CAACmC,eAAe,EAAE;IAC3B;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,IAAAC,gBAAS,EAAC,MAAM;IACZ9C,gBAAgB,CAACH,KAAK,CAAC;EAC3B,CAAC,EAAE,CAACG,gBAAgB,EAAEH,KAAK,CAAC,CAAC;EAE7B,IAAAiD,gBAAS,EAAC,MAAM;IACZnB,QAAQ,CAACoB,IAAI,CAACC,gBAAgB,CAAC,WAAW,EAAEV,sBAAsB,CAAC;IAEnE,OAAO,MAAM;MACTX,QAAQ,CAACoB,IAAI,CAACE,mBAAmB,CAAC,WAAW,EAAEX,sBAAsB,CAAC;IAC1E,CAAC;EACL,CAAC,EAAE,CAACA,sBAAsB,CAAC,CAAC;EAE5B,oBACI5E,MAAA,CAAAU,OAAA,CAAA8E,aAAA,CAACjF,WAAA,CAAAkF,gBAAgB;IAACzD,UAAU,EAAEA;EAAW,gBACrChC,MAAA,CAAAU,OAAA,CAAA8E,aAAA,CAACjF,WAAA,CAAAmF,sBAAsB;IACnBC,eAAe,EAAE,CAAC3D,UAAW;IAC7BC,OAAO,EAAEc,WAAY;IACrBb,WAAW,EAAEA,WAAY;IACzB0D,GAAG,EAAExD;EAAU,EACjB,eACFpC,MAAA,CAAAU,OAAA,CAAA8E,aAAA,CAACnF,iBAAA,CAAAK,OAAgB;IAACmF,QAAQ,EAAE5C;EAAkB,EAAG,CAClC;AAE3B,CAAC;AAEDnB,UAAU,CAACgE,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAEvBjE,UAAU;AAAAkE,OAAA,CAAAtF,OAAA,GAAAqF,QAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EmojiInputProps } from './EmojiInput';
|
|
2
|
+
export declare const StyledEmojiInput: import("styled-components").StyledComponent<"div", any, Pick<EmojiInputProps, "isDisabled"> & {
|
|
3
|
+
theme: import("@chayns-components/core/lib/components/color-scheme-provider/ColorSchemeProvider").Theme;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const StyledEmojiInputEditor: import("styled-components").StyledComponent<"div", any, Pick<EmojiInputProps, "placeholder"> & {
|
|
6
|
+
theme: import("@chayns-components/core/lib/components/color-scheme-provider/ColorSchemeProvider").Theme;
|
|
7
|
+
}, never>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledEmojiInputEditor = exports.StyledEmojiInput = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const StyledEmojiInput = _styledComponents.default.div`
|
|
10
|
+
align-items: center;
|
|
11
|
+
background-color: ${_ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
return theme['100'];
|
|
16
|
+
}};
|
|
17
|
+
border: 1px solid rgba(160, 160, 160, 0.3);
|
|
18
|
+
border-radius: 3px;
|
|
19
|
+
display: flex;
|
|
20
|
+
gap: 10px;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
min-height: 42px;
|
|
23
|
+
opacity: ${_ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
isDisabled
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return isDisabled ? 0.5 : 1;
|
|
28
|
+
}};
|
|
29
|
+
padding: 8px 10px;
|
|
30
|
+
position: relative;
|
|
31
|
+
transition: opacity 0.3s ease;
|
|
32
|
+
`;
|
|
33
|
+
exports.StyledEmojiInput = StyledEmojiInput;
|
|
34
|
+
const StyledEmojiInputEditor = _styledComponents.default.div`
|
|
35
|
+
color: ${_ref3 => {
|
|
36
|
+
let {
|
|
37
|
+
theme
|
|
38
|
+
} = _ref3;
|
|
39
|
+
return theme.text;
|
|
40
|
+
}};
|
|
41
|
+
flex: 1 1 auto;
|
|
42
|
+
font-family: 'Noto Color Emoji', 'Roboto Regular', 'Tahoma', serif;
|
|
43
|
+
|
|
44
|
+
&:empty:not(:focus):before {
|
|
45
|
+
content: '${_ref4 => {
|
|
46
|
+
let {
|
|
47
|
+
placeholder
|
|
48
|
+
} = _ref4;
|
|
49
|
+
return placeholder;
|
|
50
|
+
}}';
|
|
51
|
+
color: ${_ref5 => {
|
|
52
|
+
let {
|
|
53
|
+
theme
|
|
54
|
+
} = _ref5;
|
|
55
|
+
return theme['006'];
|
|
56
|
+
}};
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
exports.StyledEmojiInputEditor = StyledEmojiInputEditor;
|
|
60
|
+
//# sourceMappingURL=EmojiInput.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiInput.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledEmojiInput","styled","div","_ref","theme","_ref2","isDisabled","exports","StyledEmojiInputEditor","_ref3","text","_ref4","placeholder","_ref5"],"sources":["../../../src/components/emoji-input/EmojiInput.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\nimport type { EmojiInputProps } from './EmojiInput';\n\ntype StyledEmojiInputProps = WithTheme<Pick<EmojiInputProps, 'isDisabled'>>;\n\nexport const StyledEmojiInput = styled.div<StyledEmojiInputProps>`\n align-items: center;\n background-color: ${({ theme }: StyledEmojiInputProps) => theme['100']};\n border: 1px solid rgba(160, 160, 160, 0.3);\n border-radius: 3px;\n display: flex;\n gap: 10px;\n justify-content: space-between;\n min-height: 42px;\n opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)};\n padding: 8px 10px;\n position: relative;\n transition: opacity 0.3s ease;\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: 'Noto Color Emoji', 'Roboto Regular', 'Tahoma', serif;\n\n &:empty:not(:focus):before {\n content: '${({ placeholder }) => placeholder}';\n color: ${({ theme }: StyledEmojiInputEditorProps) => theme['006']};\n }\n`;\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAKhC,MAAMG,gBAAgB,GAAGC,yBAAM,CAACC,GAA2B;AAClE;AACA,wBAAwBC,IAAA;EAAA,IAAC;IAAEC;EAA6B,CAAC,GAAAD,IAAA;EAAA,OAAKC,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA,eAAeC,KAAA;EAAA,IAAC;IAAEC;EAAW,CAAC,GAAAD,KAAA;EAAA,OAAMC,UAAU,GAAG,GAAG,GAAG,CAAC;AAAA,CAAE;AAC1D;AACA;AACA;AACA,CAAC;AAACC,OAAA,CAAAP,gBAAA,GAAAA,gBAAA;AAIK,MAAMQ,sBAAsB,GAAGP,yBAAM,CAACC,GAAiC;AAC9E,aAAaO,KAAA;EAAA,IAAC;IAAEL;EAAmC,CAAC,GAAAK,KAAA;EAAA,OAAKL,KAAK,CAACM,IAAI;AAAA,CAAC;AACpE;AACA;AACA;AACA;AACA,oBAAoBC,KAAA;EAAA,IAAC;IAAEC;EAAY,CAAC,GAAAD,KAAA;EAAA,OAAKC,WAAW;AAAA,CAAC;AACrD,iBAAiBC,KAAA;EAAA,IAAC;IAAET;EAAmC,CAAC,GAAAS,KAAA;EAAA,OAAKT,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AAC1E;AACA,CAAC;AAACG,OAAA,CAAAC,sBAAA,GAAAA,sBAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _core = require("@chayns-components/core");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _dataByGroup = _interopRequireDefault(require("unicode-emoji-json/data-by-group.json"));
|
|
10
|
+
var _EmojiPickerCategories = _interopRequireDefault(require("./emoji-picker-categories/EmojiPickerCategories"));
|
|
11
|
+
var _EmojiPickerEmojis = _interopRequireDefault(require("./emoji-picker-emojis/EmojiPickerEmojis"));
|
|
12
|
+
var _EmojiPicker = require("./EmojiPicker.styles");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
const EmojiPicker = _ref => {
|
|
17
|
+
var _emojiCategories$;
|
|
18
|
+
let {
|
|
19
|
+
onSelect
|
|
20
|
+
} = _ref;
|
|
21
|
+
const [searchString, setSearchString] = (0, _react.useState)('');
|
|
22
|
+
const [selectedCategory, setSelectedCategory] = (0, _react.useState)((_emojiCategories$ = _dataByGroup.default[0]) === null || _emojiCategories$ === void 0 ? void 0 : _emojiCategories$.slug);
|
|
23
|
+
const handleCategorySelect = (0, _react.useCallback)(category => {
|
|
24
|
+
setSearchString('');
|
|
25
|
+
setSelectedCategory(category);
|
|
26
|
+
}, []);
|
|
27
|
+
const handleSearchChange = (0, _react.useCallback)(event => {
|
|
28
|
+
setSearchString(event.target.value);
|
|
29
|
+
}, []);
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_EmojiPicker.StyledEmojiPicker, null, /*#__PURE__*/_react.default.createElement(_core.Input, {
|
|
31
|
+
onChange: handleSearchChange,
|
|
32
|
+
placeholder: "Suchen",
|
|
33
|
+
value: searchString
|
|
34
|
+
}), /*#__PURE__*/_react.default.createElement(_EmojiPickerEmojis.default, {
|
|
35
|
+
onSelect: onSelect,
|
|
36
|
+
searchString: searchString,
|
|
37
|
+
selectedCategory: selectedCategory
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement(_EmojiPickerCategories.default, {
|
|
39
|
+
onSelect: handleCategorySelect,
|
|
40
|
+
searchString: searchString,
|
|
41
|
+
selectedCategory: selectedCategory
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
EmojiPicker.displayName = 'EmojiPicker';
|
|
45
|
+
var _default = EmojiPicker;
|
|
46
|
+
exports.default = _default;
|
|
47
|
+
//# sourceMappingURL=EmojiPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiPicker.js","names":["_core","require","_react","_interopRequireWildcard","_dataByGroup","_interopRequireDefault","_EmojiPickerCategories","_EmojiPickerEmojis","_EmojiPicker","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","EmojiPicker","_ref","_emojiCategories$","onSelect","searchString","setSearchString","useState","selectedCategory","setSelectedCategory","emojiCategories","slug","handleCategorySelect","useCallback","category","handleSearchChange","event","target","value","createElement","StyledEmojiPicker","Input","onChange","placeholder","displayName","_default","exports"],"sources":["../../../src/components/emoji-picker/EmojiPicker.tsx"],"sourcesContent":["import { Input } from '@chayns-components/core';\nimport React, { ChangeEvent, FC, useCallback, useState } from 'react';\nimport emojiCategories from 'unicode-emoji-json/data-by-group.json';\nimport type { Category } from '../../types/category';\nimport EmojiPickerCategories from './emoji-picker-categories/EmojiPickerCategories';\nimport EmojiPickerEmojis from './emoji-picker-emojis/EmojiPickerEmojis';\nimport { StyledEmojiPicker } from './EmojiPicker.styles';\n\nexport type EmojiPickerProps = {\n onSelect: (emoji: string) => void;\n};\nconst EmojiPicker: FC<EmojiPickerProps> = ({ onSelect }) => {\n const [searchString, setSearchString] = useState('');\n const [selectedCategory, setSelectedCategory] = useState(emojiCategories[0]?.slug as Category);\n\n const handleCategorySelect = useCallback((category: Category) => {\n setSearchString('');\n setSelectedCategory(category);\n }, []);\n\n const handleSearchChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n setSearchString(event.target.value);\n }, []);\n\n return (\n <StyledEmojiPicker>\n <Input onChange={handleSearchChange} placeholder=\"Suchen\" value={searchString} />\n <EmojiPickerEmojis\n onSelect={onSelect}\n searchString={searchString}\n selectedCategory={selectedCategory}\n />\n <EmojiPickerCategories\n onSelect={handleCategorySelect}\n searchString={searchString}\n selectedCategory={selectedCategory}\n />\n </StyledEmojiPicker>\n );\n};\n\nEmojiPicker.displayName = 'EmojiPicker';\n\nexport default EmojiPicker;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,sBAAA,GAAAD,sBAA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,oBAAqB;IAC/BP,YAAY,EAAEA,YAAa;IAC3BG,gBAAgB,EAAEA;EAAiB,EACrC,CACc;AAE5B,CAAC;AAEDP,WAAW,CAACuB,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAEzBxB,WAAW;AAAAyB,OAAA,CAAA7C,OAAA,GAAA4C,QAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.emojiPickerSize = exports.StyledEmojiPicker = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const emojiPickerSize = {
|
|
10
|
+
height: 285,
|
|
11
|
+
width: 350
|
|
12
|
+
};
|
|
13
|
+
exports.emojiPickerSize = emojiPickerSize;
|
|
14
|
+
const StyledEmojiPicker = _styledComponents.default.div`
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
height: ${emojiPickerSize.height}px;
|
|
18
|
+
padding: 10px 22px;
|
|
19
|
+
width: ${emojiPickerSize.width}px;
|
|
20
|
+
user-select: none;
|
|
21
|
+
`;
|
|
22
|
+
exports.StyledEmojiPicker = StyledEmojiPicker;
|
|
23
|
+
//# sourceMappingURL=EmojiPicker.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiPicker.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","emojiPickerSize","height","width","exports","StyledEmojiPicker","styled","div"],"sources":["../../../src/components/emoji-picker/EmojiPicker.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const emojiPickerSize = {\n height: 285,\n width: 350,\n};\n\nexport const StyledEmojiPicker = styled.div`\n display: flex;\n flex-direction: column;\n height: ${emojiPickerSize.height}px;\n padding: 10px 22px;\n width: ${emojiPickerSize.width}px;\n user-select: none;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,eAAe,GAAG;EAC3BC,MAAM,EAAE,GAAG;EACXC,KAAK,EAAE;AACX,CAAC;AAACC,OAAA,CAAAH,eAAA,GAAAA,eAAA;AAEK,MAAMI,iBAAiB,GAAGC,yBAAM,CAACC,GAAI;AAC5C;AACA;AACA,cAAcN,eAAe,CAACC,MAAO;AACrC;AACA,aAAaD,eAAe,CAACE,KAAM;AACnC;AACA,CAAC;AAACC,OAAA,CAAAC,iBAAA,GAAAA,iBAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import type { Category } from '../../../types/category';
|
|
3
|
+
export type EmojiPickerCategoriesProps = {
|
|
4
|
+
onSelect: (category: Category) => void;
|
|
5
|
+
searchString: string;
|
|
6
|
+
selectedCategory: Category;
|
|
7
|
+
};
|
|
8
|
+
declare const EmojiPickerCategories: FC<EmojiPickerCategoriesProps>;
|
|
9
|
+
export default EmojiPickerCategories;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 _dataByGroup = _interopRequireDefault(require("unicode-emoji-json/data-by-group.json"));
|
|
9
|
+
var _EmojiPickerCategories = require("./EmojiPickerCategories.styles");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
const EmojiPickerCategories = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
onSelect,
|
|
16
|
+
searchString,
|
|
17
|
+
selectedCategory
|
|
18
|
+
} = _ref;
|
|
19
|
+
const isSearchStringGiven = searchString.trim() !== '';
|
|
20
|
+
const categories = (0, _react.useMemo)(() => _dataByGroup.default.map(_ref2 => {
|
|
21
|
+
var _emojis$;
|
|
22
|
+
let {
|
|
23
|
+
emojis,
|
|
24
|
+
slug
|
|
25
|
+
} = _ref2;
|
|
26
|
+
const isSelected = selectedCategory === slug && !isSearchStringGiven;
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_EmojiPickerCategories.StyledMotionEmojiPickerCategory, {
|
|
28
|
+
animate: {
|
|
29
|
+
filter: `grayscale(${isSelected ? 0 : 0.75})`,
|
|
30
|
+
opacity: isSelected ? 1 : 0.5
|
|
31
|
+
},
|
|
32
|
+
className: "prevent-lose-focus",
|
|
33
|
+
initial: false,
|
|
34
|
+
key: slug,
|
|
35
|
+
onClick: () => onSelect(slug),
|
|
36
|
+
transition: {
|
|
37
|
+
duration: 0.2
|
|
38
|
+
}
|
|
39
|
+
}, (_emojis$ = emojis[0]) === null || _emojis$ === void 0 ? void 0 : _emojis$.emoji);
|
|
40
|
+
}), [isSearchStringGiven, onSelect, selectedCategory]);
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_EmojiPickerCategories.StyledEmojiPickerCategories, null, categories);
|
|
42
|
+
};
|
|
43
|
+
EmojiPickerCategories.displayName = 'EmojiPickerCategories';
|
|
44
|
+
var _default = EmojiPickerCategories;
|
|
45
|
+
exports.default = _default;
|
|
46
|
+
//# sourceMappingURL=EmojiPickerCategories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiPickerCategories.js","names":["_react","_interopRequireWildcard","require","_dataByGroup","_interopRequireDefault","_EmojiPickerCategories","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","EmojiPickerCategories","_ref","onSelect","searchString","selectedCategory","isSearchStringGiven","trim","categories","useMemo","unicodeEmoji","map","_ref2","_emojis$","emojis","slug","isSelected","createElement","StyledMotionEmojiPickerCategory","animate","filter","opacity","className","initial","onClick","transition","duration","emoji","StyledEmojiPickerCategories","displayName","_default","exports"],"sources":["../../../../src/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.tsx"],"sourcesContent":["import React, { FC, useMemo } from 'react';\nimport unicodeEmoji from 'unicode-emoji-json/data-by-group.json';\nimport type { Category } from '../../../types/category';\nimport {\n StyledEmojiPickerCategories,\n StyledMotionEmojiPickerCategory,\n} from './EmojiPickerCategories.styles';\n\nexport type EmojiPickerCategoriesProps = {\n onSelect: (category: Category) => void;\n searchString: string;\n selectedCategory: Category;\n};\n\nconst EmojiPickerCategories: FC<EmojiPickerCategoriesProps> = ({\n onSelect,\n searchString,\n selectedCategory,\n}) => {\n const isSearchStringGiven = searchString.trim() !== '';\n\n const categories = useMemo(\n () =>\n unicodeEmoji.map(({ emojis, slug }) => {\n const isSelected = selectedCategory === slug && !isSearchStringGiven;\n\n return (\n <StyledMotionEmojiPickerCategory\n animate={{\n filter: `grayscale(${isSelected ? 0 : 0.75})`,\n opacity: isSelected ? 1 : 0.5,\n }}\n className=\"prevent-lose-focus\"\n initial={false}\n key={slug}\n onClick={() => onSelect(slug as Category)}\n transition={{ duration: 0.2 }}\n >\n {emojis[0]?.emoji}\n </StyledMotionEmojiPickerCategory>\n );\n }),\n [isSearchStringGiven, onSelect, selectedCategory]\n );\n\n return <StyledEmojiPickerCategories>{categories}</StyledEmojiPickerCategories>;\n};\n\nEmojiPickerCategories.displayName = 'EmojiPickerCategories';\n\nexport default EmojiPickerCategories;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,sBAAA,GAAAH,OAAA;AAGwC,SAAAE,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,SAAAT,wBAAAK,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,CA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AG;MAC9B,CAAE;MACFM,SAAS,EAAC,oBAAoB;MAC9BC,OAAO,EAAE,KAAM;MACf5B,GAAG,EAAEoB,IAAK;MACVS,OAAO,EAAEA,CAAA,KAAMrB,QAAQ,CAACY,IAAI,CAAc;MAC1CU,UAAU,EAAE;QAAEC,QAAQ,EAAE;MAAI;IAAE,IAAAb,QAAA,GAE7BC,MAAM,CAAC,CAAC,CAAC,cAAAD,QAAA,uBAATA,QAAA,CAAWc,KAAK,CACa;EAE1C,CAAC,CAAC,EACN,CAACrB,mBAAmB,EAAEH,QAAQ,EAAEE,gBAAgB,CAAC,CACpD;EAED,oBAAOhC,MAAA,CAAAQ,OAAA,CAAAoC,aAAA,CAACvC,sBAAA,CAAAkD,2BAA2B,QAAEpB,UAAU,CAA+B;AAClF,CAAC;AAEDP,qBAAqB,CAAC4B,WAAW,GAAG,uBAAuB;AAAC,IAAAC,QAAA,GAE7C7B,qBAAqB;AAAA8B,OAAA,CAAAlD,OAAA,GAAAiD,QAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const StyledEmojiPickerCategories: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const StyledMotionEmojiPickerCategory: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledMotionEmojiPickerCategory = exports.StyledEmojiPickerCategories = void 0;
|
|
7
|
+
var _framerMotion = require("framer-motion");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const StyledEmojiPickerCategories = _styledComponents.default.div`
|
|
11
|
+
align-items: center;
|
|
12
|
+
border-top: 1px solid rgba(160, 160, 160, 0.3);
|
|
13
|
+
display: flex;
|
|
14
|
+
flex: 0 0 auto;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
padding-top: 10px;
|
|
17
|
+
`;
|
|
18
|
+
exports.StyledEmojiPickerCategories = StyledEmojiPickerCategories;
|
|
19
|
+
const StyledMotionEmojiPickerCategory = (0, _styledComponents.default)(_framerMotion.motion.div)`
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
font-family: 'Noto Color Emoji', 'Roboto Regular', 'Tahoma', serif;
|
|
22
|
+
font-size: 20px;
|
|
23
|
+
`;
|
|
24
|
+
exports.StyledMotionEmojiPickerCategory = StyledMotionEmojiPickerCategory;
|
|
25
|
+
//# sourceMappingURL=EmojiPickerCategories.styles.js.map
|
package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiPickerCategories.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","obj","__esModule","default","StyledEmojiPickerCategories","styled","div","exports","StyledMotionEmojiPickerCategory","motion"],"sources":["../../../../src/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\nexport const StyledEmojiPickerCategories = styled.div`\n align-items: center;\n border-top: 1px solid rgba(160, 160, 160, 0.3);\n display: flex;\n flex: 0 0 auto;\n justify-content: space-between;\n padding-top: 10px;\n`;\n\nexport const StyledMotionEmojiPickerCategory = styled(motion.div)`\n cursor: pointer;\n font-family: 'Noto Color Emoji', 'Roboto Regular', 'Tahoma', serif;\n font-size: 20px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,2BAA2B,GAAGC,yBAAM,CAACC,GAAI;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACC,OAAA,CAAAH,2BAAA,GAAAA,2BAAA;AAEK,MAAMI,+BAA+B,GAAG,IAAAH,yBAAM,EAACI,oBAAM,CAACH,GAAG,CAAE;AAClE;AACA;AACA;AACA,CAAC;AAACC,OAAA,CAAAC,+BAAA,GAAAA,+BAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import type { Category } from '../../../types/category';
|
|
3
|
+
export type EmojiPickerEmojisProps = {
|
|
4
|
+
onSelect: (emoji: string) => void;
|
|
5
|
+
searchString: string;
|
|
6
|
+
selectedCategory: Category;
|
|
7
|
+
};
|
|
8
|
+
declare const EmojiPickerEmojis: FC<EmojiPickerEmojisProps>;
|
|
9
|
+
export default EmojiPickerEmojis;
|