emoji-picker-react 3.6.1-rc.1 → 4.0.0-rc.10

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 (142) hide show
  1. package/LICENSE +17 -20
  2. package/README.md +71 -186
  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/scrollCategoryIntoView.d.ts +1 -0
  7. package/dist/DomUtils/scrollTo.d.ts +1 -0
  8. package/dist/DomUtils/selectors.d.ts +12 -0
  9. package/dist/components/Layout/Flex.d.ts +14 -0
  10. package/dist/components/Layout/Relative.d.ts +7 -0
  11. package/dist/components/body/Body.d.ts +3 -0
  12. package/dist/components/body/EmojiCategory.d.ts +11 -0
  13. package/dist/components/body/EmojiList.d.ts +3 -0
  14. package/dist/components/body/EmojiVariationPicker.d.ts +3 -0
  15. package/dist/components/body/RecentlyUsed.d.ts +7 -0
  16. package/dist/components/context/ElementRefContext.d.ts +17 -0
  17. package/dist/components/context/PickerConfigContext.d.ts +8 -0
  18. package/dist/components/context/PickerContext.d.ts +21 -0
  19. package/dist/components/emoji/Emoji.d.ts +16 -0
  20. package/dist/components/footer/Preview.d.ts +7 -0
  21. package/dist/components/header/Header.d.ts +3 -0
  22. package/dist/components/header/Search.d.ts +3 -0
  23. package/dist/components/header/SkinTonePicker.d.ts +3 -0
  24. package/dist/components/main/PickerMain.d.ts +7 -0
  25. package/dist/components/navigation/CategoryNavigation.d.ts +3 -0
  26. package/dist/config/categoryConfig.d.ts +12 -0
  27. package/dist/config/cdnUrls.d.ts +2 -0
  28. package/dist/config/config.d.ts +26 -0
  29. package/dist/config/useConfig.d.ts +11 -0
  30. package/dist/data/emojis.d.ts +2 -0
  31. package/dist/data/groups.d.ts +2 -0
  32. package/dist/data/skinToneVariations.d.ts +3 -0
  33. package/dist/dataUtils/DataTypes.d.ts +8 -0
  34. package/dist/dataUtils/alphaNumericEmojiIndex.d.ts +4 -0
  35. package/dist/dataUtils/asEmoji.d.ts +2 -0
  36. package/dist/dataUtils/emojiSelectors.d.ts +15 -0
  37. package/dist/dataUtils/parseNativeEmoji.d.ts +1 -0
  38. package/dist/dataUtils/recentlyUsed.d.ts +11 -0
  39. package/dist/emoji-picker-react.cjs.development.css +13 -0
  40. package/dist/emoji-picker-react.cjs.development.js +16757 -0
  41. package/dist/emoji-picker-react.cjs.development.js.map +1 -0
  42. package/dist/emoji-picker-react.cjs.production.min.js +2 -0
  43. package/dist/emoji-picker-react.cjs.production.min.js.map +1 -0
  44. package/dist/emoji-picker-react.esm.js +16826 -0
  45. package/dist/emoji-picker-react.esm.js.map +1 -0
  46. package/dist/hooks/preloadEmoji.d.ts +4 -0
  47. package/dist/hooks/useActiveCategoryScrollDetection.d.ts +2 -0
  48. package/dist/hooks/useCloseAllOpenToggles.d.ts +4 -0
  49. package/dist/hooks/useDebouncedState.d.ts +1 -0
  50. package/dist/hooks/useEmojiElements.d.ts +1 -0
  51. package/dist/hooks/useEmojiMouseEnter.d.ts +3 -0
  52. package/dist/hooks/useFilter.d.ts +10 -0
  53. package/dist/hooks/useInitialLoad.d.ts +2 -0
  54. package/dist/hooks/useIsEmojiHidden.d.ts +2 -0
  55. package/dist/hooks/useIsSearchMode.d.ts +1 -0
  56. package/dist/hooks/useMouseDownHandlers.d.ts +2 -0
  57. package/dist/hooks/useOnScroll.d.ts +2 -0
  58. package/dist/index.d.ts +7 -0
  59. package/dist/index.js +8 -3
  60. package/dist/types/exposedTypes.d.ts +39 -0
  61. package/package.json +72 -52
  62. package/src/DomUtils/categoryNameFromDom.ts +3 -0
  63. package/src/DomUtils/classNames.ts +6 -0
  64. package/src/DomUtils/emojiElementRef.ts +42 -0
  65. package/src/DomUtils/scrollCategoryIntoView.ts +18 -0
  66. package/src/DomUtils/scrollTo.ts +11 -0
  67. package/src/DomUtils/selectors.ts +93 -0
  68. package/src/EmojiPickerReact.css +92 -0
  69. package/src/components/Layout/Flex.css +11 -0
  70. package/src/components/Layout/Flex.tsx +28 -0
  71. package/src/components/Layout/Relative.tsx +14 -0
  72. package/src/components/body/Body.css +6 -0
  73. package/src/components/body/Body.tsx +24 -0
  74. package/src/components/body/EmojiCategory.css +42 -0
  75. package/src/components/body/EmojiCategory.tsx +40 -0
  76. package/src/components/body/EmojiList.css +5 -0
  77. package/src/components/body/EmojiList.tsx +104 -0
  78. package/src/components/body/EmojiVariationPicker.css +65 -0
  79. package/src/components/body/EmojiVariationPicker.tsx +154 -0
  80. package/src/components/body/RecentlyUsed.tsx +50 -0
  81. package/src/components/body/svg/triangle.svg +11 -0
  82. package/src/components/context/ElementRefContext.tsx +61 -0
  83. package/src/components/context/PickerConfigContext.tsx +29 -0
  84. package/src/components/context/PickerContext.tsx +143 -0
  85. package/src/components/emoji/Emoji.css +44 -0
  86. package/src/components/emoji/Emoji.tsx +111 -0
  87. package/src/components/footer/Preview.css +14 -0
  88. package/src/components/footer/Preview.tsx +88 -0
  89. package/src/components/header/Header.css +4 -0
  90. package/src/components/header/Header.tsx +21 -0
  91. package/src/components/header/Search.css +72 -0
  92. package/src/components/header/Search.tsx +40 -0
  93. package/src/components/header/SkinTonePicker.css +86 -0
  94. package/src/components/header/SkinTonePicker.tsx +55 -0
  95. package/src/components/header/svg/magnifier.svg +13 -0
  96. package/src/components/header/svg/times.svg +33 -0
  97. package/src/components/main/PickerMain.css +11 -0
  98. package/src/components/main/PickerMain.tsx +43 -0
  99. package/src/components/navigation/CategoryNavigation.css +82 -0
  100. package/src/components/navigation/CategoryNavigation.tsx +32 -0
  101. package/src/components/navigation/svg/CategoryNav.svg +508 -0
  102. package/src/config/categoryConfig.ts +99 -0
  103. package/src/config/cdnUrls.ts +24 -0
  104. package/src/config/config.ts +50 -0
  105. package/src/config/useConfig.ts +52 -0
  106. package/src/data/emojis.json +1 -0
  107. package/src/data/emojis.ts +3 -0
  108. package/src/data/groups.ts +12 -0
  109. package/src/data/skinToneVariations.ts +12 -0
  110. package/src/dataUtils/DataTypes.ts +10 -0
  111. package/src/dataUtils/alphaNumericEmojiIndex.ts +23 -0
  112. package/src/dataUtils/asEmoji.ts +5 -0
  113. package/src/dataUtils/emojiSelectors.ts +94 -0
  114. package/src/dataUtils/parseNativeEmoji.ts +6 -0
  115. package/src/dataUtils/recentlyUsed.ts +64 -0
  116. package/src/hooks/preloadEmoji.ts +29 -0
  117. package/src/hooks/useActiveCategoryScrollDetection.ts +46 -0
  118. package/src/hooks/useCloseAllOpenToggles.ts +26 -0
  119. package/src/hooks/useDebouncedState.ts +21 -0
  120. package/src/hooks/useEmojiElements.ts +7 -0
  121. package/src/hooks/useEmojiMouseEnter.ts +59 -0
  122. package/src/hooks/useFilter.ts +170 -0
  123. package/src/hooks/useInitialLoad.ts +9 -0
  124. package/src/hooks/useIsEmojiHidden.ts +16 -0
  125. package/src/hooks/useIsSearchMode.ts +7 -0
  126. package/src/hooks/useMouseDownHandlers.ts +160 -0
  127. package/src/hooks/useOnScroll.ts +28 -0
  128. package/src/index.tsx +33 -0
  129. package/src/types/exposedTypes.ts +43 -0
  130. package/.babelrc +0 -30
  131. package/.eslintrc.js +0 -37
  132. package/.github/workflows/npmpublish.yml +0 -30
  133. package/.prettierignore +0 -2
  134. package/.storybook/addons.js +0 -2
  135. package/.storybook/config.js +0 -9
  136. package/assets/captured.gif +0 -0
  137. package/dist/index.js.LICENSE.txt +0 -5
  138. package/dist/index.js.map +0 -1
  139. package/dist/main.css +0 -206
  140. package/dist/main.css.map +0 -1
  141. package/emoji-picker-react.d.ts +0 -44
  142. 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,220 +1,105 @@
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.
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
+ ## Features
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
19
+ - Custom click handler
20
+ - Dark mode
21
+ - Customizable styles via css variables
22
+ - Default skin tone selection
23
+ - Skin tone change
24
+ - Different emoji sets (Google, Apple, Facebook, Twitter)
25
+ - Native Emoji support
34
26
 
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.
27
+ ## Config Props
36
28
 
37
- ```js
38
- import React, { useState } from 'react';
39
- import Picker from 'emoji-picker-react';
29
+ - _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:
40
30
 
41
- const App = () => {
42
- const [chosenEmoji, setChosenEmoji] = useState(null);
31
+ ```ts{
32
+ activeSkinTone: SkinTones;
33
+ unified: string;
34
+ unifiedWithoutSkinTone: string;
35
+ emoji: string;
36
+ names: string[];
37
+ getImageUrl: (emojiStyle: EmojiStyle) => string;
38
+ }
39
+ ```
43
40
 
44
- const onEmojiClick = (event, emojiObject) => {
45
- setChosenEmoji(emojiObject);
46
- };
47
-
48
- return (
49
- <div>
50
- {chosenEmoji ? (
51
- <span>You chose: {chosenEmoji.emoji}</span>
52
- ) : (
53
- <span>No emoji Chosen</span>
54
- )}
55
- <Picker onEmojiClick={onEmojiClick} />
56
- </div>
57
- );
58
- };
59
- ```
60
-
61
- ### Accepted props
62
-
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 |
76
-
77
- #### onEmojiClick Arguments
78
-
79
- `onEmojiClick` is a regular click handler for any of the emojis in the app. It takes two arguments:
80
-
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.
88
-
89
- #### Setting a default skin tone modifier
90
-
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.
93
-
94
- The following are exported:
95
-
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
102
-
103
- Use them like this:
104
-
105
- ```js
106
- import React, { useState } from 'react';
107
- import Picker, { SKIN_TONE_MEDIUM_DARK } from 'emoji-picker-react';
108
-
109
- const App = () => {
110
- const [chosenEmoji, setChosenEmoji] = useState(null);
111
-
112
- const onEmojiClick = (event, emojiObject) => {
113
- setChosenEmoji(emojiObject);
114
- };
115
-
116
- return (
117
- <div>
118
- <Picker onEmojiClick={onEmojiClick} skinTone={SKIN_TONE_MEDIUM_DARK} />
119
- </div>
120
- );
121
- };
122
- ```
41
+ - _theme_ `Theme` - The theme of the picker. Can be either `light` or `dark`. Default is `light`.
42
+ The `Theme` enum can be imported from the package.
123
43
 
124
- #### Customize Styling
44
+ ```ts
45
+ import { Theme } from 'emoji-picker-react';
46
+ ```
125
47
 
126
- You can override the style of emoji-picker-react with **pickerStyle** props.
48
+ - _emojiStyle_ `EmojiStyle` - The emoji style to use. Can be either `apple`, `google`, `facebook`, `twitter` or `native`. Default is `apple`.
49
+ The `EmojiStyle` enum can be imported from the package.
127
50
 
128
- ```js
129
- import React, { useState } from 'react';
130
- import Picker from 'emoji-picker-react';
51
+ ```ts
52
+ import { EmojiStyle } from 'emoji-picker-react';
53
+ ```
131
54
 
132
- const App = () => {
133
- const [chosenEmoji, setChosenEmoji] = useState(null);
55
+ * _autoFocusSearch_: `boolean` - Whether to focus the search input on mount. Defaults to `true`.
134
56
 
135
- const onEmojiClick = (event, emojiObject) => {
136
- setChosenEmoji(emojiObject);
137
- };
57
+ * _defaultSkinTone_: `SkinTones` - The default skin tone to use when an emoji is clicked. Defaults to `SkinTones.Neutral`. Possible skin tones are:
138
58
 
139
- return (
140
- <div>
141
- <Picker onEmojiClick={onEmojiClick} pickerStyle={{ width: '100%' }} />
142
- </div>
143
- );
144
- };
145
59
  ```
146
-
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
- />
60
+ ✋ NEUTRAL = 'neutral'
61
+ ✋🏻 LIGHT = '1f3fb'
62
+ ✋🏼 MEDIUM_LIGHT = '1f3fc'
63
+ ✋🏽 MEDIUM = '1f3fd'
64
+ ✋🏾 MEDIUM_DARK = '1f3fe'
65
+ ✋🏿 DARK = '1f3ff'
166
66
  ```
167
67
 
168
- The complete list of keys is:
169
-
170
- - smileys_people
171
- - animals_nature
172
- - food_drink
173
- - travel_places
174
- - activities
175
- - objects
176
- - symbols
177
- - flags
178
- - recently_used
179
-
180
- ## Disabling categories
181
-
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:
68
+ The skin tones typescript enum can be imported directly from the package:
183
69
 
184
- ```js
185
- <Picker
186
- groupVisibility={{
187
- flags: false,
188
- }}
189
- />
70
+ ```ts
71
+ import { SkinTones } from 'emoji-picker-react';
190
72
  ```
191
73
 
192
- The complete list of keys is:
74
+ - _skinTonesDisabled_: `boolean` - Whether to disable the skin tone selection. Defaults to `false`.
193
75
 
194
- - smileys_people
195
- - animals_nature
196
- - food_drink
197
- - travel_places
198
- - activities
199
- - objects
200
- - symbols
201
- - flags
202
- - recently_used
76
+ - _showPreview_: `boolean` - Whether to show the preview of the selected emoji. Defaults to `true`.
203
77
 
204
- ## UI Customizations
78
+ - _searchPlaceholder_: `string` - The placeholder text for the search input. Defaults to `Search`.
205
79
 
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).
80
+ - categories: Allows full config over ordering, naming and display of categories.
81
+ To only sort/omit categories, you can simply pass an array of category names to display:
207
82
 
208
- # Troubleshooting
209
-
210
- ## How to use in Vite project
83
+ ```
84
+ RECENTLY_USED = 'recently_used',
85
+ SMILEYS_PEOPLE = 'smileys_people',
86
+ ANIMALS_NATURE = 'animals_nature',
87
+ FOOD_DRINK = 'food_drink',
88
+ TRAVEL_PLACES = 'travel_places',
89
+ ACTIVITIES = 'activities',
90
+ OBJECTS = 'objects',
91
+ SYMBOLS = 'symbols',
92
+ FLAGS = 'flags'
93
+ ```
211
94
 
212
- For reference, if you only need to shim global, you can add
95
+ For a more in-depth configuration, you can pass an array with category config:
213
96
 
214
- ```html
215
- <script>
216
- window.global = window;
217
- </script>
97
+ ```ts
98
+ [{
99
+ category: Categories.RECENTLY_USED;
100
+ name: "Recently Used";
101
+ }, {
102
+ category: Categories.SMILEYS_PEOPLE;
103
+ name: "Faces...";
104
+ }]
218
105
  ```
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 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 } 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(): string;
@@ -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;
@@ -0,0 +1,3 @@
1
+ import { SkinTones } from '../types/exposedTypes';
2
+ declare const skinToneVariations: SkinTones[];
3
+ export default skinToneVariations;
@@ -0,0 +1,8 @@
1
+ import emojis from '../data/emojis';
2
+ export declare type DataEmoji = {
3
+ n: string[];
4
+ u: string;
5
+ v?: string[];
6
+ };
7
+ export declare type DataEmojis = DataEmoji[];
8
+ export declare type DataGroups = keyof typeof emojis;
@@ -0,0 +1,4 @@
1
+ import { DataEmoji } from './DataTypes';
2
+ export declare const alphaNumericEmojiIndex: BaseIndex;
3
+ declare type BaseIndex = Record<string, Record<string, DataEmoji>>;
4
+ export {};
@@ -0,0 +1,2 @@
1
+ import { DataEmoji } from './DataTypes';
2
+ export declare function asEmoji(emoji: DataEmoji | undefined | null): DataEmoji;