emoji-picker-react 4.5.16 → 4.6.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.5.16",
2
+ "version": "4.6.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -39,8 +39,10 @@ export default React.memo(EmojiPicker, (prev, next) => {
39
39
  prev.theme === next.theme &&
40
40
  prev.suggestedEmojisMode === next.suggestedEmojisMode &&
41
41
  prev.lazyLoadEmojis === next.lazyLoadEmojis &&
42
+ prev.className === next.className &&
42
43
  prev.height === next.height &&
43
44
  prev.width === next.width &&
45
+ prev.style === next.style &&
44
46
  prev.searchDisabled === next.searchDisabled &&
45
47
  prev.skinTonePickerLocation === next.skinTonePickerLocation &&
46
48
  prevCustomEmojis.length === nextCustomEmojis.length
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import { ClassNames, clsx } from '../../DomUtils/classNames';
4
- import { usePickerSizeConfig, useThemeConfig } from '../../config/useConfig';
4
+ import { useClassNameConfig, useStyleConfig, useThemeConfig } from '../../config/useConfig';
5
5
  import useIsSearchMode from '../../hooks/useIsSearchMode';
6
6
  import { useKeyboardNavigation } from '../../hooks/useKeyboardNavigation';
7
7
  import { useOnFocus } from '../../hooks/useOnFocus';
@@ -23,6 +23,8 @@ export default function PickerMain({ children }: Props) {
23
23
  }
24
24
 
25
25
  type RootProps = Readonly<{
26
+ className?: string;
27
+ style?: React.CSSProperties;
26
28
  children: React.ReactNode;
27
29
  }>;
28
30
 
@@ -30,25 +32,19 @@ function PickerRootElement({ children }: RootProps) {
30
32
  const theme = useThemeConfig();
31
33
  const searchModeActive = useIsSearchMode();
32
34
  const PickerMainRef = usePickerMainRef();
33
- const { height, width } = usePickerSizeConfig();
35
+ const className = useClassNameConfig();
36
+ const style = useStyleConfig();
34
37
 
35
38
  useKeyboardNavigation();
36
39
  useOnFocus();
37
40
 
38
- const style = {
39
- height,
40
- width
41
- };
42
-
43
-
44
-
45
41
  return (
46
42
  <aside
47
43
  className={clsx(ClassNames.emojiPicker, 'epr-main', {
48
44
  [ClassNames.searchActive]: searchModeActive,
49
45
  [ClassNames.darkTheme]: theme === Theme.DARK,
50
46
  [ClassNames.autoTheme]: theme === Theme.AUTO
51
- })}
47
+ }, className)}
52
48
  ref={PickerMainRef}
53
49
  style={style}
54
50
  >
@@ -1,3 +1,5 @@
1
+ import * as React from 'react'
2
+
1
3
  import { GetEmojiUrl } from '../components/emoji/BaseEmojiProps';
2
4
  import {
3
5
  setCustomEmojis,
@@ -63,6 +65,7 @@ export function basePickerConfig(): PickerConfigInternal {
63
65
  return {
64
66
  autoFocusSearch: true,
65
67
  categories: baseCategoriesConfig(),
68
+ className: '',
66
69
  customEmojis: [],
67
70
  defaultSkinTone: SkinTones.NEUTRAL,
68
71
  emojiStyle: EmojiStyle.APPLE,
@@ -78,6 +81,7 @@ export function basePickerConfig(): PickerConfigInternal {
78
81
  searchPlaceholder: DEFAULT_SEARCH_PLACEHOLDER,
79
82
  skinTonePickerLocation: SkinTonePickerLocation.SEARCH,
80
83
  skinTonesDisabled: false,
84
+ style: {},
81
85
  suggestedEmojisMode: SuggestionMode.FREQUENT,
82
86
  theme: Theme.LIGHT,
83
87
  unicodeToHide: new Set<string>(KNOWN_FAILING_EMOJIS),
@@ -98,8 +102,10 @@ export type PickerConfigInternal = {
98
102
  suggestedEmojisMode: SuggestionMode;
99
103
  lazyLoadEmojis: boolean;
100
104
  previewConfig: PreviewConfig;
105
+ className: string;
101
106
  height: PickerDimensions;
102
107
  width: PickerDimensions;
108
+ style: React.CSSProperties;
103
109
  getEmojiUrl: GetEmojiUrl;
104
110
  searchDisabled: boolean;
105
111
  skinTonePickerLocation: SkinTonePickerLocation;
@@ -1,3 +1,5 @@
1
+ import * as React from 'react';
2
+
1
3
  import { usePickerConfig } from '../components/context/PickerConfigContext';
2
4
  import {
3
5
  EmojiClickData,
@@ -88,12 +90,14 @@ export function useLazyLoadEmojisConfig(): boolean {
88
90
  return lazyLoadEmojis;
89
91
  }
90
92
 
91
- export function usePickerSizeConfig(): {
92
- height: PickerDimensions;
93
- width: PickerDimensions;
94
- } {
95
- const { height, width } = usePickerConfig();
96
- return { height: getDimension(height), width: getDimension(width) };
93
+ export function useClassNameConfig(): string {
94
+ const { className } = usePickerConfig();
95
+ return className;
96
+ }
97
+
98
+ export function useStyleConfig(): React.CSSProperties {
99
+ const { height, width, style } = usePickerConfig();
100
+ return { height: getDimension(height), width: getDimension(width), ...style };
97
101
  }
98
102
 
99
103
  export function useEmojiVersionConfig(): string | null {