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.
Files changed (144) hide show
  1. package/LICENSE +17 -20
  2. package/README.md +94 -166
  3. package/dist/DomUtils/categoryNameFromDom.d.ts +1 -0
  4. package/dist/DomUtils/classNames.d.ts +6 -0
  5. package/dist/DomUtils/emojiElementRef.d.ts +10 -0
  6. package/dist/DomUtils/isDarkTheme.d.ts +1 -0
  7. package/dist/DomUtils/scrollCategoryIntoView.d.ts +1 -0
  8. package/dist/DomUtils/scrollTo.d.ts +1 -0
  9. package/dist/DomUtils/selectors.d.ts +12 -0
  10. package/dist/components/Layout/Flex.d.ts +14 -0
  11. package/dist/components/Layout/Relative.d.ts +7 -0
  12. package/dist/components/body/Body.d.ts +3 -0
  13. package/dist/components/body/EmojiCategory.d.ts +11 -0
  14. package/dist/components/body/EmojiList.d.ts +3 -0
  15. package/dist/components/body/EmojiVariationPicker.d.ts +3 -0
  16. package/dist/components/body/RecentlyUsed.d.ts +7 -0
  17. package/dist/components/context/ElementRefContext.d.ts +17 -0
  18. package/dist/components/context/PickerConfigContext.d.ts +8 -0
  19. package/dist/components/context/PickerContext.d.ts +21 -0
  20. package/dist/components/emoji/Emoji.d.ts +16 -0
  21. package/dist/components/footer/Preview.d.ts +7 -0
  22. package/dist/components/header/Header.d.ts +3 -0
  23. package/dist/components/header/Search.d.ts +3 -0
  24. package/dist/components/header/SkinTonePicker.d.ts +3 -0
  25. package/dist/components/main/PickerMain.d.ts +7 -0
  26. package/dist/components/navigation/CategoryNavigation.d.ts +3 -0
  27. package/dist/config/categoryConfig.d.ts +12 -0
  28. package/dist/config/cdnUrls.d.ts +2 -0
  29. package/dist/config/config.d.ts +26 -0
  30. package/dist/config/useConfig.d.ts +11 -0
  31. package/dist/data/emojis.d.ts +2 -0
  32. package/dist/data/groups.d.ts +2 -0
  33. package/dist/data/skinToneVariations.d.ts +3 -0
  34. package/dist/dataUtils/DataTypes.d.ts +8 -0
  35. package/dist/dataUtils/alphaNumericEmojiIndex.d.ts +4 -0
  36. package/dist/dataUtils/asEmoji.d.ts +2 -0
  37. package/dist/dataUtils/emojiSelectors.d.ts +15 -0
  38. package/dist/dataUtils/parseNativeEmoji.d.ts +1 -0
  39. package/dist/dataUtils/recentlyUsed.d.ts +11 -0
  40. package/dist/emoji-picker-react.cjs.development.css +13 -0
  41. package/dist/emoji-picker-react.cjs.development.js +16769 -0
  42. package/dist/emoji-picker-react.cjs.development.js.map +1 -0
  43. package/dist/emoji-picker-react.cjs.production.min.js +2 -0
  44. package/dist/emoji-picker-react.cjs.production.min.js.map +1 -0
  45. package/dist/emoji-picker-react.esm.js +16838 -0
  46. package/dist/emoji-picker-react.esm.js.map +1 -0
  47. package/dist/hooks/preloadEmoji.d.ts +4 -0
  48. package/dist/hooks/useActiveCategoryScrollDetection.d.ts +2 -0
  49. package/dist/hooks/useCloseAllOpenToggles.d.ts +4 -0
  50. package/dist/hooks/useDebouncedState.d.ts +1 -0
  51. package/dist/hooks/useEmojiElements.d.ts +1 -0
  52. package/dist/hooks/useEmojiMouseEnter.d.ts +3 -0
  53. package/dist/hooks/useFilter.d.ts +10 -0
  54. package/dist/hooks/useInitialLoad.d.ts +2 -0
  55. package/dist/hooks/useIsEmojiHidden.d.ts +2 -0
  56. package/dist/hooks/useIsSearchMode.d.ts +1 -0
  57. package/dist/hooks/useMouseDownHandlers.d.ts +2 -0
  58. package/dist/hooks/useOnScroll.d.ts +2 -0
  59. package/dist/index.d.ts +7 -0
  60. package/dist/index.js +8 -3
  61. package/dist/types/exposedTypes.d.ts +39 -0
  62. package/package.json +72 -52
  63. package/src/DomUtils/categoryNameFromDom.ts +3 -0
  64. package/src/DomUtils/classNames.ts +6 -0
  65. package/src/DomUtils/emojiElementRef.ts +42 -0
  66. package/src/DomUtils/isDarkTheme.ts +7 -0
  67. package/src/DomUtils/scrollCategoryIntoView.ts +18 -0
  68. package/src/DomUtils/scrollTo.ts +11 -0
  69. package/src/DomUtils/selectors.ts +93 -0
  70. package/src/EmojiPickerReact.css +92 -0
  71. package/src/components/Layout/Flex.css +11 -0
  72. package/src/components/Layout/Flex.tsx +28 -0
  73. package/src/components/Layout/Relative.tsx +14 -0
  74. package/src/components/body/Body.css +6 -0
  75. package/src/components/body/Body.tsx +24 -0
  76. package/src/components/body/EmojiCategory.css +42 -0
  77. package/src/components/body/EmojiCategory.tsx +40 -0
  78. package/src/components/body/EmojiList.css +5 -0
  79. package/src/components/body/EmojiList.tsx +104 -0
  80. package/src/components/body/EmojiVariationPicker.css +65 -0
  81. package/src/components/body/EmojiVariationPicker.tsx +154 -0
  82. package/src/components/body/RecentlyUsed.tsx +50 -0
  83. package/src/components/body/svg/triangle.svg +11 -0
  84. package/src/components/context/ElementRefContext.tsx +61 -0
  85. package/src/components/context/PickerConfigContext.tsx +29 -0
  86. package/src/components/context/PickerContext.tsx +143 -0
  87. package/src/components/emoji/Emoji.css +44 -0
  88. package/src/components/emoji/Emoji.tsx +111 -0
  89. package/src/components/footer/Preview.css +14 -0
  90. package/src/components/footer/Preview.tsx +88 -0
  91. package/src/components/header/Header.css +4 -0
  92. package/src/components/header/Header.tsx +21 -0
  93. package/src/components/header/Search.css +72 -0
  94. package/src/components/header/Search.tsx +40 -0
  95. package/src/components/header/SkinTonePicker.css +86 -0
  96. package/src/components/header/SkinTonePicker.tsx +55 -0
  97. package/src/components/header/svg/magnifier.svg +13 -0
  98. package/src/components/header/svg/times.svg +33 -0
  99. package/src/components/main/PickerMain.css +11 -0
  100. package/src/components/main/PickerMain.tsx +43 -0
  101. package/src/components/navigation/CategoryNavigation.css +82 -0
  102. package/src/components/navigation/CategoryNavigation.tsx +32 -0
  103. package/src/components/navigation/svg/CategoryNav.svg +508 -0
  104. package/src/config/categoryConfig.ts +99 -0
  105. package/src/config/cdnUrls.ts +24 -0
  106. package/src/config/config.ts +54 -0
  107. package/src/config/useConfig.ts +63 -0
  108. package/src/data/emojis.json +1 -0
  109. package/src/data/emojis.ts +3 -0
  110. package/src/data/groups.ts +12 -0
  111. package/src/data/skinToneVariations.ts +12 -0
  112. package/src/dataUtils/DataTypes.ts +10 -0
  113. package/src/dataUtils/alphaNumericEmojiIndex.ts +23 -0
  114. package/src/dataUtils/asEmoji.ts +5 -0
  115. package/src/dataUtils/emojiSelectors.ts +94 -0
  116. package/src/dataUtils/parseNativeEmoji.ts +6 -0
  117. package/src/dataUtils/recentlyUsed.ts +64 -0
  118. package/src/hooks/preloadEmoji.ts +29 -0
  119. package/src/hooks/useActiveCategoryScrollDetection.ts +46 -0
  120. package/src/hooks/useCloseAllOpenToggles.ts +26 -0
  121. package/src/hooks/useDebouncedState.ts +21 -0
  122. package/src/hooks/useEmojiElements.ts +7 -0
  123. package/src/hooks/useEmojiMouseEnter.ts +59 -0
  124. package/src/hooks/useFilter.ts +170 -0
  125. package/src/hooks/useInitialLoad.ts +9 -0
  126. package/src/hooks/useIsEmojiHidden.ts +16 -0
  127. package/src/hooks/useIsSearchMode.ts +7 -0
  128. package/src/hooks/useMouseDownHandlers.ts +160 -0
  129. package/src/hooks/useOnScroll.ts +28 -0
  130. package/src/index.tsx +33 -0
  131. package/src/types/exposedTypes.ts +43 -0
  132. package/.babelrc +0 -30
  133. package/.eslintrc.js +0 -37
  134. package/.github/workflows/npmpublish.yml +0 -30
  135. package/.prettierignore +0 -2
  136. package/.storybook/addons.js +0 -2
  137. package/.storybook/config.js +0 -9
  138. package/assets/captured.gif +0 -0
  139. package/dist/index.js.LICENSE.txt +0 -5
  140. package/dist/index.js.map +0 -1
  141. package/dist/main.css +0 -206
  142. package/dist/main.css.map +0 -1
  143. package/emoji-picker-react.d.ts +0 -45
  144. package/webpack.config.js +0 -52
package/LICENSE CHANGED
@@ -1,24 +1,21 @@
1
- This is free and unencumbered software released into the public domain.
1
+ MIT License
2
2
 
3
- Anyone is free to copy, modify, publish, use, compile, sell, or
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
- In jurisdictions that recognize copyright laws, the author or authors
9
- of this software dedicate any and all copyright interest in the
10
- software to the public domain. We make this dedication for the benefit
11
- of the public at large and to the detriment of our heirs and
12
- successors. We intend this dedication to be an overt act of
13
- relinquishment in perpetuity of all present and future rights to this
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
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
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
- For more information, please refer to <http://unlicense.org/>
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
- # emoji-picker-react
1
+ # Emoji Picker React (v4)
2
2
 
3
- [Live Demo](https://stackblitz.com/edit/emoji-picker-react?file=index.js)
3
+ An emoji picker component for React applications.
4
4
 
5
- ![Preview](/assets/captured.gif)
5
+ [Try it live](https://codesandbox.io/s/floral-rgb-z2gkzp?file=/src/App.tsx)
6
6
 
7
- ## What you need to know before installing?
7
+ ## What to know before using
8
8
 
9
- - Version 3 uses React hooks, which means you need to use React 16.8 or higher.
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 i emoji-picker-react
14
+ npm install emoji-picker-react
17
15
  ```
18
16
 
19
- Or
17
+ ## Usage:
20
18
 
21
- ```
22
- yarn add emoji-picker-react
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
- {chosenEmoji ? (
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
- ### Accepted props
31
+ ## Features
62
32
 
63
- | Name | Type | Default Value | Required? | Description |
64
- | ----------------------- | ---------- | ------------- | --------- | ------------------------------------------------------------------------------------------------------- |
65
- | `onEmojiClick` | `Function` | `undefined` | Yes | Callback to run when clicking an emoji. |
66
- | `preload` | `Boolean` | `false` | No | Indicates whether all emojis images, should be preloaded, or only when showing each category. |
67
- | `skinTone` | `string` | `neutral` | No | Decides the default skit tone for supported emojis. |
68
- | `disableAutoFocus` | `boolean` | `false` | No | Disables autofocus of the search bar. Useful for safari-iphone devices which zoom in to focused inputs. |
69
- | `disableSearchBar` | `boolean` | `false` | No | Disables the search bar and the skin tone picker altogether. |
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
- #### onEmojiClick Arguments
41
+ # Props
78
42
 
79
- `onEmojiClick` is a regular click handler for any of the emojis in the app. It takes two arguments:
43
+ The following props are accepted by them picker:
80
44
 
81
- 1. The click event.
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
- #### Setting a default skin tone modifier
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
- You may choose an alternative skin tone as the default skin tone to show for supported emojis (such as the 🤘 rocker hand emoji).
92
- Emoji-picker-react exports descriptive names for all skin variations so you may use them when setting your variations.
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
- The following are exported:
61
+ ```ts
62
+ import { Theme } from 'emoji-picker-react';
63
+ ```
95
64
 
96
- - ✋ SKIN_TONE_NEUTRAL
97
- - ✋🏻 SKIN_TONE_LIGHT
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
- Use them like this:
68
+ ```ts
69
+ import { EmojiStyle } from 'emoji-picker-react';
70
+ ```
104
71
 
105
- ```js
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
- const App = () => {
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
- const onEmojiClick = (event, emojiObject) => {
113
- setChosenEmoji(emojiObject);
114
- };
76
+ - ✋ 'neutral'
77
+ - ✋🏻 '1f3fb'
78
+ - ✋🏼 '1f3fc'
79
+ - ✋🏽 '1f3fd'
80
+ - ✋🏾 '1f3fe'
81
+ - ✋🏿 '1f3ff'
115
82
 
116
- return (
117
- <div>
118
- <Picker onEmojiClick={onEmojiClick} skinTone={SKIN_TONE_MEDIUM_DARK} />
119
- </div>
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
- #### Customize Styling
89
+ - `skinTonesDisabled`: `boolean` - Whether to disable the skin tone selection. Defaults to `false`.
125
90
 
126
- You can override the style of emoji-picker-react with **pickerStyle** props.
91
+ - `showPreview`: `boolean` - Whether to show the preview of the selected emoji. Defaults to `true`.
127
92
 
128
- ```js
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
- const App = () => {
133
- const [chosenEmoji, setChosenEmoji] = useState(null);
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
- const onEmojiClick = (event, emojiObject) => {
136
- setChosenEmoji(emojiObject);
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
- return (
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
- ## Internationalization
148
-
149
- The emoji names cannot be translated as they come from an external library, but it is possible to rename the categories.
150
- To rename the categories, pass a prop called `groupNames` which contains an object of group keys and their names as strings. For example:
151
-
152
- ```js
153
- <Picker
154
- groupNames={{
155
- smileys_people: 'yellow faces',
156
- animals_nature: 'cute dogs and also trees',
157
- food_drink: 'milkshakes and more',
158
- travel_places: 'I love trains',
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
- The complete list of keys is:
123
+ # Troubleshooting
169
124
 
170
- - smileys_people
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
- ## Disabling categories
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
- It is possible to disable certain categories by setting the `groupVisibility` prop. The groupVisibility prop takes an object of group names, and a boolean indicating whether they should be shown or not. For example, if you'd like to disable the flags category, set it to false like this:
129
+ ```javascript
130
+ import dynamic from 'next/dynamic';
183
131
 
184
- ```js
185
- <Picker
186
- groupVisibility={{
187
- flags: false,
188
- }}
189
- />
132
+ const Picker = dynamic(
133
+ () => {
134
+ return import('emoji-picker-react');
135
+ },
136
+ { ssr: false }
137
+ );
190
138
  ```
191
139
 
192
- The complete list of keys is:
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,6 @@
1
+ export declare enum ClassNames {
2
+ hiddenOnSearch = "epr-hidden-on-search",
3
+ searchActive = "epr-search-active",
4
+ hidden = "epr-hidden",
5
+ visible = "epr-visible"
6
+ }
@@ -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,7 @@
1
+ import * as React from 'react';
2
+ declare type Props = Readonly<{
3
+ children: React.ReactNode;
4
+ className?: string;
5
+ }>;
6
+ export default function Relative({ children, className }: Props): JSX.Element;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './Body.css';
3
+ export declare function Body(): JSX.Element;
@@ -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,3 @@
1
+ /// <reference types="react" />
2
+ import './EmojiList.css';
3
+ export declare function EmojiList(): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './EmojiVariationPicker.css';
3
+ export declare function EmojiVariationPicker(): JSX.Element;
@@ -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,7 @@
1
+ /// <reference types="react" />
2
+ import './Preview.css';
3
+ export declare function Preview(): JSX.Element | null;
4
+ export declare type HoveredEmoji = null | {
5
+ unified: string;
6
+ originalUnified: string;
7
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './Header.css';
3
+ export declare function Header(): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './Search.css';
3
+ export declare function Search(): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './SkinTonePicker.css';
3
+ export declare function SkinTonePicker(): JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import './PickerMain.css';
3
+ declare type Props = Readonly<{
4
+ children: React.ReactNode;
5
+ }>;
6
+ export default function PickerMain({ children }: Props): JSX.Element;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './CategoryNavigation.css';
3
+ export declare function CategoryNavigation(): JSX.Element;
@@ -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,2 @@
1
+ import { EmojiStyle } from "../types/exposedTypes";
2
+ export declare function cdnUrl(emojiStyle: EmojiStyle): string;
@@ -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;
@@ -0,0 +1,2 @@
1
+ import emojis from './emojis.json';
2
+ export default emojis;
@@ -0,0 +1,2 @@
1
+ declare const groups: string[];
2
+ export default groups;