emoji-picker-react 4.0.0-rc.26 → 4.0.0-rc.28
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/context/ElementRefContext.d.ts +1 -0
- package/dist/emoji-picker-react.cjs.development.css +2 -2
- package/dist/emoji-picker-react.cjs.development.js +211 -157
- 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 +213 -159
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/dist/hooks/useCloseAllOpenToggles.d.ts +1 -0
- package/dist/hooks/useSetVariationPicker.d.ts +2 -0
- package/package.json +1 -1
- package/src/DomUtils/elementPositionInRow.ts +1 -1
- package/src/components/body/EmojiVariationPicker.css +9 -1
- package/src/components/body/EmojiVariationPicker.tsx +6 -9
- package/src/components/context/ElementRefContext.tsx +10 -2
- package/src/components/emoji/Emoji.css +2 -2
- package/src/hooks/useCloseAllOpenToggles.ts +9 -0
- package/src/hooks/useEmojiPreviewEvents.ts +3 -3
- package/src/hooks/useFilter.ts +14 -10
- package/src/hooks/useKeyboardNavigation.ts +27 -5
- package/src/hooks/useMouseDownHandlers.ts +4 -4
- package/src/hooks/useSetVariationPicker.ts +28 -0
|
@@ -11,3 +11,4 @@ export declare function useBodyRef(): ElementRef<HTMLDivElement>;
|
|
|
11
11
|
export declare function useSearchInputRef(): ElementRef<HTMLInputElement>;
|
|
12
12
|
export declare function useSkinTonePickerRef(): ElementRef<HTMLDivElement>;
|
|
13
13
|
export declare function useCategoryNavigationRef(): ElementRef<HTMLDivElement>;
|
|
14
|
+
export declare function useVariationPickerRef(): ElementRef<HTMLDivElement>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.EmojiPickerReact button.epr-emoji{border-radius:8px;height:var(--epr-emoji-fullsize);padding:var(--epr-emoji-padding);position:relative;width:var(--epr-emoji-fullsize)}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color);border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:"";display:block;height:0;position:absolute;right:-2px;transform:rotate(135deg);width:0;z-index:var(--epr-emoji-variations-indictator-z-index)}.EmojiPickerReact button.epr-emoji>*{display:block;height:var(--epr-emoji-size);width:var(--epr-emoji-size)}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:hover:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color-hover)}.EmojiPickerReact
|
|
1
|
+
.EmojiPickerReact button.epr-emoji{border-radius:8px;height:var(--epr-emoji-fullsize);padding:var(--epr-emoji-padding);position:relative;width:var(--epr-emoji-fullsize)}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color);border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:"";display:block;height:0;position:absolute;right:-2px;transform:rotate(135deg);width:0;z-index:var(--epr-emoji-variations-indictator-z-index)}.EmojiPickerReact button.epr-emoji>*{display:block;height:var(--epr-emoji-size);width:var(--epr-emoji-size)}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:hover:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color-hover)}.EmojiPickerReact .epr-emoji-img{font-size:0}.EmojiPickerReact .epr-emoji-native{font-family:Noto Color Emoji,Apple Color Emoji,Segoe UI Emoji,Times,Symbola,Aegyptus,Code2000,Code2001,Code2002,Musica,serif,LastResort;font-size:var(--epr-emoji-size);line-height:100%}.EmojiPickerReact button.epr-emoji:hover{background-color:var(--epr-emoji-hover-color)}.EmojiPickerReact button.epr-emoji:focus{background-color:var(--epr-focus-bg-color)}
|
|
2
2
|
.EmojiPickerReact li.epr-emoji-category>.epr-emoji-category-content{grid-gap:0;display:grid;grid-template-columns:repeat(auto-fill,var(--epr-emoji-fullsize));justify-content:space-between;padding:var(--epr-category-padding);position:relative}.EmojiPickerReact li.epr-emoji-category:not(:has(.epr-visible)){display:none}.EmojiPickerReact li.epr-emoji-category>.epr-emoji-category-label{align-items:center;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);background-color:var(--epr-category-label-bg-color);color:var(--epr-category-label-text-color);display:flex;font-weight:700;height:var(--epr-category-label-height);padding:var(--epr-category-label-padding);position:-webkit-sticky;position:sticky;text-transform:capitalize;top:0;width:100%;z-index:var(--epr-category-label-z-index)}
|
|
3
3
|
.EmojiPickerReact ul.epr-emoji-list{list-style:none;margin:0;padding:0}
|
|
4
|
-
.EmojiPickerReact .epr-emoji-variation-picker{align-items:center;background:var(--epr-emoji-variation-picker-bg-color);border:1px solid var(--epr-picker-border-color);border-radius:3px;box-shadow:0 2px 5px rgba(0,0,0,.2);display:flex;height:0;height:var(--epr-emoji-variation-picker-height);justify-content:space-around;left:5px;opacity:0;padding:5px;pointer-events:none;position:absolute;right:5px;top:0;top:-100%;visibility:hidden;z-index:var(--epr-skin-variation-picker-z-index)}.EmojiPickerReact .epr-emoji-variation-picker.visible{opacity:1;pointer-events:all;visibility:visible}.EmojiPickerReact .epr-emoji-variation-picker .EmojiPickerReact .epr-emoji-variation-picker button.epr-emoji:hover{background:none}.EmojiPickerReact .epr-emoji-variation-picker .epr-emoji-pointer{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='15' xml:space='preserve'%3E%3Cg stroke-miterlimit='10'%3E%3Cpath fill='%23FFF' stroke='%23E8E7E7' d='m1.86-.43 9.83 11.53c.59.69 1.56.69 2.14 0L23.66-.43'/%3E%3Cpath fill='%23010202' stroke='%23151617' d='m26.86-.43 9.83 11.53c.59.69 1.56.69 2.14 0L48.66-.43'/%3E%3C/g%3E%3C/svg%3E");background-position:0 0;background-repeat:no-repeat;background-size:50px 15px;content:"";height:15px;position:absolute;top:-10px;width:25px}.EmojiPickerReact.epr-dark-theme .epr-emoji-variation-picker .epr-emoji-pointer{background-position:-25px 0}.EmojiPickerReact .epr-emoji-variation-picker .epr-emoji-pointer{top:100%;transform:translateX(-7px)}.EmojiPickerReact .epr-emoji-variation-picker .epr-emoji-pointer
|
|
4
|
+
.EmojiPickerReact .epr-emoji-variation-picker{align-items:center;background:var(--epr-emoji-variation-picker-bg-color);border:1px solid var(--epr-picker-border-color);border-radius:3px;box-shadow:0 2px 5px rgba(0,0,0,.2);display:flex;height:0;height:var(--epr-emoji-variation-picker-height);justify-content:space-around;left:5px;opacity:0;padding:5px;pointer-events:none;position:absolute;right:5px;top:0;top:-100%;transform:scale(.9);transition:transform .1s ease-out,opacity .2s ease-out;visibility:hidden;z-index:var(--epr-skin-variation-picker-z-index)}.EmojiPickerReact .epr-emoji-variation-picker.pointing-up{transform:scale(.9);transform-origin:center 0}.EmojiPickerReact .epr-emoji-variation-picker.visible{opacity:1;pointer-events:all;transform:scale(1);visibility:visible}.EmojiPickerReact .epr-emoji-variation-picker .EmojiPickerReact .epr-emoji-variation-picker button.epr-emoji:hover{background:none}.EmojiPickerReact .epr-emoji-variation-picker .epr-emoji-pointer{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='15' xml:space='preserve'%3E%3Cg stroke-miterlimit='10'%3E%3Cpath fill='%23FFF' stroke='%23E8E7E7' d='m1.86-.43 9.83 11.53c.59.69 1.56.69 2.14 0L23.66-.43'/%3E%3Cpath fill='%23010202' stroke='%23151617' d='m26.86-.43 9.83 11.53c.59.69 1.56.69 2.14 0L48.66-.43'/%3E%3C/g%3E%3C/svg%3E");background-position:0 0;background-repeat:no-repeat;background-size:50px 15px;content:"";height:15px;position:absolute;top:-10px;width:25px}.EmojiPickerReact.epr-dark-theme .epr-emoji-variation-picker .epr-emoji-pointer{background-position:-25px 0}.EmojiPickerReact .epr-emoji-variation-picker .epr-emoji-pointer{top:100%;transform:translateX(-7px)}.EmojiPickerReact .epr-emoji-variation-picker.pointing-up .epr-emoji-pointer{top:0;transform:rotate(180deg) translateY(100%) translateX(7px)}
|
|
5
5
|
.EmojiPickerReact .epr-body{flex:1;overflow-x:hidden;overflow-y:scroll;position:relative}
|
|
6
6
|
.EmojiPickerReact .Flex{display:flex}.EmojiPickerReact .Flex.FlexRow{flex-direction:row}.EmojiPickerReact .Flex.FlexColumn{flex-direction:column}
|
|
7
7
|
.EmojiPickerReact .epr-preview{align-items:center;border-top:1px solid var(--epr-preview-border-color);height:var(--epr-preview-height);padding:0 var(--epr-horizontal-padding);z-index:1}.EmojiPickerReact .epr-preview .epr-preview-emoji-label{color:var(--epr-preview-text-color);font-size:var(--epr-preview-text-size);padding:var(--epr-preview-text-padding);text-transform:capitalize}
|
|
@@ -130,6 +130,7 @@ function ElementRefContextProvider(_ref) {
|
|
|
130
130
|
var SearchInputRef = React.useRef(null);
|
|
131
131
|
var SkinTonePickerRef = React.useRef(null);
|
|
132
132
|
var CategoryNavigationRef = React.useRef(null);
|
|
133
|
+
var VariationPickerRef = React.useRef(null);
|
|
133
134
|
return React.createElement(ElementRefContext.Provider, {
|
|
134
135
|
value: {
|
|
135
136
|
AnchoredEmojiRef: AnchoredEmojiRef,
|
|
@@ -137,7 +138,8 @@ function ElementRefContextProvider(_ref) {
|
|
|
137
138
|
CategoryNavigationRef: CategoryNavigationRef,
|
|
138
139
|
PickerMainRef: PickerMainRef,
|
|
139
140
|
SearchInputRef: SearchInputRef,
|
|
140
|
-
SkinTonePickerRef: SkinTonePickerRef
|
|
141
|
+
SkinTonePickerRef: SkinTonePickerRef,
|
|
142
|
+
VariationPickerRef: VariationPickerRef
|
|
141
143
|
}
|
|
142
144
|
}, children);
|
|
143
145
|
}
|
|
@@ -147,7 +149,8 @@ var ElementRefContext = /*#__PURE__*/React.createContext({
|
|
|
147
149
|
CategoryNavigationRef: /*#__PURE__*/React.createRef(),
|
|
148
150
|
PickerMainRef: /*#__PURE__*/React.createRef(),
|
|
149
151
|
SearchInputRef: /*#__PURE__*/React.createRef(),
|
|
150
|
-
SkinTonePickerRef: /*#__PURE__*/React.createRef()
|
|
152
|
+
SkinTonePickerRef: /*#__PURE__*/React.createRef(),
|
|
153
|
+
VariationPickerRef: /*#__PURE__*/React.createRef()
|
|
151
154
|
});
|
|
152
155
|
|
|
153
156
|
function useElementRef() {
|
|
@@ -178,6 +181,9 @@ function useSkinTonePickerRef() {
|
|
|
178
181
|
function useCategoryNavigationRef() {
|
|
179
182
|
return useElementRef()['CategoryNavigationRef'];
|
|
180
183
|
}
|
|
184
|
+
function useVariationPickerRef() {
|
|
185
|
+
return useElementRef()['VariationPickerRef'];
|
|
186
|
+
}
|
|
181
187
|
|
|
182
188
|
function scrollTo(root, top) {
|
|
183
189
|
if (top === void 0) {
|
|
@@ -15323,7 +15329,7 @@ function rowNumber(parent, element) {
|
|
|
15323
15329
|
var elementHeight = element.getBoundingClientRect().height;
|
|
15324
15330
|
var elementTop = element.getBoundingClientRect().top;
|
|
15325
15331
|
var parentTop = parent.getBoundingClientRect().top;
|
|
15326
|
-
return Math.
|
|
15332
|
+
return Math.round((elementTop - parentTop) / elementHeight) - 1;
|
|
15327
15333
|
}
|
|
15328
15334
|
function hasNextRow(parent, element) {
|
|
15329
15335
|
if (!parent || !element) {
|
|
@@ -15706,11 +15712,177 @@ function useCloseAllOpenToggles() {
|
|
|
15706
15712
|
}, [variationPicker, skinToneFanOpen, setVariationPicker, setSkinToneFanOpen]);
|
|
15707
15713
|
return closeAllOpenToggles;
|
|
15708
15714
|
}
|
|
15715
|
+
function useHasOpenToggles() {
|
|
15716
|
+
var _useEmojiVariationPic2 = useEmojiVariationPickerState(),
|
|
15717
|
+
variationPicker = _useEmojiVariationPic2[0];
|
|
15718
|
+
|
|
15719
|
+
var _useSkinToneFanOpenSt2 = useSkinToneFanOpenState(),
|
|
15720
|
+
skinToneFanOpen = _useSkinToneFanOpenSt2[0];
|
|
15721
|
+
|
|
15722
|
+
return function hasOpenToggles() {
|
|
15723
|
+
return !!variationPicker || skinToneFanOpen;
|
|
15724
|
+
};
|
|
15725
|
+
}
|
|
15726
|
+
|
|
15727
|
+
function focusElement(element) {
|
|
15728
|
+
if (!element) {
|
|
15729
|
+
return;
|
|
15730
|
+
}
|
|
15731
|
+
|
|
15732
|
+
requestAnimationFrame(function () {
|
|
15733
|
+
element.focus();
|
|
15734
|
+
});
|
|
15735
|
+
}
|
|
15736
|
+
function focusPrevElementSibling(element) {
|
|
15737
|
+
if (!element) return;
|
|
15738
|
+
var prev = element.previousElementSibling;
|
|
15739
|
+
focusElement(prev);
|
|
15740
|
+
}
|
|
15741
|
+
function focusNextElementSibling(element) {
|
|
15742
|
+
if (!element) return;
|
|
15743
|
+
var next = element.nextElementSibling;
|
|
15744
|
+
focusElement(next);
|
|
15745
|
+
}
|
|
15746
|
+
function focusFirstElementChild(element) {
|
|
15747
|
+
if (!element) return;
|
|
15748
|
+
var first = element.firstElementChild;
|
|
15749
|
+
focusElement(first);
|
|
15750
|
+
}
|
|
15751
|
+
|
|
15752
|
+
function focusFirstVisibleEmoji(parent) {
|
|
15753
|
+
focusElement(firstVisibleEmoji(parent));
|
|
15754
|
+
}
|
|
15755
|
+
function focusAndClickFirstVisibleEmoji(parent) {
|
|
15756
|
+
var firstEmoji = firstVisibleEmoji(parent);
|
|
15757
|
+
focusElement(firstEmoji);
|
|
15758
|
+
firstEmoji == null ? void 0 : firstEmoji.click();
|
|
15759
|
+
}
|
|
15760
|
+
function focusLastVisibleEmoji(parent) {
|
|
15761
|
+
focusElement(lastVisibleEmoji(parent));
|
|
15762
|
+
}
|
|
15763
|
+
function focusNextVisibleEmoji(element) {
|
|
15764
|
+
if (!element) {
|
|
15765
|
+
return;
|
|
15766
|
+
}
|
|
15767
|
+
|
|
15768
|
+
var next = nextVisibleEmoji(element);
|
|
15769
|
+
|
|
15770
|
+
if (!next) {
|
|
15771
|
+
return focusFirstVisibleEmoji(nextCategory(element));
|
|
15772
|
+
}
|
|
15773
|
+
|
|
15774
|
+
focusElement(next);
|
|
15775
|
+
}
|
|
15776
|
+
function focusPrevVisibleEmoji(element) {
|
|
15777
|
+
if (!element) {
|
|
15778
|
+
return;
|
|
15779
|
+
}
|
|
15780
|
+
|
|
15781
|
+
var prev = prevVisibleEmoji(element);
|
|
15782
|
+
|
|
15783
|
+
if (!prev) {
|
|
15784
|
+
return focusLastVisibleEmoji(prevCategory(element));
|
|
15785
|
+
}
|
|
15786
|
+
|
|
15787
|
+
focusElement(prev);
|
|
15788
|
+
}
|
|
15789
|
+
function focusVisibleEmojiOneRowUp(element, exitUp) {
|
|
15790
|
+
if (!element) {
|
|
15791
|
+
return;
|
|
15792
|
+
}
|
|
15793
|
+
|
|
15794
|
+
var prev = visibleEmojiOneRowUp(element);
|
|
15795
|
+
|
|
15796
|
+
if (!prev) {
|
|
15797
|
+
return exitUp();
|
|
15798
|
+
}
|
|
15799
|
+
|
|
15800
|
+
focusElement(prev);
|
|
15801
|
+
}
|
|
15802
|
+
function focusVisibleEmojiOneRowDown(element) {
|
|
15803
|
+
if (!element) {
|
|
15804
|
+
return;
|
|
15805
|
+
}
|
|
15806
|
+
|
|
15807
|
+
var next = visibleEmojiOneRowDown(element);
|
|
15808
|
+
return focusElement(next);
|
|
15809
|
+
}
|
|
15810
|
+
|
|
15811
|
+
function visibleEmojiOneRowUp(element) {
|
|
15812
|
+
if (!element) {
|
|
15813
|
+
return null;
|
|
15814
|
+
}
|
|
15815
|
+
|
|
15816
|
+
var category = closestCategory(element);
|
|
15817
|
+
var indexInRow = elementIndexInRow(category, element);
|
|
15818
|
+
var row = rowNumber(category, element);
|
|
15819
|
+
var countInRow = elementCountInRow(category, element);
|
|
15820
|
+
|
|
15821
|
+
if (row === 0) {
|
|
15822
|
+
var prevVisibleCategory = prevCategory(category);
|
|
15823
|
+
|
|
15824
|
+
if (!prevVisibleCategory) {
|
|
15825
|
+
return null;
|
|
15826
|
+
}
|
|
15827
|
+
|
|
15828
|
+
return getElementInRow(allVisibleEmojis(prevVisibleCategory), -1, // last row
|
|
15829
|
+
countInRow, indexInRow);
|
|
15830
|
+
}
|
|
15831
|
+
|
|
15832
|
+
return getElementInPrevRow(allVisibleEmojis(category), row, countInRow, indexInRow);
|
|
15833
|
+
}
|
|
15834
|
+
|
|
15835
|
+
function visibleEmojiOneRowDown(element) {
|
|
15836
|
+
if (!element) {
|
|
15837
|
+
return null;
|
|
15838
|
+
}
|
|
15839
|
+
|
|
15840
|
+
var category = closestCategory(element);
|
|
15841
|
+
var indexInRow = elementIndexInRow(category, element);
|
|
15842
|
+
var row = rowNumber(category, element);
|
|
15843
|
+
var countInRow = elementCountInRow(category, element);
|
|
15844
|
+
|
|
15845
|
+
if (!hasNextRow(category, element)) {
|
|
15846
|
+
var nextVisibleCategory = nextCategory(category);
|
|
15847
|
+
|
|
15848
|
+
if (!nextVisibleCategory) {
|
|
15849
|
+
return null;
|
|
15850
|
+
}
|
|
15851
|
+
|
|
15852
|
+
return getElementInRow(allVisibleEmojis(nextVisibleCategory), 0, countInRow, indexInRow);
|
|
15853
|
+
}
|
|
15854
|
+
|
|
15855
|
+
var itemInNextRow = getElementInNextRow(allVisibleEmojis(category), row, countInRow, indexInRow);
|
|
15856
|
+
return itemInNextRow;
|
|
15857
|
+
}
|
|
15858
|
+
|
|
15859
|
+
function useSetVariationPicker() {
|
|
15860
|
+
var setAnchoredEmojiRef = useSetAnchoredEmojiRef();
|
|
15861
|
+
|
|
15862
|
+
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
15863
|
+
setEmojiVariationPicker = _useEmojiVariationPic[1];
|
|
15864
|
+
|
|
15865
|
+
var VariationPickerRef = useVariationPickerRef();
|
|
15866
|
+
return function setVariationPicker(element) {
|
|
15867
|
+
var _emojiFromElement = emojiFromElement(element),
|
|
15868
|
+
emoji = _emojiFromElement[0];
|
|
15869
|
+
|
|
15870
|
+
if (!emoji) {
|
|
15871
|
+
return;
|
|
15872
|
+
}
|
|
15873
|
+
|
|
15874
|
+
setAnchoredEmojiRef(element);
|
|
15875
|
+
setEmojiVariationPicker(emoji);
|
|
15876
|
+
requestAnimationFrame(function () {
|
|
15877
|
+
focusFirstVisibleEmoji(VariationPickerRef.current);
|
|
15878
|
+
});
|
|
15879
|
+
};
|
|
15880
|
+
}
|
|
15709
15881
|
|
|
15710
15882
|
function useMouseDownHandlers(BodyRef) {
|
|
15711
15883
|
var mouseDownTimerRef = React.useRef();
|
|
15712
15884
|
var preloading = React.useRef(false);
|
|
15713
|
-
var
|
|
15885
|
+
var setVariationPicker = useSetVariationPicker();
|
|
15714
15886
|
var disallowClickRef = useDisallowClickRef();
|
|
15715
15887
|
|
|
15716
15888
|
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
@@ -15772,10 +15944,10 @@ function useMouseDownHandlers(BodyRef) {
|
|
|
15772
15944
|
disallowClickRef.current = true;
|
|
15773
15945
|
mouseDownTimerRef.current = undefined;
|
|
15774
15946
|
closeAllOpenToggles();
|
|
15775
|
-
|
|
15947
|
+
setVariationPicker(event.target);
|
|
15776
15948
|
setEmojiVariationPicker(emoji);
|
|
15777
15949
|
}, 500);
|
|
15778
|
-
}, [disallowClickRef, closeAllOpenToggles,
|
|
15950
|
+
}, [disallowClickRef, closeAllOpenToggles, setVariationPicker, emojiStyle, setEmojiVariationPicker]);
|
|
15779
15951
|
var onMouseUp = React.useCallback(function onMouseUp() {
|
|
15780
15952
|
preloading.current = false;
|
|
15781
15953
|
|
|
@@ -15991,16 +16163,18 @@ function useApplyFilterToDom() {
|
|
|
15991
16163
|
var PickerMainRef = usePickerMainRef();
|
|
15992
16164
|
var filterRef = useFilterRef();
|
|
15993
16165
|
return function applyFilterToDom(searchTerm) {
|
|
15994
|
-
|
|
16166
|
+
requestAnimationFrame(function () {
|
|
16167
|
+
var _PickerMainRef$curren;
|
|
15995
16168
|
|
|
15996
|
-
|
|
15997
|
-
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
|
|
16001
|
-
|
|
16169
|
+
(_PickerMainRef$curren = PickerMainRef.current) == null ? void 0 : _PickerMainRef$curren.classList.toggle(ClassNames.searchActive, !!searchTerm);
|
|
16170
|
+
iterateEmojiRef(function (element, unified) {
|
|
16171
|
+
if (isEmojiFilteredBySearchTerm(unified, filterRef.current, searchTerm)) {
|
|
16172
|
+
hideElementOnSearch(element);
|
|
16173
|
+
return;
|
|
16174
|
+
}
|
|
16002
16175
|
|
|
16003
|
-
|
|
16176
|
+
showElementOnSearch(element);
|
|
16177
|
+
});
|
|
16004
16178
|
});
|
|
16005
16179
|
};
|
|
16006
16180
|
}
|
|
@@ -16316,7 +16490,7 @@ var Direction;
|
|
|
16316
16490
|
})(Direction || (Direction = {}));
|
|
16317
16491
|
|
|
16318
16492
|
function EmojiVariationPicker() {
|
|
16319
|
-
var VariationPickerRef =
|
|
16493
|
+
var VariationPickerRef = useVariationPickerRef();
|
|
16320
16494
|
|
|
16321
16495
|
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
16322
16496
|
emoji = _useEmojiVariationPic[0];
|
|
@@ -16343,7 +16517,8 @@ function EmojiVariationPicker() {
|
|
|
16343
16517
|
return React.createElement("div", {
|
|
16344
16518
|
ref: VariationPickerRef,
|
|
16345
16519
|
className: clsx('epr-emoji-variation-picker', {
|
|
16346
|
-
visible: visible
|
|
16520
|
+
visible: visible,
|
|
16521
|
+
'pointing-up': getMenuDirection() === Direction.Down
|
|
16347
16522
|
}),
|
|
16348
16523
|
style: {
|
|
16349
16524
|
top: top
|
|
@@ -16357,9 +16532,7 @@ function EmojiVariationPicker() {
|
|
|
16357
16532
|
showVariations: false
|
|
16358
16533
|
});
|
|
16359
16534
|
}) : null, React.createElement("div", {
|
|
16360
|
-
className:
|
|
16361
|
-
'pointing-up': getMenuDirection() === Direction.Down
|
|
16362
|
-
}),
|
|
16535
|
+
className: "epr-emoji-pointer",
|
|
16363
16536
|
style: pointerStyle
|
|
16364
16537
|
}));
|
|
16365
16538
|
}
|
|
@@ -16442,31 +16615,6 @@ function Body() {
|
|
|
16442
16615
|
}, React.createElement(EmojiVariationPicker, null), React.createElement(EmojiList, null));
|
|
16443
16616
|
}
|
|
16444
16617
|
|
|
16445
|
-
function focusElement(element) {
|
|
16446
|
-
if (!element) {
|
|
16447
|
-
return;
|
|
16448
|
-
}
|
|
16449
|
-
|
|
16450
|
-
requestAnimationFrame(function () {
|
|
16451
|
-
element.focus();
|
|
16452
|
-
});
|
|
16453
|
-
}
|
|
16454
|
-
function focusPrevElementSibling(element) {
|
|
16455
|
-
if (!element) return;
|
|
16456
|
-
var prev = element.previousElementSibling;
|
|
16457
|
-
focusElement(prev);
|
|
16458
|
-
}
|
|
16459
|
-
function focusNextElementSibling(element) {
|
|
16460
|
-
if (!element) return;
|
|
16461
|
-
var next = element.nextElementSibling;
|
|
16462
|
-
focusElement(next);
|
|
16463
|
-
}
|
|
16464
|
-
function focusFirstElementChild(element) {
|
|
16465
|
-
if (!element) return;
|
|
16466
|
-
var first = element.firstElementChild;
|
|
16467
|
-
focusElement(first);
|
|
16468
|
-
}
|
|
16469
|
-
|
|
16470
16618
|
function useEmojiPreviewEvents(allow, setPreviewEmoji) {
|
|
16471
16619
|
var BodyRef = useBodyRef();
|
|
16472
16620
|
React.useEffect(function () {
|
|
@@ -16507,10 +16655,10 @@ function useEmojiPreviewEvents(allow, setPreviewEmoji) {
|
|
|
16507
16655
|
|
|
16508
16656
|
function onLeave(e) {
|
|
16509
16657
|
if (e) {
|
|
16510
|
-
var
|
|
16658
|
+
var relatedTarget = e.relatedTarget;
|
|
16511
16659
|
|
|
16512
|
-
if (
|
|
16513
|
-
return;
|
|
16660
|
+
if (!buttonFromTarget(relatedTarget)) {
|
|
16661
|
+
return setPreviewEmoji(null);
|
|
16514
16662
|
}
|
|
16515
16663
|
}
|
|
16516
16664
|
|
|
@@ -16790,113 +16938,6 @@ function getActiveElement() {
|
|
|
16790
16938
|
return document.activeElement;
|
|
16791
16939
|
}
|
|
16792
16940
|
|
|
16793
|
-
function focusFirstVisibleEmoji(parent) {
|
|
16794
|
-
focusElement(firstVisibleEmoji(parent));
|
|
16795
|
-
}
|
|
16796
|
-
function focusAndClickFirstVisibleEmoji(parent) {
|
|
16797
|
-
var firstEmoji = firstVisibleEmoji(parent);
|
|
16798
|
-
focusElement(firstEmoji);
|
|
16799
|
-
firstEmoji == null ? void 0 : firstEmoji.click();
|
|
16800
|
-
}
|
|
16801
|
-
function focusLastVisibleEmoji(parent) {
|
|
16802
|
-
focusElement(lastVisibleEmoji(parent));
|
|
16803
|
-
}
|
|
16804
|
-
function focusNextVisibleEmoji(element) {
|
|
16805
|
-
if (!element) {
|
|
16806
|
-
return;
|
|
16807
|
-
}
|
|
16808
|
-
|
|
16809
|
-
var next = nextVisibleEmoji(element);
|
|
16810
|
-
|
|
16811
|
-
if (!next) {
|
|
16812
|
-
return focusFirstVisibleEmoji(nextCategory(element));
|
|
16813
|
-
}
|
|
16814
|
-
|
|
16815
|
-
focusElement(next);
|
|
16816
|
-
}
|
|
16817
|
-
function focusPrevVisibleEmoji(element) {
|
|
16818
|
-
if (!element) {
|
|
16819
|
-
return;
|
|
16820
|
-
}
|
|
16821
|
-
|
|
16822
|
-
var prev = prevVisibleEmoji(element);
|
|
16823
|
-
|
|
16824
|
-
if (!prev) {
|
|
16825
|
-
return focusLastVisibleEmoji(prevCategory(element));
|
|
16826
|
-
}
|
|
16827
|
-
|
|
16828
|
-
focusElement(prev);
|
|
16829
|
-
}
|
|
16830
|
-
function focusVisibleEmojiOneRowUp(element, exitUp) {
|
|
16831
|
-
if (!element) {
|
|
16832
|
-
return;
|
|
16833
|
-
}
|
|
16834
|
-
|
|
16835
|
-
var prev = visibleEmojiOneRowUp(element);
|
|
16836
|
-
|
|
16837
|
-
if (!prev) {
|
|
16838
|
-
return exitUp();
|
|
16839
|
-
}
|
|
16840
|
-
|
|
16841
|
-
focusElement(prev);
|
|
16842
|
-
}
|
|
16843
|
-
function focusVisibleEmojiOneRowDown(element) {
|
|
16844
|
-
if (!element) {
|
|
16845
|
-
return;
|
|
16846
|
-
}
|
|
16847
|
-
|
|
16848
|
-
var next = visibleEmojiOneRowDown(element);
|
|
16849
|
-
return focusElement(next);
|
|
16850
|
-
}
|
|
16851
|
-
|
|
16852
|
-
function visibleEmojiOneRowUp(element) {
|
|
16853
|
-
if (!element) {
|
|
16854
|
-
return null;
|
|
16855
|
-
}
|
|
16856
|
-
|
|
16857
|
-
var category = closestCategory(element);
|
|
16858
|
-
var indexInRow = elementIndexInRow(category, element);
|
|
16859
|
-
var row = rowNumber(category, element);
|
|
16860
|
-
var countInRow = elementCountInRow(category, element);
|
|
16861
|
-
|
|
16862
|
-
if (row === 0) {
|
|
16863
|
-
var prevVisibleCategory = prevCategory(category);
|
|
16864
|
-
|
|
16865
|
-
if (!prevVisibleCategory) {
|
|
16866
|
-
return null;
|
|
16867
|
-
}
|
|
16868
|
-
|
|
16869
|
-
return getElementInRow(allVisibleEmojis(prevVisibleCategory), -1, // last row
|
|
16870
|
-
countInRow, indexInRow);
|
|
16871
|
-
}
|
|
16872
|
-
|
|
16873
|
-
return getElementInPrevRow(allVisibleEmojis(category), row, countInRow, indexInRow);
|
|
16874
|
-
}
|
|
16875
|
-
|
|
16876
|
-
function visibleEmojiOneRowDown(element) {
|
|
16877
|
-
if (!element) {
|
|
16878
|
-
return null;
|
|
16879
|
-
}
|
|
16880
|
-
|
|
16881
|
-
var category = closestCategory(element);
|
|
16882
|
-
var indexInRow = elementIndexInRow(category, element);
|
|
16883
|
-
var row = rowNumber(category, element);
|
|
16884
|
-
var countInRow = elementCountInRow(category, element);
|
|
16885
|
-
|
|
16886
|
-
if (!hasNextRow(category, element)) {
|
|
16887
|
-
var nextVisibleCategory = nextCategory(category);
|
|
16888
|
-
|
|
16889
|
-
if (!nextVisibleCategory) {
|
|
16890
|
-
return null;
|
|
16891
|
-
}
|
|
16892
|
-
|
|
16893
|
-
return getElementInRow(allVisibleEmojis(nextVisibleCategory), 0, countInRow, indexInRow);
|
|
16894
|
-
}
|
|
16895
|
-
|
|
16896
|
-
var itemInNextRow = getElementInNextRow(allVisibleEmojis(category), row, countInRow, indexInRow);
|
|
16897
|
-
return itemInNextRow;
|
|
16898
|
-
}
|
|
16899
|
-
|
|
16900
16941
|
var KeyboardEvents;
|
|
16901
16942
|
|
|
16902
16943
|
(function (KeyboardEvents) {
|
|
@@ -16906,6 +16947,7 @@ var KeyboardEvents;
|
|
|
16906
16947
|
KeyboardEvents["ArrowRight"] = "ArrowRight";
|
|
16907
16948
|
KeyboardEvents["Escape"] = "Escape";
|
|
16908
16949
|
KeyboardEvents["Enter"] = "Enter";
|
|
16950
|
+
KeyboardEvents["Space"] = " ";
|
|
16909
16951
|
})(KeyboardEvents || (KeyboardEvents = {}));
|
|
16910
16952
|
|
|
16911
16953
|
function useKeyboardNavigation() {
|
|
@@ -16922,6 +16964,7 @@ function usePickerMainKeyboardEvents() {
|
|
|
16922
16964
|
var scrollTo = useScrollTo();
|
|
16923
16965
|
var SearchInputRef = useSearchInputRef();
|
|
16924
16966
|
var focusSearchInput = useFocusSearchInput();
|
|
16967
|
+
var hasOpenToggles = useHasOpenToggles();
|
|
16925
16968
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
16926
16969
|
var onKeyDown = React.useMemo(function () {
|
|
16927
16970
|
return function onKeyDown(event) {
|
|
@@ -16929,13 +16972,18 @@ function usePickerMainKeyboardEvents() {
|
|
|
16929
16972
|
|
|
16930
16973
|
if (key === KeyboardEvents.Escape) {
|
|
16931
16974
|
event.preventDefault();
|
|
16975
|
+
|
|
16976
|
+
if (hasOpenToggles()) {
|
|
16977
|
+
closeAllOpenToggles();
|
|
16978
|
+
return;
|
|
16979
|
+
}
|
|
16980
|
+
|
|
16932
16981
|
clearSearch();
|
|
16933
|
-
closeAllOpenToggles();
|
|
16934
16982
|
scrollTo(0);
|
|
16935
16983
|
focusSearchInput();
|
|
16936
16984
|
}
|
|
16937
16985
|
};
|
|
16938
|
-
}, [scrollTo, clearSearch, closeAllOpenToggles, focusSearchInput]);
|
|
16986
|
+
}, [scrollTo, clearSearch, closeAllOpenToggles, focusSearchInput, hasOpenToggles]);
|
|
16939
16987
|
React.useEffect(function () {
|
|
16940
16988
|
var current = PickerMainRef.current;
|
|
16941
16989
|
|
|
@@ -17116,6 +17164,7 @@ function useCategoryNavigationKeyboardEvents() {
|
|
|
17116
17164
|
function useBodyKeyboardEvents() {
|
|
17117
17165
|
var BodyRef = useBodyRef();
|
|
17118
17166
|
var goUpFromBody = useGoUpFromBody();
|
|
17167
|
+
var setVariationPicker = useSetVariationPicker();
|
|
17119
17168
|
var onType = useOnType();
|
|
17120
17169
|
var onKeyDown = React.useMemo(function () {
|
|
17121
17170
|
return function onKeyDown(event) {
|
|
@@ -17143,12 +17192,17 @@ function useBodyKeyboardEvents() {
|
|
|
17143
17192
|
focusVisibleEmojiOneRowUp(activeElement, goUpFromBody);
|
|
17144
17193
|
break;
|
|
17145
17194
|
|
|
17195
|
+
case KeyboardEvents.Space:
|
|
17196
|
+
event.preventDefault();
|
|
17197
|
+
setVariationPicker(event.target);
|
|
17198
|
+
break;
|
|
17199
|
+
|
|
17146
17200
|
default:
|
|
17147
17201
|
onType(event);
|
|
17148
17202
|
break;
|
|
17149
17203
|
}
|
|
17150
17204
|
};
|
|
17151
|
-
}, [goUpFromBody, onType]);
|
|
17205
|
+
}, [goUpFromBody, onType, setVariationPicker]);
|
|
17152
17206
|
React.useEffect(function () {
|
|
17153
17207
|
var current = BodyRef.current;
|
|
17154
17208
|
|