emoji-picker-react 3.6.1 → 4.0.0-rc.11
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 +17 -20
- package/README.md +94 -166
- package/dist/DomUtils/categoryNameFromDom.d.ts +1 -0
- package/dist/DomUtils/classNames.d.ts +6 -0
- package/dist/DomUtils/emojiElementRef.d.ts +10 -0
- package/dist/DomUtils/isDarkTheme.d.ts +1 -0
- package/dist/DomUtils/scrollCategoryIntoView.d.ts +1 -0
- package/dist/DomUtils/scrollTo.d.ts +1 -0
- package/dist/DomUtils/selectors.d.ts +12 -0
- package/dist/components/Layout/Flex.d.ts +14 -0
- package/dist/components/Layout/Relative.d.ts +7 -0
- package/dist/components/body/Body.d.ts +3 -0
- package/dist/components/body/EmojiCategory.d.ts +11 -0
- package/dist/components/body/EmojiList.d.ts +3 -0
- package/dist/components/body/EmojiVariationPicker.d.ts +3 -0
- package/dist/components/body/RecentlyUsed.d.ts +7 -0
- package/dist/components/context/ElementRefContext.d.ts +17 -0
- package/dist/components/context/PickerConfigContext.d.ts +8 -0
- package/dist/components/context/PickerContext.d.ts +21 -0
- package/dist/components/emoji/Emoji.d.ts +16 -0
- package/dist/components/footer/Preview.d.ts +7 -0
- package/dist/components/header/Header.d.ts +3 -0
- package/dist/components/header/Search.d.ts +3 -0
- package/dist/components/header/SkinTonePicker.d.ts +3 -0
- package/dist/components/main/PickerMain.d.ts +7 -0
- package/dist/components/navigation/CategoryNavigation.d.ts +3 -0
- package/dist/config/categoryConfig.d.ts +12 -0
- package/dist/config/cdnUrls.d.ts +2 -0
- package/dist/config/config.d.ts +26 -0
- package/dist/config/useConfig.d.ts +11 -0
- package/dist/data/emojis.d.ts +2 -0
- package/dist/data/groups.d.ts +2 -0
- package/dist/data/skinToneVariations.d.ts +3 -0
- package/dist/dataUtils/DataTypes.d.ts +8 -0
- package/dist/dataUtils/alphaNumericEmojiIndex.d.ts +4 -0
- package/dist/dataUtils/asEmoji.d.ts +2 -0
- package/dist/dataUtils/emojiSelectors.d.ts +15 -0
- package/dist/dataUtils/parseNativeEmoji.d.ts +1 -0
- package/dist/dataUtils/recentlyUsed.d.ts +11 -0
- package/dist/emoji-picker-react.cjs.development.css +13 -0
- package/dist/emoji-picker-react.cjs.development.js +16769 -0
- package/dist/emoji-picker-react.cjs.development.js.map +1 -0
- package/dist/emoji-picker-react.cjs.production.min.js +2 -0
- package/dist/emoji-picker-react.cjs.production.min.js.map +1 -0
- package/dist/emoji-picker-react.esm.js +16838 -0
- package/dist/emoji-picker-react.esm.js.map +1 -0
- package/dist/hooks/preloadEmoji.d.ts +4 -0
- package/dist/hooks/useActiveCategoryScrollDetection.d.ts +2 -0
- package/dist/hooks/useCloseAllOpenToggles.d.ts +4 -0
- package/dist/hooks/useDebouncedState.d.ts +1 -0
- package/dist/hooks/useEmojiElements.d.ts +1 -0
- package/dist/hooks/useEmojiMouseEnter.d.ts +3 -0
- package/dist/hooks/useFilter.d.ts +10 -0
- package/dist/hooks/useInitialLoad.d.ts +2 -0
- package/dist/hooks/useIsEmojiHidden.d.ts +2 -0
- package/dist/hooks/useIsSearchMode.d.ts +1 -0
- package/dist/hooks/useMouseDownHandlers.d.ts +2 -0
- package/dist/hooks/useOnScroll.d.ts +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -3
- package/dist/types/exposedTypes.d.ts +39 -0
- package/package.json +72 -52
- package/src/DomUtils/categoryNameFromDom.ts +3 -0
- package/src/DomUtils/classNames.ts +6 -0
- package/src/DomUtils/emojiElementRef.ts +42 -0
- package/src/DomUtils/isDarkTheme.ts +7 -0
- package/src/DomUtils/scrollCategoryIntoView.ts +18 -0
- package/src/DomUtils/scrollTo.ts +11 -0
- package/src/DomUtils/selectors.ts +93 -0
- package/src/EmojiPickerReact.css +92 -0
- package/src/components/Layout/Flex.css +11 -0
- package/src/components/Layout/Flex.tsx +28 -0
- package/src/components/Layout/Relative.tsx +14 -0
- package/src/components/body/Body.css +6 -0
- package/src/components/body/Body.tsx +24 -0
- package/src/components/body/EmojiCategory.css +42 -0
- package/src/components/body/EmojiCategory.tsx +40 -0
- package/src/components/body/EmojiList.css +5 -0
- package/src/components/body/EmojiList.tsx +104 -0
- package/src/components/body/EmojiVariationPicker.css +65 -0
- package/src/components/body/EmojiVariationPicker.tsx +154 -0
- package/src/components/body/RecentlyUsed.tsx +50 -0
- package/src/components/body/svg/triangle.svg +11 -0
- package/src/components/context/ElementRefContext.tsx +61 -0
- package/src/components/context/PickerConfigContext.tsx +29 -0
- package/src/components/context/PickerContext.tsx +143 -0
- package/src/components/emoji/Emoji.css +44 -0
- package/src/components/emoji/Emoji.tsx +111 -0
- package/src/components/footer/Preview.css +14 -0
- package/src/components/footer/Preview.tsx +88 -0
- package/src/components/header/Header.css +4 -0
- package/src/components/header/Header.tsx +21 -0
- package/src/components/header/Search.css +72 -0
- package/src/components/header/Search.tsx +40 -0
- package/src/components/header/SkinTonePicker.css +86 -0
- package/src/components/header/SkinTonePicker.tsx +55 -0
- package/src/components/header/svg/magnifier.svg +13 -0
- package/src/components/header/svg/times.svg +33 -0
- package/src/components/main/PickerMain.css +11 -0
- package/src/components/main/PickerMain.tsx +43 -0
- package/src/components/navigation/CategoryNavigation.css +82 -0
- package/src/components/navigation/CategoryNavigation.tsx +32 -0
- package/src/components/navigation/svg/CategoryNav.svg +508 -0
- package/src/config/categoryConfig.ts +99 -0
- package/src/config/cdnUrls.ts +24 -0
- package/src/config/config.ts +54 -0
- package/src/config/useConfig.ts +63 -0
- package/src/data/emojis.json +1 -0
- package/src/data/emojis.ts +3 -0
- package/src/data/groups.ts +12 -0
- package/src/data/skinToneVariations.ts +12 -0
- package/src/dataUtils/DataTypes.ts +10 -0
- package/src/dataUtils/alphaNumericEmojiIndex.ts +23 -0
- package/src/dataUtils/asEmoji.ts +5 -0
- package/src/dataUtils/emojiSelectors.ts +94 -0
- package/src/dataUtils/parseNativeEmoji.ts +6 -0
- package/src/dataUtils/recentlyUsed.ts +64 -0
- package/src/hooks/preloadEmoji.ts +29 -0
- package/src/hooks/useActiveCategoryScrollDetection.ts +46 -0
- package/src/hooks/useCloseAllOpenToggles.ts +26 -0
- package/src/hooks/useDebouncedState.ts +21 -0
- package/src/hooks/useEmojiElements.ts +7 -0
- package/src/hooks/useEmojiMouseEnter.ts +59 -0
- package/src/hooks/useFilter.ts +170 -0
- package/src/hooks/useInitialLoad.ts +9 -0
- package/src/hooks/useIsEmojiHidden.ts +16 -0
- package/src/hooks/useIsSearchMode.ts +7 -0
- package/src/hooks/useMouseDownHandlers.ts +160 -0
- package/src/hooks/useOnScroll.ts +28 -0
- package/src/index.tsx +33 -0
- package/src/types/exposedTypes.ts +43 -0
- package/.babelrc +0 -30
- package/.eslintrc.js +0 -37
- package/.github/workflows/npmpublish.yml +0 -30
- package/.prettierignore +0 -2
- package/.storybook/addons.js +0 -2
- package/.storybook/config.js +0 -9
- package/assets/captured.gif +0 -0
- package/dist/index.js.LICENSE.txt +0 -5
- package/dist/index.js.map +0 -1
- package/dist/main.css +0 -206
- package/dist/main.css.map +0 -1
- package/emoji-picker-react.d.ts +0 -45
- package/webpack.config.js +0 -52
package/LICENSE
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
distribute this software, either in source code form or as a compiled
|
|
5
|
-
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
-
means.
|
|
3
|
+
Copyright (c) 2022 ealush
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
of this software
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
software under copyright law.
|
|
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:
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
-
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
23
14
|
|
|
24
|
-
|
|
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
CHANGED
|
@@ -1,213 +1,143 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Emoji Picker React (v4)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An emoji picker component for React applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Try it live](https://codesandbox.io/s/floral-rgb-z2gkzp?file=/src/App.tsx)
|
|
6
6
|
|
|
7
|
-
## What
|
|
7
|
+
## What to know before using
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- Unlike previous versions, this version uses Apple emojis.
|
|
11
|
-
- V3 does not support SSR. The assumption is that you mount it only after user interaction in the browser. SSR support may be added in the future.
|
|
9
|
+
- This package assumes it runs in the browser. I have taken many steps to prevent it from failing on the server, but still, it is recommended to only render the component on the client. See troubleshooting section for more information.
|
|
12
10
|
|
|
13
11
|
## Installation
|
|
14
12
|
|
|
15
13
|
```
|
|
16
|
-
npm
|
|
14
|
+
npm install emoji-picker-react
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
## Usage:
|
|
20
18
|
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## New v3 features
|
|
26
|
-
|
|
27
|
-
- Larger emoji library.
|
|
28
|
-
- Apple emojis instead of emojione.
|
|
29
|
-
- Recently used emojis support.
|
|
30
|
-
- Faster load time, improved performance.
|
|
31
|
-
- Ability to set default skin tone.
|
|
32
|
-
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
Emoji-picker-react comes ready to use out of the box, zero conf needed. The only thing you need to do is add your own emoji click callback.
|
|
36
|
-
|
|
37
|
-
```js
|
|
38
|
-
import React, { useState } from 'react';
|
|
39
|
-
import Picker from 'emoji-picker-react';
|
|
40
|
-
|
|
41
|
-
const App = () => {
|
|
42
|
-
const [chosenEmoji, setChosenEmoji] = useState(null);
|
|
43
|
-
|
|
44
|
-
const onEmojiClick = (event, emojiObject) => {
|
|
45
|
-
setChosenEmoji(emojiObject);
|
|
46
|
-
};
|
|
19
|
+
```jsx
|
|
20
|
+
import EmojiPicker from 'emoji-picker-react';
|
|
47
21
|
|
|
22
|
+
function App() {
|
|
48
23
|
return (
|
|
49
24
|
<div>
|
|
50
|
-
|
|
51
|
-
<span>You chose: {chosenEmoji.emoji}</span>
|
|
52
|
-
) : (
|
|
53
|
-
<span>No emoji Chosen</span>
|
|
54
|
-
)}
|
|
55
|
-
<Picker onEmojiClick={onEmojiClick} />
|
|
25
|
+
<EmojiPicker />
|
|
56
26
|
</div>
|
|
57
27
|
);
|
|
58
|
-
}
|
|
28
|
+
}
|
|
59
29
|
```
|
|
60
30
|
|
|
61
|
-
|
|
31
|
+
## Features
|
|
62
32
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
| `disableSkinTonePicker` | `boolean` | `false` | No | Disables the skin tone picker. |
|
|
71
|
-
| `pickerStyle` | `Object` | `undefined` | No | Overrides style of the component. |
|
|
72
|
-
| `groupNames` | `Object` | `undefined` | No | Specifies alternative category names to use. See Internationalization section. |
|
|
73
|
-
| `groupVisibility` | `Object` | `undefined` | No | Specifies group names to be disabled. |
|
|
74
|
-
| `native` | `Boolean` | `false` | No | Loads system emojis instead of Apple Emoji pngs |
|
|
75
|
-
| `searchPlaceholder` | `string` | `null` | No | Decides the default placeholder for the search input |
|
|
33
|
+
- Custom click handler
|
|
34
|
+
- Dark mode
|
|
35
|
+
- Customizable styles via css variables
|
|
36
|
+
- Default skin tone selection
|
|
37
|
+
- Skin tone change
|
|
38
|
+
- Different emoji sets (Google, Apple, Facebook, Twitter)
|
|
39
|
+
- Native Emoji support
|
|
76
40
|
|
|
77
|
-
|
|
41
|
+
# Props
|
|
78
42
|
|
|
79
|
-
|
|
43
|
+
The following props are accepted by them picker:
|
|
80
44
|
|
|
81
|
-
|
|
82
|
-
2. An emoji object, which contains the following:
|
|
83
|
-
- `emoji`: The emoji symbol. May vary across OSs, in some it may not be visible to you.
|
|
84
|
-
- `unified`: The actual emoji unicode.
|
|
85
|
-
- `activeSkinTone`: The currently selected skin tone, regardless if the current emoji has one or not.
|
|
86
|
-
- `originalUnified`: If the currently selected emoji has a skin tone modifier, `originalUnified` will hold the "neutral" code.
|
|
87
|
-
- `names`: An array of one or more descriptive names for the emoji.
|
|
45
|
+
- `onEmojiClick`: `(event: MouseEvent, emoji: EmojiClickData) => void` - Callback function when an emoji is clicked. The callback receives the event and the emoji data. The emoji data is comprised of the following properties:
|
|
88
46
|
|
|
89
|
-
|
|
47
|
+
```ts
|
|
48
|
+
{
|
|
49
|
+
activeSkinTone: SkinTones;
|
|
50
|
+
unified: string;
|
|
51
|
+
unifiedWithoutSkinTone: string;
|
|
52
|
+
emoji: string;
|
|
53
|
+
names: string[];
|
|
54
|
+
getImageUrl: (emojiStyle: EmojiStyle) => string;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
90
57
|
|
|
91
|
-
|
|
92
|
-
|
|
58
|
+
- `theme`: `Theme` - The theme of the picker. Can be `light`, `dark` or auto. Default is `light`.
|
|
59
|
+
The `Theme` enum can be imported from the package.
|
|
93
60
|
|
|
94
|
-
|
|
61
|
+
```ts
|
|
62
|
+
import { Theme } from 'emoji-picker-react';
|
|
63
|
+
```
|
|
95
64
|
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
- ✋🏼 SKIN_TONE_MEDIUM_LIGHT
|
|
99
|
-
- ✋🏽 SKIN_TONE_MEDIUM
|
|
100
|
-
- ✋🏾 SKIN_TONE_MEDIUM_DARK
|
|
101
|
-
- ✋🏿 SKIN_TONE_DARK
|
|
65
|
+
- `emojiStyle`: `EmojiStyle` - The emoji style to use. Can be either `apple`, `google`, `facebook`, `twitter` or `native`. Default is `apple`.
|
|
66
|
+
The `EmojiStyle` enum can be imported from the package.
|
|
102
67
|
|
|
103
|
-
|
|
68
|
+
```ts
|
|
69
|
+
import { EmojiStyle } from 'emoji-picker-react';
|
|
70
|
+
```
|
|
104
71
|
|
|
105
|
-
|
|
106
|
-
import React, { useState } from 'react';
|
|
107
|
-
import Picker, { SKIN_TONE_MEDIUM_DARK } from 'emoji-picker-react';
|
|
72
|
+
* `autoFocusSearch`: `boolean` - Whether to focus the search input on mount. Defaults to `true`.
|
|
108
73
|
|
|
109
|
-
|
|
110
|
-
const [chosenEmoji, setChosenEmoji] = useState(null);
|
|
74
|
+
* `defaultSkinTone`: `SkinTones` - The default skin tone to use when an emoji is clicked. Defaults to `SkinTones.Neutral`. Possible skin tones are:
|
|
111
75
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
76
|
+
- ✋ 'neutral'
|
|
77
|
+
- ✋🏻 '1f3fb'
|
|
78
|
+
- ✋🏼 '1f3fc'
|
|
79
|
+
- ✋🏽 '1f3fd'
|
|
80
|
+
- ✋🏾 '1f3fe'
|
|
81
|
+
- ✋🏿 '1f3ff'
|
|
115
82
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
);
|
|
121
|
-
};
|
|
83
|
+
The skin tones typescript enum can be imported directly from the package:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { SkinTones } from 'emoji-picker-react';
|
|
122
87
|
```
|
|
123
88
|
|
|
124
|
-
|
|
89
|
+
- `skinTonesDisabled`: `boolean` - Whether to disable the skin tone selection. Defaults to `false`.
|
|
125
90
|
|
|
126
|
-
|
|
91
|
+
- `showPreview`: `boolean` - Whether to show the preview of the selected emoji. Defaults to `true`.
|
|
127
92
|
|
|
128
|
-
|
|
129
|
-
import React, { useState } from 'react';
|
|
130
|
-
import Picker from 'emoji-picker-react';
|
|
93
|
+
- `searchPlaceholder`: `string` - The placeholder text for the search input. Defaults to `Search`.
|
|
131
94
|
|
|
132
|
-
|
|
133
|
-
|
|
95
|
+
- categories: Allows full config over ordering, naming and display of categories.
|
|
96
|
+
To only sort/omit categories, you can simply pass an array of category names to display:
|
|
134
97
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
98
|
+
- 'recently_used',
|
|
99
|
+
- 'smileys_people',
|
|
100
|
+
- 'animals_nature',
|
|
101
|
+
- 'food_drink',
|
|
102
|
+
- 'travel_places',
|
|
103
|
+
- 'activities',
|
|
104
|
+
- 'objects',
|
|
105
|
+
- 'symbols',
|
|
106
|
+
- 'flags'
|
|
138
107
|
|
|
139
|
-
|
|
140
|
-
<div>
|
|
141
|
-
<Picker onEmojiClick={onEmojiClick} pickerStyle={{ width: '100%' }} />
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
};
|
|
145
|
-
```
|
|
108
|
+
For a more in-depth configuration, you can pass an array with category config:
|
|
146
109
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
activities: 'lets play a game',
|
|
160
|
-
objects: 'stuff',
|
|
161
|
-
symbols: 'more stuff',
|
|
162
|
-
flags: 'fun with flags',
|
|
163
|
-
recently_used: 'did I really use those?!',
|
|
164
|
-
}}
|
|
165
|
-
/>
|
|
166
|
-
```
|
|
110
|
+
```ts
|
|
111
|
+
[
|
|
112
|
+
{
|
|
113
|
+
category: 'recently_used',
|
|
114
|
+
name: 'Recently Used'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
category: 'smileys_people',
|
|
118
|
+
name: 'Faces...'
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
```
|
|
167
122
|
|
|
168
|
-
|
|
123
|
+
# Troubleshooting
|
|
169
124
|
|
|
170
|
-
|
|
171
|
-
- animals_nature
|
|
172
|
-
- food_drink
|
|
173
|
-
- travel_places
|
|
174
|
-
- activities
|
|
175
|
-
- objects
|
|
176
|
-
- symbols
|
|
177
|
-
- flags
|
|
178
|
-
- recently_used
|
|
125
|
+
## Next.js
|
|
179
126
|
|
|
180
|
-
|
|
127
|
+
To avoid errors such as "document is not defined" on the server side, you should make sure the library is only imported on the client side. Here is how to do that:
|
|
181
128
|
|
|
182
|
-
|
|
129
|
+
```javascript
|
|
130
|
+
import dynamic from 'next/dynamic';
|
|
183
131
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
|
|
132
|
+
const Picker = dynamic(
|
|
133
|
+
() => {
|
|
134
|
+
return import('emoji-picker-react');
|
|
135
|
+
},
|
|
136
|
+
{ ssr: false }
|
|
137
|
+
);
|
|
190
138
|
```
|
|
191
139
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
- smileys_people
|
|
195
|
-
- animals_nature
|
|
196
|
-
- food_drink
|
|
197
|
-
- travel_places
|
|
198
|
-
- activities
|
|
199
|
-
- objects
|
|
200
|
-
- symbols
|
|
201
|
-
- flags
|
|
202
|
-
- recently_used
|
|
203
|
-
|
|
204
|
-
## UI Customizations
|
|
205
|
-
|
|
206
|
-
In general, UI customizations can be done directly via CSS. Descriptive classnames were added in order for you to be able to easily target whatever it is you want to change, and the markup is guaranteed to stay unchanged until the next major version (4).
|
|
207
|
-
|
|
208
|
-
# Troubleshooting
|
|
209
|
-
|
|
210
|
-
## How to use in Vite project
|
|
140
|
+
## Vite
|
|
211
141
|
|
|
212
142
|
For reference, if you only need to shim global, you can add
|
|
213
143
|
|
|
@@ -216,5 +146,3 @@ For reference, if you only need to shim global, you can add
|
|
|
216
146
|
window.global = window;
|
|
217
147
|
</script>
|
|
218
148
|
```
|
|
219
|
-
|
|
220
|
-
to your index.html
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function categoryNameFromDom($category: Element | null): string | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare type EmojiRef = {
|
|
2
|
+
current: null | HTMLElement;
|
|
3
|
+
};
|
|
4
|
+
export declare const emojiRef: Record<string, EmojiRef>;
|
|
5
|
+
export declare function getEmojiRef(unified: string): EmojiRef;
|
|
6
|
+
export declare function iterateEmojiRef(callback: (ref: HTMLElement, unified: string) => void): void;
|
|
7
|
+
export declare function hideEmoji(unified: string): void;
|
|
8
|
+
export declare function showEmoji(unified: string): void;
|
|
9
|
+
export declare function hideElement(element: HTMLElement | null): void;
|
|
10
|
+
export declare function showElement(element: HTMLElement | null): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSystemDarkTheme(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function scrollCategoryIntoView(root: HTMLElement | null, category: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function scrollTo(root: HTMLElement | null, top?: number): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DataEmoji } from '../dataUtils/DataTypes';
|
|
2
|
+
export declare function buttonFromEmoji(emojiElement: HTMLElement | null): HTMLButtonElement | null;
|
|
3
|
+
export declare function emojiFromElement(element: HTMLElement | null): DataEmoji | undefined;
|
|
4
|
+
export declare function isEmojiElement(element: HTMLElement | null): boolean;
|
|
5
|
+
export declare function closestCategory(element: HTMLElement | null): HTMLElement | null;
|
|
6
|
+
export declare function categoryLabelFromCategory(category: HTMLElement | null): HTMLElement | null;
|
|
7
|
+
export declare function closestCategoryLabel(element: null | HTMLElement): HTMLElement | null;
|
|
8
|
+
export declare function elementHeight(element: HTMLElement | null): number;
|
|
9
|
+
export declare function emojiTrueOffsetTop(element: HTMLElement | null): number;
|
|
10
|
+
export declare function emojiTruOffsetLeft(element: HTMLElement | null): number;
|
|
11
|
+
export declare function unifiedFromEmojiElement(emoji: HTMLElement | null): string | null;
|
|
12
|
+
export declare function originalUnifiedFromEmojiElement(emoji: HTMLElement | null): string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './Flex.css';
|
|
3
|
+
export declare enum FlexDirection {
|
|
4
|
+
ROW = "FlexRow",
|
|
5
|
+
COLUMN = "FlexColumn"
|
|
6
|
+
}
|
|
7
|
+
declare type Props = Readonly<{
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
direction?: FlexDirection;
|
|
12
|
+
}>;
|
|
13
|
+
export default function Flex({ children, className, style, direction }: Props): JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CategoryConfig } from '../../config/categoryConfig';
|
|
3
|
+
import './EmojiCategory.css';
|
|
4
|
+
declare type Props = Readonly<{
|
|
5
|
+
categoryConfig: CategoryConfig;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
hiddenOnSearch?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function EmojiCategory({ categoryConfig, children, hidden, hiddenOnSearch }: Props): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CategoryConfig } from '../../config/categoryConfig';
|
|
3
|
+
declare type Props = Readonly<{
|
|
4
|
+
categoryConfig: CategoryConfig;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function RecentlyUsed({ categoryConfig }: Props): JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function ElementRefContextProvider({ children }: {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}): JSX.Element;
|
|
5
|
+
export declare type ElementRef = React.MutableRefObject<HTMLElement | null>;
|
|
6
|
+
declare type ElementRefs = {
|
|
7
|
+
PickerMainRef: ElementRef;
|
|
8
|
+
AnchoredEmojiRef: ElementRef;
|
|
9
|
+
BodyRef: React.MutableRefObject<HTMLElement | null>;
|
|
10
|
+
};
|
|
11
|
+
declare type ElementRefKeys = keyof ElementRefs;
|
|
12
|
+
export declare function useElementRef(key: ElementRefKeys): ElementRef | React.MutableRefObject<HTMLElement | null>;
|
|
13
|
+
export declare function usePickerMainRef(): ElementRef | React.MutableRefObject<HTMLElement | null>;
|
|
14
|
+
export declare function useAnchoredEmojiRef(): ElementRef | React.MutableRefObject<HTMLElement | null>;
|
|
15
|
+
export declare function useSetAnchoredEmojiRef(): (target: null | HTMLElement) => void;
|
|
16
|
+
export declare function useBodyRef(): React.MutableRefObject<HTMLDivElement | null>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PickerConfig, PickerConfigInternal } from '../../config/config';
|
|
3
|
+
declare type Props = PickerConfig & Readonly<{
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function PickerConfigProvider({ children, ...config }: Props): JSX.Element;
|
|
7
|
+
export declare function usePickerConfig(): PickerConfigInternal;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DataEmoji } from '../../dataUtils/DataTypes';
|
|
3
|
+
import { FilterDict } from '../../hooks/useFilter';
|
|
4
|
+
import { SkinTones } from '../../types/exposedTypes';
|
|
5
|
+
export declare function PickerContextProvider({ children }: Props): JSX.Element;
|
|
6
|
+
declare type ReactState<T> = [T, React.Dispatch<React.SetStateAction<T>>];
|
|
7
|
+
declare type Props = Readonly<{
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function useFilterRef(): React.MutableRefObject<Record<string, Record<string, DataEmoji>>>;
|
|
11
|
+
export declare function useDisallowClickRef(): React.MutableRefObject<boolean>;
|
|
12
|
+
export declare function useSearchTermState(): [string, (term: string) => void];
|
|
13
|
+
export declare function useActiveCategoryState(): [ActiveCategoryState, (nextActive: string) => void, (nextActive: string) => void];
|
|
14
|
+
export declare function useActiveSkinToneState(): [SkinTones, (skinTone: SkinTones) => void];
|
|
15
|
+
export declare function useEmojisThatFailedToLoadState(): ReactState<Set<string>>;
|
|
16
|
+
export declare function useIsPastInitialLoad(): boolean;
|
|
17
|
+
export declare function useEmojiVariationPickerState(): ReactState<DataEmoji | null>;
|
|
18
|
+
export declare function useSkinToneFanOpenState(): ReactState<boolean>;
|
|
19
|
+
export declare type FilterState = Record<string, FilterDict>;
|
|
20
|
+
declare type ActiveCategoryState = null | string;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataEmoji } from '../../dataUtils/DataTypes';
|
|
3
|
+
import { EmojiRef } from '../../DomUtils/emojiElementRef';
|
|
4
|
+
import { EmojiStyle } from '../../types/exposedTypes';
|
|
5
|
+
import './Emoji.css';
|
|
6
|
+
declare type Props = Readonly<{
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
emojiStyle: EmojiStyle;
|
|
9
|
+
emoji: DataEmoji;
|
|
10
|
+
unified: string;
|
|
11
|
+
showVariations?: boolean;
|
|
12
|
+
size?: number;
|
|
13
|
+
emojiRef?: EmojiRef;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function Emoji({ emoji, unified, hidden, emojiStyle, showVariations, size, emojiRef }: Props): JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Categories } from '../types/exposedTypes';
|
|
2
|
+
export { Categories };
|
|
3
|
+
export declare const baseCategoriesConfig: CategoryConfig[];
|
|
4
|
+
export declare function categoryFromCategoryConfig(category: CategoryConfig): Categories;
|
|
5
|
+
export declare function categoryNameFromCategoryConfig(category: CategoryConfig): string;
|
|
6
|
+
export declare type CategoriesConfig = CategoryConfig[];
|
|
7
|
+
export declare type CategoryConfig = {
|
|
8
|
+
category: Categories;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
export declare type UserCategoryConfig = Array<Categories | CategoryConfig>;
|
|
12
|
+
export declare function mergeCategoriesConfig(userCategoriesConfig?: UserCategoryConfig): CategoriesConfig;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EmojiClickData, EmojiStyle, SkinTones, Theme } from '../types/exposedTypes';
|
|
2
|
+
import { CategoriesConfig } from './categoryConfig';
|
|
3
|
+
export declare function mergeConfig(userConfig?: PickerConfig): {
|
|
4
|
+
categories: CategoriesConfig;
|
|
5
|
+
searchPlaceHolder: string;
|
|
6
|
+
defaultSkinTone: SkinTones;
|
|
7
|
+
skinTonesDisabled: boolean;
|
|
8
|
+
autoFocusSearch: boolean;
|
|
9
|
+
emojiStyle: EmojiStyle;
|
|
10
|
+
onEmojiClick: (event: MouseEvent, emoji: EmojiClickData) => void;
|
|
11
|
+
showPreview: boolean;
|
|
12
|
+
theme: Theme;
|
|
13
|
+
};
|
|
14
|
+
export declare function basePickerConfig(): PickerConfigInternal;
|
|
15
|
+
export declare type PickerConfigInternal = {
|
|
16
|
+
searchPlaceHolder: string;
|
|
17
|
+
defaultSkinTone: SkinTones;
|
|
18
|
+
skinTonesDisabled: boolean;
|
|
19
|
+
autoFocusSearch: boolean;
|
|
20
|
+
emojiStyle: EmojiStyle;
|
|
21
|
+
categories: CategoriesConfig;
|
|
22
|
+
onEmojiClick: (event: MouseEvent, emoji: EmojiClickData) => void;
|
|
23
|
+
showPreview: boolean;
|
|
24
|
+
theme: Theme;
|
|
25
|
+
};
|
|
26
|
+
export declare type PickerConfig = Partial<PickerConfigInternal>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EmojiClickData, EmojiStyle, SkinTones, Theme } from '../types/exposedTypes';
|
|
2
|
+
import { CategoriesConfig } from './categoryConfig';
|
|
3
|
+
export declare function useSearchPlaceHolderConfig(): string;
|
|
4
|
+
export declare function useDefaultSkinToneConfig(): SkinTones;
|
|
5
|
+
export declare function useSkinTonesDisabledConfig(): boolean;
|
|
6
|
+
export declare function useEmojiStyleConfig(): EmojiStyle;
|
|
7
|
+
export declare function useAutoFocusSearchConfig(): boolean;
|
|
8
|
+
export declare function useCategoriesConfig(): CategoriesConfig;
|
|
9
|
+
export declare function useOnEmojiClickConfig(): (event: MouseEvent, emoji: EmojiClickData) => void;
|
|
10
|
+
export declare function useShowPreviewConfig(): boolean;
|
|
11
|
+
export declare function useThemeConfig(): Theme;
|