emoji-picker-react 4.17.5 → 4.18.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/README.md +51 -6
- package/dist/components/Layout/Flex.d.ts +1 -1
- package/dist/components/body/EmojiCategory.d.ts +1 -1
- package/dist/components/context/ElementRefContext.d.ts +1 -1
- package/dist/components/emoji/ClickableEmojiButton.d.ts +1 -1
- package/dist/components/emoji/Emoji.d.ts +1 -1
- package/dist/components/emoji/EmojiImg.d.ts +1 -1
- package/dist/components/emoji/ExportedEmoji.d.ts +1 -1
- package/dist/components/emoji/NativeEmoji.d.ts +1 -1
- package/dist/components/emoji/ViewOnlyEmoji.d.ts +1 -1
- package/dist/components/header/SkinTonePicker/BtnSkinToneVariation.d.ts +1 -1
- package/dist/components/header/SkinTonePicker/SkinTonePicker.d.ts +1 -1
- package/dist/components/navigation/CategoryButton.d.ts +3 -2
- package/dist/config/config.d.ts +2 -1
- package/dist/config/useConfig.d.ts +1 -0
- package/dist/data/groups.js +1 -1
- package/dist/data/groups.ts +1 -1
- package/dist/data/skinToneVariations.js +2 -2
- package/dist/data/skinToneVariations.ts +10 -12
- package/dist/emoji-picker-react.cjs.development.js +107 -89
- 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 +107 -89
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/dist/hooks/useActiveCategoryScrollDetection.d.ts +1 -1
- package/dist/hooks/useEmojiVirtualization.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/typeRefinements/typeRefinements.d.ts +1 -1
- package/dist/types/exposedTypes.d.ts +3 -0
- package/dist/virtualization/virtualizationHelpers.d.ts +1 -1
- package/package.json +1 -1
- package/src/DomUtils/classNames.ts +2 -2
- package/src/DomUtils/detectEmojyPartiallyBelowFold.ts +1 -1
- package/src/DomUtils/elementPositionInRow.ts +3 -3
- package/src/DomUtils/keyboardNavigation.ts +2 -2
- package/src/DomUtils/scrollTo.ts +2 -2
- package/src/DomUtils/selectors.ts +18 -17
- package/src/Stylesheet/stylesheet.tsx +22 -22
- package/src/components/Layout/Flex.tsx +6 -6
- package/src/components/Layout/Space.tsx +0 -1
- package/src/components/Reactions/BtnPlus.tsx +8 -8
- package/src/components/Reactions/DEFAULT_REACTIONS.ts +1 -1
- package/src/components/atoms/Button.tsx +6 -7
- package/src/components/body/Body.tsx +3 -3
- package/src/components/body/EmojiCategory.tsx +8 -8
- package/src/components/body/EmojiList.tsx +9 -9
- package/src/components/body/EmojiVariationPicker.tsx +22 -23
- package/src/components/body/MeasureEmoji.tsx +10 -11
- package/src/components/context/ElementRefContext.tsx +5 -6
- package/src/components/context/PickerConfigContext.tsx +5 -6
- package/src/components/context/PickerContext.tsx +8 -8
- package/src/components/context/PickerDataContext.tsx +2 -3
- package/src/components/emoji/ClickableEmojiButton.tsx +15 -14
- package/src/components/emoji/Emoji.tsx +1 -1
- package/src/components/emoji/EmojiImg.tsx +10 -5
- package/src/components/emoji/ExportedEmoji.tsx +1 -1
- package/src/components/emoji/NativeEmoji.tsx +4 -4
- package/src/components/emoji/ViewOnlyEmoji.tsx +2 -3
- package/src/components/emoji/emojiStyles.ts +3 -3
- package/src/components/footer/Preview.tsx +10 -10
- package/src/components/header/Search/BtnClearSearch.tsx +13 -13
- package/src/components/header/Search/IcnSearch.tsx +3 -3
- package/src/components/header/Search/Search.tsx +18 -18
- package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +15 -14
- package/src/components/header/SkinTonePicker/SkinTonePicker.tsx +15 -15
- package/src/components/main/PickerMain.tsx +16 -16
- package/src/components/navigation/CategoryButton.tsx +41 -26
- package/src/components/navigation/CategoryNavigation.tsx +14 -8
- package/src/config/config.ts +3 -0
- package/src/config/mutableConfig.ts +2 -2
- package/src/config/useConfig.ts +15 -10
- package/src/data/groups.ts +1 -1
- package/src/data/skinToneVariations.ts +10 -12
- package/src/dataUtils/DataTypes.ts +1 -1
- package/src/dataUtils/alphaNumericEmojiIndex.ts +1 -1
- package/src/dataUtils/parseNativeEmoji.ts +1 -1
- package/src/dataUtils/suggested.ts +3 -3
- package/src/hooks/preloadEmoji.ts +3 -3
- package/src/hooks/useActiveCategoryScrollDetection.ts +9 -7
- package/src/hooks/useCloseAllOpenToggles.ts +2 -2
- package/src/hooks/useDebouncedState.ts +2 -2
- package/src/hooks/useDisallowMouseMove.ts +1 -1
- package/src/hooks/useDisallowedEmojis.ts +2 -2
- package/src/hooks/useEmojiPreviewEvents.ts +8 -8
- package/src/hooks/useEmojiVirtualization.tsx +9 -9
- package/src/hooks/useFilter.ts +16 -16
- package/src/hooks/useFocus.ts +1 -1
- package/src/hooks/useHideEmojisByUniocode.ts +4 -4
- package/src/hooks/useInitialLoad.ts +1 -1
- package/src/hooks/useIsEmojiHidden.ts +1 -1
- package/src/hooks/useKeyboardNavigation.ts +18 -18
- package/src/hooks/useMouseDownHandlers.ts +18 -18
- package/src/hooks/useOnScroll.ts +1 -1
- package/src/hooks/useScrollCategoryIntoView.ts +2 -2
- package/src/index.tsx +5 -2
- package/src/typeRefinements/typeRefinements.ts +2 -2
- package/src/types/exposedTypes.ts +11 -6
- package/src/virtualization/virtualizationHelpers.ts +2 -2
|
@@ -8,23 +8,23 @@ import {
|
|
|
8
8
|
buttonFromTarget,
|
|
9
9
|
elementHeight,
|
|
10
10
|
emojiTrueOffsetTop,
|
|
11
|
-
emojiTruOffsetLeft
|
|
11
|
+
emojiTruOffsetLeft,
|
|
12
12
|
} from '../../DomUtils/selectors';
|
|
13
13
|
import { darkMode, stylesheet } from '../../Stylesheet/stylesheet';
|
|
14
14
|
import {
|
|
15
15
|
useEmojiStyleConfig,
|
|
16
|
-
useGetEmojiUrlConfig
|
|
16
|
+
useGetEmojiUrlConfig,
|
|
17
17
|
} from '../../config/useConfig';
|
|
18
18
|
import {
|
|
19
19
|
emojiHasVariations,
|
|
20
20
|
emojiUnified,
|
|
21
|
-
emojiVariations
|
|
21
|
+
emojiVariations,
|
|
22
22
|
} from '../../dataUtils/emojiSelectors';
|
|
23
23
|
import {
|
|
24
24
|
useAnchoredEmojiRef,
|
|
25
25
|
useBodyRef,
|
|
26
26
|
useSetAnchoredEmojiRef,
|
|
27
|
-
useVariationPickerRef
|
|
27
|
+
useVariationPickerRef,
|
|
28
28
|
} from '../context/ElementRefContext';
|
|
29
29
|
import { useEmojiVariationPickerState } from '../context/PickerContext';
|
|
30
30
|
import { ClickableEmoji } from '../emoji/Emoji';
|
|
@@ -33,7 +33,7 @@ import SVGTriangle from './svg/triangle.svg';
|
|
|
33
33
|
|
|
34
34
|
enum Direction {
|
|
35
35
|
Up,
|
|
36
|
-
Down
|
|
36
|
+
Down,
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// eslint-disable-next-line complexity
|
|
@@ -43,9 +43,8 @@ export function EmojiVariationPicker() {
|
|
|
43
43
|
const [emoji] = useEmojiVariationPickerState();
|
|
44
44
|
const emojiStyle = useEmojiStyleConfig();
|
|
45
45
|
|
|
46
|
-
const { getTop, getMenuDirection } =
|
|
47
|
-
VariationPickerRef
|
|
48
|
-
);
|
|
46
|
+
const { getTop, getMenuDirection } =
|
|
47
|
+
useVariationPickerTop(VariationPickerRef);
|
|
49
48
|
const setAnchoredEmojiRef = useSetAnchoredEmojiRef();
|
|
50
49
|
const getPointerStyle = usePointerStyle(VariationPickerRef);
|
|
51
50
|
const getEmojiUrl = useGetEmojiUrlConfig();
|
|
@@ -54,9 +53,9 @@ export function EmojiVariationPicker() {
|
|
|
54
53
|
|
|
55
54
|
const visible = Boolean(
|
|
56
55
|
emoji &&
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
button &&
|
|
57
|
+
emojiHasVariations(emoji) &&
|
|
58
|
+
button.classList.contains(ClassNames.emojiHasVariations),
|
|
60
59
|
);
|
|
61
60
|
|
|
62
61
|
useEffect(() => {
|
|
@@ -82,7 +81,7 @@ export function EmojiVariationPicker() {
|
|
|
82
81
|
className={cx(
|
|
83
82
|
styles.variationPicker,
|
|
84
83
|
getMenuDirection() === Direction.Down && styles.pointingUp,
|
|
85
|
-
visible && styles.visible
|
|
84
|
+
visible && styles.visible,
|
|
86
85
|
)}
|
|
87
86
|
style={{ top }}
|
|
88
87
|
>
|
|
@@ -90,7 +89,7 @@ export function EmojiVariationPicker() {
|
|
|
90
89
|
? [emojiUnified(emoji)]
|
|
91
90
|
.concat(emojiVariations(emoji))
|
|
92
91
|
.slice(0, 6)
|
|
93
|
-
.map(unified => (
|
|
92
|
+
.map((unified) => (
|
|
94
93
|
<ClickableEmoji
|
|
95
94
|
key={unified}
|
|
96
95
|
emoji={emoji}
|
|
@@ -132,7 +131,7 @@ function usePointerStyle(VariationPickerRef: React.RefObject<HTMLElement>) {
|
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
function useVariationPickerTop(
|
|
135
|
-
VariationPickerRef: React.RefObject<HTMLElement
|
|
134
|
+
VariationPickerRef: React.RefObject<HTMLElement>,
|
|
136
135
|
) {
|
|
137
136
|
const AnchoredEmojiRef = useAnchoredEmojiRef();
|
|
138
137
|
const BodyRef = useBodyRef();
|
|
@@ -140,7 +139,7 @@ function useVariationPickerTop(
|
|
|
140
139
|
|
|
141
140
|
return {
|
|
142
141
|
getMenuDirection,
|
|
143
|
-
getTop
|
|
142
|
+
getTop,
|
|
144
143
|
};
|
|
145
144
|
|
|
146
145
|
function getMenuDirection() {
|
|
@@ -198,24 +197,24 @@ const styles = stylesheet.create({
|
|
|
198
197
|
zIndex: 'var(--epr-skin-variation-picker-z-index)',
|
|
199
198
|
background: 'var(--epr-emoji-variation-picker-bg-color)',
|
|
200
199
|
transform: 'scale(0.9)',
|
|
201
|
-
transition: 'transform 0.1s ease-out, opacity 0.2s ease-out'
|
|
200
|
+
transition: 'transform 0.1s ease-out, opacity 0.2s ease-out',
|
|
202
201
|
},
|
|
203
202
|
visible: {
|
|
204
203
|
opacity: '1',
|
|
205
204
|
visibility: 'visible',
|
|
206
205
|
pointerEvents: 'all',
|
|
207
|
-
transform: 'scale(1)'
|
|
206
|
+
transform: 'scale(1)',
|
|
208
207
|
},
|
|
209
208
|
pointingUp: {
|
|
210
209
|
'.': 'pointing-up',
|
|
211
210
|
transformOrigin: 'center 0%',
|
|
212
|
-
transform: 'scale(0.9)'
|
|
211
|
+
transform: 'scale(0.9)',
|
|
213
212
|
},
|
|
214
213
|
'.pointing-up': {
|
|
215
214
|
pointer: {
|
|
216
215
|
top: '0',
|
|
217
|
-
transform: 'rotate(180deg) translateY(100%) translateX(18px)'
|
|
218
|
-
}
|
|
216
|
+
transform: 'rotate(180deg) translateY(100%) translateX(18px)',
|
|
217
|
+
},
|
|
219
218
|
},
|
|
220
219
|
pointer: {
|
|
221
220
|
'.': 'epr-emoji-pointer',
|
|
@@ -228,9 +227,9 @@ const styles = stylesheet.create({
|
|
|
228
227
|
backgroundSize: '50px 15px',
|
|
229
228
|
top: '100%',
|
|
230
229
|
transform: 'translateX(-18px)',
|
|
231
|
-
backgroundImage: `url(${SVGTriangle})
|
|
230
|
+
backgroundImage: `url(${SVGTriangle})`,
|
|
232
231
|
},
|
|
233
232
|
...darkMode('pointer', {
|
|
234
|
-
backgroundPosition: '-25px 0'
|
|
235
|
-
})
|
|
233
|
+
backgroundPosition: '-25px 0',
|
|
234
|
+
}),
|
|
236
235
|
});
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
categoryFromCategoryConfig
|
|
5
|
-
} from '../../config/categoryConfig';
|
|
3
|
+
import { categoryFromCategoryConfig } from '../../config/categoryConfig';
|
|
6
4
|
import {
|
|
7
5
|
useCategoriesConfig,
|
|
8
6
|
useEmojiStyleConfig,
|
|
9
7
|
useGetEmojiUrlConfig,
|
|
10
|
-
useLazyLoadEmojisConfig
|
|
8
|
+
useLazyLoadEmojisConfig,
|
|
11
9
|
} from '../../config/useConfig';
|
|
12
10
|
import {
|
|
13
11
|
useGetEmojisByCategory,
|
|
14
|
-
emojiUnified
|
|
12
|
+
emojiUnified,
|
|
15
13
|
} from '../../dataUtils/emojiSelectors';
|
|
16
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
useActiveSkinToneState,
|
|
16
|
+
useEmojiSizeState,
|
|
17
|
+
} from '../context/PickerContext';
|
|
17
18
|
import { ClickableEmoji } from '../emoji/Emoji';
|
|
18
19
|
|
|
19
20
|
export function MeasureEmoji() {
|
|
@@ -38,11 +39,9 @@ export function MeasureEmoji() {
|
|
|
38
39
|
|
|
39
40
|
const firstCategory = categories[0];
|
|
40
41
|
const dummyEmoji = getEmojisByCategory(
|
|
41
|
-
categoryFromCategoryConfig(firstCategory)
|
|
42
|
+
categoryFromCategoryConfig(firstCategory),
|
|
42
43
|
)[0];
|
|
43
|
-
const unified = dummyEmoji
|
|
44
|
-
? emojiUnified(dummyEmoji, activeSkinTone)
|
|
45
|
-
: '';
|
|
44
|
+
const unified = dummyEmoji ? emojiUnified(dummyEmoji, activeSkinTone) : '';
|
|
46
45
|
|
|
47
46
|
if (!dummyEmoji) {
|
|
48
47
|
return null;
|
|
@@ -66,7 +65,7 @@ export function MeasureEmoji() {
|
|
|
66
65
|
left: 0,
|
|
67
66
|
zIndex: -1,
|
|
68
67
|
height: 'var(--epr-emoji-fullsize)',
|
|
69
|
-
width: 'var(--epr-emoji-fullsize)'
|
|
68
|
+
width: 'var(--epr-emoji-fullsize)',
|
|
70
69
|
}}
|
|
71
70
|
/>
|
|
72
71
|
</div>
|
|
@@ -4,7 +4,7 @@ import { focusElement } from '../../DomUtils/focusElement';
|
|
|
4
4
|
import { NullableElement } from '../../DomUtils/selectors';
|
|
5
5
|
|
|
6
6
|
export function ElementRefContextProvider({
|
|
7
|
-
children
|
|
7
|
+
children,
|
|
8
8
|
}: {
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
}) {
|
|
@@ -29,7 +29,7 @@ export function ElementRefContextProvider({
|
|
|
29
29
|
SearchInputRef,
|
|
30
30
|
SkinTonePickerRef,
|
|
31
31
|
VariationPickerRef,
|
|
32
|
-
ReactionsRef
|
|
32
|
+
ReactionsRef,
|
|
33
33
|
}}
|
|
34
34
|
>
|
|
35
35
|
{children}
|
|
@@ -37,9 +37,8 @@ export function ElementRefContextProvider({
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export type ElementRef<
|
|
41
|
-
E
|
|
42
|
-
> = React.MutableRefObject<E | null>;
|
|
40
|
+
export type ElementRef<E extends HTMLElement = HTMLElement> =
|
|
41
|
+
React.MutableRefObject<E | null>;
|
|
43
42
|
|
|
44
43
|
type ElementRefs = {
|
|
45
44
|
PickerMainRef: ElementRef;
|
|
@@ -62,7 +61,7 @@ const ElementRefContext = React.createContext<ElementRefs>({
|
|
|
62
61
|
SearchInputRef: React.createRef(),
|
|
63
62
|
SkinTonePickerRef: React.createRef(),
|
|
64
63
|
VariationPickerRef: React.createRef(),
|
|
65
|
-
ReactionsRef: React.createRef()
|
|
64
|
+
ReactionsRef: React.createRef(),
|
|
66
65
|
});
|
|
67
66
|
|
|
68
67
|
function useElementRef() {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
basePickerConfig,
|
|
6
6
|
mergeConfig,
|
|
7
7
|
PickerConfig,
|
|
8
|
-
PickerConfigInternal
|
|
8
|
+
PickerConfigInternal,
|
|
9
9
|
} from '../../config/config';
|
|
10
10
|
|
|
11
11
|
type Props = PickerConfig &
|
|
@@ -13,9 +13,8 @@ type Props = PickerConfig &
|
|
|
13
13
|
children: React.ReactNode;
|
|
14
14
|
}>;
|
|
15
15
|
|
|
16
|
-
const ConfigContext =
|
|
17
|
-
basePickerConfig()
|
|
18
|
-
);
|
|
16
|
+
const ConfigContext =
|
|
17
|
+
React.createContext<PickerConfigInternal>(basePickerConfig());
|
|
19
18
|
|
|
20
19
|
export function PickerConfigProvider({ children, ...config }: Props) {
|
|
21
20
|
const mergedConfig = useSetConfig(config);
|
|
@@ -29,7 +28,7 @@ export function PickerConfigProvider({ children, ...config }: Props) {
|
|
|
29
28
|
|
|
30
29
|
export function useSetConfig(config: PickerConfig) {
|
|
31
30
|
const [mergedConfig, setMergedConfig] = React.useState(() =>
|
|
32
|
-
mergeConfig(config)
|
|
31
|
+
mergeConfig(config),
|
|
33
32
|
);
|
|
34
33
|
|
|
35
34
|
React.useEffect(() => {
|
|
@@ -60,7 +59,7 @@ export function useSetConfig(config: PickerConfig) {
|
|
|
60
59
|
config.searchDisabled,
|
|
61
60
|
config.skinTonePickerLocation,
|
|
62
61
|
config.allowExpandReactions,
|
|
63
|
-
config.emojiData
|
|
62
|
+
config.emojiData,
|
|
64
63
|
]);
|
|
65
64
|
|
|
66
65
|
return mergedConfig;
|
|
@@ -3,7 +3,7 @@ import { useState } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
useDefaultSkinToneConfig,
|
|
6
|
-
useReactionsOpenConfig
|
|
6
|
+
useReactionsOpenConfig,
|
|
7
7
|
} from '../../config/useConfig';
|
|
8
8
|
import { DataEmoji } from '../../dataUtils/DataTypes';
|
|
9
9
|
import { useDebouncedState } from '../../hooks/useDebouncedState';
|
|
@@ -11,6 +11,7 @@ import { useDisallowedEmojis } from '../../hooks/useDisallowedEmojis';
|
|
|
11
11
|
import { FilterDict } from '../../hooks/useFilter';
|
|
12
12
|
import { useMarkInitialLoad } from '../../hooks/useInitialLoad';
|
|
13
13
|
import { SkinTones } from '../../types/exposedTypes';
|
|
14
|
+
|
|
14
15
|
import { usePickerDataContext } from './PickerDataContext';
|
|
15
16
|
|
|
16
17
|
export function PickerContextProvider({ children }: Props) {
|
|
@@ -27,9 +28,8 @@ export function PickerContextProvider({ children }: Props) {
|
|
|
27
28
|
}, [searchIndex]);
|
|
28
29
|
const disallowClickRef = React.useRef<boolean>(false);
|
|
29
30
|
const disallowMouseRef = React.useRef<boolean>(false);
|
|
30
|
-
const disallowedEmojisRef =
|
|
31
|
-
disallowedEmojis
|
|
32
|
-
);
|
|
31
|
+
const disallowedEmojisRef =
|
|
32
|
+
React.useRef<Record<string, boolean>>(disallowedEmojis);
|
|
33
33
|
|
|
34
34
|
const suggestedUpdateState = useDebouncedState(Date.now(), 200);
|
|
35
35
|
const searchTerm = useDebouncedState('', 100);
|
|
@@ -62,7 +62,7 @@ export function PickerContextProvider({ children }: Props) {
|
|
|
62
62
|
suggestedUpdateState,
|
|
63
63
|
reactionsModeState,
|
|
64
64
|
visibleCategoriesState,
|
|
65
|
-
emojiSizeState
|
|
65
|
+
emojiSizeState,
|
|
66
66
|
}}
|
|
67
67
|
>
|
|
68
68
|
{children}
|
|
@@ -103,7 +103,7 @@ const PickerContext = React.createContext<{
|
|
|
103
103
|
suggestedUpdateState: [Date.now(), () => {}],
|
|
104
104
|
reactionsModeState: [false, () => {}],
|
|
105
105
|
visibleCategoriesState: [[], () => []],
|
|
106
|
-
emojiSizeState: [null, () => {}]
|
|
106
|
+
emojiSizeState: [null, () => {}],
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
type Props = Readonly<{
|
|
@@ -137,7 +137,7 @@ export function useSearchTermState() {
|
|
|
137
137
|
|
|
138
138
|
export function useActiveSkinToneState(): [
|
|
139
139
|
SkinTones,
|
|
140
|
-
(skinTone: SkinTones) => void
|
|
140
|
+
(skinTone: SkinTones) => void,
|
|
141
141
|
] {
|
|
142
142
|
const { activeSkinTone } = React.useContext(PickerContext);
|
|
143
143
|
return activeSkinTone;
|
|
@@ -186,7 +186,7 @@ export function useUpdateSuggested(): [number, () => void] {
|
|
|
186
186
|
suggestedUpdated,
|
|
187
187
|
function updateSuggested() {
|
|
188
188
|
setsuggestedUpdate(Date.now());
|
|
189
|
-
}
|
|
189
|
+
},
|
|
190
190
|
];
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -3,13 +3,13 @@ import React from 'react';
|
|
|
3
3
|
import { CustomEmoji } from '../../config/customEmojiConfig';
|
|
4
4
|
import { useSuggestedEmojisModeConfig } from '../../config/useConfig';
|
|
5
5
|
import defaultEmojiData from '../../data/emojis';
|
|
6
|
-
|
|
7
6
|
import {
|
|
8
7
|
DataEmoji,
|
|
9
8
|
DataEmojis,
|
|
10
9
|
EmojiProperties,
|
|
11
10
|
EmojiProperties as Keys,
|
|
12
11
|
} from '../../dataUtils/DataTypes';
|
|
12
|
+
import { emojiByUnified } from '../../dataUtils/emojiSelectors';
|
|
13
13
|
import {
|
|
14
14
|
activeVariationFromUnified,
|
|
15
15
|
unifiedWithoutSkinTone,
|
|
@@ -19,7 +19,6 @@ import { Categories, EmojiData, SkinTones } from '../../types/exposedTypes';
|
|
|
19
19
|
|
|
20
20
|
import { usePickerConfig } from './PickerConfigContext';
|
|
21
21
|
import { useUpdateSuggested } from './PickerContext';
|
|
22
|
-
import { emojiByUnified } from '../../dataUtils/emojiSelectors';
|
|
23
22
|
|
|
24
23
|
export interface PickerDataContextValue {
|
|
25
24
|
emojiData: EmojiData;
|
|
@@ -35,7 +34,7 @@ const PickerDataContext = React.createContext<PickerDataContextValue>({
|
|
|
35
34
|
allEmojis: [],
|
|
36
35
|
allEmojisByUnified: {},
|
|
37
36
|
searchIndex: {},
|
|
38
|
-
emojiByUnified
|
|
37
|
+
emojiByUnified,
|
|
39
38
|
activeVariationFromUnified: () => null,
|
|
40
39
|
});
|
|
41
40
|
|
|
@@ -5,7 +5,7 @@ import { ClassNames } from '../../DomUtils/classNames';
|
|
|
5
5
|
import {
|
|
6
6
|
commonInteractionStyles,
|
|
7
7
|
commonStyles,
|
|
8
|
-
stylesheet
|
|
8
|
+
stylesheet,
|
|
9
9
|
} from '../../Stylesheet/stylesheet';
|
|
10
10
|
import { Button } from '../atoms/Button';
|
|
11
11
|
|
|
@@ -32,7 +32,7 @@ export function ClickableEmojiButton({
|
|
|
32
32
|
children,
|
|
33
33
|
className,
|
|
34
34
|
noBackground = false,
|
|
35
|
-
style
|
|
35
|
+
style,
|
|
36
36
|
}: ClickableEmojiButtonProps) {
|
|
37
37
|
return (
|
|
38
38
|
<Button
|
|
@@ -41,11 +41,11 @@ export function ClickableEmojiButton({
|
|
|
41
41
|
hidden && commonStyles.hidden,
|
|
42
42
|
hiddenOnSearch && commonInteractionStyles.hiddenOnSearch,
|
|
43
43
|
{
|
|
44
|
-
[ClassNames.visible]: !hidden && !hiddenOnSearch
|
|
44
|
+
[ClassNames.visible]: !hidden && !hiddenOnSearch,
|
|
45
45
|
},
|
|
46
46
|
!!(hasVariations && showVariations) && styles.hasVariations,
|
|
47
47
|
noBackground && styles.noBackground,
|
|
48
|
-
className
|
|
48
|
+
className,
|
|
49
49
|
)}
|
|
50
50
|
data-unified={unified}
|
|
51
51
|
aria-label={getAriaLabel(emojiNames)}
|
|
@@ -77,22 +77,22 @@ const styles = stylesheet.create({
|
|
|
77
77
|
overflow: 'hidden',
|
|
78
78
|
transition: 'background-color 0.2s',
|
|
79
79
|
':hover': {
|
|
80
|
-
backgroundColor: 'var(--epr-emoji-hover-color)'
|
|
80
|
+
backgroundColor: 'var(--epr-emoji-hover-color)',
|
|
81
81
|
},
|
|
82
82
|
':focus': {
|
|
83
|
-
backgroundColor: 'var(--epr-focus-bg-color)'
|
|
84
|
-
}
|
|
83
|
+
backgroundColor: 'var(--epr-focus-bg-color)',
|
|
84
|
+
},
|
|
85
85
|
},
|
|
86
86
|
noBackground: {
|
|
87
87
|
background: 'none',
|
|
88
88
|
':hover': {
|
|
89
89
|
backgroundColor: 'transparent',
|
|
90
|
-
background: 'none'
|
|
90
|
+
background: 'none',
|
|
91
91
|
},
|
|
92
92
|
':focus': {
|
|
93
93
|
backgroundColor: 'transparent',
|
|
94
|
-
background: 'none'
|
|
95
|
-
}
|
|
94
|
+
background: 'none',
|
|
95
|
+
},
|
|
96
96
|
},
|
|
97
97
|
hasVariations: {
|
|
98
98
|
'.': ClassNames.emojiHasVariations,
|
|
@@ -108,10 +108,11 @@ const styles = stylesheet.create({
|
|
|
108
108
|
borderRight: '4px solid transparent',
|
|
109
109
|
transform: 'rotate(135deg)',
|
|
110
110
|
borderBottom: '4px solid var(--epr-emoji-variation-indicator-color)',
|
|
111
|
-
zIndex: 'var(--epr-emoji-variations-indictator-z-index)'
|
|
111
|
+
zIndex: 'var(--epr-emoji-variations-indictator-z-index)',
|
|
112
112
|
},
|
|
113
113
|
':hover:after': {
|
|
114
|
-
borderBottom:
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
borderBottom:
|
|
115
|
+
'4px solid var(--epr-emoji-variation-indicator-color-hover)',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
117
118
|
});
|
|
@@ -12,21 +12,26 @@ export function EmojiImg({
|
|
|
12
12
|
lazyLoad = false,
|
|
13
13
|
imgUrl,
|
|
14
14
|
onError,
|
|
15
|
-
className
|
|
15
|
+
className,
|
|
16
16
|
}: {
|
|
17
17
|
emojiName: string;
|
|
18
18
|
emojiStyle: EmojiStyle;
|
|
19
19
|
style: React.CSSProperties;
|
|
20
20
|
lazyLoad?: boolean;
|
|
21
21
|
imgUrl: string;
|
|
22
|
-
|
|
22
|
+
onError: () => void;
|
|
23
23
|
className?: string;
|
|
24
24
|
}) {
|
|
25
25
|
return (
|
|
26
26
|
<img
|
|
27
27
|
src={imgUrl}
|
|
28
28
|
alt={emojiName}
|
|
29
|
-
className={cx(
|
|
29
|
+
className={cx(
|
|
30
|
+
styles.emojiImag,
|
|
31
|
+
emojiStyles.external,
|
|
32
|
+
emojiStyles.common,
|
|
33
|
+
className,
|
|
34
|
+
)}
|
|
30
35
|
loading={lazyLoad ? 'lazy' : 'eager'}
|
|
31
36
|
onError={onError}
|
|
32
37
|
style={style}
|
|
@@ -41,6 +46,6 @@ const styles = stylesheet.create({
|
|
|
41
46
|
maxHeight: 'var(--epr-emoji-fullsize)',
|
|
42
47
|
minWidth: 'var(--epr-emoji-fullsize)',
|
|
43
48
|
minHeight: 'var(--epr-emoji-fullsize)',
|
|
44
|
-
padding: 'var(--epr-emoji-padding)'
|
|
45
|
-
}
|
|
49
|
+
padding: 'var(--epr-emoji-padding)',
|
|
50
|
+
},
|
|
46
51
|
});
|
|
@@ -9,7 +9,7 @@ import { emojiStyles } from './emojiStyles';
|
|
|
9
9
|
export function NativeEmoji({
|
|
10
10
|
unified,
|
|
11
11
|
style,
|
|
12
|
-
className
|
|
12
|
+
className,
|
|
13
13
|
}: {
|
|
14
14
|
unified: string;
|
|
15
15
|
style: React.CSSProperties;
|
|
@@ -21,7 +21,7 @@ export function NativeEmoji({
|
|
|
21
21
|
styles.nativeEmoji,
|
|
22
22
|
emojiStyles.common,
|
|
23
23
|
emojiStyles.external,
|
|
24
|
-
className
|
|
24
|
+
className,
|
|
25
25
|
)}
|
|
26
26
|
data-unified={unified}
|
|
27
27
|
style={style}
|
|
@@ -43,6 +43,6 @@ const styles = stylesheet.create({
|
|
|
43
43
|
alignSelf: 'center',
|
|
44
44
|
justifySelf: 'center',
|
|
45
45
|
letterSpacing: '0',
|
|
46
|
-
padding: 'var(--epr-emoji-padding)'
|
|
47
|
-
}
|
|
46
|
+
padding: 'var(--epr-emoji-padding)',
|
|
47
|
+
},
|
|
48
48
|
});
|
|
@@ -4,7 +4,6 @@ import { emojiName, emojiUrlByUnified } from '../../dataUtils/emojiUtils';
|
|
|
4
4
|
import { isCustomEmoji } from '../../typeRefinements/typeRefinements';
|
|
5
5
|
import { EmojiStyle } from '../../types/exposedTypes';
|
|
6
6
|
import { useEmojisThatFailedToLoadState } from '../context/PickerContext';
|
|
7
|
-
|
|
8
7
|
import { usePickerDataContext } from '../context/PickerDataContext';
|
|
9
8
|
|
|
10
9
|
import { BaseEmojiProps } from './BaseEmojiProps';
|
|
@@ -18,7 +17,7 @@ export function ViewOnlyEmoji({
|
|
|
18
17
|
size,
|
|
19
18
|
lazyLoad,
|
|
20
19
|
getEmojiUrl = emojiUrlByUnified,
|
|
21
|
-
className
|
|
20
|
+
className,
|
|
22
21
|
}: BaseEmojiProps) {
|
|
23
22
|
const [, setEmojisThatFailedToLoad] = useEmojisThatFailedToLoadState();
|
|
24
23
|
const { emojiByUnified } = usePickerDataContext();
|
|
@@ -67,6 +66,6 @@ export function ViewOnlyEmoji({
|
|
|
67
66
|
);
|
|
68
67
|
|
|
69
68
|
function onError() {
|
|
70
|
-
setEmojisThatFailedToLoad(prev => new Set(prev).add(unified));
|
|
69
|
+
setEmojisThatFailedToLoad((prev) => new Set(prev).add(unified));
|
|
71
70
|
}
|
|
72
71
|
}
|
|
@@ -4,11 +4,11 @@ import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
|
4
4
|
export const emojiStyles = stylesheet.create({
|
|
5
5
|
external: {
|
|
6
6
|
'.': ClassNames.external,
|
|
7
|
-
fontSize: '0'
|
|
7
|
+
fontSize: '0',
|
|
8
8
|
},
|
|
9
9
|
common: {
|
|
10
10
|
alignSelf: 'center',
|
|
11
11
|
justifySelf: 'center',
|
|
12
|
-
display: 'block'
|
|
13
|
-
}
|
|
12
|
+
display: 'block',
|
|
13
|
+
},
|
|
14
14
|
});
|
|
@@ -4,12 +4,12 @@ import { useState } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
commonInteractionStyles,
|
|
7
|
-
stylesheet
|
|
7
|
+
stylesheet,
|
|
8
8
|
} from '../../Stylesheet/stylesheet';
|
|
9
9
|
import {
|
|
10
10
|
useEmojiStyleConfig,
|
|
11
11
|
useGetEmojiUrlConfig,
|
|
12
|
-
usePreviewConfig
|
|
12
|
+
usePreviewConfig,
|
|
13
13
|
} from '../../config/useConfig';
|
|
14
14
|
import { emojiName, emojiUnified } from '../../dataUtils/emojiSelectors';
|
|
15
15
|
import { useEmojiPreviewEvents } from '../../hooks/useEmojiPreviewEvents';
|
|
@@ -18,7 +18,7 @@ import Flex from '../Layout/Flex';
|
|
|
18
18
|
import Space from '../Layout/Space';
|
|
19
19
|
import {
|
|
20
20
|
useEmojiVariationPickerState,
|
|
21
|
-
useReactionsModeState
|
|
21
|
+
useReactionsModeState,
|
|
22
22
|
} from '../context/PickerContext';
|
|
23
23
|
import { usePickerDataContext } from '../context/PickerDataContext';
|
|
24
24
|
import { ViewOnlyEmoji } from '../emoji/ViewOnlyEmoji';
|
|
@@ -38,7 +38,7 @@ export function Preview() {
|
|
|
38
38
|
className={cx(
|
|
39
39
|
styles.preview,
|
|
40
40
|
commonInteractionStyles.hiddenOnReactions,
|
|
41
|
-
reactionsOpen && styles.hideOnReactions
|
|
41
|
+
reactionsOpen && styles.hideOnReactions,
|
|
42
42
|
)}
|
|
43
43
|
>
|
|
44
44
|
<PreviewBody />
|
|
@@ -61,7 +61,7 @@ export function PreviewBody() {
|
|
|
61
61
|
const emoji = emojiByUnified(
|
|
62
62
|
(previewEmoji?.unified ?? previewEmoji?.originalUnified) as
|
|
63
63
|
| string
|
|
64
|
-
| undefined
|
|
64
|
+
| undefined,
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
const show = emoji != null && previewEmoji != null;
|
|
@@ -121,19 +121,19 @@ const styles = stylesheet.create({
|
|
|
121
121
|
height: 'var(--epr-preview-height)',
|
|
122
122
|
padding: '0 var(--epr-horizontal-padding)',
|
|
123
123
|
position: 'relative',
|
|
124
|
-
zIndex: 'var(--epr-preview-z-index)'
|
|
124
|
+
zIndex: 'var(--epr-preview-z-index)',
|
|
125
125
|
},
|
|
126
126
|
label: {
|
|
127
127
|
color: 'var(--epr-preview-text-color)',
|
|
128
128
|
fontSize: 'var(--epr-preview-text-size)',
|
|
129
129
|
padding: 'var(--epr-preview-text-padding)',
|
|
130
|
-
textTransform: 'capitalize'
|
|
130
|
+
textTransform: 'capitalize',
|
|
131
131
|
},
|
|
132
132
|
emoji: {
|
|
133
|
-
padding: '0'
|
|
133
|
+
padding: '0',
|
|
134
134
|
},
|
|
135
135
|
hideOnReactions: {
|
|
136
136
|
opacity: '0',
|
|
137
|
-
transition: 'opacity 0.5s ease-in-out'
|
|
138
|
-
}
|
|
137
|
+
transition: 'opacity 0.5s ease-in-out',
|
|
138
|
+
},
|
|
139
139
|
});
|