emoji-picker-react 4.6.15 → 4.7.0

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 (33) hide show
  1. package/README.md +37 -12
  2. package/dist/components/Reactions/BtnPlus.d.ts +2 -0
  3. package/dist/components/Reactions/DEFAULT_REACTIONS.d.ts +1 -0
  4. package/dist/components/Reactions/Reactions.d.ts +2 -0
  5. package/dist/components/context/ElementRefContext.d.ts +1 -0
  6. package/dist/components/context/PickerContext.d.ts +1 -0
  7. package/dist/components/emoji/ClickableEmojiButton.d.ts +2 -1
  8. package/dist/components/emoji/Emoji.d.ts +2 -1
  9. package/dist/config/config.d.ts +2 -0
  10. package/dist/config/useConfig.d.ts +2 -0
  11. package/dist/emoji-picker-react.cjs.development.js +931 -725
  12. package/dist/emoji-picker-react.cjs.development.js.map +1 -1
  13. package/dist/emoji-picker-react.cjs.production.min.js +1 -1
  14. package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
  15. package/dist/emoji-picker-react.esm.js +932 -726
  16. package/dist/emoji-picker-react.esm.js.map +1 -1
  17. package/package.json +5 -2
  18. package/src/EmojiPickerReact.tsx +28 -3
  19. package/src/Stylesheet/stylesheet.tsx +14 -2
  20. package/src/components/Reactions/BtnPlus.tsx +78 -0
  21. package/src/components/Reactions/DEFAULT_REACTIONS.ts +9 -0
  22. package/src/components/Reactions/Reactions.tsx +62 -0
  23. package/src/components/Reactions/svg/plus.svg +17 -0
  24. package/src/components/body/Body.tsx +8 -2
  25. package/src/components/context/ElementRefContext.tsx +10 -2
  26. package/src/components/context/PickerContext.tsx +16 -3
  27. package/src/components/emoji/ClickableEmojiButton.tsx +8 -2
  28. package/src/components/emoji/Emoji.tsx +4 -1
  29. package/src/components/footer/Preview.tsx +7 -2
  30. package/src/components/header/Header.tsx +5 -1
  31. package/src/components/main/PickerMain.tsx +27 -2
  32. package/src/config/config.ts +7 -2
  33. package/src/config/useConfig.ts +16 -3
package/README.md CHANGED
@@ -2,14 +2,17 @@
2
2
 
3
3
  ![Picker](https://user-images.githubusercontent.com/11255103/192167134-8205eb89-a71d-4463-8f3a-940e844917d5.gif)
4
4
 
5
+ ## Usage as a Reactions Picker
5
6
 
6
- ____
7
+ ![image](https://github.com/ealush/emoji-picker-react/assets/11255103/48901306-e7fd-49cd-8f1e-9b214083a61d)
8
+
9
+ ---
7
10
 
8
11
  _If you enjoy using emoji-picker-react<br/>
9
12
  You should also consider trying:<br/>
10
13
  <img src="https://cdn.jsdelivr.net/gh/ealush/emoji-picker-react@custom_emojis_assets/vest.png" height="16"/> [Vest validation framework](https://vestjs.dev).<br/>_
11
14
 
12
- ____
15
+ ---
13
16
 
14
17
  ## What to know before using
15
18
 
@@ -21,7 +24,7 @@ ____
21
24
  npm install emoji-picker-react
22
25
  ```
23
26
 
24
- ## Usage:
27
+ ## Usage
25
28
 
26
29
  ```jsx
27
30
  import EmojiPicker from 'emoji-picker-react';
@@ -35,7 +38,7 @@ function App() {
35
38
  }
36
39
  ```
37
40
 
38
- ## Shout Outs!
41
+ ## Shout Outs
39
42
 
40
43
  | Component Design 🎨 |
41
44
  | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
@@ -53,6 +56,7 @@ function App() {
53
56
  - Different emoji sets (Google, Apple, Facebook, Twitter)
54
57
  - Native Emoji support
55
58
  - Emoji Component To Render Emojis in your app
59
+ - Reactions Picker
56
60
 
57
61
  # Props
58
62
 
@@ -73,13 +77,15 @@ The following props are accepted by them picker:
73
77
  | searchDisabled | boolean | `false` | Controls whether the search is disabled or not. When disabled, the skin tone picker will be shown in the preview component. |
74
78
  | skinTonePickerLocation | string | `SEARCH` | Controls the location of the skin tone picker. Possible values are `SEARCH` and `PREVIEW`. |
75
79
  | emojiVersion | `string` | - | Allows displaying emojis up to a certain version for compatibility. |
76
- | `className` | `string` | - | Adds a class name to the root element of the picker. |
80
+ | `className` | `string` | - | Adds a class name to the root element of the picker. |
77
81
  | `width` | `number`/`string` | `350` | Controls the width of the picker. You can provide a number that will be treated as pixel size, or your any accepted css width as string. |
78
82
  | `height` | `number`/`string` | `450` | Controls the height of the picker. You can provide a number that will be treated as pixel size, or your any accepted css height as string. |
79
- | `style` | `React.CSSProperties` | `{}` | Adds inline style to the root element of the picker. |
83
+ | `style` | `React.CSSProperties` | `{}` | Adds inline style to the root element of the picker. |
80
84
  | getEmojiUrl | `Function` | - | Allows to customize the emoji url and provide your own image host. |
81
85
  | categories | `Array` | - | Allows full config over ordering, naming and display of categories. |
82
86
  | customEmojis | `Array<{names: string[], imgUrl: string, id: string}>` | - | Allows adding custom emojis to the picker. |
87
+ | reactionsDefaultOpen | `boolean` | `false` | Controls whether the reactions picker is on the initial mount instead of the main picker component. |
88
+ | reactions | string[] | - | Controls the reactions to display in the reactions picker. Takes unified emoji ids |
83
89
 
84
90
  ## Full details
85
91
 
@@ -112,11 +118,13 @@ The following props are accepted by them picker:
112
118
  import { EmojiStyle } from 'emoji-picker-react';
113
119
  ```
114
120
 
115
- * `autoFocusSearch`: `boolean` - Whether to focus the search input on mount. Defaults to `true`.
116
- *
117
- * `lazyLoadEmojis`: `boolean` - Whether to lazy load the emojis. Defaults to `false`.
121
+ - `autoFocusSearch`: `boolean` - Whether to focus the search input on mount. Defaults to `true`.
122
+
123
+ \*
118
124
 
119
- * `defaultSkinTone`: `SkinTones` - The default skin tone to use when an emoji is clicked. Defaults to `SkinTones.Neutral`. Possible skin tones are:
125
+ - `lazyLoadEmojis`: `boolean` - Whether to lazy load the emojis. Defaults to `false`.
126
+
127
+ - `defaultSkinTone`: `SkinTones` - The default skin tone to use when an emoji is clicked. Defaults to `SkinTones.Neutral`. Possible skin tones are:
120
128
 
121
129
  - ✋ 'neutral'
122
130
  - ✋🏻 '1f3fb'
@@ -190,6 +198,7 @@ import { SkinTones } from 'emoji-picker-react';
190
198
  ```
191
199
 
192
200
  - `emojiVersion`: `string` - Allows displaying emojis up to a certain version for compatibility. The passed version will be parsed as a float and each emoji will be tested against it. Common values are:
201
+
193
202
  - `"0.6"`
194
203
  - `"1.0"`
195
204
  - `"2.0"`
@@ -197,7 +206,7 @@ import { SkinTones } from 'emoji-picker-react';
197
206
  - `"4.0"`
198
207
  - `"5.0"`
199
208
 
200
- * `getEmojiUrl`: `(unified: string, emojiStyle: EmojiStyle) => string` - Allows to customize the emoji url and provide your own image host. The function receives the emoji unified and the emoji style as parameters. The function should return the url of the emoji image.
209
+ - `getEmojiUrl`: `(unified: string, emojiStyle: EmojiStyle) => string` - Allows to customize the emoji url and provide your own image host. The function receives the emoji unified and the emoji style as parameters. The function should return the url of the emoji image.
201
210
 
202
211
  ## Custom Emojis
203
212
 
@@ -207,7 +216,7 @@ id: Unique identifier for each of the custom emojis
207
216
  names: an array of string identifiers, will be used both for display, search and indexing.
208
217
  imgUrl: URL for the emoji image
209
218
 
210
- ### Usage Example:
219
+ ### Usage Example
211
220
 
212
221
  ```jsx
213
222
  <Picker
@@ -246,6 +255,22 @@ Here are some additional things to keep in mind about custom emojis:
246
255
  - The location or name of the Custom category can be controlled via the categories prop.
247
256
  - The custom emojis will be indexed by their id property. This means that you can search for custom emojis by their id or names.
248
257
 
258
+ ## Reactions Picker
259
+
260
+ ![image](https://github.com/ealush/emoji-picker-react/assets/11255103/48901306-e7fd-49cd-8f1e-9b214083a61d)
261
+
262
+ ![reactions](https://github.com/ealush/emoji-picker-react/assets/11255103/38a9c652-ee2e-43d4-b0e6-33735f1bcbe7)
263
+
264
+ The picker can be used as a reactions picker. To use it as a reactions picker, you should set the reactionsDefaultOpen prop to true. This will cause the picker to the reactions picker on the initial mount instead of the main picker component.
265
+
266
+ To customize the reactions, you should pass an array of unified emoji ids to the reactions prop.
267
+
268
+ The reactions picker uses the same event handlers, and the same css variables for customizations.
269
+
270
+ ```jsx
271
+ <Picker reactionsDefaultOpen />
272
+ ```
273
+
249
274
  # Customization
250
275
 
251
276
  ## Custom Picker Width and Height
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function BtnPlus(): JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_REACTIONS: string[];
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function Reactions(): JSX.Element | null;
@@ -8,6 +8,7 @@ export declare function usePickerMainRef(): ElementRef<HTMLElement>;
8
8
  export declare function useAnchoredEmojiRef(): ElementRef<HTMLElement>;
9
9
  export declare function useSetAnchoredEmojiRef(): (target: NullableElement) => void;
10
10
  export declare function useBodyRef(): ElementRef<HTMLDivElement>;
11
+ export declare function useReactionsRef(): ElementRef<HTMLUListElement>;
11
12
  export declare function useSearchInputRef(): ElementRef<HTMLInputElement>;
12
13
  export declare function useSkinTonePickerRef(): ElementRef<HTMLDivElement>;
13
14
  export declare function useCategoryNavigationRef(): ElementRef<HTMLDivElement>;
@@ -10,6 +10,7 @@ declare type Props = Readonly<{
10
10
  export declare function useFilterRef(): React.MutableRefObject<Record<string, Record<string, DataEmoji>>>;
11
11
  export declare function useDisallowClickRef(): React.MutableRefObject<boolean>;
12
12
  export declare function useDisallowMouseRef(): React.MutableRefObject<boolean>;
13
+ export declare function useReactionsModeState(): ReactState<boolean>;
13
14
  export declare function useSearchTermState(): [string, (term: string) => Promise<string>];
14
15
  export declare function useActiveSkinToneState(): [SkinTones, (skinTone: SkinTones) => void];
15
16
  export declare function useEmojisThatFailedToLoadState(): ReactState<Set<string>>;
@@ -7,6 +7,7 @@ declare type ClickableEmojiButtonProps = Readonly<{
7
7
  children: React.ReactNode;
8
8
  hasVariations: boolean;
9
9
  unified?: string;
10
+ round?: boolean;
10
11
  }>;
11
- export declare function ClickableEmojiButton({ emojiNames, unified, hidden, hiddenOnSearch, showVariations, hasVariations, children }: ClickableEmojiButtonProps): JSX.Element;
12
+ export declare function ClickableEmojiButton({ emojiNames, unified, hidden, hiddenOnSearch, showVariations, hasVariations, children, round }: ClickableEmojiButtonProps): JSX.Element;
12
13
  export {};
@@ -7,6 +7,7 @@ declare type ClickableEmojiProps = Readonly<BaseEmojiProps & {
7
7
  hiddenOnSearch?: boolean;
8
8
  emoji: DataEmoji;
9
9
  className?: string;
10
+ round?: boolean;
10
11
  }>;
11
- export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad, getEmojiUrl }: ClickableEmojiProps): JSX.Element;
12
+ export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad, getEmojiUrl, round }: ClickableEmojiProps): JSX.Element;
12
13
  export {};
@@ -32,6 +32,8 @@ export declare type PickerConfigInternal = {
32
32
  skinTonePickerLocation: SkinTonePickerLocation;
33
33
  unicodeToHide: Set<string>;
34
34
  customEmojis: CustomEmoji[];
35
+ reactionsDefaultOpen: boolean;
36
+ reactions: string[];
35
37
  };
36
38
  export declare type PreviewConfig = {
37
39
  defaultEmoji: string;
@@ -17,9 +17,11 @@ export declare function useSuggestedEmojisModeConfig(): SuggestionMode;
17
17
  export declare function useLazyLoadEmojisConfig(): boolean;
18
18
  export declare function useClassNameConfig(): string;
19
19
  export declare function useStyleConfig(): React.CSSProperties;
20
+ export declare function useReactionsOpenConfig(): boolean;
20
21
  export declare function useEmojiVersionConfig(): string | null;
21
22
  export declare function useSearchDisabledConfig(): boolean;
22
23
  export declare function useSkinTonePickerLocationConfig(): SkinTonePickerLocation;
23
24
  export declare function useUnicodeToHide(): Set<string>;
25
+ export declare function useReactionsConfig(): string[];
24
26
  export declare function useGetEmojiUrlConfig(): (unified: string, style: EmojiStyle) => string;
25
27
  export declare function useSearchResultsConfig(searchResultsCount: number): string;