emoji-picker-react 4.17.5 → 4.19.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 (101) hide show
  1. package/README.md +51 -6
  2. package/dist/Stylesheet/stylesheet.d.ts +3 -1
  3. package/dist/components/Layout/Flex.d.ts +1 -1
  4. package/dist/components/body/EmojiCategory.d.ts +1 -1
  5. package/dist/components/context/ElementRefContext.d.ts +1 -1
  6. package/dist/components/emoji/ClickableEmojiButton.d.ts +1 -1
  7. package/dist/components/emoji/Emoji.d.ts +1 -1
  8. package/dist/components/emoji/EmojiImg.d.ts +1 -1
  9. package/dist/components/emoji/ExportedEmoji.d.ts +1 -1
  10. package/dist/components/emoji/NativeEmoji.d.ts +1 -1
  11. package/dist/components/emoji/ViewOnlyEmoji.d.ts +1 -1
  12. package/dist/components/header/SkinTonePicker/BtnSkinToneVariation.d.ts +1 -1
  13. package/dist/components/header/SkinTonePicker/SkinTonePicker.d.ts +1 -1
  14. package/dist/components/navigation/CategoryButton.d.ts +3 -2
  15. package/dist/config/config.d.ts +3 -1
  16. package/dist/config/useConfig.d.ts +1 -0
  17. package/dist/data/groups.js +1 -1
  18. package/dist/data/groups.ts +1 -1
  19. package/dist/data/skinToneVariations.js +2 -2
  20. package/dist/data/skinToneVariations.ts +10 -12
  21. package/dist/emoji-picker-react.cjs.development.js +114 -91
  22. package/dist/emoji-picker-react.cjs.development.js.map +1 -1
  23. package/dist/emoji-picker-react.cjs.production.min.js +1 -1
  24. package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
  25. package/dist/emoji-picker-react.esm.js +114 -91
  26. package/dist/emoji-picker-react.esm.js.map +1 -1
  27. package/dist/hooks/useActiveCategoryScrollDetection.d.ts +1 -1
  28. package/dist/hooks/useEmojiVirtualization.d.ts +1 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/typeRefinements/typeRefinements.d.ts +1 -1
  31. package/dist/types/exposedTypes.d.ts +3 -0
  32. package/dist/virtualization/virtualizationHelpers.d.ts +1 -1
  33. package/package.json +1 -1
  34. package/src/DomUtils/classNames.ts +2 -2
  35. package/src/DomUtils/detectEmojyPartiallyBelowFold.ts +1 -1
  36. package/src/DomUtils/elementPositionInRow.ts +3 -3
  37. package/src/DomUtils/keyboardNavigation.ts +2 -2
  38. package/src/DomUtils/scrollTo.ts +2 -2
  39. package/src/DomUtils/selectors.ts +18 -17
  40. package/src/EmojiPickerReact.tsx +1 -1
  41. package/src/Stylesheet/stylesheet.tsx +28 -23
  42. package/src/components/Layout/Flex.tsx +6 -6
  43. package/src/components/Layout/Space.tsx +0 -1
  44. package/src/components/Reactions/BtnPlus.tsx +8 -8
  45. package/src/components/Reactions/DEFAULT_REACTIONS.ts +1 -1
  46. package/src/components/atoms/Button.tsx +6 -7
  47. package/src/components/body/Body.tsx +3 -3
  48. package/src/components/body/EmojiCategory.tsx +8 -8
  49. package/src/components/body/EmojiList.tsx +9 -9
  50. package/src/components/body/EmojiVariationPicker.tsx +22 -23
  51. package/src/components/body/MeasureEmoji.tsx +10 -11
  52. package/src/components/context/ElementRefContext.tsx +5 -6
  53. package/src/components/context/PickerConfigContext.tsx +5 -6
  54. package/src/components/context/PickerContext.tsx +8 -8
  55. package/src/components/context/PickerDataContext.tsx +2 -3
  56. package/src/components/emoji/ClickableEmojiButton.tsx +15 -14
  57. package/src/components/emoji/Emoji.tsx +1 -1
  58. package/src/components/emoji/EmojiImg.tsx +10 -5
  59. package/src/components/emoji/ExportedEmoji.tsx +1 -1
  60. package/src/components/emoji/NativeEmoji.tsx +4 -4
  61. package/src/components/emoji/ViewOnlyEmoji.tsx +2 -3
  62. package/src/components/emoji/emojiStyles.ts +3 -3
  63. package/src/components/footer/Preview.tsx +10 -10
  64. package/src/components/header/Search/BtnClearSearch.tsx +13 -13
  65. package/src/components/header/Search/IcnSearch.tsx +3 -3
  66. package/src/components/header/Search/Search.tsx +18 -18
  67. package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +15 -14
  68. package/src/components/header/SkinTonePicker/SkinTonePicker.tsx +15 -15
  69. package/src/components/main/PickerMain.tsx +16 -16
  70. package/src/components/navigation/CategoryButton.tsx +41 -26
  71. package/src/components/navigation/CategoryNavigation.tsx +14 -8
  72. package/src/config/config.ts +5 -0
  73. package/src/config/mutableConfig.ts +2 -2
  74. package/src/config/useConfig.ts +15 -10
  75. package/src/data/groups.ts +1 -1
  76. package/src/data/skinToneVariations.ts +10 -12
  77. package/src/dataUtils/DataTypes.ts +1 -1
  78. package/src/dataUtils/alphaNumericEmojiIndex.ts +1 -1
  79. package/src/dataUtils/parseNativeEmoji.ts +1 -1
  80. package/src/dataUtils/suggested.ts +3 -3
  81. package/src/hooks/preloadEmoji.ts +3 -3
  82. package/src/hooks/useActiveCategoryScrollDetection.ts +9 -7
  83. package/src/hooks/useCloseAllOpenToggles.ts +2 -2
  84. package/src/hooks/useDebouncedState.ts +2 -2
  85. package/src/hooks/useDisallowMouseMove.ts +1 -1
  86. package/src/hooks/useDisallowedEmojis.ts +2 -2
  87. package/src/hooks/useEmojiPreviewEvents.ts +8 -8
  88. package/src/hooks/useEmojiVirtualization.tsx +9 -9
  89. package/src/hooks/useFilter.ts +16 -16
  90. package/src/hooks/useFocus.ts +1 -1
  91. package/src/hooks/useHideEmojisByUniocode.ts +4 -4
  92. package/src/hooks/useInitialLoad.ts +1 -1
  93. package/src/hooks/useIsEmojiHidden.ts +1 -1
  94. package/src/hooks/useKeyboardNavigation.ts +18 -18
  95. package/src/hooks/useMouseDownHandlers.ts +18 -18
  96. package/src/hooks/useOnScroll.ts +1 -1
  97. package/src/hooks/useScrollCategoryIntoView.ts +2 -2
  98. package/src/index.tsx +5 -2
  99. package/src/typeRefinements/typeRefinements.ts +2 -2
  100. package/src/types/exposedTypes.ts +11 -6
  101. package/src/virtualization/virtualizationHelpers.ts +2 -2
@@ -18,12 +18,12 @@ export function useMutableConfig(): React.MutableRefObject<MutableConfig> {
18
18
  }
19
19
 
20
20
  export function useDefineMutableConfig(
21
- config: MutableConfig
21
+ config: MutableConfig,
22
22
  ): React.MutableRefObject<MutableConfig> {
23
23
  const MutableConfigRef = React.useRef<MutableConfig>({
24
24
  onEmojiClick: config.onEmojiClick || emptyFunc,
25
25
  onReactionClick: config.onReactionClick || config.onEmojiClick,
26
- onSkinToneChange: config.onSkinToneChange || emptyFunc
26
+ onSkinToneChange: config.onSkinToneChange || emptyFunc,
27
27
  });
28
28
 
29
29
  React.useEffect(() => {
@@ -8,7 +8,7 @@ import {
8
8
  SkinTonePickerLocation,
9
9
  SkinTones,
10
10
  SuggestionMode,
11
- Theme
11
+ Theme,
12
12
  } from '../types/exposedTypes';
13
13
 
14
14
  import { CategoriesConfig } from './categoryConfig';
@@ -19,21 +19,21 @@ import {
19
19
  SEARCH_RESULTS_ONE_RESULT_FOUND,
20
20
  SEARCH_RESULTS_MULTIPLE_RESULTS_FOUND,
21
21
  PickerDimensions,
22
- PreviewConfig
22
+ PreviewConfig,
23
23
  } from './config';
24
24
  import { CustomEmoji } from './customEmojiConfig';
25
25
  import { useMutableConfig } from './mutableConfig';
26
26
 
27
27
  export enum MOUSE_EVENT_SOURCE {
28
28
  REACTIONS = 'reactions',
29
- PICKER = 'picker'
29
+ PICKER = 'picker',
30
30
  }
31
31
 
32
32
  export function useSearchPlaceHolderConfig(): string {
33
33
  const { searchPlaceHolder, searchPlaceholder } = usePickerConfig();
34
34
  return (
35
35
  [searchPlaceHolder, searchPlaceholder].find(
36
- p => p !== DEFAULT_SEARCH_PLACEHOLDER
36
+ (p) => p !== DEFAULT_SEARCH_PLACEHOLDER,
37
37
  ) ?? DEFAULT_SEARCH_PLACEHOLDER
38
38
  );
39
39
  }
@@ -73,6 +73,11 @@ export function useCategoriesConfig(): CategoriesConfig {
73
73
  return categories;
74
74
  }
75
75
 
76
+ export function useCategoryIconsConfig() {
77
+ const { categoryIcons } = usePickerConfig();
78
+ return categoryIcons;
79
+ }
80
+
76
81
  export function useCustomEmojisConfig(): CustomEmoji[] {
77
82
  const { customEmojis } = usePickerConfig();
78
83
  return customEmojis;
@@ -84,7 +89,7 @@ export function useOpenConfig(): boolean {
84
89
  }
85
90
 
86
91
  export function useOnEmojiClickConfig(
87
- mouseEventSource: MOUSE_EVENT_SOURCE
92
+ mouseEventSource: MOUSE_EVENT_SOURCE,
88
93
  ): (emoji: EmojiClickData, event: MouseEvent) => void {
89
94
  const { current } = useMutableConfig();
90
95
  const [, setReactionsOpen] = useReactionsModeState();
@@ -96,8 +101,8 @@ export function useOnEmojiClickConfig(
96
101
  return (...args) =>
97
102
  onReactionClick(...args, {
98
103
  collapseToReactions: () => {
99
- setReactionsOpen(o => o);
100
- }
104
+ setReactionsOpen((o) => o);
105
+ },
101
106
  });
102
107
  }
103
108
 
@@ -105,7 +110,7 @@ export function useOnEmojiClickConfig(
105
110
  handler(...args, {
106
111
  collapseToReactions: () => {
107
112
  setReactionsOpen(true);
108
- }
113
+ },
109
114
  });
110
115
  };
111
116
  }
@@ -179,7 +184,7 @@ export function useReactionsConfig(): string[] {
179
184
 
180
185
  export function useGetEmojiUrlConfig(): (
181
186
  unified: string,
182
- style: EmojiStyle
187
+ style: EmojiStyle,
183
188
  ) => string {
184
189
  const { getEmojiUrl } = usePickerConfig();
185
190
  return getEmojiUrl;
@@ -199,7 +204,7 @@ export function useSearchResultsConfig(searchResultsCount: number): string {
199
204
  return isPlural
200
205
  ? SEARCH_RESULTS_MULTIPLE_RESULTS_FOUND.replace(
201
206
  '%n',
202
- searchResultsCount.toString()
207
+ searchResultsCount.toString(),
203
208
  )
204
209
  : SEARCH_RESULTS_ONE_RESULT_FOUND;
205
210
  }
@@ -6,7 +6,7 @@ const groups = [
6
6
  'activities',
7
7
  'objects',
8
8
  'symbols',
9
- 'flags'
9
+ 'flags',
10
10
  ];
11
11
 
12
12
  export default groups;
@@ -6,7 +6,7 @@ const skinToneVariations = [
6
6
  SkinTones.MEDIUM_LIGHT,
7
7
  SkinTones.MEDIUM,
8
8
  SkinTones.MEDIUM_DARK,
9
- SkinTones.DARK
9
+ SkinTones.DARK,
10
10
  ];
11
11
 
12
12
  export const skinTonesNamed = Object.entries(SkinTones).reduce(
@@ -14,18 +14,16 @@ export const skinTonesNamed = Object.entries(SkinTones).reduce(
14
14
  acc[value] = key;
15
15
  return acc;
16
16
  },
17
- {} as Record<string, string>
17
+ {} as Record<string, string>,
18
18
  );
19
19
 
20
- export const skinTonesMapped: Record<
21
- string,
22
- string
23
- > = skinToneVariations.reduce(
24
- (mapped, skinTone) =>
25
- Object.assign(mapped, {
26
- [skinTone]: skinTone
27
- }),
28
- {}
29
- );
20
+ export const skinTonesMapped: Record<string, string> =
21
+ skinToneVariations.reduce(
22
+ (mapped, skinTone) =>
23
+ Object.assign(mapped, {
24
+ [skinTone]: skinTone,
25
+ }),
26
+ {},
27
+ );
30
28
 
31
29
  export default skinToneVariations;
@@ -5,7 +5,7 @@ export enum EmojiProperties {
5
5
  unified = 'u',
6
6
  variations = 'v',
7
7
  added_in = 'a',
8
- imgUrl = 'imgUrl'
8
+ imgUrl = 'imgUrl',
9
9
  }
10
10
 
11
11
  export interface DataEmoji extends WithName {
@@ -13,7 +13,7 @@ export function indexEmoji(emoji: DataEmoji): void {
13
13
  .replace(/[^a-zA-Z\d]/g, '')
14
14
  .split('');
15
15
 
16
- joinedNameString.forEach(char => {
16
+ joinedNameString.forEach((char) => {
17
17
  alphaNumericEmojiIndex[char] = alphaNumericEmojiIndex[char] ?? {};
18
18
 
19
19
  alphaNumericEmojiIndex[char][emojiUnified(emoji)] = emoji;
@@ -1,6 +1,6 @@
1
1
  export function parseNativeEmoji(unified: string): string {
2
2
  return unified
3
3
  .split('-')
4
- .map(hex => String.fromCodePoint(parseInt(hex, 16)))
4
+ .map((hex) => String.fromCodePoint(parseInt(hex, 16)))
5
5
  .join('');
6
6
  }
@@ -19,7 +19,7 @@ export function getSuggested(mode?: SuggestionMode): Suggested {
19
19
  return [];
20
20
  }
21
21
  const recent = JSON.parse(
22
- window?.localStorage.getItem(SUGGESTED_LS_KEY) ?? '[]'
22
+ window?.localStorage.getItem(SUGGESTED_LS_KEY) ?? '[]',
23
23
  ) as Suggested;
24
24
 
25
25
  if (mode === SuggestionMode.FREQUENT) {
@@ -43,12 +43,12 @@ export function setSuggested(emoji: DataEmoji, skinTone: SkinTones) {
43
43
  let nextList: SuggestedItem[];
44
44
 
45
45
  if (existing) {
46
- nextList = [existing].concat(recent.filter(i => i !== existing));
46
+ nextList = [existing].concat(recent.filter((i) => i !== existing));
47
47
  } else {
48
48
  existing = {
49
49
  unified,
50
50
  original: originalUnified,
51
- count: 0
51
+ count: 0,
52
52
  };
53
53
  nextList = [existing, ...recent];
54
54
  }
@@ -13,7 +13,7 @@ export function preloadEmojiIfNeeded(
13
13
  topOffset: number,
14
14
  style: { top: number } | undefined,
15
15
  dimensions: Dimensions,
16
- getEmojiUrl: GetEmojiUrl
16
+ getEmojiUrl: GetEmojiUrl,
17
17
  ): void {
18
18
  if (!emoji) {
19
19
  return;
@@ -51,7 +51,7 @@ export function preloadEmojiIfNeeded(
51
51
  export function preloadEmoji(
52
52
  getEmojiUrl: GetEmojiUrl,
53
53
  emoji: undefined | DataEmoji,
54
- emojiStyle: EmojiStyle
54
+ emojiStyle: EmojiStyle,
55
55
  ): void {
56
56
  if (!emoji) {
57
57
  return;
@@ -66,7 +66,7 @@ export function preloadEmoji(
66
66
 
67
67
  emojiVariations(emoji)
68
68
  .concat(unified)
69
- .forEach(variation => {
69
+ .forEach((variation) => {
70
70
  const emojiUrl = getEmojiUrl(variation, emojiStyle);
71
71
  preloadImage(emojiUrl);
72
72
  });
@@ -6,7 +6,7 @@ import { useBodyRef } from '../components/context/ElementRefContext';
6
6
 
7
7
  export function useActiveCategoryScrollDetection({
8
8
  setActiveCategory,
9
- setVisibleCategories
9
+ setVisibleCategories,
10
10
  }: {
11
11
  setActiveCategory: (category: string) => void;
12
12
  setVisibleCategories: (categories: string[]) => void;
@@ -18,7 +18,7 @@ export function useActiveCategoryScrollDetection({
18
18
  const intersectingCategories = new Map<string, boolean>();
19
19
  const bodyRef = BodyRef.current;
20
20
  const observer = new IntersectionObserver(
21
- entries => {
21
+ (entries) => {
22
22
  if (!bodyRef) {
23
23
  return;
24
24
  }
@@ -55,12 +55,14 @@ export function useActiveCategoryScrollDetection({
55
55
  },
56
56
  {
57
57
  root: bodyRef,
58
- threshold: [0, 1]
59
- }
58
+ threshold: [0, 1],
59
+ },
60
60
  );
61
- bodyRef?.querySelectorAll(asSelectors(ClassNames.category)).forEach(el => {
62
- observer.observe(el);
63
- });
61
+ bodyRef
62
+ ?.querySelectorAll(asSelectors(ClassNames.category))
63
+ .forEach((el) => {
64
+ observer.observe(el);
65
+ });
64
66
 
65
67
  return () => {
66
68
  observer.disconnect();
@@ -2,7 +2,7 @@ import { useCallback } from 'react';
2
2
 
3
3
  import {
4
4
  useEmojiVariationPickerState,
5
- useSkinToneFanOpenState
5
+ useSkinToneFanOpenState,
6
6
  } from '../components/context/PickerContext';
7
7
 
8
8
  export function useCloseAllOpenToggles() {
@@ -21,7 +21,7 @@ export function useCloseAllOpenToggles() {
21
21
  variationPicker,
22
22
  skinToneFanOpen,
23
23
  setVariationPicker,
24
- setSkinToneFanOpen
24
+ setSkinToneFanOpen,
25
25
  ]);
26
26
 
27
27
  return closeAllOpenToggles;
@@ -2,13 +2,13 @@ import { useRef, useState } from 'react';
2
2
 
3
3
  export function useDebouncedState<T>(
4
4
  initialValue: T,
5
- delay: number = 0
5
+ delay: number = 0,
6
6
  ): [T, (value: T) => Promise<T>] {
7
7
  const [state, setState] = useState<T>(initialValue);
8
8
  const timer = useRef<number | null>(null);
9
9
 
10
10
  function debouncedSetState(value: T) {
11
- return new Promise<T>(resolve => {
11
+ return new Promise<T>((resolve) => {
12
12
  if (timer.current) {
13
13
  clearTimeout(timer.current);
14
14
  }
@@ -32,7 +32,7 @@ export function useOnMouseMove() {
32
32
  useEffect(() => {
33
33
  const bodyRef = BodyRef.current;
34
34
  bodyRef?.addEventListener('mousemove', onMouseMove, {
35
- passive: true
35
+ passive: true,
36
36
  });
37
37
 
38
38
  function onMouseMove() {
@@ -6,7 +6,7 @@ import { DataEmoji } from '../dataUtils/DataTypes';
6
6
  import {
7
7
  addedIn,
8
8
  emojiUnified,
9
- unifiedWithoutSkinTone
9
+ unifiedWithoutSkinTone,
10
10
  } from '../dataUtils/emojiUtils';
11
11
 
12
12
  import { useIsUnicodeHidden } from './useHideEmojisByUniocode';
@@ -46,7 +46,7 @@ export function useIsEmojiDisallowed() {
46
46
 
47
47
  function addedInNewerVersion(
48
48
  emoji: DataEmoji,
49
- supportedLevel: number
49
+ supportedLevel: number,
50
50
  ): boolean {
51
51
  return addedIn(emoji) > supportedLevel;
52
52
  }
@@ -5,19 +5,19 @@ import { detectEmojyPartiallyBelowFold } from '../DomUtils/detectEmojyPartiallyB
5
5
  import { focusElement } from '../DomUtils/focusElement';
6
6
  import {
7
7
  allUnifiedFromEmojiElement,
8
- buttonFromTarget
8
+ buttonFromTarget,
9
9
  } from '../DomUtils/selectors';
10
10
  import { useBodyRef } from '../components/context/ElementRefContext';
11
11
  import { PreviewEmoji } from '../components/footer/Preview';
12
12
 
13
13
  import {
14
14
  useAllowMouseMove,
15
- useIsMouseDisallowed
15
+ useIsMouseDisallowed,
16
16
  } from './useDisallowMouseMove';
17
17
 
18
18
  export function useEmojiPreviewEvents(
19
19
  allow: boolean,
20
- setPreviewEmoji: React.Dispatch<React.SetStateAction<PreviewEmoji>>
20
+ setPreviewEmoji: React.Dispatch<React.SetStateAction<PreviewEmoji>>,
21
21
  ) {
22
22
  const BodyRef = useBodyRef();
23
23
  const isMouseDisallowed = useIsMouseDisallowed();
@@ -30,7 +30,7 @@ export function useEmojiPreviewEvents(
30
30
  const bodyRef = BodyRef.current;
31
31
 
32
32
  bodyRef?.addEventListener('keydown', onEscape, {
33
- passive: true
33
+ passive: true,
34
34
  });
35
35
 
36
36
  bodyRef?.addEventListener('mouseover', onMouseOver, true);
@@ -38,7 +38,7 @@ export function useEmojiPreviewEvents(
38
38
  bodyRef?.addEventListener('focus', onEnter, true);
39
39
 
40
40
  bodyRef?.addEventListener('mouseout', onLeave, {
41
- passive: true
41
+ passive: true,
42
42
  });
43
43
  bodyRef?.addEventListener('blur', onLeave, true);
44
44
 
@@ -57,7 +57,7 @@ export function useEmojiPreviewEvents(
57
57
 
58
58
  setPreviewEmoji({
59
59
  unified,
60
- originalUnified
60
+ originalUnified,
61
61
  });
62
62
  }
63
63
  function onLeave(e?: FocusEvent | MouseEvent) {
@@ -107,7 +107,7 @@ export function useEmojiPreviewEvents(
107
107
 
108
108
  function handlePartiallyVisibleElementFocus(
109
109
  button: HTMLElement,
110
- setPreviewEmoji: React.Dispatch<React.SetStateAction<PreviewEmoji>>
110
+ setPreviewEmoji: React.Dispatch<React.SetStateAction<PreviewEmoji>>,
111
111
  ) {
112
112
  const { unified, originalUnified } = allUnifiedFromEmojiElement(button);
113
113
 
@@ -119,6 +119,6 @@ function handlePartiallyVisibleElementFocus(
119
119
 
120
120
  setPreviewEmoji({
121
121
  unified,
122
- originalUnified
122
+ originalUnified,
123
123
  });
124
124
  }
@@ -8,13 +8,13 @@ import {
8
8
  useEmojiStyleConfig,
9
9
  useGetEmojiUrlConfig,
10
10
  useLazyLoadEmojisConfig,
11
- useSkinTonesDisabledConfig
11
+ useSkinTonesDisabledConfig,
12
12
  } from '../config/useConfig';
13
13
  import { DataEmojis } from '../dataUtils/DataTypes';
14
14
  import { emojiUnified } from '../dataUtils/emojiUtils';
15
15
  import {
16
16
  getEmojiPositionStyle,
17
- shouldVirtualize
17
+ shouldVirtualize,
18
18
  } from '../virtualization/virtualizationHelpers';
19
19
 
20
20
  import { preloadEmojiIfNeeded } from './preloadEmoji';
@@ -27,7 +27,7 @@ export function useEmojiVirtualization({
27
27
  topOffset,
28
28
  onHeightReady,
29
29
  scrollTop,
30
- isCategoryVisible
30
+ isCategoryVisible,
31
31
  }: {
32
32
  categoryEmojis: DataEmojis;
33
33
  topOffset: number;
@@ -46,7 +46,7 @@ export function useEmojiVirtualization({
46
46
 
47
47
  let virtualizedCounter = 0;
48
48
 
49
- const emojisToPush = categoryEmojis.filter(emoji => {
49
+ const emojisToPush = categoryEmojis.filter((emoji) => {
50
50
  const isDisallowed = isEmojiDisallowed(emoji);
51
51
  const { failedToLoad, filteredOut, hidden } = isEmojiHidden(emoji);
52
52
 
@@ -69,7 +69,7 @@ export function useEmojiVirtualization({
69
69
  clientHeight: BodyRef.current?.clientHeight ?? 0,
70
70
  topOffset,
71
71
  style,
72
- dimensions
72
+ dimensions,
73
73
  });
74
74
 
75
75
  const emojis = emojisToPush.reduce((accumulator, emoji, index) => {
@@ -86,7 +86,7 @@ export function useEmojiVirtualization({
86
86
  topOffset,
87
87
  style,
88
88
  dimensions,
89
- getEmojiUrl
89
+ getEmojiUrl,
90
90
  );
91
91
  return accumulator;
92
92
  }
@@ -107,9 +107,9 @@ export function useEmojiVirtualization({
107
107
  getEmojiUrl={getEmojiUrl}
108
108
  style={{
109
109
  ...style,
110
- position: 'absolute'
110
+ position: 'absolute',
111
111
  }}
112
- />
112
+ />,
113
113
  );
114
114
  return accumulator;
115
115
  }, [] as ReactNode[]);
@@ -117,6 +117,6 @@ export function useEmojiVirtualization({
117
117
  return {
118
118
  virtualizedCounter,
119
119
  emojis,
120
- dimensions
120
+ dimensions,
121
121
  };
122
122
  }
@@ -1,12 +1,12 @@
1
1
  import { scrollTo } from '../DomUtils/scrollTo';
2
2
  import {
3
3
  usePickerMainRef,
4
- useSearchInputRef
4
+ useSearchInputRef,
5
5
  } from '../components/context/ElementRefContext';
6
6
  import {
7
7
  FilterState,
8
8
  useFilterRef,
9
- useSearchTermState
9
+ useSearchTermState,
10
10
  } from '../components/context/PickerContext';
11
11
  import { useSearchResultsConfig } from '../config/useConfig';
12
12
  import { DataEmoji } from '../dataUtils/DataTypes';
@@ -18,7 +18,7 @@ function useSetFilterRef() {
18
18
  const filterRef = useFilterRef();
19
19
 
20
20
  return function setFilter(
21
- setter: FilterState | ((current: FilterState) => FilterState)
21
+ setter: FilterState | ((current: FilterState) => FilterState),
22
22
  ): void {
23
23
  if (typeof setter === 'function') {
24
24
  return setFilter(setter(filterRef.current));
@@ -66,14 +66,14 @@ export function useFilter() {
66
66
  const [searchTerm] = useSearchTermState();
67
67
  const statusSearchResults = getStatusSearchResults(
68
68
  filterRef.current,
69
- searchTerm
69
+ searchTerm,
70
70
  );
71
71
 
72
72
  return {
73
73
  onChange,
74
74
  searchTerm,
75
75
  SearchInputRef,
76
- statusSearchResults
76
+ statusSearchResults,
77
77
  };
78
78
 
79
79
  function onChange(inputValue: string) {
@@ -93,10 +93,10 @@ export function useFilter() {
93
93
  return applySearch(nextValue);
94
94
  }
95
95
 
96
- setFilterRef(current =>
96
+ setFilterRef((current) =>
97
97
  Object.assign(current, {
98
- [nextValue]: filterEmojiObjectByKeyword(longestMatch, nextValue)
99
- })
98
+ [nextValue]: filterEmojiObjectByKeyword(longestMatch, nextValue),
99
+ }),
100
100
  );
101
101
  applySearch(nextValue);
102
102
  }
@@ -111,7 +111,7 @@ function useApplySearch() {
111
111
  setSearchTerm(searchTerm ? searchTerm?.toLowerCase() : searchTerm).then(
112
112
  () => {
113
113
  scrollTo(PickerMainRef.current, 0);
114
- }
114
+ },
115
115
  );
116
116
  });
117
117
  };
@@ -119,7 +119,7 @@ function useApplySearch() {
119
119
 
120
120
  export function filterEmojiObjectByKeyword(
121
121
  emojis: FilterDict,
122
- keyword: string
122
+ keyword: string,
123
123
  ): FilterDict {
124
124
  const filtered: FilterDict = {};
125
125
 
@@ -135,20 +135,20 @@ export function filterEmojiObjectByKeyword(
135
135
  }
136
136
 
137
137
  function hasMatch(emoji: DataEmoji, keyword: string): boolean {
138
- return emojiNames(emoji).some(name => name.includes(keyword));
138
+ return emojiNames(emoji).some((name) => name.includes(keyword));
139
139
  }
140
140
 
141
141
  export function useIsEmojiFiltered(): (unified: string) => boolean {
142
142
  const { current: filter } = useFilterRef();
143
143
  const [searchTerm] = useSearchTermState();
144
144
 
145
- return unified => isEmojiFilteredBySearchTerm(unified, filter, searchTerm);
145
+ return (unified) => isEmojiFilteredBySearchTerm(unified, filter, searchTerm);
146
146
  }
147
147
 
148
148
  export function isEmojiFilteredBySearchTerm(
149
149
  unified: string,
150
150
  filter: FilterState,
151
- searchTerm: string
151
+ searchTerm: string,
152
152
  ): boolean {
153
153
  if (!filter || !searchTerm) {
154
154
  return false;
@@ -161,7 +161,7 @@ export type FilterDict = Record<string, DataEmoji>;
161
161
 
162
162
  export function findLongestMatch(
163
163
  keyword: string,
164
- dict: Record<string, FilterDict> | null
164
+ dict: Record<string, FilterDict> | null,
165
165
  ): FilterDict | null {
166
166
  if (!dict) {
167
167
  return null;
@@ -173,7 +173,7 @@ export function findLongestMatch(
173
173
 
174
174
  const longestMatchingKey = Object.keys(dict)
175
175
  .sort((a, b) => b.length - a.length)
176
- .find(key => keyword.includes(key));
176
+ .find((key) => keyword.includes(key));
177
177
 
178
178
  if (longestMatchingKey) {
179
179
  return dict[longestMatchingKey];
@@ -192,7 +192,7 @@ export function getNormalizedSearchTerm(str: string): string {
192
192
 
193
193
  function getStatusSearchResults(
194
194
  filterState: FilterState,
195
- searchTerm: string
195
+ searchTerm: string,
196
196
  ): string {
197
197
  if (!filterState?.[searchTerm]) return '';
198
198
 
@@ -4,7 +4,7 @@ import { focusElement, focusFirstElementChild } from '../DomUtils/focusElement';
4
4
  import {
5
5
  useCategoryNavigationRef,
6
6
  useSearchInputRef,
7
- useSkinTonePickerRef
7
+ useSkinTonePickerRef,
8
8
  } from '../components/context/ElementRefContext';
9
9
 
10
10
  export function useFocusSearchInput() {
@@ -1,6 +1,6 @@
1
- import { useUnicodeToHide } from "../config/useConfig";
1
+ import { useUnicodeToHide } from '../config/useConfig';
2
2
 
3
3
  export function useIsUnicodeHidden() {
4
- const unicodeToHide = useUnicodeToHide();
5
- return (emojiUnified: string) => unicodeToHide.has(emojiUnified);
6
- }
4
+ const unicodeToHide = useUnicodeToHide();
5
+ return (emojiUnified: string) => unicodeToHide.has(emojiUnified);
6
+ }
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
2
2
  import * as React from 'react';
3
3
 
4
4
  export function useMarkInitialLoad(
5
- dispatch: React.Dispatch<React.SetStateAction<boolean>>
5
+ dispatch: React.Dispatch<React.SetStateAction<boolean>>,
6
6
  ) {
7
7
  useEffect(() => {
8
8
  dispatch(true);
@@ -17,7 +17,7 @@ export function useIsEmojiHidden(): (emoji: DataEmoji) => IsHiddenReturn {
17
17
  return {
18
18
  failedToLoad,
19
19
  filteredOut,
20
- hidden: failedToLoad || filteredOut
20
+ hidden: failedToLoad || filteredOut,
21
21
  };
22
22
  };
23
23
  }