emoji-picker-react 4.4.5 → 4.4.6

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.
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import './EmojiVariationPicker.css';
3
- export declare function EmojiVariationPicker(): JSX.Element;
3
+ export declare function EmojiVariationPicker(): JSX.Element | null;
@@ -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) {
@@ -18081,10 +18085,6 @@ function useIsEmojiHidden() {
18081
18085
  };
18082
18086
  }
18083
18087
 
18084
- function asEmoji(emoji) {
18085
- return emoji;
18086
- }
18087
-
18088
18088
  function Button(props) {
18089
18089
  return React.createElement("button", Object.assign({
18090
18090
  type: "button"
@@ -18136,13 +18136,18 @@ function ViewOnlyEmoji(_ref2) {
18136
18136
  }
18137
18137
 
18138
18138
  var emojiToRender = emoji ? emoji : emojiByUnified(unified);
18139
+
18140
+ if (!emojiToRender) {
18141
+ return null;
18142
+ }
18143
+
18139
18144
  return React.createElement(React.Fragment, null, emojiStyle === exports.EmojiStyle.NATIVE ? React.createElement(NativeEmoji, {
18140
18145
  unified: unified,
18141
18146
  style: style
18142
18147
  }) : React.createElement(EmojiImg, {
18143
18148
  unified: unified,
18144
18149
  style: style,
18145
- emoji: asEmoji(emojiToRender),
18150
+ emoji: emojiToRender,
18146
18151
  emojiStyle: emojiStyle,
18147
18152
  lazyLoad: lazyLoad,
18148
18153
  getEmojiUrl: getEmojiUrl
@@ -18477,7 +18482,10 @@ function EmojiVariationPicker() {
18477
18482
  pointerStyle = getPointerStyle();
18478
18483
  }
18479
18484
 
18480
- var safeEmoji = asEmoji(emoji);
18485
+ if (!emoji) {
18486
+ return null;
18487
+ }
18488
+
18481
18489
  return React.createElement("div", {
18482
18490
  ref: VariationPickerRef,
18483
18491
  className: clsx(ClassNames.variationPicker, {
@@ -18487,10 +18495,10 @@ function EmojiVariationPicker() {
18487
18495
  style: {
18488
18496
  top: top
18489
18497
  }
18490
- }, visible ? [emojiUnified(safeEmoji)].concat(emojiVariations(safeEmoji)).slice(0, 6).map(function (unified) {
18498
+ }, visible ? [emojiUnified(emoji)].concat(emojiVariations(emoji)).slice(0, 6).map(function (unified) {
18491
18499
  return React.createElement(ClickableEmoji, {
18492
18500
  key: unified,
18493
- emoji: safeEmoji,
18501
+ emoji: emoji,
18494
18502
  unified: unified,
18495
18503
  emojiStyle: emojiStyle,
18496
18504
  showVariations: false,
@@ -18841,11 +18849,16 @@ function PreviewBody() {
18841
18849
  return React.createElement(PreviewContent, null);
18842
18850
 
18843
18851
  function PreviewContent() {
18844
- var defaultEmoji = asEmoji(variationPickerEmoji != null ? variationPickerEmoji : emojiByUnified(previewConfig.defaultEmoji));
18852
+ var defaultEmoji = variationPickerEmoji != null ? variationPickerEmoji : emojiByUnified(previewConfig.defaultEmoji);
18853
+
18854
+ if (!defaultEmoji) {
18855
+ return null;
18856
+ }
18857
+
18845
18858
  var defaultText = variationPickerEmoji ? emojiName(variationPickerEmoji) : previewConfig.defaultCaption;
18846
18859
  return React.createElement(React.Fragment, null, React.createElement("div", null, show ? React.createElement(ViewOnlyEmoji, {
18847
18860
  unified: previewEmoji == null ? void 0 : previewEmoji.unified,
18848
- emoji: asEmoji(emoji),
18861
+ emoji: emoji,
18849
18862
  emojiStyle: emojiStyle,
18850
18863
  size: 45,
18851
18864
  getEmojiUrl: getEmojiUrl
@@ -18857,7 +18870,7 @@ function PreviewBody() {
18857
18870
  getEmojiUrl: getEmojiUrl
18858
18871
  }) : null), show ? React.createElement("div", {
18859
18872
  className: "epr-preview-emoji-label"
18860
- }, emojiName(asEmoji(emoji))) : React.createElement("div", {
18873
+ }, emojiName(emoji)) : React.createElement("div", {
18861
18874
  className: "epr-preview-emoji-label"
18862
18875
  }, defaultText));
18863
18876
  }