emoji-picker-react 4.0.0-rc.2 → 4.0.0-rc.20

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 (107) hide show
  1. package/README.md +159 -139
  2. package/dist/DomUtils/classNames.d.ts +11 -0
  3. package/dist/DomUtils/elementPositionInRow.d.ts +10 -0
  4. package/dist/DomUtils/emojiElementRef.d.ts +11 -0
  5. package/dist/DomUtils/focusElement.d.ts +5 -0
  6. package/dist/DomUtils/getActiveElement.d.ts +2 -0
  7. package/dist/DomUtils/isDarkTheme.d.ts +1 -0
  8. package/dist/DomUtils/keyboardNavigation.d.ts +7 -0
  9. package/dist/DomUtils/lastElementChild.d.ts +2 -0
  10. package/dist/DomUtils/scrollCategoryIntoView.d.ts +2 -1
  11. package/dist/DomUtils/scrollTo.d.ts +3 -1
  12. package/dist/DomUtils/selectors.d.ts +23 -11
  13. package/dist/EmojiPickerReact.d.ts +6 -0
  14. package/dist/components/ErrorBoundary.d.ts +15 -0
  15. package/dist/components/body/EmojiCategory.d.ts +2 -1
  16. package/dist/components/body/{RecentlyUsed.d.ts → Suggested.d.ts} +1 -1
  17. package/dist/components/context/ElementRefContext.d.ts +9 -13
  18. package/dist/components/context/PickerContext.d.ts +3 -2
  19. package/dist/components/emoji/Emoji.d.ts +5 -2
  20. package/dist/components/footer/Preview.d.ts +1 -1
  21. package/dist/config/categoryConfig.d.ts +8 -13
  22. package/dist/config/cdnUrls.d.ts +1 -1
  23. package/dist/config/config.d.ts +16 -28
  24. package/dist/config/useConfig.d.ts +7 -6
  25. package/dist/data/emojis.d.ts +1 -39
  26. package/dist/data/skinToneVariations.d.ts +2 -8
  27. package/dist/dataUtils/emojiSelectors.d.ts +3 -3
  28. package/dist/dataUtils/suggested.d.ts +11 -0
  29. package/dist/emoji-picker-react.cjs.development.css +7 -7
  30. package/dist/emoji-picker-react.cjs.development.js +15928 -6204
  31. package/dist/emoji-picker-react.cjs.development.js.map +1 -1
  32. package/dist/emoji-picker-react.cjs.production.min.js +1 -1
  33. package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
  34. package/dist/emoji-picker-react.esm.js +15915 -6182
  35. package/dist/emoji-picker-react.esm.js.map +1 -1
  36. package/dist/hooks/preloadEmoji.d.ts +1 -1
  37. package/dist/hooks/useCloseAllOpenToggles.d.ts +1 -4
  38. package/dist/hooks/useDebouncedState.d.ts +1 -0
  39. package/dist/hooks/useEmojiPreviewEvents.d.ts +3 -0
  40. package/dist/hooks/useFilter.d.ts +2 -1
  41. package/dist/hooks/useFocus.d.ts +3 -0
  42. package/dist/hooks/useInitialLoad.d.ts +1 -1
  43. package/dist/hooks/useKeyboardNavigation.d.ts +1 -0
  44. package/dist/hooks/useMouseDownHandlers.d.ts +3 -2
  45. package/dist/index.d.ts +2 -2
  46. package/dist/types/exposedTypes.d.ts +35 -2
  47. package/package.json +13 -10
  48. package/src/DomUtils/classNames.ts +14 -0
  49. package/src/DomUtils/elementPositionInRow.ts +169 -0
  50. package/src/DomUtils/emojiElementRef.ts +43 -0
  51. package/src/DomUtils/focusElement.ts +35 -0
  52. package/src/DomUtils/getActiveElement.ts +5 -0
  53. package/src/DomUtils/isDarkTheme.ts +7 -0
  54. package/src/DomUtils/keyboardNavigation.ts +153 -0
  55. package/src/DomUtils/lastElementChild.ts +7 -0
  56. package/src/DomUtils/scrollCategoryIntoView.ts +2 -1
  57. package/src/DomUtils/scrollTo.ts +22 -1
  58. package/src/DomUtils/selectors.ts +180 -39
  59. package/src/EmojiPickerReact.css +79 -47
  60. package/src/EmojiPickerReact.tsx +26 -0
  61. package/src/components/ErrorBoundary.tsx +28 -0
  62. package/src/components/body/EmojiCategory.css +5 -2
  63. package/src/components/body/EmojiCategory.tsx +15 -2
  64. package/src/components/body/EmojiList.tsx +11 -6
  65. package/src/components/body/EmojiVariationPicker.tsx +3 -3
  66. package/src/components/body/Suggested.tsx +61 -0
  67. package/src/components/context/ElementRefContext.tsx +46 -19
  68. package/src/components/context/PickerContext.tsx +35 -13
  69. package/src/components/emoji/Emoji.css +7 -2
  70. package/src/components/emoji/Emoji.tsx +23 -9
  71. package/src/components/footer/Preview.css +1 -1
  72. package/src/components/footer/Preview.tsx +22 -17
  73. package/src/components/header/Search.css +7 -7
  74. package/src/components/header/Search.tsx +12 -6
  75. package/src/components/header/SkinTonePicker.css +15 -8
  76. package/src/components/header/SkinTonePicker.tsx +11 -3
  77. package/src/components/main/PickerMain.tsx +7 -2
  78. package/src/components/navigation/CategoryNavigation.css +15 -4
  79. package/src/components/navigation/CategoryNavigation.tsx +5 -2
  80. package/src/config/categoryConfig.ts +42 -24
  81. package/src/config/cdnUrls.ts +1 -1
  82. package/src/config/config.ts +54 -26
  83. package/src/config/useConfig.ts +30 -9
  84. package/src/data/emojis.json +1 -0
  85. package/src/data/emojis.ts +1 -5348
  86. package/src/data/skinToneVariations.ts +12 -8
  87. package/src/dataUtils/emojiSelectors.ts +18 -4
  88. package/src/dataUtils/{recentlyUsed.ts → suggested.ts} +19 -15
  89. package/src/hooks/preloadEmoji.ts +2 -2
  90. package/src/hooks/useActiveCategoryScrollDetection.ts +7 -4
  91. package/src/hooks/useCloseAllOpenToggles.ts +7 -5
  92. package/src/hooks/useDebouncedState.ts +24 -0
  93. package/src/hooks/useEmojiPreviewEvents.ts +72 -0
  94. package/src/hooks/useFilter.ts +63 -28
  95. package/src/hooks/useFocus.ts +40 -0
  96. package/src/hooks/useInitialLoad.ts +1 -0
  97. package/src/hooks/useKeyboardNavigation.ts +337 -0
  98. package/src/hooks/useMouseDownHandlers.ts +106 -80
  99. package/src/hooks/useOnScroll.ts +2 -2
  100. package/src/index.tsx +14 -17
  101. package/src/types/exposedTypes.ts +40 -3
  102. package/dist/dataUtils/recentlyUsed.d.ts +0 -11
  103. package/dist/hooks/useEmojiElements.d.ts +0 -1
  104. package/dist/hooks/useEmojiMouseEnter.d.ts +0 -3
  105. package/src/components/body/RecentlyUsed.tsx +0 -50
  106. package/src/hooks/useEmojiElements.ts +0 -7
  107. package/src/hooks/useEmojiMouseEnter.ts +0 -59
package/README.md CHANGED
@@ -1,181 +1,201 @@
1
- # TSDX React w/ Storybook User Guide
1
+ # Emoji Picker React (v4)
2
2
 
3
- Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
3
+ An emoji picker component for React applications.
4
4
 
5
- > This TSDX setup is meant for developing React component libraries (not apps!) that can be published to NPM. If you’re looking to build a React-based app, you should use `create-react-app`, `razzle`, `nextjs`, `gatsby`, or `react-static`.
5
+ [Try it live](https://codesandbox.io/s/floral-rgb-z2gkzp?file=/src/App.tsx)
6
6
 
7
- > If you’re new to TypeScript and React, checkout [this handy cheatsheet](https://github.com/sw-yx/react-typescript-cheatsheet/)
7
+ ## What to know before using
8
8
 
9
- ## Commands
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.
10
10
 
11
- TSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.
11
+ ## Installation
12
12
 
13
- The recommended workflow is to run TSDX in one terminal:
14
-
15
- ```bash
16
- npm start # or yarn start
17
13
  ```
18
-
19
- This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
20
-
21
- Then run either Storybook or the example playground:
22
-
23
- ### Storybook
24
-
25
- Run inside another terminal:
26
-
27
- ```bash
28
- yarn storybook
14
+ npm install emoji-picker-react
29
15
  ```
30
16
 
31
- This loads the stories from `./stories`.
32
-
33
- > NOTE: Stories should reference the components as if using the library, similar to the example playground. This means importing from the root project directory. This has been aliased in the tsconfig and the storybook webpack config as a helper.
17
+ ## Usage:
34
18
 
35
- ### Example
19
+ ```jsx
20
+ import EmojiPicker from 'emoji-picker-react';
36
21
 
37
- Then run the example inside another:
38
-
39
- ```bash
40
- cd example
41
- npm i # or yarn to install dependencies
42
- npm start # or yarn start
22
+ function App() {
23
+ return (
24
+ <div>
25
+ <EmojiPicker />
26
+ </div>
27
+ );
28
+ }
43
29
  ```
44
30
 
45
- The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).
46
-
47
- To do a one-off build, use `npm run build` or `yarn build`.
48
-
49
- To run tests, use `npm test` or `yarn test`.
50
-
51
- ## Configuration
52
-
53
- Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
54
-
55
- ### Jest
56
-
57
- Jest tests are set up to run with `npm test` or `yarn test`.
58
-
59
- ### Bundle analysis
60
-
61
- Calculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `npm run size` and visulize it with `npm run analyze`.
62
-
63
- #### Setup Files
64
-
65
- This is the folder structure we set up for you:
66
-
67
- ```txt
68
- /example
69
- index.html
70
- index.tsx # test your component here in a demo app
71
- package.json
72
- tsconfig.json
73
- /src
74
- index.tsx # EDIT THIS
75
- /test
76
- blah.test.tsx # EDIT THIS
77
- /stories
78
- Thing.stories.tsx # EDIT THIS
79
- /.storybook
80
- main.js
81
- preview.js
82
- .gitignore
83
- package.json
84
- README.md # EDIT THIS
85
- tsconfig.json
31
+ ## Features
32
+
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
40
+
41
+ # Props
42
+
43
+ The following props are accepted by them picker:
44
+
45
+ | Prop | Type | Default | Description |
46
+ | ------------------- | -------- | ---------- | ----------------------------------------------------------------------------------------------------------------- |
47
+ | onEmojiClick | function | | Callback function that is called when an emoji is clicked. The function receives the emoji object as a parameter. |
48
+ | autoFocusSearch | boolean | `true` | Controls the auto focus of the search input. |
49
+ | Theme | string | `light` | Controls the theme of the picker. Possible values are `light`, `dark` and `auto`. |
50
+ | emojiStyle | string | `apple` | Controls the emoji style. Possible values are `google`, `apple`, `facebook`, `twitter` and `native`. |
51
+ | defaultSkinTone | string | `neutral` | Controls the default skin tone. |
52
+ | lazyLoadEmojis | boolean | `false` | Controls whether the emojis are loaded lazily or not. |
53
+ | previewConfig | object | `{}` | Controls the preview of the emoji. See below for more information. |
54
+ | searchPlaceholder | string | `Search` | Controls the placeholder of the search input. |
55
+ | suggestedEmojisMode | string | `frequent` | Controls the suggested emojis mode. Possible values are `frequent` and `recent`. |
56
+ | skinTonesDisabled | boolean | `false` | Controls whether the skin tones are disabled or not. |
57
+
58
+ ## Full details
59
+
60
+ - `onEmojiClick`: `(emojiData: EmojiClickData, event: MouseEvent) => 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:
61
+
62
+ ```ts
63
+ {
64
+ activeSkinTone: SkinTones;
65
+ unified: string;
66
+ unifiedWithoutSkinTone: string;
67
+ emoji: string;
68
+ names: string[];
69
+ getImageUrl: (emojiStyle: EmojiStyle) => string;
70
+ }
71
+ ```
72
+
73
+ - `theme`: `Theme` - The theme of the picker. Can be `light`, `dark` or auto. Default is `light`.
74
+ The `Theme` enum can be imported from the package.
75
+
76
+ ```ts
77
+ import { Theme } from 'emoji-picker-react';
78
+ ```
79
+
80
+ - `emojiStyle`: `EmojiStyle` - The emoji style to use. Can be either `apple`, `google`, `facebook`, `twitter` or `native`. Default is `apple`.
81
+ The `EmojiStyle` enum can be imported from the package.
82
+
83
+ ```ts
84
+ import { EmojiStyle } from 'emoji-picker-react';
85
+ ```
86
+
87
+ * `autoFocusSearch`: `boolean` - Whether to focus the search input on mount. Defaults to `true`.
88
+ *
89
+ * `lazyLoadEmojis`: `boolean` - Whether to lazy load the emojis. Defaults to `false`.
90
+
91
+ * `defaultSkinTone`: `SkinTones` - The default skin tone to use when an emoji is clicked. Defaults to `SkinTones.Neutral`. Possible skin tones are:
92
+
93
+ - ✋ 'neutral'
94
+ - ✋🏻 '1f3fb'
95
+ - ✋🏼 '1f3fc'
96
+ - ✋🏽 '1f3fd'
97
+ - ✋🏾 '1f3fe'
98
+ - ✋🏿 '1f3ff'
99
+
100
+ The skin tones typescript enum can be imported directly from the package:
101
+
102
+ ```ts
103
+ import { SkinTones } from 'emoji-picker-react';
86
104
  ```
87
105
 
88
- #### React Testing Library
106
+ - `skinTonesDisabled`: `boolean` - Whether to disable the skin tone selection. Defaults to `false`.
89
107
 
90
- We do not set up `react-testing-library` for you yet, we welcome contributions and documentation on this.
108
+ - `previewConfig`: `PreviewConfig` - Full control over the Preview component, either to show/hide it, change the default emoji or the default caption.
91
109
 
92
- ### Rollup
110
+ ```ts
111
+ {
112
+ defaultEmoji: string; // defaults to: "1f60a"
113
+ defaultCaption: string; // defaults to: "What's your mood?"
114
+ showPreview: boolean; // defaults to: true
115
+ }
116
+ ```
93
117
 
94
- TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
118
+ - `searchPlaceholder`: `string` - The placeholder text for the search input. Defaults to `Search`.
95
119
 
96
- ### TypeScript
120
+ - categories: Allows full config over ordering, naming and display of categories.
121
+ To only sort/omit categories, you can simply pass an array of category names to display:
97
122
 
98
- `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
123
+ - 'suggested',
124
+ - 'smileys_people',
125
+ - 'animals_nature',
126
+ - 'food_drink',
127
+ - 'travel_places',
128
+ - 'activities',
129
+ - 'objects',
130
+ - 'symbols',
131
+ - 'flags'
99
132
 
100
- ## Continuous Integration
133
+ For a more in-depth configuration, you can pass an array with category config:
101
134
 
102
- ### GitHub Actions
135
+ ```ts
136
+ [
137
+ {
138
+ category: 'suggested',
139
+ name: 'Recently Used'
140
+ },
141
+ {
142
+ category: 'smileys_people',
143
+ name: 'Faces...'
144
+ }
145
+ ];
146
+ ```
103
147
 
104
- Two actions are added by default:
148
+ - `suggestedEmojisMode`: `SuggestedEmojisMode` - The mode to use for the suggested emojis. Can be either `recent` or `frequent`. Defaults to `recent`.
149
+ The `SuggestionMode` enum can be imported from the package.
105
150
 
106
- - `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
107
- - `size` which comments cost comparison of your library on every pull request using [size-limit](https://github.com/ai/size-limit)
151
+ ```ts
152
+ import { SuggestionMode } from 'emoji-picker-react';
153
+ ```
108
154
 
109
- ## Optimizations
155
+ # Customization
110
156
 
111
- Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
157
+ The picker can be customized via css variables. The root selector for the picker is `.EmojiPickerReact`, when overriding, make sure to provide a more specific selector.
112
158
 
113
- ```js
114
- // ./types/index.d.ts
115
- declare var __DEV__: boolean;
159
+ In dark mode, the specific selector is `.EmojiPickerReact.epr-dark-theme`.
116
160
 
117
- // inside your code...
118
- if (__DEV__) {
119
- console.log('foo');
120
- }
121
- ```
161
+ The list of possible variables is quite extensive, but the main ones you may want to override are:
122
162
 
123
- You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
163
+ - `--epr-picker-width`: The width of the picker.
164
+ - `--epr-picker-height`: The height of the picker.
165
+ - `--epr-emoji-size`: The size of the emojis.
166
+ - `--epr-emoji-gap`: The space between emojis.
124
167
 
125
- ## Module Formats
168
+ - `--epr-hover-bg-color` Hovered emoji background color.
169
+ - `--epr-bg-color`: The background color of the picker. When changing it, you should also change `--epr-category-label-bg-color` as they are usually the same color.
170
+ - `--epr-text-color`: The text color in the picker.
126
171
 
127
- CJS, ESModules, and UMD module formats are supported.
172
+ # Troubleshooting
128
173
 
129
- The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
174
+ ## Error Boundary
130
175
 
131
- ## Deploying the Example Playground
176
+ emoji-picker-react has a top-level error boundary, trying to catch rendering errors. It won't catch server side related errors, or event handlers errors. If an error is caught, the picker will not render, and a console error will be logged.
132
177
 
133
- The Playground is just a simple [Parcel](https://parceljs.org) app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for **manually** deploying with the Netlify CLI (`npm i -g netlify-cli`):
178
+ ## Next.js
134
179
 
135
- ```bash
136
- cd example # if not already in the example folder
137
- npm run build # builds to dist
138
- netlify deploy # deploy the dist folder
139
- ```
180
+ 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:
140
181
 
141
- Alternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:
182
+ ```javascript
183
+ import dynamic from 'next/dynamic';
142
184
 
143
- ```bash
144
- netlify init
145
- # build command: yarn build && cd example && yarn && yarn build
146
- # directory to deploy: example/dist
147
- # pick yes for netlify.toml
185
+ const Picker = dynamic(
186
+ () => {
187
+ return import('emoji-picker-react');
188
+ },
189
+ { ssr: false }
190
+ );
148
191
  ```
149
192
 
150
- ## Named Exports
151
-
152
- Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
153
-
154
- ## Including Styles
193
+ ## Vite
155
194
 
156
- There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
195
+ For reference, if you only need to shim global, you can add
157
196
 
158
- For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
159
-
160
- ## Publishing to NPM
161
-
162
- We recommend using [np](https://github.com/sindresorhus/np).
163
-
164
- ## Usage with Lerna
165
-
166
- When creating a new package with TSDX within a project set up with Lerna, you might encounter a `Cannot resolve dependency` error when trying to run the `example` project. To fix that you will need to make changes to the `package.json` file _inside the `example` directory_.
167
-
168
- The problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's `package.json` might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.
169
-
170
- Change the `alias` to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.
171
-
172
- ```diff
173
- "alias": {
174
- - "react": "../node_modules/react",
175
- - "react-dom": "../node_modules/react-dom"
176
- + "react": "../../../node_modules/react",
177
- + "react-dom": "../../../node_modules/react-dom"
178
- },
197
+ ```html
198
+ <script>
199
+ window.global = window;
200
+ </script>
179
201
  ```
180
-
181
- An alternative to fixing this problem would be to remove aliases altogether and define the dependencies referenced as aliases as dev dependencies instead. [However, that might cause other problems.](https://github.com/palmerhq/tsdx/issues/64)
@@ -0,0 +1,11 @@
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
+ active = "epr-active",
7
+ emoji = "epr-emoji",
8
+ category = "epr-emoji-category",
9
+ label = "epr-emoji-category-label"
10
+ }
11
+ export declare function asSelectors(...classNames: ClassNames[]): string;
@@ -0,0 +1,10 @@
1
+ import { NullableElement } from './selectors';
2
+ export declare function elementCountInRow(parent: NullableElement, element: NullableElement): number;
3
+ export declare function elementIndexInRow(parent: NullableElement, element: NullableElement): number;
4
+ export declare function rowNumber(parent: NullableElement, element: NullableElement): number;
5
+ export declare function hasNextRow(parent: NullableElement, element: NullableElement): boolean;
6
+ export declare function getElementInRow(elements: HTMLElement[], row: number, elementsInRow: number, indexInRow: number): NullableElement;
7
+ export declare function getElementInNextRow(allElements: HTMLElement[], currentRow: number, elementsInRow: number, index: number): NullableElement;
8
+ export declare function getElementInPrevRow(allElements: HTMLElement[], currentRow: number, elementsInRow: number, index: number): NullableElement;
9
+ export declare function firstVisibleElementInContainer(parent: NullableElement, elements: HTMLElement[]): NullableElement;
10
+ export declare function hasNextElementSibling(element: HTMLElement): boolean;
@@ -0,0 +1,11 @@
1
+ import { NullableElement } from './selectors';
2
+ export declare type EmojiRef = {
3
+ current: NullableElement;
4
+ };
5
+ export declare const emojiRef: Record<string, EmojiRef>;
6
+ export declare function getEmojiRef(unified: string): EmojiRef;
7
+ export declare function iterateEmojiRef(callback: (ref: HTMLElement, unified: string) => void): void;
8
+ export declare function hideEmoji(unified: string): void;
9
+ export declare function showEmoji(unified: string): void;
10
+ export declare function hideElement(element: NullableElement): void;
11
+ export declare function showElement(element: NullableElement): void;
@@ -0,0 +1,5 @@
1
+ import { NullableElement } from './selectors';
2
+ export declare function focusElement(element: NullableElement): void;
3
+ export declare function focusPrevElementSibling(element: NullableElement): void;
4
+ export declare function focusNextElementSibling(element: NullableElement): void;
5
+ export declare function focusFirstElementChild(element: NullableElement): void;
@@ -0,0 +1,2 @@
1
+ import { NullableElement } from './selectors';
2
+ export declare function getActiveElement(): NullableElement;
@@ -0,0 +1 @@
1
+ export declare function isSystemDarkTheme(): boolean;
@@ -0,0 +1,7 @@
1
+ import { NullableElement } from './selectors';
2
+ export declare function focusFirstVisibleEmoji(parent: NullableElement): void;
3
+ export declare function focusLastVisibleEmoji(parent: NullableElement): void;
4
+ export declare function focusNextVisibleEmoji(element: NullableElement): void;
5
+ export declare function focusPrevVisibleEmoji(element: NullableElement): void;
6
+ export declare function focusVisibleEmojiOneRowUp(element: NullableElement, exitUp: () => void): void;
7
+ export declare function focusVisibleEmojiOneRowDown(element: NullableElement): void;
@@ -0,0 +1,2 @@
1
+ import { NullableElement } from './selectors';
2
+ export declare function lastElementChild(element: NullableElement): NullableElement;
@@ -1 +1,2 @@
1
- export declare function scrollCategoryIntoView(root: HTMLElement | null, category: string): void;
1
+ import { NullableElement } from './selectors';
2
+ export declare function scrollCategoryIntoView(root: NullableElement, category: string): void;
@@ -1 +1,3 @@
1
- export declare function scrollTo(root: HTMLElement | null, top?: number): void;
1
+ import { NullableElement } from './selectors';
2
+ export declare function scrollTo(root: NullableElement, top?: number): void;
3
+ export declare function useScrollTo(): (top: number) => void;
@@ -1,12 +1,24 @@
1
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;
2
+ export declare type NullableElement = HTMLElement | null;
3
+ export declare const EmojiButtonSelector: string;
4
+ export declare const VisibleEmojiSelector: string;
5
+ export declare function buttonFromTarget(emojiElement: NullableElement): HTMLButtonElement | null;
6
+ export declare function emojiFromElement(element: NullableElement): [DataEmoji, string] | [];
7
+ export declare function isEmojiElement(element: NullableElement): boolean;
8
+ export declare function categoryLabelFromCategory(category: NullableElement): NullableElement;
9
+ export declare function closestCategoryLabel(element: NullableElement): NullableElement;
10
+ export declare function elementHeight(element: NullableElement): number;
11
+ export declare function emojiTrueOffsetTop(element: NullableElement): number;
12
+ export declare function emojiTruOffsetLeft(element: NullableElement): number;
13
+ export declare function unifiedFromEmojiElement(emoji: NullableElement): string | null;
14
+ export declare function originalUnifiedFromEmojiElement(emoji: NullableElement): string | null;
15
+ export declare function isVisibleEmoji(element: HTMLElement): boolean;
16
+ export declare function isHidden(element: NullableElement): boolean;
17
+ export declare function allVisibleEmojis(parent: NullableElement): HTMLElement[];
18
+ export declare function lastVisibleEmoji(element: NullableElement): NullableElement;
19
+ export declare function nextVisibleEmoji(element: HTMLElement): NullableElement;
20
+ export declare function prevVisibleEmoji(element: HTMLElement): NullableElement;
21
+ export declare function firstVisibleEmoji(parent: NullableElement): NullableElement;
22
+ export declare function prevCategory(element: NullableElement): NullableElement;
23
+ export declare function nextCategory(element: NullableElement): NullableElement;
24
+ export declare function closestCategory(element: NullableElement): NullableElement;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { PickerConfig } from './config/config';
3
+ import './EmojiPickerReact.css';
4
+ export interface Props extends PickerConfig {
5
+ }
6
+ export default function EmojiPicker(props: Props): JSX.Element;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ export default class ErrorBoundary extends React.Component<{
3
+ children: React.ReactNode;
4
+ }, {
5
+ hasError: boolean;
6
+ }> {
7
+ constructor(props: {
8
+ children: React.ReactNode;
9
+ });
10
+ static getDerivedStateFromError(): {
11
+ hasError: boolean;
12
+ };
13
+ componentDidCatch(error: Error, errorInfo: any): void;
14
+ render(): number | boolean | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactFragment | null | undefined;
15
+ }
@@ -5,6 +5,7 @@ declare type Props = Readonly<{
5
5
  categoryConfig: CategoryConfig;
6
6
  children?: React.ReactNode;
7
7
  hidden?: boolean;
8
+ hiddenOnSearch?: boolean;
8
9
  }>;
9
- export declare function EmojiCategory({ categoryConfig, children, hidden }: Props): JSX.Element;
10
+ export declare function EmojiCategory({ categoryConfig, children, hidden, hiddenOnSearch }: Props): JSX.Element;
10
11
  export {};
@@ -3,5 +3,5 @@ import { CategoryConfig } from '../../config/categoryConfig';
3
3
  declare type Props = Readonly<{
4
4
  categoryConfig: CategoryConfig;
5
5
  }>;
6
- export declare function RecentlyUsed({ categoryConfig }: Props): JSX.Element | null;
6
+ export declare function Suggested({ categoryConfig }: Props): JSX.Element;
7
7
  export {};
@@ -1,17 +1,13 @@
1
1
  import * as React from 'react';
2
+ import { NullableElement } from '../../DomUtils/selectors';
2
3
  export declare function ElementRefContextProvider({ children }: {
3
4
  children: React.ReactNode;
4
5
  }): 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 {};
6
+ export declare type ElementRef<E extends HTMLElement = HTMLElement> = React.MutableRefObject<E | null>;
7
+ export declare function usePickerMainRef(): ElementRef<HTMLElement>;
8
+ export declare function useAnchoredEmojiRef(): ElementRef<HTMLElement>;
9
+ export declare function useSetAnchoredEmojiRef(): (target: NullableElement) => void;
10
+ export declare function useBodyRef(): ElementRef<HTMLDivElement>;
11
+ export declare function useSearchInputRef(): ElementRef<HTMLInputElement>;
12
+ export declare function useSkinTonePickerRef(): ElementRef<HTMLDivElement>;
13
+ export declare function useCategoryNavigationRef(): ElementRef<HTMLDivElement>;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { SkinTones } from '../../data/skinToneVariations';
3
2
  import { DataEmoji } from '../../dataUtils/DataTypes';
4
3
  import { FilterDict } from '../../hooks/useFilter';
4
+ import { SkinTones } from '../../types/exposedTypes';
5
5
  export declare function PickerContextProvider({ children }: Props): JSX.Element;
6
6
  declare type ReactState<T> = [T, React.Dispatch<React.SetStateAction<T>>];
7
7
  declare type Props = Readonly<{
@@ -9,13 +9,14 @@ declare type Props = Readonly<{
9
9
  }>;
10
10
  export declare function useFilterRef(): React.MutableRefObject<Record<string, Record<string, DataEmoji>>>;
11
11
  export declare function useDisallowClickRef(): React.MutableRefObject<boolean>;
12
- export declare function useSearchTermState(): ReactState<string>;
12
+ export declare function useSearchTermState(): [string, (term: string) => Promise<string>];
13
13
  export declare function useActiveCategoryState(): [ActiveCategoryState, (nextActive: string) => void, (nextActive: string) => void];
14
14
  export declare function useActiveSkinToneState(): [SkinTones, (skinTone: SkinTones) => void];
15
15
  export declare function useEmojisThatFailedToLoadState(): ReactState<Set<string>>;
16
16
  export declare function useIsPastInitialLoad(): boolean;
17
17
  export declare function useEmojiVariationPickerState(): ReactState<DataEmoji | null>;
18
18
  export declare function useSkinToneFanOpenState(): ReactState<boolean>;
19
+ export declare function useUpdateSuggested(): [number, () => void];
19
20
  export declare type FilterState = Record<string, FilterDict>;
20
21
  declare type ActiveCategoryState = null | string;
21
22
  export {};
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { EmojiStyle } from '../../config/config';
2
+ import { EmojiRef } from '../../DomUtils/emojiElementRef';
3
3
  import { DataEmoji } from '../../dataUtils/DataTypes';
4
+ import { EmojiStyle } from '../../types/exposedTypes';
4
5
  import './Emoji.css';
5
6
  declare type Props = Readonly<{
6
7
  hidden?: boolean;
@@ -9,6 +10,8 @@ declare type Props = Readonly<{
9
10
  unified: string;
10
11
  showVariations?: boolean;
11
12
  size?: number;
13
+ emojiRef?: EmojiRef;
14
+ lazyLoad?: boolean;
12
15
  }>;
13
- export declare function Emoji({ emoji, unified, hidden, emojiStyle, showVariations, size }: Props): JSX.Element;
16
+ export declare function Emoji({ emoji, unified, hidden, emojiStyle, showVariations, size, emojiRef, lazyLoad }: Props): JSX.Element;
14
17
  export {};
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import './Preview.css';
3
3
  export declare function Preview(): JSX.Element | null;
4
- export declare type HoveredEmoji = null | {
4
+ export declare type PreviewEmoji = null | {
5
5
  unified: string;
6
6
  originalUnified: string;
7
7
  };
@@ -1,15 +1,7 @@
1
- export declare enum Categories {
2
- RECENTLY_USED = "recently_used",
3
- SMILEYS_PEOPLE = "smileys_people",
4
- ANIMALS_NATURE = "animals_nature",
5
- FOOD_DRINK = "food_drink",
6
- TRAVEL_PLACES = "travel_places",
7
- ACTIVITIES = "activities",
8
- OBJECTS = "objects",
9
- SYMBOLS = "symbols",
10
- FLAGS = "flags"
11
- }
12
- export declare const baseCategoriesConfig: CategoryConfig[];
1
+ import { Categories, SuggestionMode } from '../types/exposedTypes';
2
+ export { Categories };
3
+ export declare const SuggestedRecent: CategoryConfig;
4
+ export declare function baseCategoriesConfig(modifiers?: Record<Categories, CategoryConfig>): CategoriesConfig;
13
5
  export declare function categoryFromCategoryConfig(category: CategoryConfig): Categories;
14
6
  export declare function categoryNameFromCategoryConfig(category: CategoryConfig): string;
15
7
  export declare type CategoriesConfig = CategoryConfig[];
@@ -18,4 +10,7 @@ export declare type CategoryConfig = {
18
10
  name: string;
19
11
  };
20
12
  export declare type UserCategoryConfig = Array<Categories | CategoryConfig>;
21
- export declare function mergeCategoriesConfig(userCategoriesConfig?: UserCategoryConfig): CategoriesConfig;
13
+ export declare function mergeCategoriesConfig(userCategoriesConfig?: UserCategoryConfig, modifiers?: CategoryConfigModifiers): CategoriesConfig;
14
+ declare type CategoryConfigModifiers = {
15
+ suggestionMode?: SuggestionMode;
16
+ };
@@ -1,2 +1,2 @@
1
- import { EmojiStyle } from './config';
1
+ import { EmojiStyle } from "../types/exposedTypes";
2
2
  export declare function cdnUrl(emojiStyle: EmojiStyle): string;