emoji-picker-react 4.4.5 → 4.4.7

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
@@ -263,3 +263,11 @@ For reference, if you only need to shim global, you can add
263
263
  window.global = window;
264
264
  </script>
265
265
  ```
266
+
267
+ # Other stuff I build
268
+
269
+ If you enjoy using emoji-picker-react, you may be interested in some of my other open source projects:
270
+
271
+ - [Vest](https://github.com/ealush/vest) - The best form validation framwork to date.
272
+ - [Context](https://github.com/ealush/vest/tree/latest/packages/context) - Context propagation library for JS Apps.
273
+ - [n4s](https://github.com/ealush/vest/tree/latest/packages/n4s) - enforce: fluent assertion library.
@@ -17,6 +17,6 @@ declare type BaseProps = {
17
17
  getEmojiUrl?: GetEmojiUrl;
18
18
  };
19
19
  export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad, getEmojiUrl, }: ClickableEmojiProps): JSX.Element;
20
- export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad, getEmojiUrl, }: BaseProps): JSX.Element;
20
+ export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad, getEmojiUrl, }: BaseProps): JSX.Element | null;
21
21
  export declare type GetEmojiUrl = (unified: string, style: EmojiStyle) => string;
22
22
  export {};
@@ -3,7 +3,7 @@ import { EmojiStyle, SkinTones } from '../types/exposedTypes';
3
3
  import { DataEmoji, DataEmojis } from './DataTypes';
4
4
  export declare function emojiNames(emoji: DataEmoji): string[];
5
5
  export declare function addedIn(emoji: DataEmoji): number;
6
- export declare function emojiName(emoji: DataEmoji): string;
6
+ export declare function emojiName(emoji?: DataEmoji): string;
7
7
  export declare function unifiedWithoutSkinTone(unified: string): string;
8
8
  export declare function emojiUnified(emoji: DataEmoji, skinTone?: string): string;
9
9
  export declare function emojisByCategory(category: Categories): DataEmojis;
@@ -16642,6 +16642,10 @@ function addedIn(emoji) {
16642
16642
  return parseFloat(emoji[EmojiProperties.added_in]);
16643
16643
  }
16644
16644
  function emojiName(emoji) {
16645
+ if (!emoji) {
16646
+ return '';
16647
+ }
16648
+
16645
16649
  return emojiNames(emoji)[0];
16646
16650
  }
16647
16651
  function unifiedWithoutSkinTone(unified) {
@@ -17084,14 +17088,14 @@ function PickerContextProvider(_ref) {
17084
17088
  activeSkinTone: activeSkinTone,
17085
17089
  disallowClickRef: disallowClickRef,
17086
17090
  disallowMouseRef: disallowMouseRef,
17091
+ disallowedEmojisRef: disallowedEmojisRef,
17087
17092
  emojiVariationPickerState: emojiVariationPickerState,
17088
17093
  emojisThatFailedToLoadState: emojisThatFailedToLoadState,
17089
17094
  filterRef: filterRef,
17090
17095
  isPastInitialLoad: isPastInitialLoad,
17091
17096
  searchTerm: searchTerm,
17092
17097
  skinToneFanOpenState: skinToneFanOpenState,
17093
- suggestedUpdateState: suggestedUpdateState,
17094
- disallowedEmojisRef: disallowedEmojisRef
17098
+ suggestedUpdateState: suggestedUpdateState
17095
17099
  }
17096
17100
  }, children);
17097
17101
  }
@@ -17670,12 +17674,10 @@ function useSetVariationPicker() {
17670
17674
  var _emojiFromElement = emojiFromElement(element),
17671
17675
  emoji = _emojiFromElement[0];
17672
17676
 
17673
- if (!emoji) {
17674
- return;
17677
+ if (emoji) {
17678
+ setAnchoredEmojiRef(element);
17679
+ setEmojiVariationPicker(emoji);
17675
17680
  }
17676
-
17677
- setAnchoredEmojiRef(element);
17678
- setEmojiVariationPicker(emoji);
17679
17681
  };
17680
17682
  }
17681
17683
 
@@ -18081,10 +18083,6 @@ function useIsEmojiHidden() {
18081
18083
  };
18082
18084
  }
18083
18085
 
18084
- function asEmoji(emoji) {
18085
- return emoji;
18086
- }
18087
-
18088
18086
  function Button(props) {
18089
18087
  return React.createElement("button", Object.assign({
18090
18088
  type: "button"
@@ -18136,13 +18134,18 @@ function ViewOnlyEmoji(_ref2) {
18136
18134
  }
18137
18135
 
18138
18136
  var emojiToRender = emoji ? emoji : emojiByUnified(unified);
18137
+
18138
+ if (!emojiToRender) {
18139
+ return null;
18140
+ }
18141
+
18139
18142
  return React.createElement(React.Fragment, null, emojiStyle === exports.EmojiStyle.NATIVE ? React.createElement(NativeEmoji, {
18140
18143
  unified: unified,
18141
18144
  style: style
18142
18145
  }) : React.createElement(EmojiImg, {
18143
18146
  unified: unified,
18144
18147
  style: style,
18145
- emoji: asEmoji(emojiToRender),
18148
+ emoji: emojiToRender,
18146
18149
  emojiStyle: emojiStyle,
18147
18150
  lazyLoad: lazyLoad,
18148
18151
  getEmojiUrl: getEmojiUrl
@@ -18477,7 +18480,6 @@ function EmojiVariationPicker() {
18477
18480
  pointerStyle = getPointerStyle();
18478
18481
  }
18479
18482
 
18480
- var safeEmoji = asEmoji(emoji);
18481
18483
  return React.createElement("div", {
18482
18484
  ref: VariationPickerRef,
18483
18485
  className: clsx(ClassNames.variationPicker, {
@@ -18487,10 +18489,10 @@ function EmojiVariationPicker() {
18487
18489
  style: {
18488
18490
  top: top
18489
18491
  }
18490
- }, visible ? [emojiUnified(safeEmoji)].concat(emojiVariations(safeEmoji)).slice(0, 6).map(function (unified) {
18492
+ }, visible && emoji ? [emojiUnified(emoji)].concat(emojiVariations(emoji)).slice(0, 6).map(function (unified) {
18491
18493
  return React.createElement(ClickableEmoji, {
18492
18494
  key: unified,
18493
- emoji: safeEmoji,
18495
+ emoji: emoji,
18494
18496
  unified: unified,
18495
18497
  emojiStyle: emojiStyle,
18496
18498
  showVariations: false,
@@ -18841,11 +18843,16 @@ function PreviewBody() {
18841
18843
  return React.createElement(PreviewContent, null);
18842
18844
 
18843
18845
  function PreviewContent() {
18844
- var defaultEmoji = asEmoji(variationPickerEmoji != null ? variationPickerEmoji : emojiByUnified(previewConfig.defaultEmoji));
18846
+ var defaultEmoji = variationPickerEmoji != null ? variationPickerEmoji : emojiByUnified(previewConfig.defaultEmoji);
18847
+
18848
+ if (!defaultEmoji) {
18849
+ return null;
18850
+ }
18851
+
18845
18852
  var defaultText = variationPickerEmoji ? emojiName(variationPickerEmoji) : previewConfig.defaultCaption;
18846
18853
  return React.createElement(React.Fragment, null, React.createElement("div", null, show ? React.createElement(ViewOnlyEmoji, {
18847
18854
  unified: previewEmoji == null ? void 0 : previewEmoji.unified,
18848
- emoji: asEmoji(emoji),
18855
+ emoji: emoji,
18849
18856
  emojiStyle: emojiStyle,
18850
18857
  size: 45,
18851
18858
  getEmojiUrl: getEmojiUrl
@@ -18857,7 +18864,7 @@ function PreviewBody() {
18857
18864
  getEmojiUrl: getEmojiUrl
18858
18865
  }) : null), show ? React.createElement("div", {
18859
18866
  className: "epr-preview-emoji-label"
18860
- }, emojiName(asEmoji(emoji))) : React.createElement("div", {
18867
+ }, emojiName(emoji)) : React.createElement("div", {
18861
18868
  className: "epr-preview-emoji-label"
18862
18869
  }, defaultText));
18863
18870
  }