emoji-picker-react 4.7.0 → 4.7.2

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.
@@ -16886,7 +16886,8 @@ function useMutableConfig() {
16886
16886
  }
16887
16887
  function useDefineMutableConfig(config) {
16888
16888
  var MutableConfigRef = React__default.useRef({
16889
- onEmojiClick: config.onEmojiClick || emptyFunc
16889
+ onEmojiClick: config.onEmojiClick || emptyFunc,
16890
+ onReactionClick: config.onReactionClick || config.onEmojiClick
16890
16891
  });
16891
16892
  React__default.useEffect(function () {
16892
16893
  MutableConfigRef.current.onEmojiClick = config.onEmojiClick || emptyFunc;
@@ -16895,6 +16896,11 @@ function useDefineMutableConfig(config) {
16895
16896
  }
16896
16897
  function emptyFunc() {}
16897
16898
 
16899
+ var MOUSE_EVENT_SOURCE;
16900
+ (function (MOUSE_EVENT_SOURCE) {
16901
+ MOUSE_EVENT_SOURCE["REACTIONS"] = "reactions";
16902
+ MOUSE_EVENT_SOURCE["PICKER"] = "picker";
16903
+ })(MOUSE_EVENT_SOURCE || (MOUSE_EVENT_SOURCE = {}));
16898
16904
  function useSearchPlaceHolderConfig() {
16899
16905
  var _find;
16900
16906
  var _usePickerConfig = usePickerConfig(),
@@ -16934,10 +16940,12 @@ function useCustomEmojisConfig() {
16934
16940
  customEmojis = _usePickerConfig7.customEmojis;
16935
16941
  return customEmojis;
16936
16942
  }
16937
- function useOnEmojiClickConfig() {
16943
+ function useOnEmojiClickConfig(mouseEventSource) {
16944
+ var _ref;
16938
16945
  var _useMutableConfig = useMutableConfig(),
16939
16946
  current = _useMutableConfig.current;
16940
- return current.onEmojiClick || function () {};
16947
+ var handler = (_ref = mouseEventSource === MOUSE_EVENT_SOURCE.REACTIONS ? current.onReactionClick : current.onEmojiClick) != null ? _ref : current.onEmojiClick;
16948
+ return handler || function () {};
16941
16949
  }
16942
16950
  function usePreviewConfig() {
16943
16951
  var _usePickerConfig8 = usePickerConfig(),
@@ -17688,7 +17696,7 @@ function useSetVariationPicker() {
17688
17696
  };
17689
17697
  }
17690
17698
 
17691
- function useMouseDownHandlers(BodyRef) {
17699
+ function useMouseDownHandlers(ContainerRef, mouseEventSource) {
17692
17700
  var mouseDownTimerRef = useRef();
17693
17701
  var setVariationPicker = useSetVariationPicker();
17694
17702
  var disallowClickRef = useDisallowClickRef();
@@ -17697,7 +17705,7 @@ function useMouseDownHandlers(BodyRef) {
17697
17705
  var closeAllOpenToggles = useCloseAllOpenToggles();
17698
17706
  var _useActiveSkinToneSta = useActiveSkinToneState(),
17699
17707
  activeSkinTone = _useActiveSkinToneSta[0];
17700
- var onEmojiClick = useOnEmojiClickConfig();
17708
+ var onEmojiClick = useOnEmojiClickConfig(mouseEventSource);
17701
17709
  var _useUpdateSuggested = useUpdateSuggested(),
17702
17710
  updateSuggested = _useUpdateSuggested[1];
17703
17711
  var getEmojiUrl = useGetEmojiUrlConfig();
@@ -17752,25 +17760,25 @@ function useMouseDownHandlers(BodyRef) {
17752
17760
  }
17753
17761
  }, [disallowClickRef]);
17754
17762
  useEffect(function () {
17755
- if (!BodyRef.current) {
17763
+ if (!ContainerRef.current) {
17756
17764
  return;
17757
17765
  }
17758
- var bodyRef = BodyRef.current;
17759
- bodyRef.addEventListener('click', onClick, {
17766
+ var confainerRef = ContainerRef.current;
17767
+ confainerRef.addEventListener('click', onClick, {
17760
17768
  passive: true
17761
17769
  });
17762
- bodyRef.addEventListener('mousedown', onMouseDown, {
17770
+ confainerRef.addEventListener('mousedown', onMouseDown, {
17763
17771
  passive: true
17764
17772
  });
17765
- bodyRef.addEventListener('mouseup', onMouseUp, {
17773
+ confainerRef.addEventListener('mouseup', onMouseUp, {
17766
17774
  passive: true
17767
17775
  });
17768
17776
  return function () {
17769
- bodyRef == null ? void 0 : bodyRef.removeEventListener('click', onClick);
17770
- bodyRef == null ? void 0 : bodyRef.removeEventListener('mousedown', onMouseDown);
17771
- bodyRef == null ? void 0 : bodyRef.removeEventListener('mouseup', onMouseUp);
17777
+ confainerRef == null ? void 0 : confainerRef.removeEventListener('click', onClick);
17778
+ confainerRef == null ? void 0 : confainerRef.removeEventListener('mousedown', onMouseDown);
17779
+ confainerRef == null ? void 0 : confainerRef.removeEventListener('mouseup', onMouseUp);
17772
17780
  };
17773
- }, [BodyRef, onClick, onMouseDown, onMouseUp]);
17781
+ }, [ContainerRef, onClick, onMouseDown, onMouseUp]);
17774
17782
  }
17775
17783
  function emojiFromEvent(event) {
17776
17784
  var target = event == null ? void 0 : event.target;
@@ -17841,10 +17849,11 @@ function ClickableEmojiButton(_ref) {
17841
17849
  showVariations = _ref$showVariations === void 0 ? true : _ref$showVariations,
17842
17850
  hasVariations = _ref.hasVariations,
17843
17851
  children = _ref.children,
17852
+ className = _ref.className,
17844
17853
  _ref$round = _ref.round,
17845
17854
  round = _ref$round === void 0 ? false : _ref$round;
17846
17855
  return createElement(Button, {
17847
- className: cx(styles$1.emoji, hidden && commonStyles.hidden, hiddenOnSearch && commonInteractionStyles.hiddenOnSearch, (_cx = {}, _cx[ClassNames.visible] = !hidden && !hiddenOnSearch, _cx), !!(hasVariations && showVariations) && styles$1.hasVariations, round && styles$1.round),
17856
+ className: cx(styles$1.emoji, hidden && commonStyles.hidden, hiddenOnSearch && commonInteractionStyles.hiddenOnSearch, (_cx = {}, _cx[ClassNames.visible] = !hidden && !hiddenOnSearch, _cx), !!(hasVariations && showVariations) && styles$1.hasVariations, round && styles$1.round, className),
17848
17857
  "data-unified": unified,
17849
17858
  "aria-label": emojiNames[0],
17850
17859
  "data-full-name": emojiNames
@@ -18023,6 +18032,7 @@ function ClickableEmoji(_ref) {
18023
18032
  size = _ref.size,
18024
18033
  lazyLoad = _ref.lazyLoad,
18025
18034
  getEmojiUrl = _ref.getEmojiUrl,
18035
+ className = _ref.className,
18026
18036
  _ref$round = _ref.round,
18027
18037
  round = _ref$round === void 0 ? false : _ref$round;
18028
18038
  var hasVariations = emojiHasVariations(emoji);
@@ -18040,7 +18050,8 @@ function ClickableEmoji(_ref) {
18040
18050
  size: size,
18041
18051
  emojiStyle: emojiStyle,
18042
18052
  lazyLoad: lazyLoad,
18043
- getEmojiUrl: getEmojiUrl
18053
+ getEmojiUrl: getEmojiUrl,
18054
+ className: className
18044
18055
  }));
18045
18056
  }
18046
18057
 
@@ -18129,7 +18140,7 @@ function Reactions() {
18129
18140
  reactionsOpen = _useReactionsModeStat[0];
18130
18141
  var ReactionsRef = useReactionsRef();
18131
18142
  var reactions = useReactionsConfig();
18132
- useMouseDownHandlers(ReactionsRef);
18143
+ useMouseDownHandlers(ReactionsRef, MOUSE_EVENT_SOURCE.REACTIONS);
18133
18144
  var emojiStyle = useEmojiStyleConfig();
18134
18145
  if (!reactionsOpen) {
18135
18146
  return null;
@@ -18145,6 +18156,7 @@ function Reactions() {
18145
18156
  emojiStyle: emojiStyle,
18146
18157
  unified: reaction,
18147
18158
  showVariations: false,
18159
+ className: cx(styles$5.emojiButton),
18148
18160
  round: true
18149
18161
  }));
18150
18162
  }), createElement("li", null, createElement(BtnPlus, null)));
@@ -18158,6 +18170,12 @@ var styles$5 = /*#__PURE__*/stylesheet.create({
18158
18170
  justifyContent: 'space-between',
18159
18171
  alignItems: 'center',
18160
18172
  height: '100%'
18173
+ },
18174
+ emojiButton: {
18175
+ ':hover': {
18176
+ transform: 'scale(1.2)'
18177
+ },
18178
+ transition: 'transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.5)'
18161
18179
  }
18162
18180
  });
18163
18181
 
@@ -18885,7 +18903,7 @@ var styles$8 = /*#__PURE__*/stylesheet.create({
18885
18903
  function Body() {
18886
18904
  var BodyRef = useBodyRef();
18887
18905
  useOnScroll(BodyRef);
18888
- useMouseDownHandlers(BodyRef);
18906
+ useMouseDownHandlers(BodyRef, MOUSE_EVENT_SOURCE.PICKER);
18889
18907
  useOnMouseMove();
18890
18908
  return createElement("div", {
18891
18909
  className: cx(styles$9.body, commonInteractionStyles.hiddenOnReactions),
@@ -20457,7 +20475,8 @@ function ExportedEmoji(_ref) {
20457
20475
 
20458
20476
  function EmojiPicker$1(props) {
20459
20477
  var MutableConfigRef = useDefineMutableConfig({
20460
- onEmojiClick: props.onEmojiClick
20478
+ onEmojiClick: props.onEmojiClick,
20479
+ onReactionClick: props.onReactionClick
20461
20480
  });
20462
20481
  return createElement(ErrorBoundary, null, createElement(MutableConfigContext.Provider, {
20463
20482
  value: MutableConfigRef