emoji-picker-react 4.7.16-rc.0 → 4.7.16
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 +29 -29
- package/dist/DomUtils/detectEmojyPartiallyBelowFold.d.ts +2 -0
- package/dist/DomUtils/selectors.d.ts +4 -0
- package/dist/Stylesheet/stylesheet.d.ts +19 -2
- package/dist/components/emoji/ClickableEmojiButton.d.ts +3 -2
- package/dist/components/emoji/Emoji.d.ts +2 -2
- package/dist/components/main/PickerMain.d.ts +1 -0
- package/dist/config/compareConfig.d.ts +2 -0
- package/dist/config/config.d.ts +4 -1
- package/dist/config/mutableConfig.d.ts +3 -2
- package/dist/config/useConfig.d.ts +6 -1
- package/dist/emoji-picker-react.cjs.development.js +3109 -3061
- 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 +3110 -3062
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/dist/hooks/useIsEverMounted.d.ts +1 -0
- package/dist/hooks/useMouseDownHandlers.d.ts +2 -1
- package/package.json +2 -2
- package/src/DomUtils/detectEmojyPartiallyBelowFold.ts +16 -0
- package/src/DomUtils/elementPositionInRow.ts +17 -0
- package/src/DomUtils/selectors.ts +16 -0
- package/src/EmojiPickerReact.tsx +14 -30
- package/src/Stylesheet/stylesheet.tsx +17 -11
- package/src/components/Reactions/BtnPlus.tsx +11 -19
- package/src/components/Reactions/Reactions.tsx +16 -2
- package/src/components/body/Body.tsx +2 -1
- package/src/components/body/EmojiVariationPicker.tsx +4 -13
- package/src/components/body/Suggested.tsx +2 -2
- package/src/components/context/PickerConfigContext.tsx +24 -3
- package/src/components/emoji/ClickableEmojiButton.tsx +16 -5
- package/src/components/emoji/Emoji.tsx +5 -3
- package/src/components/header/Search/BtnClearSearch.tsx +5 -16
- package/src/components/header/Search/IcnSearch.tsx +4 -13
- package/src/components/header/Search/Search.tsx +8 -25
- package/src/components/main/PickerMain.tsx +14 -4
- package/src/components/navigation/CategoryButton.tsx +2 -4
- package/src/config/compareConfig.ts +28 -0
- package/src/config/config.ts +7 -2
- package/src/config/mutableConfig.ts +8 -4
- package/src/config/useConfig.ts +20 -5
- package/src/hooks/useEmojiPreviewEvents.ts +27 -5
- package/src/hooks/useIsEverMounted.ts +14 -0
- package/src/hooks/useMouseDownHandlers.ts +13 -11
- package/src/index.tsx +2 -1
- package/dist/hooks/useIsMounted.d.ts +0 -1
- package/src/hooks/useIsMounted.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsEverMounted(): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { NullableElement } from '../DomUtils/selectors';
|
|
3
|
-
|
|
3
|
+
import { MOUSE_EVENT_SOURCE } from '../config/useConfig';
|
|
4
|
+
export declare function useMouseDownHandlers(ContainerRef: React.MutableRefObject<NullableElement>, mouseEventSource: MOUSE_EVENT_SOURCE): void;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.7.16
|
|
2
|
+
"version": "4.7.16",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -98,6 +98,6 @@
|
|
|
98
98
|
"rollup-plugin-svg": "^2.0.0"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"flairup": "0.0.
|
|
101
|
+
"flairup": "0.0.38"
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NullableElement } from './selectors';
|
|
2
|
+
|
|
3
|
+
export function detectEmojyPartiallyBelowFold(
|
|
4
|
+
button: HTMLButtonElement,
|
|
5
|
+
bodyRef: NullableElement
|
|
6
|
+
): number {
|
|
7
|
+
if (!button || !bodyRef) {
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const buttonRect = button.getBoundingClientRect();
|
|
12
|
+
const bodyRect = bodyRef.getBoundingClientRect();
|
|
13
|
+
|
|
14
|
+
// If the element is obscured by at least half of its size
|
|
15
|
+
return bodyRect.height - (buttonRect.y - bodyRect.y);
|
|
16
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { DEFAULT_LABEL_HEIGHT } from '../components/main/PickerMain';
|
|
2
|
+
|
|
3
|
+
import { ClassNames, asSelectors } from './classNames';
|
|
1
4
|
import { NullableElement } from './selectors';
|
|
2
5
|
|
|
3
6
|
export function elementCountInRow(
|
|
@@ -149,10 +152,16 @@ export function firstVisibleElementInContainer(
|
|
|
149
152
|
const parentTop = parent.getBoundingClientRect().top;
|
|
150
153
|
const parentBottom = parent.getBoundingClientRect().bottom;
|
|
151
154
|
|
|
155
|
+
const parentTopWithLabel = parentTop + getLabelHight(parent);
|
|
156
|
+
|
|
152
157
|
const visibleElements = elements.find(element => {
|
|
153
158
|
const elementTop = element.getBoundingClientRect().top;
|
|
154
159
|
const elementBottom = element.getBoundingClientRect().bottom;
|
|
155
160
|
|
|
161
|
+
if (elementTop < parentTopWithLabel) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
156
165
|
return (
|
|
157
166
|
(elementTop >= parentTop && elementTop <= parentBottom) ||
|
|
158
167
|
(elementBottom >= parentTop && elementBottom <= parentBottom)
|
|
@@ -165,3 +174,11 @@ export function firstVisibleElementInContainer(
|
|
|
165
174
|
export function hasNextElementSibling(element: HTMLElement) {
|
|
166
175
|
return !!element.nextElementSibling;
|
|
167
176
|
}
|
|
177
|
+
|
|
178
|
+
function getLabelHight(parentNode: HTMLElement) {
|
|
179
|
+
return (
|
|
180
|
+
parentNode
|
|
181
|
+
.querySelector(asSelectors(ClassNames.label))
|
|
182
|
+
?.getBoundingClientRect().height ?? DEFAULT_LABEL_HEIGHT /* default */
|
|
183
|
+
);
|
|
184
|
+
}
|
|
@@ -166,6 +166,22 @@ export function originalUnifiedFromEmojiElement(
|
|
|
166
166
|
return null;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
export function allUnifiedFromEmojiElement(
|
|
170
|
+
emoji: NullableElement
|
|
171
|
+
): { unified: string | null; originalUnified: string | null } {
|
|
172
|
+
if (!emoji) {
|
|
173
|
+
return {
|
|
174
|
+
unified: null,
|
|
175
|
+
originalUnified: null
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
unified: unifiedFromEmojiElement(emoji),
|
|
181
|
+
originalUnified: originalUnifiedFromEmojiElement(emoji)
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
169
185
|
function elementDataSetKey(
|
|
170
186
|
element: NullableElement,
|
|
171
187
|
key: string
|
package/src/EmojiPickerReact.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
+
import { PickerStyleTag } from './Stylesheet/stylesheet';
|
|
3
4
|
import { Reactions } from './components/Reactions/Reactions';
|
|
4
5
|
import { Body } from './components/body/Body';
|
|
5
6
|
import { ElementRefContextProvider } from './components/context/ElementRefContext';
|
|
@@ -8,16 +9,17 @@ import { useReactionsModeState } from './components/context/PickerContext';
|
|
|
8
9
|
import { Preview } from './components/footer/Preview';
|
|
9
10
|
import { Header } from './components/header/Header';
|
|
10
11
|
import PickerMain from './components/main/PickerMain';
|
|
12
|
+
import { compareConfig } from './config/compareConfig';
|
|
13
|
+
import { useOpenConfig } from './config/useConfig';
|
|
11
14
|
|
|
12
15
|
import { PickerProps } from './index';
|
|
13
16
|
|
|
14
17
|
function EmojiPicker(props: PickerProps) {
|
|
15
18
|
return (
|
|
16
19
|
<ElementRefContextProvider>
|
|
20
|
+
<PickerStyleTag />
|
|
17
21
|
<PickerConfigProvider {...props}>
|
|
18
|
-
<
|
|
19
|
-
<ContentControl />
|
|
20
|
-
</PickerMain>
|
|
22
|
+
<ContentControl />
|
|
21
23
|
</PickerConfigProvider>
|
|
22
24
|
</ElementRefContextProvider>
|
|
23
25
|
);
|
|
@@ -26,15 +28,20 @@ function EmojiPicker(props: PickerProps) {
|
|
|
26
28
|
function ContentControl() {
|
|
27
29
|
const [reactionsDefaultOpen] = useReactionsModeState();
|
|
28
30
|
const [renderAll, setRenderAll] = React.useState(!reactionsDefaultOpen);
|
|
31
|
+
const isOpen = useOpenConfig();
|
|
29
32
|
|
|
30
33
|
React.useEffect(() => {
|
|
31
34
|
if (!renderAll) {
|
|
32
35
|
setRenderAll(true);
|
|
33
36
|
}
|
|
34
|
-
}, []);
|
|
37
|
+
}, [renderAll]);
|
|
38
|
+
|
|
39
|
+
if (!isOpen) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
35
42
|
|
|
36
43
|
return (
|
|
37
|
-
|
|
44
|
+
<PickerMain>
|
|
38
45
|
<Reactions />
|
|
39
46
|
{renderAll ? (
|
|
40
47
|
<>
|
|
@@ -43,32 +50,9 @@ function ContentControl() {
|
|
|
43
50
|
<Preview />
|
|
44
51
|
</>
|
|
45
52
|
) : null}
|
|
46
|
-
|
|
53
|
+
</PickerMain>
|
|
47
54
|
);
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
// eslint-disable-next-line complexity
|
|
51
|
-
export default React.memo(EmojiPicker,
|
|
52
|
-
const prevCustomEmojis = prev.customEmojis ?? [];
|
|
53
|
-
const nextCustomEmojis = next.customEmojis ?? [];
|
|
54
|
-
return (
|
|
55
|
-
prev.emojiVersion === next.emojiVersion &&
|
|
56
|
-
prev.reactionsDefaultOpen === next.reactionsDefaultOpen &&
|
|
57
|
-
prev.searchPlaceHolder === next.searchPlaceHolder &&
|
|
58
|
-
prev.searchPlaceholder === next.searchPlaceholder &&
|
|
59
|
-
prev.defaultSkinTone === next.defaultSkinTone &&
|
|
60
|
-
prev.skinTonesDisabled === next.skinTonesDisabled &&
|
|
61
|
-
prev.autoFocusSearch === next.autoFocusSearch &&
|
|
62
|
-
prev.emojiStyle === next.emojiStyle &&
|
|
63
|
-
prev.theme === next.theme &&
|
|
64
|
-
prev.suggestedEmojisMode === next.suggestedEmojisMode &&
|
|
65
|
-
prev.lazyLoadEmojis === next.lazyLoadEmojis &&
|
|
66
|
-
prev.className === next.className &&
|
|
67
|
-
prev.height === next.height &&
|
|
68
|
-
prev.width === next.width &&
|
|
69
|
-
prev.style === next.style &&
|
|
70
|
-
prev.searchDisabled === next.searchDisabled &&
|
|
71
|
-
prev.skinTonePickerLocation === next.skinTonePickerLocation &&
|
|
72
|
-
prevCustomEmojis.length === nextCustomEmojis.length
|
|
73
|
-
);
|
|
74
|
-
});
|
|
58
|
+
export default React.memo(EmojiPicker, compareConfig);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { createSheet } from 'flairup';
|
|
1
|
+
import { Styles, createSheet } from 'flairup';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { ClassNames } from '../DomUtils/classNames';
|
|
5
|
-
import { useIsMounted } from '../hooks/useIsMounted';
|
|
6
5
|
|
|
7
|
-
export const stylesheet = createSheet('epr');
|
|
6
|
+
export const stylesheet = createSheet('epr', null);
|
|
8
7
|
|
|
9
8
|
const hidden = {
|
|
10
9
|
display: 'none',
|
|
@@ -21,20 +20,14 @@ export const commonStyles = stylesheet.create({
|
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
export function PickerStyleTag() {
|
|
25
|
-
const isMounted = useIsMounted();
|
|
26
|
-
|
|
27
|
-
if (stylesheet.isApplied() && isMounted) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
23
|
+
export const PickerStyleTag = React.memo(function PickerStyleTag() {
|
|
31
24
|
return (
|
|
32
25
|
<style
|
|
33
26
|
suppressHydrationWarning
|
|
34
27
|
dangerouslySetInnerHTML={{ __html: stylesheet.getStyle() }}
|
|
35
28
|
/>
|
|
36
29
|
);
|
|
37
|
-
}
|
|
30
|
+
});
|
|
38
31
|
|
|
39
32
|
export const commonInteractionStyles = stylesheet.create({
|
|
40
33
|
'.epr-main': {
|
|
@@ -84,3 +77,16 @@ export const commonInteractionStyles = stylesheet.create({
|
|
|
84
77
|
}
|
|
85
78
|
}
|
|
86
79
|
});
|
|
80
|
+
|
|
81
|
+
export function darkMode(key: string, value: Styles) {
|
|
82
|
+
return {
|
|
83
|
+
'.epr-dark-theme': {
|
|
84
|
+
[key]: value
|
|
85
|
+
},
|
|
86
|
+
'.epr-auto-theme': {
|
|
87
|
+
[key]: {
|
|
88
|
+
'@media (prefers-color-scheme: dark)': value
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cx } from 'flairup';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
4
|
+
import { darkMode, stylesheet } from '../../Stylesheet/stylesheet';
|
|
5
5
|
import { Button } from '../atoms/Button';
|
|
6
6
|
import { useReactionsModeState } from '../context/PickerContext';
|
|
7
7
|
|
|
@@ -11,6 +11,8 @@ export function BtnPlus() {
|
|
|
11
11
|
const [, setReactionsMode] = useReactionsModeState();
|
|
12
12
|
return (
|
|
13
13
|
<Button
|
|
14
|
+
aria-label="Show all Emojis"
|
|
15
|
+
title="Show all Emojis"
|
|
14
16
|
tabIndex={0}
|
|
15
17
|
className={cx(styles.plusSign)}
|
|
16
18
|
onClick={() => setReactionsMode(false)}
|
|
@@ -21,7 +23,7 @@ export function BtnPlus() {
|
|
|
21
23
|
const styles = stylesheet.create({
|
|
22
24
|
plusSign: {
|
|
23
25
|
fontSize: '20px',
|
|
24
|
-
padding: '
|
|
26
|
+
padding: '17px',
|
|
25
27
|
color: 'var(--epr-text-color)',
|
|
26
28
|
borderRadius: '50%',
|
|
27
29
|
textAlign: 'center',
|
|
@@ -31,7 +33,7 @@ const styles = stylesheet.create({
|
|
|
31
33
|
display: 'flex',
|
|
32
34
|
justifyContent: 'center',
|
|
33
35
|
alignItems: 'center',
|
|
34
|
-
transition: 'background-color 0.
|
|
36
|
+
transition: 'background-color 0.2s ease-in-out',
|
|
35
37
|
':after': {
|
|
36
38
|
content: '',
|
|
37
39
|
minWidth: '20px',
|
|
@@ -44,7 +46,7 @@ const styles = stylesheet.create({
|
|
|
44
46
|
},
|
|
45
47
|
':hover': {
|
|
46
48
|
color: 'var(--epr-highlight-color)',
|
|
47
|
-
backgroundColor: 'var(--epr-hover-bg-color)',
|
|
49
|
+
backgroundColor: 'var(--epr-hover-bg-color-reduced-opacity)',
|
|
48
50
|
// @ts-ignore
|
|
49
51
|
':after': {
|
|
50
52
|
backgroundPositionY: '-20px'
|
|
@@ -52,25 +54,15 @@ const styles = stylesheet.create({
|
|
|
52
54
|
},
|
|
53
55
|
':focus': {
|
|
54
56
|
color: 'var(--epr-highlight-color)',
|
|
55
|
-
backgroundColor: 'var(--epr-hover-bg-color)',
|
|
57
|
+
backgroundColor: 'var(--epr-hover-bg-color-reduced-opacity)',
|
|
56
58
|
// @ts-ignore
|
|
57
59
|
':after': {
|
|
58
60
|
backgroundPositionY: '-40px'
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
},
|
|
62
|
-
'
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
'.epr-auto-theme': {
|
|
69
|
-
plusSign: {
|
|
70
|
-
'@media (prefers-color-scheme: dark)': {
|
|
71
|
-
':after': { backgroundPositionY: '-40px' },
|
|
72
|
-
':hover:after': { backgroundPositionY: '-60px' }
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
64
|
+
...darkMode('plusSign', {
|
|
65
|
+
':after': { backgroundPositionY: '-40px' },
|
|
66
|
+
':hover:after': { backgroundPositionY: '-60px' }
|
|
67
|
+
})
|
|
76
68
|
});
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { commonStyles, stylesheet } from '../../Stylesheet/stylesheet';
|
|
5
5
|
import {
|
|
6
|
+
MOUSE_EVENT_SOURCE,
|
|
6
7
|
useEmojiStyleConfig,
|
|
7
8
|
useReactionsConfig
|
|
8
9
|
} from '../../config/useConfig';
|
|
@@ -19,7 +20,7 @@ export function Reactions() {
|
|
|
19
20
|
const [reactionsOpen] = useReactionsModeState();
|
|
20
21
|
const ReactionsRef = useReactionsRef();
|
|
21
22
|
const reactions = useReactionsConfig();
|
|
22
|
-
useMouseDownHandlers(ReactionsRef);
|
|
23
|
+
useMouseDownHandlers(ReactionsRef, MOUSE_EVENT_SOURCE.REACTIONS);
|
|
23
24
|
const emojiStyle = useEmojiStyleConfig();
|
|
24
25
|
|
|
25
26
|
if (!reactionsOpen) {
|
|
@@ -38,7 +39,8 @@ export function Reactions() {
|
|
|
38
39
|
emojiStyle={emojiStyle}
|
|
39
40
|
unified={reaction}
|
|
40
41
|
showVariations={false}
|
|
41
|
-
|
|
42
|
+
className={cx(styles.emojiButton)}
|
|
43
|
+
noBackground
|
|
42
44
|
/>
|
|
43
45
|
</li>
|
|
44
46
|
))}
|
|
@@ -58,5 +60,17 @@ const styles = stylesheet.create({
|
|
|
58
60
|
justifyContent: 'space-between',
|
|
59
61
|
alignItems: 'center',
|
|
60
62
|
height: '100%'
|
|
63
|
+
},
|
|
64
|
+
emojiButton: {
|
|
65
|
+
':hover': {
|
|
66
|
+
transform: 'scale(1.2)'
|
|
67
|
+
},
|
|
68
|
+
':focus': {
|
|
69
|
+
transform: 'scale(1.2)'
|
|
70
|
+
},
|
|
71
|
+
':active': {
|
|
72
|
+
transform: 'scale(1.1)'
|
|
73
|
+
},
|
|
74
|
+
transition: 'transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.5)'
|
|
61
75
|
}
|
|
62
76
|
});
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
commonInteractionStyles,
|
|
7
7
|
stylesheet
|
|
8
8
|
} from '../../Stylesheet/stylesheet';
|
|
9
|
+
import { MOUSE_EVENT_SOURCE } from '../../config/useConfig';
|
|
9
10
|
import { useOnMouseMove } from '../../hooks/useDisallowMouseMove';
|
|
10
11
|
import { useMouseDownHandlers } from '../../hooks/useMouseDownHandlers';
|
|
11
12
|
import { useOnScroll } from '../../hooks/useOnScroll';
|
|
@@ -17,7 +18,7 @@ import { EmojiVariationPicker } from './EmojiVariationPicker';
|
|
|
17
18
|
export function Body() {
|
|
18
19
|
const BodyRef = useBodyRef();
|
|
19
20
|
useOnScroll(BodyRef);
|
|
20
|
-
useMouseDownHandlers(BodyRef);
|
|
21
|
+
useMouseDownHandlers(BodyRef, MOUSE_EVENT_SOURCE.PICKER);
|
|
21
22
|
useOnMouseMove();
|
|
22
23
|
|
|
23
24
|
return (
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
emojiTrueOffsetTop,
|
|
11
11
|
emojiTruOffsetLeft
|
|
12
12
|
} from '../../DomUtils/selectors';
|
|
13
|
-
import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
13
|
+
import { darkMode, stylesheet } from '../../Stylesheet/stylesheet';
|
|
14
14
|
import {
|
|
15
15
|
useEmojiStyleConfig,
|
|
16
16
|
useGetEmojiUrlConfig
|
|
@@ -230,16 +230,7 @@ const styles = stylesheet.create({
|
|
|
230
230
|
transform: 'translateX(-18px)',
|
|
231
231
|
backgroundImage: `url(${SVGTriangle})`
|
|
232
232
|
},
|
|
233
|
-
'
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
'.epr-auto-theme': {
|
|
239
|
-
pointer: {
|
|
240
|
-
'@media (prefers-color-scheme: dark)': {
|
|
241
|
-
backgroundPosition: '-25px 0'
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
233
|
+
...darkMode('pointer', {
|
|
234
|
+
backgroundPosition: '-25px 0'
|
|
235
|
+
})
|
|
245
236
|
});
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '../../config/useConfig';
|
|
9
9
|
import { emojiByUnified } from '../../dataUtils/emojiSelectors';
|
|
10
10
|
import { getSuggested } from '../../dataUtils/suggested';
|
|
11
|
-
import {
|
|
11
|
+
import { useIsEverMounted } from '../../hooks/useIsEverMounted';
|
|
12
12
|
import { useUpdateSuggested } from '../context/PickerContext';
|
|
13
13
|
import { ClickableEmoji } from '../emoji/Emoji';
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ type Props = Readonly<{
|
|
|
20
20
|
|
|
21
21
|
export function Suggested({ categoryConfig }: Props) {
|
|
22
22
|
const [suggestedUpdated] = useUpdateSuggested();
|
|
23
|
-
const isMounted =
|
|
23
|
+
const isMounted = useIsEverMounted();
|
|
24
24
|
const suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
|
|
25
25
|
const getEmojiUrl = useGetEmojiUrlConfig();
|
|
26
26
|
const suggested = React.useMemo(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
+
import { compareConfig } from '../../config/compareConfig';
|
|
3
4
|
import {
|
|
4
5
|
basePickerConfig,
|
|
5
6
|
mergeConfig,
|
|
@@ -32,12 +33,32 @@ export function useSetConfig(config: PickerConfig) {
|
|
|
32
33
|
);
|
|
33
34
|
|
|
34
35
|
React.useEffect(() => {
|
|
35
|
-
if (config
|
|
36
|
-
|
|
36
|
+
if (compareConfig(mergedConfig, config)) {
|
|
37
|
+
return;
|
|
37
38
|
}
|
|
39
|
+
setMergedConfig(mergeConfig(config));
|
|
38
40
|
// not gonna...
|
|
39
41
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
-
}, [
|
|
42
|
+
}, [
|
|
43
|
+
config.customEmojis?.length,
|
|
44
|
+
config.open,
|
|
45
|
+
config.emojiVersion,
|
|
46
|
+
config.reactionsDefaultOpen,
|
|
47
|
+
config.searchPlaceHolder,
|
|
48
|
+
config.searchPlaceholder,
|
|
49
|
+
config.defaultSkinTone,
|
|
50
|
+
config.skinTonesDisabled,
|
|
51
|
+
config.autoFocusSearch,
|
|
52
|
+
config.emojiStyle,
|
|
53
|
+
config.theme,
|
|
54
|
+
config.suggestedEmojisMode,
|
|
55
|
+
config.lazyLoadEmojis,
|
|
56
|
+
config.className,
|
|
57
|
+
config.height,
|
|
58
|
+
config.width,
|
|
59
|
+
config.searchDisabled,
|
|
60
|
+
config.skinTonePickerLocation
|
|
61
|
+
]);
|
|
41
62
|
|
|
42
63
|
return mergedConfig;
|
|
43
64
|
}
|
|
@@ -17,7 +17,8 @@ type ClickableEmojiButtonProps = Readonly<{
|
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
hasVariations: boolean;
|
|
19
19
|
unified?: string;
|
|
20
|
-
|
|
20
|
+
noBackground?: boolean;
|
|
21
|
+
className?: string;
|
|
21
22
|
}>;
|
|
22
23
|
|
|
23
24
|
export function ClickableEmojiButton({
|
|
@@ -28,7 +29,8 @@ export function ClickableEmojiButton({
|
|
|
28
29
|
showVariations = true,
|
|
29
30
|
hasVariations,
|
|
30
31
|
children,
|
|
31
|
-
|
|
32
|
+
className,
|
|
33
|
+
noBackground = false
|
|
32
34
|
}: ClickableEmojiButtonProps) {
|
|
33
35
|
return (
|
|
34
36
|
<Button
|
|
@@ -40,7 +42,8 @@ export function ClickableEmojiButton({
|
|
|
40
42
|
[ClassNames.visible]: !hidden && !hiddenOnSearch
|
|
41
43
|
},
|
|
42
44
|
!!(hasVariations && showVariations) && styles.hasVariations,
|
|
43
|
-
|
|
45
|
+
noBackground && styles.noBackground,
|
|
46
|
+
className
|
|
44
47
|
)}
|
|
45
48
|
data-unified={unified}
|
|
46
49
|
aria-label={emojiNames[0]}
|
|
@@ -73,8 +76,16 @@ const styles = stylesheet.create({
|
|
|
73
76
|
backgroundColor: 'var(--epr-focus-bg-color)'
|
|
74
77
|
}
|
|
75
78
|
},
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
noBackground: {
|
|
80
|
+
background: 'none',
|
|
81
|
+
':hover': {
|
|
82
|
+
backgroundColor: 'transparent',
|
|
83
|
+
background: 'none'
|
|
84
|
+
},
|
|
85
|
+
':focus': {
|
|
86
|
+
backgroundColor: 'transparent',
|
|
87
|
+
background: 'none'
|
|
88
|
+
}
|
|
78
89
|
},
|
|
79
90
|
hasVariations: {
|
|
80
91
|
'.': ClassNames.emojiHasVariations,
|
|
@@ -14,7 +14,7 @@ type ClickableEmojiProps = Readonly<
|
|
|
14
14
|
hiddenOnSearch?: boolean;
|
|
15
15
|
emoji: DataEmoji;
|
|
16
16
|
className?: string;
|
|
17
|
-
|
|
17
|
+
noBackground?: boolean;
|
|
18
18
|
}
|
|
19
19
|
>;
|
|
20
20
|
|
|
@@ -28,7 +28,8 @@ export function ClickableEmoji({
|
|
|
28
28
|
size,
|
|
29
29
|
lazyLoad,
|
|
30
30
|
getEmojiUrl,
|
|
31
|
-
|
|
31
|
+
className,
|
|
32
|
+
noBackground = false
|
|
32
33
|
}: ClickableEmojiProps) {
|
|
33
34
|
const hasVariations = emojiHasVariations(emoji);
|
|
34
35
|
|
|
@@ -40,7 +41,7 @@ export function ClickableEmoji({
|
|
|
40
41
|
hiddenOnSearch={hiddenOnSearch}
|
|
41
42
|
emojiNames={emojiNames(emoji)}
|
|
42
43
|
unified={unified}
|
|
43
|
-
|
|
44
|
+
noBackground={noBackground}
|
|
44
45
|
>
|
|
45
46
|
<ViewOnlyEmoji
|
|
46
47
|
unified={unified}
|
|
@@ -49,6 +50,7 @@ export function ClickableEmoji({
|
|
|
49
50
|
emojiStyle={emojiStyle}
|
|
50
51
|
lazyLoad={lazyLoad}
|
|
51
52
|
getEmojiUrl={getEmojiUrl}
|
|
53
|
+
className={className}
|
|
52
54
|
/>
|
|
53
55
|
</ClickableEmojiButton>
|
|
54
56
|
);
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
commonInteractionStyles,
|
|
6
|
+
darkMode,
|
|
6
7
|
stylesheet
|
|
7
8
|
} from '../../../Stylesheet/stylesheet';
|
|
8
9
|
import { useClearSearch } from '../../../hooks/useFilter';
|
|
@@ -72,20 +73,8 @@ const styles = stylesheet.create({
|
|
|
72
73
|
backgroundPositionY: '-20px'
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
|
-
'
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
btnClearSearch: HoverDark
|
|
80
|
-
},
|
|
81
|
-
'.epr-auto-theme': {
|
|
82
|
-
icnClearnSearch: {
|
|
83
|
-
'@media (prefers-color-scheme: dark)': {
|
|
84
|
-
backgroundPositionY: '-40px'
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
btnClearSearch: {
|
|
88
|
-
'@media (prefers-color-scheme: dark)': HoverDark
|
|
89
|
-
}
|
|
90
|
-
}
|
|
76
|
+
...darkMode('icnClearnSearch', {
|
|
77
|
+
backgroundPositionY: '-40px'
|
|
78
|
+
}),
|
|
79
|
+
...darkMode('btnClearSearch', HoverDark)
|
|
91
80
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cx } from 'flairup';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import { stylesheet } from '../../../Stylesheet/stylesheet';
|
|
4
|
+
import { darkMode, stylesheet } from '../../../Stylesheet/stylesheet';
|
|
5
5
|
|
|
6
6
|
import SVGMagnifier from './svg/magnifier.svg';
|
|
7
7
|
|
|
@@ -24,16 +24,7 @@ const styles = stylesheet.create({
|
|
|
24
24
|
backgroundSize: '20px',
|
|
25
25
|
backgroundImage: `url(${SVGMagnifier})`
|
|
26
26
|
},
|
|
27
|
-
'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
'.epr-auto-theme': {
|
|
33
|
-
icnSearch: {
|
|
34
|
-
'@media (prefers-color-scheme: dark)': {
|
|
35
|
-
backgroundPositionY: '-20px'
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
27
|
+
...darkMode('icnSearch', {
|
|
28
|
+
backgroundPositionY: '-20px'
|
|
29
|
+
})
|
|
39
30
|
});
|
|
@@ -2,7 +2,7 @@ import { cx } from 'flairup';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
|
-
import { stylesheet } from '../../../Stylesheet/stylesheet';
|
|
5
|
+
import { darkMode, stylesheet } from '../../../Stylesheet/stylesheet';
|
|
6
6
|
import {
|
|
7
7
|
useAutoFocusSearchConfig,
|
|
8
8
|
useSearchDisabledConfig,
|
|
@@ -161,29 +161,12 @@ const styles = stylesheet.create({
|
|
|
161
161
|
backgroundPositionY: '-20px'
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
|
-
'
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
backgroundPositionY: '-60px'
|
|
171
|
-
}
|
|
164
|
+
...darkMode('icnClearnSearch', {
|
|
165
|
+
backgroundPositionY: '-40px'
|
|
166
|
+
}),
|
|
167
|
+
...darkMode('btnClearSearch', {
|
|
168
|
+
':hover > .epr-icn-clear-search': {
|
|
169
|
+
backgroundPositionY: '-60px'
|
|
172
170
|
}
|
|
173
|
-
}
|
|
174
|
-
'.epr-auto-theme': {
|
|
175
|
-
icnClearnSearch: {
|
|
176
|
-
'@media (prefers-color-scheme: dark)': {
|
|
177
|
-
backgroundPositionY: '-40px'
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
btnClearSearch: {
|
|
181
|
-
'@media (prefers-color-scheme: dark)': {
|
|
182
|
-
// @ts-ignore
|
|
183
|
-
':hover > .epr-icn-clear-search': {
|
|
184
|
-
backgroundPositionY: '-60px'
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
171
|
+
})
|
|
189
172
|
});
|