emoji-picker-react 4.12.4 → 4.13.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/dist/config/config.d.ts +4 -1
- package/dist/emoji-picker-react.cjs.development.js +202 -171
- package/dist/emoji-picker-react.cjs.development.js.map +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
- package/dist/emoji-picker-react.esm.js +202 -171
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/footer/Preview.tsx +14 -2
- package/src/config/config.ts +9 -1
- package/src/config/useConfig.ts +22 -8
package/package.json
CHANGED
|
@@ -20,13 +20,17 @@ import { useEmojiPreviewEvents } from '../../hooks/useEmojiPreviewEvents';
|
|
|
20
20
|
import { useIsSkinToneInPreview } from '../../hooks/useShouldShowSkinTonePicker';
|
|
21
21
|
import Flex from '../Layout/Flex';
|
|
22
22
|
import Space from '../Layout/Space';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
useEmojiVariationPickerState,
|
|
25
|
+
useReactionsModeState
|
|
26
|
+
} from '../context/PickerContext';
|
|
24
27
|
import { ViewOnlyEmoji } from '../emoji/ViewOnlyEmoji';
|
|
25
28
|
import { SkinTonePickerMenu } from '../header/SkinTonePicker/SkinTonePicker';
|
|
26
29
|
|
|
27
30
|
export function Preview() {
|
|
28
31
|
const previewConfig = usePreviewConfig();
|
|
29
32
|
const isSkinToneInPreview = useIsSkinToneInPreview();
|
|
33
|
+
const [reactionsOpen] = useReactionsModeState();
|
|
30
34
|
|
|
31
35
|
if (!previewConfig.showPreview) {
|
|
32
36
|
return null;
|
|
@@ -34,7 +38,11 @@ export function Preview() {
|
|
|
34
38
|
|
|
35
39
|
return (
|
|
36
40
|
<Flex
|
|
37
|
-
className={cx(
|
|
41
|
+
className={cx(
|
|
42
|
+
styles.preview,
|
|
43
|
+
commonInteractionStyles.hiddenOnReactions,
|
|
44
|
+
reactionsOpen && styles.hideOnReactions
|
|
45
|
+
)}
|
|
38
46
|
>
|
|
39
47
|
<PreviewBody />
|
|
40
48
|
<Space />
|
|
@@ -123,5 +131,9 @@ const styles = stylesheet.create({
|
|
|
123
131
|
},
|
|
124
132
|
emoji: {
|
|
125
133
|
padding: '0'
|
|
134
|
+
},
|
|
135
|
+
hideOnReactions: {
|
|
136
|
+
opacity: '0',
|
|
137
|
+
transition: 'opacity 0.5s ease-in-out'
|
|
126
138
|
}
|
|
127
139
|
});
|
package/src/config/config.ts
CHANGED
|
@@ -151,5 +151,13 @@ export type PickerConfig = Partial<ConfigExternal>;
|
|
|
151
151
|
|
|
152
152
|
export type PickerDimensions = string | number;
|
|
153
153
|
|
|
154
|
-
export type MouseDownEvent = (
|
|
154
|
+
export type MouseDownEvent = (
|
|
155
|
+
emoji: EmojiClickData,
|
|
156
|
+
event: MouseEvent,
|
|
157
|
+
api: OnEmojiClickApi
|
|
158
|
+
) => void;
|
|
155
159
|
export type OnSkinToneChange = (emoji: SkinTones) => void;
|
|
160
|
+
|
|
161
|
+
type OnEmojiClickApi = {
|
|
162
|
+
collapseToReactions: () => void;
|
|
163
|
+
};
|
package/src/config/useConfig.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import { usePickerConfig } from '../components/context/PickerConfigContext';
|
|
4
|
+
import { useReactionsModeState } from '../components/context/PickerContext';
|
|
4
5
|
import {
|
|
5
6
|
EmojiClickData,
|
|
6
7
|
EmojiStyle,
|
|
@@ -80,17 +81,30 @@ export function useOnEmojiClickConfig(
|
|
|
80
81
|
mouseEventSource: MOUSE_EVENT_SOURCE
|
|
81
82
|
): (emoji: EmojiClickData, event: MouseEvent) => void {
|
|
82
83
|
const { current } = useMutableConfig();
|
|
84
|
+
const [, setReactionsOpen] = useReactionsModeState();
|
|
85
|
+
|
|
86
|
+
const handler = current.onEmojiClick || (() => {});
|
|
87
|
+
const { onReactionClick } = current;
|
|
88
|
+
|
|
89
|
+
if (mouseEventSource === MOUSE_EVENT_SOURCE.REACTIONS && onReactionClick) {
|
|
90
|
+
return (...args) =>
|
|
91
|
+
onReactionClick(...args, {
|
|
92
|
+
collapseToReactions: () => {
|
|
93
|
+
setReactionsOpen(o => o);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
83
97
|
|
|
84
|
-
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
return (...args) => {
|
|
99
|
+
handler(...args, {
|
|
100
|
+
collapseToReactions: () => {
|
|
101
|
+
setReactionsOpen(true);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
};
|
|
90
105
|
}
|
|
91
106
|
|
|
92
|
-
export function useOnSkinToneChangeConfig(
|
|
93
|
-
): (skinTone: SkinTones) => void {
|
|
107
|
+
export function useOnSkinToneChangeConfig(): (skinTone: SkinTones) => void {
|
|
94
108
|
const { current } = useMutableConfig();
|
|
95
109
|
|
|
96
110
|
return current.onSkinToneChange || (() => {});
|