emoji-picker-react 4.17.4 → 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 +110 -93
- 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 +110 -93
- 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/hooks/useFilter.d.ts +4 -0
- 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 +18 -10
- package/src/DomUtils/classNames.ts +2 -2
- package/src/DomUtils/detectEmojyPartiallyBelowFold.ts +1 -1
- package/src/DomUtils/elementPositionInRow.ts +3 -3
- package/src/DomUtils/focusElement.ts +0 -1
- 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/Reactions/Reactions.tsx +1 -0
- 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 -2
- 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 +19 -19
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function useActiveCategoryScrollDetection({ setActiveCategory, setVisibleCategories }: {
|
|
1
|
+
export declare function useActiveCategoryScrollDetection({ setActiveCategory, setVisibleCategories, }: {
|
|
2
2
|
setActiveCategory: (category: string) => void;
|
|
3
3
|
setVisibleCategories: (categories: string[]) => void;
|
|
4
4
|
}): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { DataEmojis } from '../dataUtils/DataTypes';
|
|
3
|
-
export declare function useEmojiVirtualization({ categoryEmojis, topOffset, onHeightReady, scrollTop, isCategoryVisible }: {
|
|
3
|
+
export declare function useEmojiVirtualization({ categoryEmojis, topOffset, onHeightReady, scrollTop, isCategoryVisible, }: {
|
|
4
4
|
categoryEmojis: DataEmojis;
|
|
5
5
|
topOffset: number;
|
|
6
6
|
onHeightReady: (height: number) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FilterState } from '../components/context/PickerContext';
|
|
1
2
|
import { DataEmoji } from '../dataUtils/DataTypes';
|
|
2
3
|
export declare function useClearSearch(): () => void;
|
|
3
4
|
export declare function useAppendSearch(): (str: string) => void;
|
|
@@ -7,6 +8,9 @@ export declare function useFilter(): {
|
|
|
7
8
|
SearchInputRef: import("../components/context/ElementRefContext").ElementRef<HTMLInputElement>;
|
|
8
9
|
statusSearchResults: string;
|
|
9
10
|
};
|
|
11
|
+
export declare function filterEmojiObjectByKeyword(emojis: FilterDict, keyword: string): FilterDict;
|
|
10
12
|
export declare function useIsEmojiFiltered(): (unified: string) => boolean;
|
|
13
|
+
export declare function isEmojiFilteredBySearchTerm(unified: string, filter: FilterState, searchTerm: string): boolean;
|
|
11
14
|
export declare type FilterDict = Record<string, DataEmoji>;
|
|
15
|
+
export declare function findLongestMatch(keyword: string, dict: Record<string, FilterDict> | null): FilterDict | null;
|
|
12
16
|
export declare function getNormalizedSearchTerm(str: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PickerConfig } from './config/config';
|
|
3
3
|
export { ExportedEmoji as Emoji } from './components/emoji/ExportedEmoji';
|
|
4
|
-
export { EmojiStyle, SkinTones, Theme, Categories, EmojiClickData, SuggestionMode, SkinTonePickerLocation } from './types/exposedTypes';
|
|
4
|
+
export { EmojiStyle, SkinTones, Theme, Categories, EmojiClickData, SuggestionMode, SkinTonePickerLocation, CategoryIcons, CategoryConfig, } from './types/exposedTypes';
|
|
5
5
|
export { emojiByUnified } from './dataUtils/emojiSelectors';
|
|
6
6
|
export interface PickerProps extends PickerConfig {
|
|
7
7
|
}
|
|
8
|
+
export declare type Props = PickerProps;
|
|
8
9
|
export default function EmojiPicker(props: PickerProps): JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CustomCategoryConfig } from '../config/categoryConfig';
|
|
2
2
|
import { CustomEmoji } from '../config/customEmojiConfig';
|
|
3
|
-
import { CategoryConfig } from '../types/exposedTypes';
|
|
4
3
|
import { DataEmoji } from '../dataUtils/DataTypes';
|
|
4
|
+
import { CategoryConfig } from '../types/exposedTypes';
|
|
5
5
|
export declare function isCustomCategory(category: CategoryConfig | CustomCategoryConfig): category is CustomCategoryConfig;
|
|
6
6
|
export declare function isCustomEmoji(emoji: Partial<DataEmoji>): emoji is CustomEmoji;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
export declare type EmojiClickData = {
|
|
2
3
|
activeSkinTone: SkinTones;
|
|
3
4
|
unified: string;
|
|
@@ -11,7 +12,9 @@ export declare type EmojiClickData = {
|
|
|
11
12
|
export declare type CategoryConfig = {
|
|
12
13
|
category: Categories;
|
|
13
14
|
name: string;
|
|
15
|
+
icon?: React.ReactNode;
|
|
14
16
|
};
|
|
17
|
+
export declare type CategoryIcons = Partial<Record<Categories, React.ReactNode>>;
|
|
15
18
|
export declare type EmojiData = {
|
|
16
19
|
categories: Partial<Record<Categories, CategoryConfig>>;
|
|
17
20
|
emojis: Record<string, DataEmoji[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function shouldVirtualize({ scrollTop, clientHeight, topOffset, style, dimensions }: {
|
|
1
|
+
export declare function shouldVirtualize({ scrollTop, clientHeight, topOffset, style, dimensions, }: {
|
|
2
2
|
scrollTop: number;
|
|
3
3
|
clientHeight: number;
|
|
4
4
|
topOffset: number;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.18.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"start": "tsdx watch",
|
|
30
30
|
"build": "yarn build:data:src && yarn type-check && tsdx build --transpileOnly && yarn build:data:dist",
|
|
31
31
|
"type-check": "tsc --noEmit --incremental --pretty --project tsconfig.json",
|
|
32
|
-
"test": "
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:watch": "vitest",
|
|
34
|
+
"test:visual": "playwright test",
|
|
33
35
|
"lint": "eslint ./src --ext .ts,.tsx",
|
|
34
36
|
"prepare": "yarn build",
|
|
35
37
|
"size": "size-limit",
|
|
@@ -70,14 +72,18 @@
|
|
|
70
72
|
"@babel/core": "^7.18.10",
|
|
71
73
|
"@babel/preset-react": "^7.24.1",
|
|
72
74
|
"@babel/preset-typescript": "^7.24.1",
|
|
75
|
+
"@playwright/test": "^1.46.1",
|
|
73
76
|
"@size-limit/preset-small-lib": "^8.0.1",
|
|
74
|
-
"@storybook/addon-essentials": "^8.
|
|
77
|
+
"@storybook/addon-essentials": "^8.6.15",
|
|
75
78
|
"@storybook/addon-info": "^5.3.21",
|
|
76
|
-
"@storybook/addon-links": "^8.
|
|
77
|
-
"@storybook/addon-webpack5-compiler-swc": "1.0.
|
|
78
|
-
"@storybook/
|
|
79
|
-
"@storybook/react": "
|
|
80
|
-
"@
|
|
79
|
+
"@storybook/addon-links": "^8.6.15",
|
|
80
|
+
"@storybook/addon-webpack5-compiler-swc": "1.0.5",
|
|
81
|
+
"@storybook/react": "^8.6.15",
|
|
82
|
+
"@storybook/react-webpack5": "8.6.15",
|
|
83
|
+
"@testing-library/dom": "^10.4.1",
|
|
84
|
+
"@testing-library/jest-dom": "^6.4.8",
|
|
85
|
+
"@testing-library/react": "^16.0.0",
|
|
86
|
+
"@testing-library/user-event": "^14.5.2",
|
|
81
87
|
"@types/react": "^18.0.17",
|
|
82
88
|
"@types/react-dom": "^18.0.6",
|
|
83
89
|
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
@@ -95,17 +101,19 @@
|
|
|
95
101
|
"fs-extra": "^10.1.0",
|
|
96
102
|
"glob": "^8.0.3",
|
|
97
103
|
"husky": "^8.0.1",
|
|
104
|
+
"jsdom": "^24.1.0",
|
|
98
105
|
"lodash": "^4.17.21",
|
|
99
106
|
"react": "^18.2.0",
|
|
100
107
|
"react-dom": "^18.2.0",
|
|
101
108
|
"react-is": "^18.2.0",
|
|
102
109
|
"rollup-plugin-svg": "^2.0.0",
|
|
103
110
|
"size-limit": "^8.0.1",
|
|
104
|
-
"storybook": "8.
|
|
111
|
+
"storybook": "8.6.15",
|
|
105
112
|
"tiny-invariant": "^1.2.0",
|
|
106
113
|
"tsdx": "^0.14.1",
|
|
107
114
|
"tslib": "^2.4.0",
|
|
108
|
-
"typescript": "^4.7.4"
|
|
115
|
+
"typescript": "^4.7.4",
|
|
116
|
+
"vitest": "^2.0.5"
|
|
109
117
|
},
|
|
110
118
|
"dependencies": {
|
|
111
119
|
"flairup": "1.0.0"
|
|
@@ -18,9 +18,9 @@ export enum ClassNames {
|
|
|
18
18
|
horizontal = 'epr-horizontal',
|
|
19
19
|
variationPicker = 'epr-emoji-variation-picker',
|
|
20
20
|
darkTheme = 'epr-dark-theme',
|
|
21
|
-
autoTheme = 'epr-auto-theme'
|
|
21
|
+
autoTheme = 'epr-auto-theme',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function asSelectors(...classNames: ClassNames[]): string {
|
|
25
|
-
return classNames.map(c => `.${c}`).join('');
|
|
25
|
+
return classNames.map((c) => `.${c}`).join('');
|
|
26
26
|
}
|
|
@@ -5,7 +5,7 @@ import { NullableElement } from './selectors';
|
|
|
5
5
|
|
|
6
6
|
export function elementCountInRow(
|
|
7
7
|
parent: NullableElement,
|
|
8
|
-
element: NullableElement
|
|
8
|
+
element: NullableElement,
|
|
9
9
|
): number {
|
|
10
10
|
if (!parent || !element) {
|
|
11
11
|
return 0;
|
|
@@ -19,7 +19,7 @@ export function elementCountInRow(
|
|
|
19
19
|
export function firstVisibleElementInContainer(
|
|
20
20
|
parent: NullableElement,
|
|
21
21
|
elements: HTMLElement[],
|
|
22
|
-
maxVisibilityDiffThreshold = 0
|
|
22
|
+
maxVisibilityDiffThreshold = 0,
|
|
23
23
|
): NullableElement {
|
|
24
24
|
if (!parent || !elements.length) {
|
|
25
25
|
return null;
|
|
@@ -29,7 +29,7 @@ export function firstVisibleElementInContainer(
|
|
|
29
29
|
const parentBottom = parent.getBoundingClientRect().bottom;
|
|
30
30
|
const parentTopWithLabel = parentTop + getLabelHeight(parent);
|
|
31
31
|
|
|
32
|
-
const visibleElements = elements.find(element => {
|
|
32
|
+
const visibleElements = elements.find((element) => {
|
|
33
33
|
const elementTop = element.getBoundingClientRect().top;
|
|
34
34
|
const elementBottom = element.getBoundingClientRect().bottom;
|
|
35
35
|
const maxVisibilityDiffPixels =
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
NullableElement,
|
|
12
12
|
prevCategory,
|
|
13
13
|
prevVisibleEmoji,
|
|
14
|
-
closestCategoryContent
|
|
14
|
+
closestCategoryContent,
|
|
15
15
|
} from './selectors';
|
|
16
16
|
|
|
17
17
|
export function focusFirstVisibleEmoji(parent: NullableElement) {
|
|
@@ -63,7 +63,7 @@ export function focusPrevVisibleEmoji(element: NullableElement) {
|
|
|
63
63
|
|
|
64
64
|
export function focusVisibleEmojiOneRowUp(
|
|
65
65
|
element: NullableElement,
|
|
66
|
-
exitUp: () => void
|
|
66
|
+
exitUp: () => void,
|
|
67
67
|
) {
|
|
68
68
|
if (!element) {
|
|
69
69
|
return;
|
package/src/DomUtils/scrollTo.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
emojiDistanceFromScrollTop,
|
|
11
11
|
isEmojiBehindLabel,
|
|
12
12
|
NullableElement,
|
|
13
|
-
queryScrollBody
|
|
13
|
+
queryScrollBody,
|
|
14
14
|
} from './selectors';
|
|
15
15
|
|
|
16
16
|
export function scrollTo(root: NullableElement, top: number = 0) {
|
|
@@ -48,7 +48,7 @@ export function useScrollTo() {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
},
|
|
51
|
-
[BodyRef]
|
|
51
|
+
[BodyRef],
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataEmoji } from '../dataUtils/DataTypes';
|
|
2
2
|
import {
|
|
3
3
|
emojiByUnified,
|
|
4
|
-
unifiedWithoutSkinTone
|
|
4
|
+
unifiedWithoutSkinTone,
|
|
5
5
|
} from '../dataUtils/emojiSelectors';
|
|
6
6
|
|
|
7
7
|
import { asSelectors, ClassNames } from './classNames';
|
|
@@ -13,11 +13,11 @@ export const EmojiButtonSelector = `button${asSelectors(ClassNames.emoji)}`;
|
|
|
13
13
|
export const VisibleEmojiSelector = [
|
|
14
14
|
EmojiButtonSelector,
|
|
15
15
|
asSelectors(ClassNames.visible),
|
|
16
|
-
`:not(${asSelectors(ClassNames.hidden)})
|
|
16
|
+
`:not(${asSelectors(ClassNames.hidden)})`,
|
|
17
17
|
].join('');
|
|
18
18
|
|
|
19
19
|
export function buttonFromTarget(
|
|
20
|
-
emojiElement: NullableElement
|
|
20
|
+
emojiElement: NullableElement,
|
|
21
21
|
): HTMLButtonElement | null {
|
|
22
22
|
return emojiElement?.closest(EmojiButtonSelector) ?? null;
|
|
23
23
|
}
|
|
@@ -31,7 +31,7 @@ export function isEmojiButton(element: NullableElement): boolean {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export function emojiFromElement(
|
|
34
|
-
element: NullableElement
|
|
34
|
+
element: NullableElement,
|
|
35
35
|
): [DataEmoji, string] | [] {
|
|
36
36
|
const originalUnified = originalUnifiedFromEmojiElement(element);
|
|
37
37
|
const unified = unifiedFromEmojiElement(element);
|
|
@@ -52,18 +52,18 @@ export function emojiFromElement(
|
|
|
52
52
|
export function isEmojiElement(element: NullableElement): boolean {
|
|
53
53
|
return Boolean(
|
|
54
54
|
element?.matches(EmojiButtonSelector) ||
|
|
55
|
-
|
|
55
|
+
element?.parentElement?.matches(EmojiButtonSelector),
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function categoryLabelFromCategory(
|
|
60
|
-
category: NullableElement
|
|
60
|
+
category: NullableElement,
|
|
61
61
|
): NullableElement {
|
|
62
62
|
return category?.querySelector(asSelectors(ClassNames.label)) ?? null;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export function closestCategoryLabel(
|
|
66
|
-
element: NullableElement
|
|
66
|
+
element: NullableElement,
|
|
67
67
|
): NullableElement {
|
|
68
68
|
const category = closestCategory(element);
|
|
69
69
|
return categoryLabelFromCategory(category);
|
|
@@ -93,7 +93,7 @@ export function categoryLabelHeight(category: NullableElement): number {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
const categoryWithoutLabel = category.querySelector(
|
|
96
|
-
asSelectors(ClassNames.categoryContent)
|
|
96
|
+
asSelectors(ClassNames.categoryContent),
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
return (
|
|
@@ -156,7 +156,7 @@ export function unifiedFromEmojiElement(emoji: NullableElement): string | null {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
export function originalUnifiedFromEmojiElement(
|
|
159
|
-
emoji: NullableElement
|
|
159
|
+
emoji: NullableElement,
|
|
160
160
|
): string | null {
|
|
161
161
|
const unified = unifiedFromEmojiElement(emoji);
|
|
162
162
|
|
|
@@ -166,25 +166,26 @@ export function originalUnifiedFromEmojiElement(
|
|
|
166
166
|
return null;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
export function allUnifiedFromEmojiElement(
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
export function allUnifiedFromEmojiElement(emoji: NullableElement): {
|
|
170
|
+
unified: string | null;
|
|
171
|
+
originalUnified: string | null;
|
|
172
|
+
} {
|
|
172
173
|
if (!emoji) {
|
|
173
174
|
return {
|
|
174
175
|
unified: null,
|
|
175
|
-
originalUnified: null
|
|
176
|
+
originalUnified: null,
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
return {
|
|
180
181
|
unified: unifiedFromEmojiElement(emoji),
|
|
181
|
-
originalUnified: originalUnifiedFromEmojiElement(emoji)
|
|
182
|
+
originalUnified: originalUnifiedFromEmojiElement(emoji),
|
|
182
183
|
};
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
function elementDataSetKey(
|
|
186
187
|
element: NullableElement,
|
|
187
|
-
key: string
|
|
188
|
+
key: string,
|
|
188
189
|
): string | null {
|
|
189
190
|
return elementDataSet(element)[key] ?? null;
|
|
190
191
|
}
|
|
@@ -209,7 +210,7 @@ export function allVisibleEmojis(parent: NullableElement) {
|
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
return Array.from(
|
|
212
|
-
parent.querySelectorAll(VisibleEmojiSelector)
|
|
213
|
+
parent.querySelectorAll(VisibleEmojiSelector),
|
|
213
214
|
) as HTMLElement[];
|
|
214
215
|
}
|
|
215
216
|
|
|
@@ -319,6 +320,6 @@ export function closestCategoryContent(element: NullableElement) {
|
|
|
319
320
|
return null;
|
|
320
321
|
}
|
|
321
322
|
return element.closest(
|
|
322
|
-
asSelectors(ClassNames.categoryContent)
|
|
323
|
+
asSelectors(ClassNames.categoryContent),
|
|
323
324
|
) as HTMLElement;
|
|
324
325
|
}
|
|
@@ -10,14 +10,14 @@ const hidden = {
|
|
|
10
10
|
opacity: '0',
|
|
11
11
|
pointerEvents: 'none',
|
|
12
12
|
visibility: 'hidden',
|
|
13
|
-
overflow: 'hidden'
|
|
13
|
+
overflow: 'hidden',
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export const commonStyles = stylesheet.create({
|
|
17
17
|
hidden: {
|
|
18
18
|
'.': ClassNames.hidden,
|
|
19
|
-
...hidden
|
|
20
|
-
}
|
|
19
|
+
...hidden,
|
|
20
|
+
},
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export const PickerStyleTag = React.memo(function PickerStyleTag() {
|
|
@@ -35,20 +35,20 @@ export const commonInteractionStyles = stylesheet.create({
|
|
|
35
35
|
categoryBtn: {
|
|
36
36
|
':hover': {
|
|
37
37
|
opacity: '1',
|
|
38
|
-
backgroundPositionY: 'var(--epr-category-navigation-button-size)'
|
|
39
|
-
}
|
|
38
|
+
backgroundPositionY: 'var(--epr-category-navigation-button-size)',
|
|
39
|
+
},
|
|
40
40
|
},
|
|
41
41
|
hiddenOnSearch: {
|
|
42
42
|
'.': ClassNames.hiddenOnSearch,
|
|
43
|
-
...hidden
|
|
44
|
-
}
|
|
43
|
+
...hidden,
|
|
44
|
+
},
|
|
45
45
|
},
|
|
46
46
|
':has(input:placeholder-shown)': {
|
|
47
|
-
visibleOnSearchOnly: hidden
|
|
48
|
-
}
|
|
47
|
+
visibleOnSearchOnly: hidden,
|
|
48
|
+
},
|
|
49
49
|
},
|
|
50
50
|
hiddenOnReactions: {
|
|
51
|
-
transition: 'all 0.5s ease-in-out'
|
|
51
|
+
transition: 'all 0.5s ease-in-out',
|
|
52
52
|
},
|
|
53
53
|
'.epr-reactions': {
|
|
54
54
|
hiddenOnReactions: {
|
|
@@ -56,36 +56,36 @@ export const commonInteractionStyles = stylesheet.create({
|
|
|
56
56
|
width: '0px',
|
|
57
57
|
opacity: '0',
|
|
58
58
|
pointerEvents: 'none',
|
|
59
|
-
overflow: 'hidden'
|
|
60
|
-
}
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
},
|
|
61
61
|
},
|
|
62
62
|
'.EmojiPickerReact:not(.epr-search-active)': {
|
|
63
63
|
categoryBtn: {
|
|
64
64
|
':hover': {
|
|
65
65
|
opacity: '1',
|
|
66
|
-
backgroundPositionY: 'var(--epr-category-navigation-button-size)'
|
|
66
|
+
backgroundPositionY: 'var(--epr-category-navigation-button-size)',
|
|
67
67
|
},
|
|
68
68
|
'&.epr-active': {
|
|
69
69
|
opacity: '1',
|
|
70
|
-
backgroundPositionY: 'var(--epr-category-navigation-button-size)'
|
|
71
|
-
}
|
|
70
|
+
backgroundPositionY: 'var(--epr-category-navigation-button-size)',
|
|
71
|
+
},
|
|
72
72
|
},
|
|
73
73
|
visibleOnSearchOnly: {
|
|
74
74
|
'.': 'epr-visible-on-search-only',
|
|
75
|
-
...hidden
|
|
76
|
-
}
|
|
77
|
-
}
|
|
75
|
+
...hidden,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
export function darkMode(key: string, value: Styles) {
|
|
81
81
|
return {
|
|
82
82
|
'.epr-dark-theme': {
|
|
83
|
-
[key]: value
|
|
83
|
+
[key]: value,
|
|
84
84
|
},
|
|
85
85
|
'.epr-auto-theme': {
|
|
86
86
|
[key]: {
|
|
87
|
-
'@media (prefers-color-scheme: dark)': value
|
|
88
|
-
}
|
|
89
|
-
}
|
|
87
|
+
'@media (prefers-color-scheme: dark)': value,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
90
|
};
|
|
91
91
|
}
|
|
@@ -5,7 +5,7 @@ import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
|
5
5
|
|
|
6
6
|
export enum FlexDirection {
|
|
7
7
|
ROW = 'FlexRow',
|
|
8
|
-
COLUMN = 'FlexColumn'
|
|
8
|
+
COLUMN = 'FlexColumn',
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
type Props = Readonly<{
|
|
@@ -19,7 +19,7 @@ export default function Flex({
|
|
|
19
19
|
children,
|
|
20
20
|
className,
|
|
21
21
|
style = {},
|
|
22
|
-
direction = FlexDirection.ROW
|
|
22
|
+
direction = FlexDirection.ROW,
|
|
23
23
|
}: Props) {
|
|
24
24
|
return (
|
|
25
25
|
<div
|
|
@@ -33,12 +33,12 @@ export default function Flex({
|
|
|
33
33
|
|
|
34
34
|
const styles = stylesheet.create({
|
|
35
35
|
flex: {
|
|
36
|
-
display: 'flex'
|
|
36
|
+
display: 'flex',
|
|
37
37
|
},
|
|
38
38
|
[FlexDirection.ROW]: {
|
|
39
|
-
flexDirection: 'row'
|
|
39
|
+
flexDirection: 'row',
|
|
40
40
|
},
|
|
41
41
|
[FlexDirection.COLUMN]: {
|
|
42
|
-
flexDirection: 'column'
|
|
43
|
-
}
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
},
|
|
44
44
|
});
|
|
@@ -42,25 +42,25 @@ const styles = stylesheet.create({
|
|
|
42
42
|
backgroundColor: 'transparent',
|
|
43
43
|
backgroundRepeat: 'no-repeat',
|
|
44
44
|
backgroundSize: '20px',
|
|
45
|
-
backgroundPositionY: '0'
|
|
45
|
+
backgroundPositionY: '0',
|
|
46
46
|
},
|
|
47
47
|
':hover': {
|
|
48
48
|
color: 'var(--epr-highlight-color)',
|
|
49
49
|
backgroundColor: 'var(--epr-hover-bg-color-reduced-opacity)',
|
|
50
50
|
':after': {
|
|
51
|
-
backgroundPositionY: '-20px'
|
|
52
|
-
}
|
|
51
|
+
backgroundPositionY: '-20px',
|
|
52
|
+
},
|
|
53
53
|
},
|
|
54
54
|
':focus': {
|
|
55
55
|
color: 'var(--epr-highlight-color)',
|
|
56
56
|
backgroundColor: 'var(--epr-hover-bg-color-reduced-opacity)',
|
|
57
57
|
':after': {
|
|
58
|
-
backgroundPositionY: '-40px'
|
|
59
|
-
}
|
|
60
|
-
}
|
|
58
|
+
backgroundPositionY: '-40px',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
61
|
},
|
|
62
62
|
...darkMode('plusSign', {
|
|
63
63
|
':after': { backgroundPositionY: '-40px' },
|
|
64
|
-
':hover:after': { backgroundPositionY: '-60px' }
|
|
65
|
-
})
|
|
64
|
+
':hover:after': { backgroundPositionY: '-60px' },
|
|
65
|
+
}),
|
|
66
66
|
});
|
|
@@ -3,11 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
5
5
|
|
|
6
|
-
interface Props
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> {
|
|
6
|
+
interface Props extends React.DetailedHTMLProps<
|
|
7
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
8
|
+
HTMLButtonElement
|
|
9
|
+
> {
|
|
11
10
|
className?: string;
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -29,6 +28,6 @@ const styles = stylesheet.create({
|
|
|
29
28
|
cursor: 'pointer',
|
|
30
29
|
border: '0',
|
|
31
30
|
background: 'none',
|
|
32
|
-
outline: 'none'
|
|
33
|
-
}
|
|
31
|
+
outline: 'none',
|
|
32
|
+
},
|
|
34
33
|
});
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { ClassNames } from '../../DomUtils/classNames';
|
|
5
5
|
import {
|
|
6
6
|
commonInteractionStyles,
|
|
7
|
-
stylesheet
|
|
7
|
+
stylesheet,
|
|
8
8
|
} from '../../Stylesheet/stylesheet';
|
|
9
9
|
import { MOUSE_EVENT_SOURCE } from '../../config/useConfig';
|
|
10
10
|
import { useOnMouseMove } from '../../hooks/useDisallowMouseMove';
|
|
@@ -38,6 +38,6 @@ const styles = stylesheet.create({
|
|
|
38
38
|
flex: '1',
|
|
39
39
|
overflowY: 'scroll',
|
|
40
40
|
overflowX: 'hidden',
|
|
41
|
-
position: 'relative'
|
|
42
|
-
}
|
|
41
|
+
position: 'relative',
|
|
42
|
+
},
|
|
43
43
|
});
|
|
@@ -5,11 +5,11 @@ 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 {
|
|
11
11
|
categoryFromCategoryConfig,
|
|
12
|
-
categoryNameFromCategoryConfig
|
|
12
|
+
categoryNameFromCategoryConfig,
|
|
13
13
|
} from '../../config/categoryConfig';
|
|
14
14
|
import { CategoryConfig } from '../../types/exposedTypes';
|
|
15
15
|
|
|
@@ -26,7 +26,7 @@ export function EmojiCategory({
|
|
|
26
26
|
children,
|
|
27
27
|
hidden,
|
|
28
28
|
hiddenOnSearch,
|
|
29
|
-
height
|
|
29
|
+
height,
|
|
30
30
|
}: Props) {
|
|
31
31
|
const category = categoryFromCategoryConfig(categoryConfig);
|
|
32
32
|
const categoryName = categoryNameFromCategoryConfig(categoryConfig);
|
|
@@ -36,7 +36,7 @@ export function EmojiCategory({
|
|
|
36
36
|
className={cx(
|
|
37
37
|
styles.category,
|
|
38
38
|
hidden && commonStyles.hidden,
|
|
39
|
-
hiddenOnSearch && commonInteractionStyles.hiddenOnSearch
|
|
39
|
+
hiddenOnSearch && commonInteractionStyles.hiddenOnSearch,
|
|
40
40
|
)}
|
|
41
41
|
data-name={category}
|
|
42
42
|
aria-label={categoryName}
|
|
@@ -54,7 +54,7 @@ const styles = stylesheet.create({
|
|
|
54
54
|
'.': ClassNames.category,
|
|
55
55
|
minHeight:
|
|
56
56
|
'calc(var(--epr-emoji-fullsize) + var(--epr-category-label-height))',
|
|
57
|
-
position: 'relative'
|
|
57
|
+
position: 'relative',
|
|
58
58
|
},
|
|
59
59
|
categoryContent: {
|
|
60
60
|
'.': ClassNames.categoryContent,
|
|
@@ -63,7 +63,7 @@ const styles = stylesheet.create({
|
|
|
63
63
|
gridTemplateColumns: 'repeat(auto-fill, var(--epr-emoji-fullsize))',
|
|
64
64
|
justifyContent: 'space-between',
|
|
65
65
|
margin: 'var(--epr-category-padding)',
|
|
66
|
-
position: 'relative'
|
|
66
|
+
position: 'relative',
|
|
67
67
|
},
|
|
68
68
|
label: {
|
|
69
69
|
'.': ClassNames.label,
|
|
@@ -82,6 +82,6 @@ const styles = stylesheet.create({
|
|
|
82
82
|
textTransform: 'capitalize',
|
|
83
83
|
top: '0',
|
|
84
84
|
width: '100%',
|
|
85
|
-
zIndex: 'var(--epr-category-label-z-index)'
|
|
86
|
-
}
|
|
85
|
+
zIndex: 'var(--epr-category-label-z-index)',
|
|
86
|
+
},
|
|
87
87
|
});
|