emoji-picker-react 4.2.0 → 4.3.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/README.md CHANGED
@@ -43,22 +43,22 @@ function App() {
43
43
 
44
44
  The following props are accepted by them picker:
45
45
 
46
- | Prop | Type | Default | Description |
47
- | ------------------- | ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------- |
48
- | onEmojiClick | function | | Callback function that is called when an emoji is clicked. The function receives the emoji object as a parameter. |
49
- | autoFocusSearch | boolean | `true` | Controls the auto focus of the search input. |
50
- | Theme | string | `light` | Controls the theme of the picker. Possible values are `light`, `dark` and `auto`. |
51
- | emojiStyle | string | `apple` | Controls the emoji style. Possible values are `google`, `apple`, `facebook`, `twitter` and `native`. |
52
- | defaultSkinTone | string | `neutral` | Controls the default skin tone. |
53
- | lazyLoadEmojis | boolean | `false` | Controls whether the emojis are loaded lazily or not. |
54
- | previewConfig | object | `{}` | Controls the preview of the emoji. See below for more information. |
55
- | searchPlaceholder | string | `Search` | Controls the placeholder of the search input. |
56
- | suggestedEmojisMode | string | `frequent` | Controls the suggested emojis mode. Possible values are `frequent` and `recent`. |
57
- | skinTonesDisabled | boolean | `false` | Controls whether the skin tones are disabled or not. |
58
- | `width` | number | `350` | Controls the width of the picker. |
59
- | emojiVersion | `string` | - | Allows displaying emojis up to a certain version for compatibility. |
60
- | `height` | number | `450` | Controls the height of the picker. |
61
- | getEmojiUrl | `Function` | - | Allows to customize the emoji url and provide your own image host. |
46
+ | Prop | Type | Default | Description |
47
+ | ------------------- | ----------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
48
+ | onEmojiClick | function | | Callback function that is called when an emoji is clicked. The function receives the emoji object as a parameter. |
49
+ | autoFocusSearch | boolean | `true` | Controls the auto focus of the search input. |
50
+ | Theme | string | `light` | Controls the theme of the picker. Possible values are `light`, `dark` and `auto`. |
51
+ | emojiStyle | string | `apple` | Controls the emoji style. Possible values are `google`, `apple`, `facebook`, `twitter` and `native`. |
52
+ | defaultSkinTone | string | `neutral` | Controls the default skin tone. |
53
+ | lazyLoadEmojis | boolean | `false` | Controls whether the emojis are loaded lazily or not. |
54
+ | previewConfig | object | `{}` | Controls the preview of the emoji. See below for more information. |
55
+ | searchPlaceholder | string | `Search` | Controls the placeholder of the search input. |
56
+ | suggestedEmojisMode | string | `frequent` | Controls the suggested emojis mode. Possible values are `frequent` and `recent`. |
57
+ | skinTonesDisabled | boolean | `false` | Controls whether the skin tones are disabled or not. |
58
+ | `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. |
59
+ | emojiVersion | `string` | - | Allows displaying emojis up to a certain version for compatibility. |
60
+ | `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. |
61
+ | getEmojiUrl | `Function` | - | Allows to customize the emoji url and provide your own image host. |
62
62
 
63
63
  ## Full details
64
64
 
@@ -141,12 +141,12 @@ import { SkinTones } from 'emoji-picker-react';
141
141
  [
142
142
  {
143
143
  category: 'suggested',
144
- name: 'Recently Used',
144
+ name: 'Recently Used'
145
145
  },
146
146
  {
147
147
  category: 'smileys_people',
148
- name: 'Faces...',
149
- },
148
+ name: 'Faces...'
149
+ }
150
150
  ];
151
151
  ```
152
152
 
@@ -171,12 +171,16 @@ import { SkinTones } from 'emoji-picker-react';
171
171
 
172
172
  ## Custom Picker Width and Height
173
173
 
174
- To customize the dimensions of the picker, use the `height` and `width` props:
174
+ To customize the dimensions of the picker, use the `height` and `width` props. You can pass in a number that will be treated as pixel size, or your any accepted css width/height as string.
175
175
 
176
176
  ```jsx
177
177
  <EmojiPicker height={500} width={400} />
178
178
  ```
179
179
 
180
+ ```jsx
181
+ <EmojiPicker height="100%" width="15em" />
182
+ ```
183
+
180
184
  ## CSS Variables
181
185
 
182
186
  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.
@@ -16,8 +16,8 @@ export declare type PickerConfigInternal = {
16
16
  suggestedEmojisMode: SuggestionMode;
17
17
  lazyLoadEmojis: boolean;
18
18
  previewConfig: PreviewConfig;
19
- height: number;
20
- width: number;
19
+ height: PickerDimensions;
20
+ width: PickerDimensions;
21
21
  getEmojiUrl: GetEmojiUrl;
22
22
  };
23
23
  export declare type PreviewConfig = {
@@ -29,4 +29,5 @@ declare type ConfigExternal = {
29
29
  previewConfig: Partial<PreviewConfig>;
30
30
  } & Omit<PickerConfigInternal, 'previewConfig'>;
31
31
  export declare type PickerConfig = Partial<ConfigExternal>;
32
+ export declare type PickerDimensions = string | number;
32
33
  export {};
@@ -1,6 +1,6 @@
1
1
  import { EmojiClickData, EmojiStyle, SkinTones, SuggestionMode, Theme } from '../types/exposedTypes';
2
2
  import { CategoriesConfig } from './categoryConfig';
3
- import { PreviewConfig } from './config';
3
+ import { PickerDimensions, PreviewConfig } from './config';
4
4
  export declare function useSearchPlaceHolderConfig(): string;
5
5
  export declare function useDefaultSkinToneConfig(): SkinTones;
6
6
  export declare function useSkinTonesDisabledConfig(): boolean;
@@ -13,8 +13,8 @@ export declare function useThemeConfig(): Theme;
13
13
  export declare function useSuggestedEmojisModeConfig(): SuggestionMode;
14
14
  export declare function useLazyLoadEmojisConfig(): boolean;
15
15
  export declare function usePickerSizeConfig(): {
16
- height: number;
17
- width: number;
16
+ height: PickerDimensions;
17
+ width: PickerDimensions;
18
18
  };
19
19
  export declare function useEmojiVersionConfig(): string | null;
20
20
  export declare function useGetEmojiUrlConfig(): (unified: string, style: EmojiStyle) => string;
@@ -16901,8 +16901,8 @@ function usePickerSizeConfig() {
16901
16901
  width = _usePickerConfig12.width;
16902
16902
 
16903
16903
  return {
16904
- height: height,
16905
- width: width
16904
+ height: getDimension(height),
16905
+ width: getDimension(width)
16906
16906
  };
16907
16907
  }
16908
16908
  function useEmojiVersionConfig() {
@@ -16918,6 +16918,10 @@ function useGetEmojiUrlConfig() {
16918
16918
  return getEmojiUrl;
16919
16919
  }
16920
16920
 
16921
+ function getDimension(dimensionConfig) {
16922
+ return typeof dimensionConfig === 'number' ? dimensionConfig + "px" : dimensionConfig;
16923
+ }
16924
+
16921
16925
  var alphaNumericEmojiIndex = {};
16922
16926
  setTimeout(function () {
16923
16927
  allEmojis.reduce(function (searchIndex, emoji) {
@@ -19392,8 +19396,8 @@ function PickerRootElement(_ref2) {
19392
19396
  useKeyboardNavigation();
19393
19397
  useOnFocus();
19394
19398
  var style = {
19395
- height: height + "px",
19396
- width: width + "px"
19399
+ height: height,
19400
+ width: width
19397
19401
  };
19398
19402
  return React.createElement("aside", {
19399
19403
  className: clsx(ClassNames.emojiPicker, 'epr-main', (_clsx = {}, _clsx[ClassNames.searchActive] = searchModeActive, _clsx['epr-dark-theme'] = theme === exports.Theme.DARK, _clsx)),