@choice-ui/react 1.7.7 → 1.8.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/dist/components/emoji-picker/dist/index.d.ts +29 -1
- package/dist/components/emoji-picker/dist/index.js +144 -42
- package/dist/components/emoji-picker/src/components/emoji-empty.d.ts +4 -0
- package/dist/components/emoji-picker/src/components/emoji-empty.js +9 -3
- package/dist/components/emoji-picker/src/components/emoji-footer.d.ts +4 -1
- package/dist/components/emoji-picker/src/components/emoji-footer.js +11 -3
- package/dist/components/emoji-picker/src/emoji-picker.d.ts +16 -0
- package/dist/components/emoji-picker/src/emoji-picker.js +59 -19
- package/dist/components/emoji-picker/src/hooks/index.d.ts +1 -1
- package/dist/components/emoji-picker/src/hooks/use-emoji-data.d.ts +13 -10
- package/dist/components/emoji-picker/src/hooks/use-emoji-data.js +41 -13
- package/dist/components/emoji-picker/src/hooks/use-emoji-scroll.js +24 -3
- package/dist/components/emoji-picker/src/tv.js +1 -1
- package/dist/components/icon-button/dist/index.d.ts +1 -1
- package/dist/components/icon-button/dist/index.js +29 -0
- package/dist/components/icon-button/src/icon-button.d.ts +1 -1
- package/dist/components/icon-button/src/tv.d.ts +9 -0
- package/dist/components/icon-button/src/tv.js +29 -0
- package/dist/components/textarea/dist/index.js +3 -1
- package/dist/components/tooltip/dist/index.d.ts +2 -0
- package/dist/components/tooltip/dist/index.js +23 -5
- package/dist/components/tooltip/src/components/tooltip-content.js +20 -4
- package/dist/components/tooltip/src/tooltip.js +3 -1
- package/dist/components/tooltip/src/types.d.ts +3 -0
- package/dist/components/virtual-select/dist/index.d.ts +48 -0
- package/dist/styles/components.css +15 -0
- package/package.json +20 -32
|
@@ -15,12 +15,24 @@ type VirtualItem = {
|
|
|
15
15
|
emojis: EmojiData[];
|
|
16
16
|
type: "emojis";
|
|
17
17
|
};
|
|
18
|
+
interface CategoryNames {
|
|
19
|
+
activities: string;
|
|
20
|
+
animalsNature: string;
|
|
21
|
+
flags: string;
|
|
22
|
+
foodDrink: string;
|
|
23
|
+
frequentlyUsed: string;
|
|
24
|
+
objects: string;
|
|
25
|
+
smileysPeople: string;
|
|
26
|
+
symbols: string;
|
|
27
|
+
travelPlaces: string;
|
|
28
|
+
}
|
|
18
29
|
interface UseEmojiDataProps {
|
|
30
|
+
categoryNames?: CategoryNames;
|
|
19
31
|
columns: number;
|
|
20
32
|
searchQuery: string;
|
|
21
33
|
showFrequentlyUsed: boolean;
|
|
22
34
|
}
|
|
23
|
-
declare function useEmojiData({ searchQuery, columns, showFrequentlyUsed }: UseEmojiDataProps): {
|
|
35
|
+
declare function useEmojiData({ searchQuery, columns, showFrequentlyUsed, categoryNames, }: UseEmojiDataProps): {
|
|
24
36
|
categorizedData: VirtualItem[];
|
|
25
37
|
categoryIndexMap: Map<EmojiCategory, number>;
|
|
26
38
|
searchResults: {
|
|
@@ -52,6 +64,22 @@ interface EmojiPickerProps {
|
|
|
52
64
|
showFooter?: boolean;
|
|
53
65
|
value?: EmojiData | null;
|
|
54
66
|
variant?: "default" | "dark" | "light";
|
|
67
|
+
i18n?: {
|
|
68
|
+
noEmojisFoundTitle?: string;
|
|
69
|
+
noEmojisFoundDescription?: string;
|
|
70
|
+
footerPickAnEmoji?: string;
|
|
71
|
+
categories?: {
|
|
72
|
+
frequentlyUsed: string;
|
|
73
|
+
smileysPeople: string;
|
|
74
|
+
animalsNature: string;
|
|
75
|
+
foodDrink: string;
|
|
76
|
+
travelPlaces: string;
|
|
77
|
+
activities: string;
|
|
78
|
+
objects: string;
|
|
79
|
+
symbols: string;
|
|
80
|
+
flags: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
55
83
|
}
|
|
56
84
|
declare const EmojiPicker: React.NamedExoticComponent<EmojiPickerProps>;
|
|
57
85
|
|
|
@@ -141,7 +141,7 @@ var emojiFooterTv = tcv({
|
|
|
141
141
|
var emojiEmptyTv = tcv({
|
|
142
142
|
slots: {
|
|
143
143
|
container: "flex h-32 flex-col items-center justify-center p-4 text-center",
|
|
144
|
-
title: "text-
|
|
144
|
+
title: "text-body-large-strong",
|
|
145
145
|
description: "mt-2 w-32"
|
|
146
146
|
},
|
|
147
147
|
variants: {
|
|
@@ -179,13 +179,20 @@ var EmojiCategoryHeader = forwardRef(
|
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
);
|
|
182
|
-
|
|
182
|
+
var EmojiFooter = memo(function EmojiFooter2({
|
|
183
|
+
hoveredEmoji,
|
|
184
|
+
selectedEmoji,
|
|
185
|
+
variant = "dark",
|
|
186
|
+
i18n = {
|
|
187
|
+
pickAnEmoji: "Pick an emoji..."
|
|
188
|
+
}
|
|
189
|
+
}) {
|
|
183
190
|
var _a, _b;
|
|
184
191
|
const tv = emojiFooterTv({ variant });
|
|
185
192
|
return /* @__PURE__ */ jsxs("div", { className: tv.footer(), children: [
|
|
186
193
|
/* @__PURE__ */ jsx("div", { className: tv.emojiPreview(), children: ((_a = hoveredEmoji || selectedEmoji) == null ? void 0 : _a.emoji) || /* @__PURE__ */ jsx("div", { className: tv.emojiPreviewEmpty() }) }),
|
|
187
194
|
/* @__PURE__ */ jsxs("div", { className: tv.emojiInfo(), children: [
|
|
188
|
-
/* @__PURE__ */ jsx("div", { className: tv.emojiName(), children: (hoveredEmoji == null ? void 0 : hoveredEmoji.name) || (selectedEmoji == null ? void 0 : selectedEmoji.name) ||
|
|
195
|
+
/* @__PURE__ */ jsx("div", { className: tv.emojiName(), children: (hoveredEmoji == null ? void 0 : hoveredEmoji.name) || (selectedEmoji == null ? void 0 : selectedEmoji.name) || i18n.pickAnEmoji }),
|
|
189
196
|
hoveredEmoji || selectedEmoji ? /* @__PURE__ */ jsxs("div", { className: tv.emojiCode(), children: [
|
|
190
197
|
":",
|
|
191
198
|
(_b = hoveredEmoji || selectedEmoji) == null ? void 0 : _b.nameUrl,
|
|
@@ -193,7 +200,7 @@ function EmojiFooter({ hoveredEmoji, selectedEmoji, variant = "dark" }) {
|
|
|
193
200
|
] }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
194
201
|
] })
|
|
195
202
|
] });
|
|
196
|
-
}
|
|
203
|
+
});
|
|
197
204
|
var EmojiItem = memo(function EmojiItem2(props) {
|
|
198
205
|
const { emoji, onSelect, onHover, selected = false, variant = "dark" } = props;
|
|
199
206
|
return /* @__PURE__ */ jsx(
|
|
@@ -209,11 +216,17 @@ var EmojiItem = memo(function EmojiItem2(props) {
|
|
|
209
216
|
}
|
|
210
217
|
);
|
|
211
218
|
});
|
|
212
|
-
var EmojiEmpty = memo(function EmojiEmpty2({
|
|
219
|
+
var EmojiEmpty = memo(function EmojiEmpty2({
|
|
220
|
+
variant = "dark",
|
|
221
|
+
i18n = {
|
|
222
|
+
title: "No emoji found",
|
|
223
|
+
description: "You can search for an emoji by name or use the search bar to find it."
|
|
224
|
+
}
|
|
225
|
+
}) {
|
|
213
226
|
const tv = emojiEmptyTv({ variant });
|
|
214
227
|
return /* @__PURE__ */ jsxs("div", { className: tv.container(), children: [
|
|
215
|
-
/* @__PURE__ */ jsx("div", { className: tv.title(), children:
|
|
216
|
-
/* @__PURE__ */ jsx("p", { className: tv.description(), children:
|
|
228
|
+
/* @__PURE__ */ jsx("div", { className: tv.title(), children: i18n.title }),
|
|
229
|
+
/* @__PURE__ */ jsx("p", { className: tv.description(), children: i18n.description })
|
|
217
230
|
] });
|
|
218
231
|
});
|
|
219
232
|
var emojis = [
|
|
@@ -11727,15 +11740,15 @@ var emojis = [
|
|
|
11727
11740
|
}
|
|
11728
11741
|
];
|
|
11729
11742
|
var categories = [
|
|
11730
|
-
{ id: "frequently_used"
|
|
11731
|
-
{ id: "smileys_people",
|
|
11732
|
-
{ id: "animals_nature",
|
|
11733
|
-
{ id: "food_drink",
|
|
11734
|
-
{ id: "travel_places",
|
|
11735
|
-
{ id: "activities",
|
|
11736
|
-
{ id: "objects",
|
|
11737
|
-
{ id: "symbols",
|
|
11738
|
-
{ id: "flags",
|
|
11743
|
+
{ id: "frequently_used" },
|
|
11744
|
+
{ id: "smileys_people", range: [1, 460] },
|
|
11745
|
+
{ id: "animals_nature", range: [465, 591] },
|
|
11746
|
+
{ id: "food_drink", range: [592, 712] },
|
|
11747
|
+
{ id: "travel_places", range: [713, 922] },
|
|
11748
|
+
{ id: "activities", range: [923, 1001] },
|
|
11749
|
+
{ id: "objects", range: [1002, 1234] },
|
|
11750
|
+
{ id: "symbols", range: [1235, 1451] },
|
|
11751
|
+
{ id: "flags", range: [1452, 1719] }
|
|
11739
11752
|
];
|
|
11740
11753
|
var STORAGE_KEY = "emoji-picker-frequently-used";
|
|
11741
11754
|
function getEmojiCategory(id) {
|
|
@@ -11769,7 +11782,34 @@ function saveFrequentlyUsedEmoji(emojiId) {
|
|
|
11769
11782
|
} catch {
|
|
11770
11783
|
}
|
|
11771
11784
|
}
|
|
11772
|
-
|
|
11785
|
+
var defaultCategoryNames = {
|
|
11786
|
+
frequentlyUsed: "Frequently used",
|
|
11787
|
+
smileysPeople: "Smileys & People",
|
|
11788
|
+
animalsNature: "Animals & Nature",
|
|
11789
|
+
foodDrink: "Food & Drink",
|
|
11790
|
+
travelPlaces: "Travel & Places",
|
|
11791
|
+
activities: "Activities",
|
|
11792
|
+
objects: "Objects",
|
|
11793
|
+
symbols: "Symbols",
|
|
11794
|
+
flags: "Flags"
|
|
11795
|
+
};
|
|
11796
|
+
var categoryIdToI18nKey = {
|
|
11797
|
+
frequently_used: "frequentlyUsed",
|
|
11798
|
+
smileys_people: "smileysPeople",
|
|
11799
|
+
animals_nature: "animalsNature",
|
|
11800
|
+
food_drink: "foodDrink",
|
|
11801
|
+
travel_places: "travelPlaces",
|
|
11802
|
+
activities: "activities",
|
|
11803
|
+
objects: "objects",
|
|
11804
|
+
symbols: "symbols",
|
|
11805
|
+
flags: "flags"
|
|
11806
|
+
};
|
|
11807
|
+
function useEmojiData({
|
|
11808
|
+
searchQuery,
|
|
11809
|
+
columns,
|
|
11810
|
+
showFrequentlyUsed,
|
|
11811
|
+
categoryNames = defaultCategoryNames
|
|
11812
|
+
}) {
|
|
11773
11813
|
const [frequentlyUsed, setFrequentlyUsed] = useState([]);
|
|
11774
11814
|
useEffect(() => {
|
|
11775
11815
|
if (showFrequentlyUsed) {
|
|
@@ -11799,7 +11839,7 @@ function useEmojiData({ searchQuery, columns, showFrequentlyUsed }) {
|
|
|
11799
11839
|
items.push({
|
|
11800
11840
|
type: "header",
|
|
11801
11841
|
category: "frequently_used",
|
|
11802
|
-
title:
|
|
11842
|
+
title: categoryNames.frequentlyUsed
|
|
11803
11843
|
});
|
|
11804
11844
|
for (let i = 0; i < frequentlyUsed.length; i += columns) {
|
|
11805
11845
|
items.push({
|
|
@@ -11814,10 +11854,11 @@ function useEmojiData({ searchQuery, columns, showFrequentlyUsed }) {
|
|
|
11814
11854
|
(emoji) => emoji.id >= category.range[0] && emoji.id <= category.range[1]
|
|
11815
11855
|
);
|
|
11816
11856
|
if (categoryEmojis.length > 0) {
|
|
11857
|
+
const i18nKey = categoryIdToI18nKey[category.id];
|
|
11817
11858
|
items.push({
|
|
11818
11859
|
type: "header",
|
|
11819
11860
|
category: category.id,
|
|
11820
|
-
title: category.
|
|
11861
|
+
title: i18nKey ? categoryNames[i18nKey] : category.id
|
|
11821
11862
|
});
|
|
11822
11863
|
for (let i = 0; i < categoryEmojis.length; i += columns) {
|
|
11823
11864
|
items.push({
|
|
@@ -11828,7 +11869,7 @@ function useEmojiData({ searchQuery, columns, showFrequentlyUsed }) {
|
|
|
11828
11869
|
}
|
|
11829
11870
|
});
|
|
11830
11871
|
return items;
|
|
11831
|
-
}, [searchQuery, searchResults, frequentlyUsed, columns, showFrequentlyUsed]);
|
|
11872
|
+
}, [searchQuery, searchResults, frequentlyUsed, columns, showFrequentlyUsed, categoryNames]);
|
|
11832
11873
|
const categoryIndexMap = useMemo(() => {
|
|
11833
11874
|
const map = /* @__PURE__ */ new Map();
|
|
11834
11875
|
categorizedData.forEach((item, index) => {
|
|
@@ -11884,6 +11925,8 @@ function useEmojiScroll({
|
|
|
11884
11925
|
const [currentVisibleCategory, setCurrentVisibleCategory] = useState("frequently_used");
|
|
11885
11926
|
const isScrollingToTarget = useRef(false);
|
|
11886
11927
|
const isInternalUpdate = useRef(false);
|
|
11928
|
+
const scrollingTimeoutRef = useRef(null);
|
|
11929
|
+
const internalUpdateTimeoutRef = useRef(null);
|
|
11887
11930
|
const virtualizer = useVirtualizer({
|
|
11888
11931
|
count: categorizedData.length,
|
|
11889
11932
|
getScrollElement: () => scrollRef.current,
|
|
@@ -11948,7 +11991,10 @@ function useEmojiScroll({
|
|
|
11948
11991
|
align: "start",
|
|
11949
11992
|
behavior: "auto"
|
|
11950
11993
|
});
|
|
11951
|
-
|
|
11994
|
+
if (scrollingTimeoutRef.current) {
|
|
11995
|
+
clearTimeout(scrollingTimeoutRef.current);
|
|
11996
|
+
}
|
|
11997
|
+
scrollingTimeoutRef.current = setTimeout(() => {
|
|
11952
11998
|
isScrollingToTarget.current = false;
|
|
11953
11999
|
}, 100);
|
|
11954
12000
|
}
|
|
@@ -11961,17 +12007,33 @@ function useEmojiScroll({
|
|
|
11961
12007
|
align: "center",
|
|
11962
12008
|
behavior: "auto"
|
|
11963
12009
|
});
|
|
11964
|
-
|
|
12010
|
+
if (scrollingTimeoutRef.current) {
|
|
12011
|
+
clearTimeout(scrollingTimeoutRef.current);
|
|
12012
|
+
}
|
|
12013
|
+
scrollingTimeoutRef.current = setTimeout(() => {
|
|
11965
12014
|
isScrollingToTarget.current = false;
|
|
11966
12015
|
}, 100);
|
|
11967
12016
|
}
|
|
11968
12017
|
});
|
|
11969
12018
|
const markInternalUpdate = useEventCallback(() => {
|
|
11970
12019
|
isInternalUpdate.current = true;
|
|
11971
|
-
|
|
12020
|
+
if (internalUpdateTimeoutRef.current) {
|
|
12021
|
+
clearTimeout(internalUpdateTimeoutRef.current);
|
|
12022
|
+
}
|
|
12023
|
+
internalUpdateTimeoutRef.current = setTimeout(() => {
|
|
11972
12024
|
isInternalUpdate.current = false;
|
|
11973
12025
|
}, 50);
|
|
11974
12026
|
});
|
|
12027
|
+
useEffect(() => {
|
|
12028
|
+
return () => {
|
|
12029
|
+
if (scrollingTimeoutRef.current) {
|
|
12030
|
+
clearTimeout(scrollingTimeoutRef.current);
|
|
12031
|
+
}
|
|
12032
|
+
if (internalUpdateTimeoutRef.current) {
|
|
12033
|
+
clearTimeout(internalUpdateTimeoutRef.current);
|
|
12034
|
+
}
|
|
12035
|
+
};
|
|
12036
|
+
}, []);
|
|
11975
12037
|
useEffect(() => {
|
|
11976
12038
|
if (value && !searchQuery.trim() && !isInternalUpdate.current) {
|
|
11977
12039
|
scrollToEmoji(value);
|
|
@@ -11996,17 +12058,6 @@ function useEmojiScroll({
|
|
|
11996
12058
|
PADDING
|
|
11997
12059
|
};
|
|
11998
12060
|
}
|
|
11999
|
-
var categoriesWithIcons = [
|
|
12000
|
-
{ id: "frequently_used", name: "Frequently used", icon: /* @__PURE__ */ jsx(EmojiFrequentlyUsed, {}) },
|
|
12001
|
-
{ id: "smileys_people", name: "Smileys & People", icon: /* @__PURE__ */ jsx(EmojiSmileysPeople, {}) },
|
|
12002
|
-
{ id: "animals_nature", name: "Animals & Nature", icon: /* @__PURE__ */ jsx(EmojiAnimalsNature, {}) },
|
|
12003
|
-
{ id: "food_drink", name: "Food & Drink", icon: /* @__PURE__ */ jsx(EmojiFoodDrink, {}) },
|
|
12004
|
-
{ id: "travel_places", name: "Travel & Places", icon: /* @__PURE__ */ jsx(EmojiTravelPlaces, {}) },
|
|
12005
|
-
{ id: "activities", name: "Activities", icon: /* @__PURE__ */ jsx(EmojiActivity, {}) },
|
|
12006
|
-
{ id: "objects", name: "Objects", icon: /* @__PURE__ */ jsx(EmojiObjects, {}) },
|
|
12007
|
-
{ id: "symbols", name: "Symbols", icon: /* @__PURE__ */ jsx(EmojiSymbols, {}) },
|
|
12008
|
-
{ id: "flags", name: "Flags", icon: /* @__PURE__ */ jsx(EmojiFlags, {}) }
|
|
12009
|
-
];
|
|
12010
12061
|
var EmojiPicker = memo(function EmojiPicker2({
|
|
12011
12062
|
value,
|
|
12012
12063
|
onChange,
|
|
@@ -12019,11 +12070,49 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12019
12070
|
showSearch = true,
|
|
12020
12071
|
showFooter = true,
|
|
12021
12072
|
children,
|
|
12022
|
-
variant = "dark"
|
|
12073
|
+
variant = "dark",
|
|
12074
|
+
i18n = {
|
|
12075
|
+
noEmojisFoundTitle: "No emoji found",
|
|
12076
|
+
noEmojisFoundDescription: "You can search for an emoji by name or use the search bar to find it.",
|
|
12077
|
+
footerPickAnEmoji: "Pick an emoji...",
|
|
12078
|
+
categories: {
|
|
12079
|
+
frequentlyUsed: "Frequently used",
|
|
12080
|
+
smileysPeople: "Smileys & People",
|
|
12081
|
+
animalsNature: "Animals & Nature",
|
|
12082
|
+
foodDrink: "Food & Drink",
|
|
12083
|
+
travelPlaces: "Travel & Places",
|
|
12084
|
+
activities: "Activities",
|
|
12085
|
+
objects: "Objects",
|
|
12086
|
+
symbols: "Symbols",
|
|
12087
|
+
flags: "Flags"
|
|
12088
|
+
}
|
|
12089
|
+
}
|
|
12023
12090
|
}) {
|
|
12024
12091
|
const [searchQuery, setSearchQuery] = useState("");
|
|
12025
12092
|
const [hoveredEmoji, setHoveredEmoji] = useState(null);
|
|
12093
|
+
const safeColumns = Math.max(1, columns);
|
|
12026
12094
|
const tv = emojiTv({ variant });
|
|
12095
|
+
const categoriesWithIcons = useMemo(
|
|
12096
|
+
() => {
|
|
12097
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
12098
|
+
return [
|
|
12099
|
+
{
|
|
12100
|
+
id: "frequently_used",
|
|
12101
|
+
name: (_a = i18n.categories) == null ? void 0 : _a.frequentlyUsed,
|
|
12102
|
+
icon: /* @__PURE__ */ jsx(EmojiFrequentlyUsed, {})
|
|
12103
|
+
},
|
|
12104
|
+
{ id: "smileys_people", name: (_b = i18n.categories) == null ? void 0 : _b.smileysPeople, icon: /* @__PURE__ */ jsx(EmojiSmileysPeople, {}) },
|
|
12105
|
+
{ id: "animals_nature", name: (_c = i18n.categories) == null ? void 0 : _c.animalsNature, icon: /* @__PURE__ */ jsx(EmojiAnimalsNature, {}) },
|
|
12106
|
+
{ id: "food_drink", name: (_d = i18n.categories) == null ? void 0 : _d.foodDrink, icon: /* @__PURE__ */ jsx(EmojiFoodDrink, {}) },
|
|
12107
|
+
{ id: "travel_places", name: (_e = i18n.categories) == null ? void 0 : _e.travelPlaces, icon: /* @__PURE__ */ jsx(EmojiTravelPlaces, {}) },
|
|
12108
|
+
{ id: "activities", name: (_f = i18n.categories) == null ? void 0 : _f.activities, icon: /* @__PURE__ */ jsx(EmojiActivity, {}) },
|
|
12109
|
+
{ id: "objects", name: (_g = i18n.categories) == null ? void 0 : _g.objects, icon: /* @__PURE__ */ jsx(EmojiObjects, {}) },
|
|
12110
|
+
{ id: "symbols", name: (_h = i18n.categories) == null ? void 0 : _h.symbols, icon: /* @__PURE__ */ jsx(EmojiSymbols, {}) },
|
|
12111
|
+
{ id: "flags", name: (_i = i18n.categories) == null ? void 0 : _i.flags, icon: /* @__PURE__ */ jsx(EmojiFlags, {}) }
|
|
12112
|
+
];
|
|
12113
|
+
},
|
|
12114
|
+
[i18n.categories]
|
|
12115
|
+
);
|
|
12027
12116
|
const {
|
|
12028
12117
|
categorizedData,
|
|
12029
12118
|
categoryIndexMap,
|
|
@@ -12031,8 +12120,9 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12031
12120
|
findEmojiPosition
|
|
12032
12121
|
} = useEmojiData({
|
|
12033
12122
|
searchQuery,
|
|
12034
|
-
columns,
|
|
12035
|
-
showFrequentlyUsed
|
|
12123
|
+
columns: safeColumns,
|
|
12124
|
+
showFrequentlyUsed,
|
|
12125
|
+
categoryNames: i18n.categories
|
|
12036
12126
|
});
|
|
12037
12127
|
const {
|
|
12038
12128
|
scrollRef,
|
|
@@ -12048,7 +12138,7 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12048
12138
|
findEmojiPosition,
|
|
12049
12139
|
searchQuery,
|
|
12050
12140
|
value,
|
|
12051
|
-
columns
|
|
12141
|
+
columns: safeColumns
|
|
12052
12142
|
});
|
|
12053
12143
|
const availableCategories = useMemo(() => {
|
|
12054
12144
|
return categoriesWithIcons.filter((category) => {
|
|
@@ -12057,7 +12147,7 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12057
12147
|
}
|
|
12058
12148
|
return true;
|
|
12059
12149
|
});
|
|
12060
|
-
}, [showFrequentlyUsed]);
|
|
12150
|
+
}, [categoriesWithIcons, showFrequentlyUsed]);
|
|
12061
12151
|
const handleEmojiSelect = useEventCallback((emoji) => {
|
|
12062
12152
|
markInternalUpdate();
|
|
12063
12153
|
addToFrequentlyUsed(emoji.id);
|
|
@@ -12073,7 +12163,7 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12073
12163
|
const rootStyle = {
|
|
12074
12164
|
"--emoji-height": `${height}px`,
|
|
12075
12165
|
"--emoji-padding": `${PADDING2}px`,
|
|
12076
|
-
"--emoji-columns": `${
|
|
12166
|
+
"--emoji-columns": `${safeColumns}`
|
|
12077
12167
|
};
|
|
12078
12168
|
return /* @__PURE__ */ jsxs(
|
|
12079
12169
|
"div",
|
|
@@ -12176,7 +12266,16 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12176
12266
|
},
|
|
12177
12267
|
virtualItem.key
|
|
12178
12268
|
);
|
|
12179
|
-
}) : /* @__PURE__ */ jsx(
|
|
12269
|
+
}) : /* @__PURE__ */ jsx(
|
|
12270
|
+
EmojiEmpty,
|
|
12271
|
+
{
|
|
12272
|
+
variant,
|
|
12273
|
+
i18n: {
|
|
12274
|
+
title: i18n.noEmojisFoundTitle,
|
|
12275
|
+
description: i18n.noEmojisFoundDescription
|
|
12276
|
+
}
|
|
12277
|
+
}
|
|
12278
|
+
)
|
|
12180
12279
|
}
|
|
12181
12280
|
)
|
|
12182
12281
|
}
|
|
@@ -12188,7 +12287,10 @@ var EmojiPicker = memo(function EmojiPicker2({
|
|
|
12188
12287
|
{
|
|
12189
12288
|
hoveredEmoji,
|
|
12190
12289
|
selectedEmoji: value || null,
|
|
12191
|
-
variant
|
|
12290
|
+
variant,
|
|
12291
|
+
i18n: {
|
|
12292
|
+
pickAnEmoji: i18n.footerPickAnEmoji
|
|
12293
|
+
}
|
|
12192
12294
|
}
|
|
12193
12295
|
),
|
|
12194
12296
|
children
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from "react";
|
|
3
3
|
import { emojiEmptyTv } from "../tv.js";
|
|
4
|
-
const EmojiEmpty = memo(function EmojiEmpty2({
|
|
4
|
+
const EmojiEmpty = memo(function EmojiEmpty2({
|
|
5
|
+
variant = "dark",
|
|
6
|
+
i18n = {
|
|
7
|
+
title: "No emoji found",
|
|
8
|
+
description: "You can search for an emoji by name or use the search bar to find it."
|
|
9
|
+
}
|
|
10
|
+
}) {
|
|
5
11
|
const tv = emojiEmptyTv({ variant });
|
|
6
12
|
return /* @__PURE__ */ jsxs("div", { className: tv.container(), children: [
|
|
7
|
-
/* @__PURE__ */ jsx("div", { className: tv.title(), children:
|
|
8
|
-
/* @__PURE__ */ jsx("p", { className: tv.description(), children:
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: tv.title(), children: i18n.title }),
|
|
14
|
+
/* @__PURE__ */ jsx("p", { className: tv.description(), children: i18n.description })
|
|
9
15
|
] });
|
|
10
16
|
});
|
|
11
17
|
export {
|
|
@@ -3,6 +3,9 @@ interface EmojiFooterProps {
|
|
|
3
3
|
hoveredEmoji: EmojiData | null;
|
|
4
4
|
selectedEmoji: EmojiData | null;
|
|
5
5
|
variant?: "default" | "dark" | "light";
|
|
6
|
+
i18n?: {
|
|
7
|
+
pickAnEmoji?: string;
|
|
8
|
+
};
|
|
6
9
|
}
|
|
7
|
-
export declare
|
|
10
|
+
export declare const EmojiFooter: import('react').NamedExoticComponent<EmojiFooterProps>;
|
|
8
11
|
export {};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
2
3
|
import { emojiFooterTv } from "../tv.js";
|
|
3
|
-
|
|
4
|
+
const EmojiFooter = memo(function EmojiFooter2({
|
|
5
|
+
hoveredEmoji,
|
|
6
|
+
selectedEmoji,
|
|
7
|
+
variant = "dark",
|
|
8
|
+
i18n = {
|
|
9
|
+
pickAnEmoji: "Pick an emoji..."
|
|
10
|
+
}
|
|
11
|
+
}) {
|
|
4
12
|
var _a, _b;
|
|
5
13
|
const tv = emojiFooterTv({ variant });
|
|
6
14
|
return /* @__PURE__ */ jsxs("div", { className: tv.footer(), children: [
|
|
7
15
|
/* @__PURE__ */ jsx("div", { className: tv.emojiPreview(), children: ((_a = hoveredEmoji || selectedEmoji) == null ? void 0 : _a.emoji) || /* @__PURE__ */ jsx("div", { className: tv.emojiPreviewEmpty() }) }),
|
|
8
16
|
/* @__PURE__ */ jsxs("div", { className: tv.emojiInfo(), children: [
|
|
9
|
-
/* @__PURE__ */ jsx("div", { className: tv.emojiName(), children: (hoveredEmoji == null ? void 0 : hoveredEmoji.name) || (selectedEmoji == null ? void 0 : selectedEmoji.name) ||
|
|
17
|
+
/* @__PURE__ */ jsx("div", { className: tv.emojiName(), children: (hoveredEmoji == null ? void 0 : hoveredEmoji.name) || (selectedEmoji == null ? void 0 : selectedEmoji.name) || i18n.pickAnEmoji }),
|
|
10
18
|
hoveredEmoji || selectedEmoji ? /* @__PURE__ */ jsxs("div", { className: tv.emojiCode(), children: [
|
|
11
19
|
":",
|
|
12
20
|
(_b = hoveredEmoji || selectedEmoji) == null ? void 0 : _b.nameUrl,
|
|
@@ -14,7 +22,7 @@ function EmojiFooter({ hoveredEmoji, selectedEmoji, variant = "dark" }) {
|
|
|
14
22
|
] }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
15
23
|
] })
|
|
16
24
|
] });
|
|
17
|
-
}
|
|
25
|
+
});
|
|
18
26
|
export {
|
|
19
27
|
EmojiFooter
|
|
20
28
|
};
|
|
@@ -13,6 +13,22 @@ export interface EmojiPickerProps {
|
|
|
13
13
|
showFooter?: boolean;
|
|
14
14
|
value?: EmojiData | null;
|
|
15
15
|
variant?: "default" | "dark" | "light";
|
|
16
|
+
i18n?: {
|
|
17
|
+
noEmojisFoundTitle?: string;
|
|
18
|
+
noEmojisFoundDescription?: string;
|
|
19
|
+
footerPickAnEmoji?: string;
|
|
20
|
+
categories?: {
|
|
21
|
+
frequentlyUsed: string;
|
|
22
|
+
smileysPeople: string;
|
|
23
|
+
animalsNature: string;
|
|
24
|
+
foodDrink: string;
|
|
25
|
+
travelPlaces: string;
|
|
26
|
+
activities: string;
|
|
27
|
+
objects: string;
|
|
28
|
+
symbols: string;
|
|
29
|
+
flags: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
16
32
|
}
|
|
17
33
|
export declare const EmojiPicker: React.NamedExoticComponent<EmojiPickerProps>;
|
|
18
34
|
export default EmojiPicker;
|
|
@@ -12,17 +12,6 @@ import { EmojiCategoryHeader } from "./components/emoji-category-header.js";
|
|
|
12
12
|
import { EmojiItem } from "./components/emoji-item.js";
|
|
13
13
|
import { EmojiEmpty } from "./components/emoji-empty.js";
|
|
14
14
|
import { EmojiFooter } from "./components/emoji-footer.js";
|
|
15
|
-
const categoriesWithIcons = [
|
|
16
|
-
{ id: "frequently_used", name: "Frequently used", icon: /* @__PURE__ */ jsx(EmojiFrequentlyUsed, {}) },
|
|
17
|
-
{ id: "smileys_people", name: "Smileys & People", icon: /* @__PURE__ */ jsx(EmojiSmileysPeople, {}) },
|
|
18
|
-
{ id: "animals_nature", name: "Animals & Nature", icon: /* @__PURE__ */ jsx(EmojiAnimalsNature, {}) },
|
|
19
|
-
{ id: "food_drink", name: "Food & Drink", icon: /* @__PURE__ */ jsx(EmojiFoodDrink, {}) },
|
|
20
|
-
{ id: "travel_places", name: "Travel & Places", icon: /* @__PURE__ */ jsx(EmojiTravelPlaces, {}) },
|
|
21
|
-
{ id: "activities", name: "Activities", icon: /* @__PURE__ */ jsx(EmojiActivity, {}) },
|
|
22
|
-
{ id: "objects", name: "Objects", icon: /* @__PURE__ */ jsx(EmojiObjects, {}) },
|
|
23
|
-
{ id: "symbols", name: "Symbols", icon: /* @__PURE__ */ jsx(EmojiSymbols, {}) },
|
|
24
|
-
{ id: "flags", name: "Flags", icon: /* @__PURE__ */ jsx(EmojiFlags, {}) }
|
|
25
|
-
];
|
|
26
15
|
const EmojiPicker = memo(function EmojiPicker2({
|
|
27
16
|
value,
|
|
28
17
|
onChange,
|
|
@@ -35,11 +24,49 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
35
24
|
showSearch = true,
|
|
36
25
|
showFooter = true,
|
|
37
26
|
children,
|
|
38
|
-
variant = "dark"
|
|
27
|
+
variant = "dark",
|
|
28
|
+
i18n = {
|
|
29
|
+
noEmojisFoundTitle: "No emoji found",
|
|
30
|
+
noEmojisFoundDescription: "You can search for an emoji by name or use the search bar to find it.",
|
|
31
|
+
footerPickAnEmoji: "Pick an emoji...",
|
|
32
|
+
categories: {
|
|
33
|
+
frequentlyUsed: "Frequently used",
|
|
34
|
+
smileysPeople: "Smileys & People",
|
|
35
|
+
animalsNature: "Animals & Nature",
|
|
36
|
+
foodDrink: "Food & Drink",
|
|
37
|
+
travelPlaces: "Travel & Places",
|
|
38
|
+
activities: "Activities",
|
|
39
|
+
objects: "Objects",
|
|
40
|
+
symbols: "Symbols",
|
|
41
|
+
flags: "Flags"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
39
44
|
}) {
|
|
40
45
|
const [searchQuery, setSearchQuery] = useState("");
|
|
41
46
|
const [hoveredEmoji, setHoveredEmoji] = useState(null);
|
|
47
|
+
const safeColumns = Math.max(1, columns);
|
|
42
48
|
const tv = emojiTv({ variant });
|
|
49
|
+
const categoriesWithIcons = useMemo(
|
|
50
|
+
() => {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
52
|
+
return [
|
|
53
|
+
{
|
|
54
|
+
id: "frequently_used",
|
|
55
|
+
name: (_a = i18n.categories) == null ? void 0 : _a.frequentlyUsed,
|
|
56
|
+
icon: /* @__PURE__ */ jsx(EmojiFrequentlyUsed, {})
|
|
57
|
+
},
|
|
58
|
+
{ id: "smileys_people", name: (_b = i18n.categories) == null ? void 0 : _b.smileysPeople, icon: /* @__PURE__ */ jsx(EmojiSmileysPeople, {}) },
|
|
59
|
+
{ id: "animals_nature", name: (_c = i18n.categories) == null ? void 0 : _c.animalsNature, icon: /* @__PURE__ */ jsx(EmojiAnimalsNature, {}) },
|
|
60
|
+
{ id: "food_drink", name: (_d = i18n.categories) == null ? void 0 : _d.foodDrink, icon: /* @__PURE__ */ jsx(EmojiFoodDrink, {}) },
|
|
61
|
+
{ id: "travel_places", name: (_e = i18n.categories) == null ? void 0 : _e.travelPlaces, icon: /* @__PURE__ */ jsx(EmojiTravelPlaces, {}) },
|
|
62
|
+
{ id: "activities", name: (_f = i18n.categories) == null ? void 0 : _f.activities, icon: /* @__PURE__ */ jsx(EmojiActivity, {}) },
|
|
63
|
+
{ id: "objects", name: (_g = i18n.categories) == null ? void 0 : _g.objects, icon: /* @__PURE__ */ jsx(EmojiObjects, {}) },
|
|
64
|
+
{ id: "symbols", name: (_h = i18n.categories) == null ? void 0 : _h.symbols, icon: /* @__PURE__ */ jsx(EmojiSymbols, {}) },
|
|
65
|
+
{ id: "flags", name: (_i = i18n.categories) == null ? void 0 : _i.flags, icon: /* @__PURE__ */ jsx(EmojiFlags, {}) }
|
|
66
|
+
];
|
|
67
|
+
},
|
|
68
|
+
[i18n.categories]
|
|
69
|
+
);
|
|
43
70
|
const {
|
|
44
71
|
categorizedData,
|
|
45
72
|
categoryIndexMap,
|
|
@@ -48,8 +75,9 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
48
75
|
findEmojiByChar
|
|
49
76
|
} = useEmojiData({
|
|
50
77
|
searchQuery,
|
|
51
|
-
columns,
|
|
52
|
-
showFrequentlyUsed
|
|
78
|
+
columns: safeColumns,
|
|
79
|
+
showFrequentlyUsed,
|
|
80
|
+
categoryNames: i18n.categories
|
|
53
81
|
});
|
|
54
82
|
const {
|
|
55
83
|
scrollRef,
|
|
@@ -65,7 +93,7 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
65
93
|
findEmojiPosition,
|
|
66
94
|
searchQuery,
|
|
67
95
|
value,
|
|
68
|
-
columns
|
|
96
|
+
columns: safeColumns
|
|
69
97
|
});
|
|
70
98
|
const availableCategories = useMemo(() => {
|
|
71
99
|
return categoriesWithIcons.filter((category) => {
|
|
@@ -74,7 +102,7 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
74
102
|
}
|
|
75
103
|
return true;
|
|
76
104
|
});
|
|
77
|
-
}, [showFrequentlyUsed]);
|
|
105
|
+
}, [categoriesWithIcons, showFrequentlyUsed]);
|
|
78
106
|
const handleEmojiSelect = useEventCallback((emoji) => {
|
|
79
107
|
markInternalUpdate();
|
|
80
108
|
addToFrequentlyUsed(emoji.id);
|
|
@@ -90,7 +118,7 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
90
118
|
const rootStyle = {
|
|
91
119
|
"--emoji-height": `${height}px`,
|
|
92
120
|
"--emoji-padding": `${PADDING}px`,
|
|
93
|
-
"--emoji-columns": `${
|
|
121
|
+
"--emoji-columns": `${safeColumns}`
|
|
94
122
|
};
|
|
95
123
|
return /* @__PURE__ */ jsxs(
|
|
96
124
|
"div",
|
|
@@ -193,7 +221,16 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
193
221
|
},
|
|
194
222
|
virtualItem.key
|
|
195
223
|
);
|
|
196
|
-
}) : /* @__PURE__ */ jsx(
|
|
224
|
+
}) : /* @__PURE__ */ jsx(
|
|
225
|
+
EmojiEmpty,
|
|
226
|
+
{
|
|
227
|
+
variant,
|
|
228
|
+
i18n: {
|
|
229
|
+
title: i18n.noEmojisFoundTitle,
|
|
230
|
+
description: i18n.noEmojisFoundDescription
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
)
|
|
197
234
|
}
|
|
198
235
|
)
|
|
199
236
|
}
|
|
@@ -205,7 +242,10 @@ const EmojiPicker = memo(function EmojiPicker2({
|
|
|
205
242
|
{
|
|
206
243
|
hoveredEmoji,
|
|
207
244
|
selectedEmoji: value || null,
|
|
208
|
-
variant
|
|
245
|
+
variant,
|
|
246
|
+
i18n: {
|
|
247
|
+
pickAnEmoji: i18n.footerPickAnEmoji
|
|
248
|
+
}
|
|
209
249
|
}
|
|
210
250
|
),
|
|
211
251
|
children
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useEmojiData } from './use-emoji-data';
|
|
2
2
|
export { useEmojiScroll } from './use-emoji-scroll';
|
|
3
|
-
export type { EmojiData, EmojiCategory, VirtualItem } from './use-emoji-data';
|
|
3
|
+
export type { EmojiData, EmojiCategory, VirtualItem, CategoryNames } from './use-emoji-data';
|