emoji-picker-react 4.0.0-rc.21 → 4.0.0-rc.24
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/components/emoji/Emoji.d.ts +8 -5
- package/dist/emoji-picker-react.cjs.development.css +2 -2
- package/dist/emoji-picker-react.cjs.development.js +74 -58
- 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 +77 -61
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/EmojiList.tsx +2 -2
- package/src/components/body/EmojiVariationPicker.tsx +2 -2
- package/src/components/body/Suggested.tsx +2 -2
- package/src/components/emoji/Emoji.css +3 -1
- package/src/components/emoji/Emoji.tsx +41 -20
- package/src/components/footer/Preview.tsx +3 -7
- package/src/components/header/SkinTonePicker.css +1 -1
- package/src/components/header/SkinTonePicker.tsx +6 -1
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
useActiveSkinToneState,
|
|
18
18
|
useIsPastInitialLoad
|
|
19
19
|
} from '../context/PickerContext';
|
|
20
|
-
import {
|
|
20
|
+
import { ClickableEmoji } from '../emoji/Emoji';
|
|
21
21
|
|
|
22
22
|
import { EmojiCategory } from './EmojiCategory';
|
|
23
23
|
import { Suggested } from './Suggested';
|
|
@@ -81,7 +81,7 @@ function RenderCategory({
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
return (
|
|
84
|
-
<
|
|
84
|
+
<ClickableEmoji
|
|
85
85
|
key={unified}
|
|
86
86
|
emoji={emoji}
|
|
87
87
|
unified={unified}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
useSetAnchoredEmojiRef
|
|
21
21
|
} from '../context/ElementRefContext';
|
|
22
22
|
import { useEmojiVariationPickerState } from '../context/PickerContext';
|
|
23
|
-
import {
|
|
23
|
+
import { ClickableEmoji } from '../emoji/Emoji';
|
|
24
24
|
import './EmojiVariationPicker.css';
|
|
25
25
|
|
|
26
26
|
enum Direction {
|
|
@@ -63,7 +63,7 @@ export function EmojiVariationPicker() {
|
|
|
63
63
|
.concat(emojiVariations(safeEmoji))
|
|
64
64
|
.slice(0, 6)
|
|
65
65
|
.map(unified => (
|
|
66
|
-
<
|
|
66
|
+
<ClickableEmoji
|
|
67
67
|
key={unified}
|
|
68
68
|
emoji={safeEmoji}
|
|
69
69
|
unified={unified}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useSearchTermState,
|
|
12
12
|
useUpdateSuggested
|
|
13
13
|
} from '../context/PickerContext';
|
|
14
|
-
import {
|
|
14
|
+
import { ClickableEmoji } from '../emoji/Emoji';
|
|
15
15
|
|
|
16
16
|
import { EmojiCategory } from './EmojiCategory';
|
|
17
17
|
|
|
@@ -46,7 +46,7 @@ export function Suggested({ categoryConfig }: Props) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
|
-
<
|
|
49
|
+
<ClickableEmoji
|
|
50
50
|
showVariations={false}
|
|
51
51
|
unified={suggestedItem.unified}
|
|
52
52
|
emojiStyle={emojiStyle}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
padding: var(--epr-emoji-padding);
|
|
4
4
|
border-radius: 8px;
|
|
5
|
+
width: var(--epr-emoji-fullsize);
|
|
6
|
+
height: var(--epr-emoji-fullsize);
|
|
5
7
|
}
|
|
6
8
|
|
|
7
9
|
.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:after {
|
|
@@ -44,6 +46,6 @@
|
|
|
44
46
|
background-color: var(--epr-emoji-hover-color);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
.EmojiPickerReact button.epr-emoji:focus
|
|
49
|
+
.EmojiPickerReact button.epr-emoji:focus {
|
|
48
50
|
background-color: var(--epr-focus-bg-color);
|
|
49
51
|
}
|
|
@@ -14,18 +14,23 @@ import { EmojiStyle } from '../../types/exposedTypes';
|
|
|
14
14
|
import { useEmojisThatFailedToLoadState } from '../context/PickerContext';
|
|
15
15
|
import './Emoji.css';
|
|
16
16
|
|
|
17
|
-
type
|
|
18
|
-
|
|
17
|
+
type ClickableEmojiProps = Readonly<
|
|
18
|
+
BaseProps & {
|
|
19
|
+
hidden?: boolean;
|
|
20
|
+
showVariations?: boolean;
|
|
21
|
+
emojiRef?: EmojiRef;
|
|
22
|
+
}
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
type BaseProps = {
|
|
19
26
|
emojiStyle: EmojiStyle;
|
|
20
27
|
emoji: DataEmoji;
|
|
21
28
|
unified: string;
|
|
22
|
-
showVariations?: boolean;
|
|
23
29
|
size?: number;
|
|
24
|
-
emojiRef?: EmojiRef;
|
|
25
30
|
lazyLoad?: boolean;
|
|
26
|
-
}
|
|
31
|
+
};
|
|
27
32
|
|
|
28
|
-
export function
|
|
33
|
+
export function ClickableEmoji({
|
|
29
34
|
emoji,
|
|
30
35
|
unified,
|
|
31
36
|
hidden,
|
|
@@ -34,19 +39,9 @@ export function Emoji({
|
|
|
34
39
|
size,
|
|
35
40
|
emojiRef,
|
|
36
41
|
lazyLoad
|
|
37
|
-
}:
|
|
42
|
+
}: ClickableEmojiProps) {
|
|
38
43
|
const hasVariations = emojiHasVariations(emoji);
|
|
39
44
|
|
|
40
|
-
const style = {} as React.CSSProperties;
|
|
41
|
-
if (size) {
|
|
42
|
-
style.width = style.height = style.fontSize = `${size}px`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const base = {
|
|
46
|
-
style,
|
|
47
|
-
unified
|
|
48
|
-
};
|
|
49
|
-
|
|
50
45
|
return (
|
|
51
46
|
<button
|
|
52
47
|
className={clsx(ClassNames.emoji, {
|
|
@@ -58,17 +53,43 @@ export function Emoji({
|
|
|
58
53
|
// @ts-ignore - let's ignore the fact this is not a real react ref, ok?
|
|
59
54
|
ref={emojiRef}
|
|
60
55
|
>
|
|
56
|
+
<ViewOnlyEmoji
|
|
57
|
+
unified={unified}
|
|
58
|
+
emoji={emoji}
|
|
59
|
+
size={size}
|
|
60
|
+
emojiStyle={emojiStyle}
|
|
61
|
+
lazyLoad={lazyLoad}
|
|
62
|
+
/>
|
|
63
|
+
</button>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function ViewOnlyEmoji({
|
|
68
|
+
emoji,
|
|
69
|
+
unified,
|
|
70
|
+
emojiStyle,
|
|
71
|
+
size,
|
|
72
|
+
lazyLoad
|
|
73
|
+
}: BaseProps) {
|
|
74
|
+
const style = {} as React.CSSProperties;
|
|
75
|
+
if (size) {
|
|
76
|
+
style.width = style.height = style.fontSize = `${size}px`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
61
81
|
{emojiStyle === EmojiStyle.NATIVE ? (
|
|
62
|
-
<NativeEmoji {
|
|
82
|
+
<NativeEmoji unified={unified} style={style} />
|
|
63
83
|
) : (
|
|
64
84
|
<EmojiImg
|
|
65
|
-
{
|
|
85
|
+
unified={unified}
|
|
86
|
+
style={style}
|
|
66
87
|
emoji={emoji}
|
|
67
88
|
emojiStyle={emojiStyle}
|
|
68
89
|
lazyLoad={lazyLoad}
|
|
69
90
|
/>
|
|
70
91
|
)}
|
|
71
|
-
|
|
92
|
+
</>
|
|
72
93
|
);
|
|
73
94
|
}
|
|
74
95
|
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { useEmojiPreviewEvents } from '../../hooks/useEmojiPreviewEvents';
|
|
12
12
|
import Flex from '../Layout/Flex';
|
|
13
13
|
import { useEmojiVariationPickerState } from '../context/PickerContext';
|
|
14
|
-
import {
|
|
14
|
+
import { ViewOnlyEmoji } from '../emoji/Emoji';
|
|
15
15
|
import './Preview.css';
|
|
16
16
|
|
|
17
17
|
export function Preview() {
|
|
@@ -48,21 +48,17 @@ export function Preview() {
|
|
|
48
48
|
<>
|
|
49
49
|
<div>
|
|
50
50
|
{show ? (
|
|
51
|
-
<
|
|
51
|
+
<ViewOnlyEmoji
|
|
52
52
|
unified={previewEmoji?.unified as string}
|
|
53
53
|
emoji={asEmoji(emoji)}
|
|
54
|
-
showVariations={false}
|
|
55
54
|
emojiStyle={emojiStyle}
|
|
56
|
-
hidden={false}
|
|
57
55
|
size={45}
|
|
58
56
|
/>
|
|
59
57
|
) : defaultEmoji ? (
|
|
60
|
-
<
|
|
58
|
+
<ViewOnlyEmoji
|
|
61
59
|
unified={emojiUnified(defaultEmoji)}
|
|
62
60
|
emoji={defaultEmoji}
|
|
63
|
-
showVariations={false}
|
|
64
61
|
emojiStyle={emojiStyle}
|
|
65
|
-
hidden={false}
|
|
66
62
|
size={45}
|
|
67
63
|
/>
|
|
68
64
|
) : null}
|
|
@@ -5,6 +5,7 @@ import { ClassNames } from '../../DomUtils/classNames';
|
|
|
5
5
|
import { useSkinTonesDisabledConfig } from '../../config/useConfig';
|
|
6
6
|
import skinToneVariations from '../../data/skinToneVariations';
|
|
7
7
|
import { useCloseAllOpenToggles } from '../../hooks/useCloseAllOpenToggles';
|
|
8
|
+
import { useFocusSearchInput } from '../../hooks/useFocus';
|
|
8
9
|
import Relative from '../Layout/Relative';
|
|
9
10
|
import { useSkinTonePickerRef } from '../context/ElementRefContext';
|
|
10
11
|
import {
|
|
@@ -19,6 +20,7 @@ export function SkinTonePicker() {
|
|
|
19
20
|
const [isOpen, setIsOpen] = useSkinToneFanOpenState();
|
|
20
21
|
const [activeSkinTone, setActiveSkinTone] = useActiveSkinToneState();
|
|
21
22
|
const closeAllOpenToggles = useCloseAllOpenToggles();
|
|
23
|
+
const focusSearchInput = useFocusSearchInput();
|
|
22
24
|
|
|
23
25
|
if (isDisabled) {
|
|
24
26
|
return null;
|
|
@@ -46,7 +48,10 @@ export function SkinTonePicker() {
|
|
|
46
48
|
)
|
|
47
49
|
}}
|
|
48
50
|
onClick={() => {
|
|
49
|
-
|
|
51
|
+
if (isOpen) {
|
|
52
|
+
setActiveSkinTone(skinToneVariation);
|
|
53
|
+
focusSearchInput();
|
|
54
|
+
}
|
|
50
55
|
closeAllOpenToggles();
|
|
51
56
|
}}
|
|
52
57
|
key={skinToneVariation}
|