@antscorp/antsomi-ui 1.3.5-beta.774 → 1.3.5-beta.775
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/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +0 -1
- package/es/components/molecules/EmojiCollections/CommonCollection/constants.d.ts +53 -0
- package/es/components/molecules/EmojiCollections/CommonCollection/constants.js +55 -0
- package/es/components/molecules/EmojiCollections/CommonCollection/index.d.ts +4 -0
- package/es/components/molecules/EmojiCollections/CommonCollection/index.js +87 -0
- package/es/components/molecules/EmojiCollections/LineCollection/constants.d.ts +138 -0
- package/es/components/molecules/EmojiCollections/LineCollection/constants.js +209 -0
- package/es/components/molecules/EmojiCollections/LineCollection/index.d.ts +4 -0
- package/es/components/molecules/EmojiCollections/LineCollection/index.js +55 -0
- package/es/components/molecules/EmojiCollections/ViberCollection/index.d.ts +4 -0
- package/es/components/molecules/EmojiCollections/ViberCollection/index.js +61 -0
- package/es/components/molecules/EmojiCollections/index.d.ts +4 -0
- package/es/components/molecules/EmojiCollections/index.js +6 -0
- package/es/components/molecules/EmojiCollections/styled.d.ts +9 -0
- package/es/components/molecules/EmojiCollections/styled.js +27 -0
- package/es/components/molecules/EmojiCollections/types.d.ts +3 -0
- package/es/components/molecules/EmojiCollections/types.js +1 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +15 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +82 -0
- package/es/components/molecules/EmojiPopover/index.d.ts +2 -0
- package/es/components/molecules/EmojiPopover/index.js +2 -0
- package/es/components/molecules/EmojiPopover/styled.d.ts +9 -0
- package/es/components/molecules/EmojiPopover/styled.js +17 -0
- package/es/components/molecules/EmojiPopover/utils.d.ts +2 -0
- package/es/components/molecules/EmojiPopover/utils.js +35 -0
- package/es/components/molecules/TagifyInput/TagifyInput.js +71 -18
- package/es/components/molecules/TagifyInput/constants.d.ts +8 -1
- package/es/components/molecules/TagifyInput/constants.js +9 -2
- package/es/components/molecules/TagifyInput/patternHandlers.d.ts +1 -0
- package/es/components/molecules/TagifyInput/patternHandlers.js +1 -0
- package/es/components/molecules/TagifyInput/styled.js +16 -26
- package/es/components/molecules/TagifyInput/types.d.ts +3 -6
- package/es/components/molecules/TagifyInput/utils.d.ts +4 -3
- package/es/components/molecules/TagifyInput/utils.js +73 -16
- package/es/components/molecules/index.d.ts +2 -0
- package/es/components/molecules/index.js +2 -0
- package/es/components/template/TemplateListing/Loadable.d.ts +0 -1
- package/es/locales/ja/google-sheet.json +46 -46
- package/es/locales/vi/google-sheet.json +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const COMMON_COLLECTION_KEYS: {
|
|
2
|
+
readonly SMILEYS_BODY: "smileys_body";
|
|
3
|
+
readonly ANIMALS_NATURE: "animals_nature";
|
|
4
|
+
readonly FOOD_DRINK: "food_drink";
|
|
5
|
+
readonly TRAVEL_PLACES: "travel_places";
|
|
6
|
+
readonly ACTITVITIES: "activities";
|
|
7
|
+
readonly OBJECTS: "objects";
|
|
8
|
+
readonly SYMBOLS: "symbols";
|
|
9
|
+
readonly FLAGS: "flags";
|
|
10
|
+
};
|
|
11
|
+
export declare const SMILEYS_BODY: "smileys_body", ANIMALS_NATURE: "animals_nature", FOOD_DRINK: "food_drink", TRAVEL_PLACES: "travel_places", ACTITVITIES: "activities", OBJECTS: "objects", SYMBOLS: "symbols", FLAGS: "flags";
|
|
12
|
+
export declare const COMMON_TAB_COLLECTION: {
|
|
13
|
+
readonly smileys_body: {
|
|
14
|
+
readonly value: "smileys_body";
|
|
15
|
+
readonly label: "Smileys & Body";
|
|
16
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
readonly animals_nature: {
|
|
19
|
+
readonly value: "animals_nature";
|
|
20
|
+
readonly label: "Animals & Nature";
|
|
21
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
};
|
|
23
|
+
readonly food_drink: {
|
|
24
|
+
readonly value: "food_drink";
|
|
25
|
+
readonly label: "Food & Drink";
|
|
26
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
};
|
|
28
|
+
readonly travel_places: {
|
|
29
|
+
readonly value: "travel_places";
|
|
30
|
+
readonly label: "Travel & Places";
|
|
31
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
};
|
|
33
|
+
readonly activities: {
|
|
34
|
+
readonly value: "activities";
|
|
35
|
+
readonly label: "Activities";
|
|
36
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
};
|
|
38
|
+
readonly objects: {
|
|
39
|
+
readonly value: "objects";
|
|
40
|
+
readonly label: "Objects";
|
|
41
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
};
|
|
43
|
+
readonly symbols: {
|
|
44
|
+
readonly value: "symbols";
|
|
45
|
+
readonly label: "Symbols";
|
|
46
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
};
|
|
48
|
+
readonly flags: {
|
|
49
|
+
readonly value: "flags";
|
|
50
|
+
readonly label: "Flags";
|
|
51
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EmojiAirportShuttleIcon, EmojiBallIcon, EmojiElectricBoltIcon, EmojiFlagIcon, EmojiLightBulbIcon, EmojiPetFootIcon, EmojiRamenDiningIcon, EmojiReactionIcon, } from '@antscorp/antsomi-ui/es/components/icons';
|
|
3
|
+
export const COMMON_COLLECTION_KEYS = {
|
|
4
|
+
SMILEYS_BODY: 'smileys_body',
|
|
5
|
+
ANIMALS_NATURE: 'animals_nature',
|
|
6
|
+
FOOD_DRINK: 'food_drink',
|
|
7
|
+
TRAVEL_PLACES: 'travel_places',
|
|
8
|
+
ACTITVITIES: 'activities',
|
|
9
|
+
OBJECTS: 'objects',
|
|
10
|
+
SYMBOLS: 'symbols',
|
|
11
|
+
FLAGS: 'flags',
|
|
12
|
+
};
|
|
13
|
+
export const { SMILEYS_BODY, ANIMALS_NATURE, FOOD_DRINK, TRAVEL_PLACES, ACTITVITIES, OBJECTS, SYMBOLS, FLAGS, } = COMMON_COLLECTION_KEYS;
|
|
14
|
+
export const COMMON_TAB_COLLECTION = {
|
|
15
|
+
[SMILEYS_BODY]: {
|
|
16
|
+
value: SMILEYS_BODY,
|
|
17
|
+
label: 'Smileys & Body',
|
|
18
|
+
icon: _jsx(EmojiReactionIcon, {}),
|
|
19
|
+
},
|
|
20
|
+
[ANIMALS_NATURE]: {
|
|
21
|
+
value: ANIMALS_NATURE,
|
|
22
|
+
label: 'Animals & Nature',
|
|
23
|
+
icon: _jsx(EmojiPetFootIcon, {}),
|
|
24
|
+
},
|
|
25
|
+
[FOOD_DRINK]: {
|
|
26
|
+
value: FOOD_DRINK,
|
|
27
|
+
label: 'Food & Drink',
|
|
28
|
+
icon: _jsx(EmojiRamenDiningIcon, {}),
|
|
29
|
+
},
|
|
30
|
+
[TRAVEL_PLACES]: {
|
|
31
|
+
value: TRAVEL_PLACES,
|
|
32
|
+
label: 'Travel & Places',
|
|
33
|
+
icon: _jsx(EmojiAirportShuttleIcon, {}),
|
|
34
|
+
},
|
|
35
|
+
[ACTITVITIES]: {
|
|
36
|
+
value: ACTITVITIES,
|
|
37
|
+
label: 'Activities',
|
|
38
|
+
icon: _jsx(EmojiBallIcon, {}),
|
|
39
|
+
},
|
|
40
|
+
[OBJECTS]: {
|
|
41
|
+
value: OBJECTS,
|
|
42
|
+
label: 'Objects',
|
|
43
|
+
icon: _jsx(EmojiLightBulbIcon, {}),
|
|
44
|
+
},
|
|
45
|
+
[SYMBOLS]: {
|
|
46
|
+
value: SYMBOLS,
|
|
47
|
+
label: 'Symbols',
|
|
48
|
+
icon: _jsx(EmojiElectricBoltIcon, {}),
|
|
49
|
+
},
|
|
50
|
+
[FLAGS]: {
|
|
51
|
+
value: FLAGS,
|
|
52
|
+
label: 'Flags',
|
|
53
|
+
icon: _jsx(EmojiFlagIcon, {}),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
// Libraries
|
|
4
|
+
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
5
|
+
import { useImmer } from 'use-immer';
|
|
6
|
+
import _ from 'lodash';
|
|
7
|
+
// Components & Styled
|
|
8
|
+
import { Emoji, EmojiList, WrapperCollection } from '../styled';
|
|
9
|
+
import { Empty, Flex, Input, Scrollbars, Typography, } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
10
|
+
import { ICON_EMOJI_COMMON, Select } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
11
|
+
import { EmojiSmileIcon, SearchIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
12
|
+
// Hooks
|
|
13
|
+
import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounceV2';
|
|
14
|
+
// Constants
|
|
15
|
+
import { COMMON_TAB_COLLECTION, SMILEYS_BODY } from './constants';
|
|
16
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
17
|
+
const { Text } = Typography;
|
|
18
|
+
const emojiListParsed = JSON.parse(JSON.stringify(ICON_EMOJI_COMMON));
|
|
19
|
+
const CommonCollection = ({ onEmojiClick }) => {
|
|
20
|
+
// States
|
|
21
|
+
const [state, setState] = useImmer({
|
|
22
|
+
collectionActive: SMILEYS_BODY,
|
|
23
|
+
txtSearch: '',
|
|
24
|
+
});
|
|
25
|
+
const txtSearchDebounce = useDebounce(state.txtSearch, 300);
|
|
26
|
+
// Memoizations
|
|
27
|
+
const collectionOptions = useMemo(() => Object.values(COMMON_TAB_COLLECTION), []);
|
|
28
|
+
const emojiCollection = useMemo(() => {
|
|
29
|
+
if (!_.isArray(emojiListParsed))
|
|
30
|
+
return [];
|
|
31
|
+
const listFiltered = emojiListParsed.filter(item => item.slug === state.collectionActive);
|
|
32
|
+
let result = _.get(listFiltered, '[0].emojis', []);
|
|
33
|
+
if (txtSearchDebounce) {
|
|
34
|
+
result = result.filter(item => {
|
|
35
|
+
const { emoji = '', name = '' } = item;
|
|
36
|
+
const isEmoji = emoji.toLowerCase().includes(txtSearchDebounce.toLowerCase());
|
|
37
|
+
const isName = name.toLowerCase().includes(txtSearchDebounce.toLowerCase());
|
|
38
|
+
return isEmoji || isName;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}, [state.collectionActive, txtSearchDebounce]);
|
|
43
|
+
const handleChangeInput = useCallback((e) => {
|
|
44
|
+
if (e.target) {
|
|
45
|
+
setState(draft => {
|
|
46
|
+
draft.txtSearch = e.target.value.trim();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}, [setState]);
|
|
50
|
+
const handleChangeSelect = useCallback((newCollection) => {
|
|
51
|
+
setState(draft => {
|
|
52
|
+
draft.collectionActive = newCollection;
|
|
53
|
+
});
|
|
54
|
+
}, [setState]);
|
|
55
|
+
useEffect(() => () => {
|
|
56
|
+
setState(() => ({
|
|
57
|
+
collectionActive: SMILEYS_BODY,
|
|
58
|
+
txtSearch: '',
|
|
59
|
+
}));
|
|
60
|
+
}, [setState]);
|
|
61
|
+
const renderOption = useCallback((rawOption) => {
|
|
62
|
+
const icon = _.get(rawOption, 'data.icon', null);
|
|
63
|
+
return (_jsxs(Flex, { gap: 6, align: "center", children: [_jsx("span", { style: {
|
|
64
|
+
color: globalToken?.bw8,
|
|
65
|
+
fontSize: '20px',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
}, children: icon }), _jsx(Text, { style: { color: globalToken?.colorText }, children: rawOption?.label })] }));
|
|
69
|
+
}, []);
|
|
70
|
+
const renderCommonCollection = useCallback(() => {
|
|
71
|
+
if (!_.isArray(emojiCollection) ||
|
|
72
|
+
(_.isArray(emojiCollection) && emojiCollection.length === 0)) {
|
|
73
|
+
return (_jsx(Empty, { image: _jsx(EmojiSmileIcon, { width: 30, height: 30, color: globalToken?.bw8 }), description: _jsx("span", { style: { color: globalToken?.bw8 }, children: "Emoji not found" }) }));
|
|
74
|
+
}
|
|
75
|
+
const content = emojiCollection.map((item) => {
|
|
76
|
+
const { emoji, slug = '', unicode_version: unicodeVersion = '' } = item;
|
|
77
|
+
const key = `${slug}-${unicodeVersion}`;
|
|
78
|
+
return (_jsx(Emoji, { type: "text", onClick: () => onEmojiClick(emoji), children: _jsx("span", { style: { fontSize: '30px' }, children: emoji }) }, key));
|
|
79
|
+
});
|
|
80
|
+
return (_jsx(Scrollbars, { autoHeight: true, autoHeightMax: 150, children: _jsx(Flex, { wrap: "wrap", children: content }) }));
|
|
81
|
+
}, [emojiCollection, onEmojiClick]);
|
|
82
|
+
return (_jsxs(WrapperCollection, { children: [_jsxs(Flex, { gap: 20, justify: "space-between", align: "flex-end", children: [_jsx(Input, { placeholder: "Search...", suffix: _jsx(SearchIcon, { color: globalToken?.bw8 }), styles: { affixWrapper: { minWidth: 280 } }, onChange: handleChangeInput }), _jsx(Select, { placeholder: "Select collection", value: state.collectionActive, style: { width: 200 }, options: collectionOptions, optionRender: renderOption, onChange: handleChangeSelect })] }), _jsx(EmojiList, { children: renderCommonCollection() })] }));
|
|
83
|
+
};
|
|
84
|
+
CommonCollection.defaultProps = {
|
|
85
|
+
onEmojiClick: () => { },
|
|
86
|
+
};
|
|
87
|
+
export default memo(CommonCollection);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export declare const PRODUCT_ID_EMOJIS: readonly [{
|
|
2
|
+
readonly id: "5ac2213e040ab15980c9b447";
|
|
3
|
+
readonly total: 182;
|
|
4
|
+
}, {
|
|
5
|
+
readonly id: "5ac21a8c040ab15980c9b43f";
|
|
6
|
+
readonly total: 149;
|
|
7
|
+
}, {
|
|
8
|
+
readonly id: "5ac21c4e031a6752fb806d5b";
|
|
9
|
+
readonly total: 161;
|
|
10
|
+
}, {
|
|
11
|
+
readonly id: "5ac21e6c040ab15980c9b444";
|
|
12
|
+
readonly total: 222;
|
|
13
|
+
}, {
|
|
14
|
+
readonly id: "5ac1bfd5040ab15980c9b435";
|
|
15
|
+
readonly total: 250;
|
|
16
|
+
}, {
|
|
17
|
+
readonly id: "5ac22e85040ab15980c9b44f";
|
|
18
|
+
readonly total: 209;
|
|
19
|
+
}, {
|
|
20
|
+
readonly id: "5ac22775040ab15980c9b44c";
|
|
21
|
+
readonly total: 247;
|
|
22
|
+
}, {
|
|
23
|
+
readonly id: "5ac2197b040ab15980c9b43d";
|
|
24
|
+
readonly total: 201;
|
|
25
|
+
}, {
|
|
26
|
+
readonly id: "5ac21d59031a6752fb806d5d";
|
|
27
|
+
readonly total: 212;
|
|
28
|
+
}, {
|
|
29
|
+
readonly id: "5ac221ca040ab15980c9b449";
|
|
30
|
+
readonly total: 167;
|
|
31
|
+
}, {
|
|
32
|
+
readonly id: "5ac22bad031a6752fb806d67";
|
|
33
|
+
readonly total: 214;
|
|
34
|
+
}, {
|
|
35
|
+
readonly id: "5ac2211e031a6752fb806d61";
|
|
36
|
+
readonly total: 250;
|
|
37
|
+
}, {
|
|
38
|
+
readonly id: "5ac21b4f031a6752fb806d59";
|
|
39
|
+
readonly total: 149;
|
|
40
|
+
}, {
|
|
41
|
+
readonly id: "5ac21cce040ab15980c9b443";
|
|
42
|
+
readonly total: 161;
|
|
43
|
+
}, {
|
|
44
|
+
readonly id: "5ac21fda040ab15980c9b446";
|
|
45
|
+
readonly total: 140;
|
|
46
|
+
}, {
|
|
47
|
+
readonly id: "5ac22224031a6752fb806d62";
|
|
48
|
+
readonly total: 251;
|
|
49
|
+
}, {
|
|
50
|
+
readonly id: "5ac22c9e031a6752fb806d68";
|
|
51
|
+
readonly total: 198;
|
|
52
|
+
}, {
|
|
53
|
+
readonly id: "5ac222bf031a6752fb806d64";
|
|
54
|
+
readonly total: 250;
|
|
55
|
+
}, {
|
|
56
|
+
readonly id: "5ac21869040ab15980c9b43b";
|
|
57
|
+
readonly total: 199;
|
|
58
|
+
}, {
|
|
59
|
+
readonly id: "5ac2280f031a6752fb806d65";
|
|
60
|
+
readonly total: 250;
|
|
61
|
+
}, {
|
|
62
|
+
readonly id: "5ac22293031a6752fb806d63";
|
|
63
|
+
readonly total: 184;
|
|
64
|
+
}, {
|
|
65
|
+
readonly id: "5ac2173d031a6752fb806d56";
|
|
66
|
+
readonly total: 240;
|
|
67
|
+
}, {
|
|
68
|
+
readonly id: "5ac21542031a6752fb806d55";
|
|
69
|
+
readonly total: 248;
|
|
70
|
+
}, {
|
|
71
|
+
readonly id: "5ac2216f040ab15980c9b448";
|
|
72
|
+
readonly total: 188;
|
|
73
|
+
}, {
|
|
74
|
+
readonly id: "5ac21f52040ab15980c9b445";
|
|
75
|
+
readonly total: 183;
|
|
76
|
+
}, {
|
|
77
|
+
readonly id: "5ac21ef5031a6752fb806d5e";
|
|
78
|
+
readonly total: 150;
|
|
79
|
+
}, {
|
|
80
|
+
readonly id: "5ac223c6040ab15980c9b44a";
|
|
81
|
+
readonly total: 157;
|
|
82
|
+
}, {
|
|
83
|
+
readonly id: "5ac22b23040ab15980c9b44d";
|
|
84
|
+
readonly total: 247;
|
|
85
|
+
}, {
|
|
86
|
+
readonly id: "5ac22def040ab15980c9b44e";
|
|
87
|
+
readonly total: 250;
|
|
88
|
+
}, {
|
|
89
|
+
readonly id: "5ac21c46040ab15980c9b442";
|
|
90
|
+
readonly total: 221;
|
|
91
|
+
}, {
|
|
92
|
+
readonly id: "5ac22d62031a6752fb806d69";
|
|
93
|
+
readonly total: 196;
|
|
94
|
+
}, {
|
|
95
|
+
readonly id: "5ac21a13031a6752fb806d57";
|
|
96
|
+
readonly total: 149;
|
|
97
|
+
}, {
|
|
98
|
+
readonly id: "5ac21a18040ab15980c9b43e";
|
|
99
|
+
readonly total: 239;
|
|
100
|
+
}, {
|
|
101
|
+
readonly id: "5ac21ba5040ab15980c9b441";
|
|
102
|
+
readonly total: 161;
|
|
103
|
+
}, {
|
|
104
|
+
readonly id: "5ac2264e040ab15980c9b44b";
|
|
105
|
+
readonly total: 252;
|
|
106
|
+
}, {
|
|
107
|
+
readonly id: "5ac2206d031a6752fb806d5f";
|
|
108
|
+
readonly total: 252;
|
|
109
|
+
}, {
|
|
110
|
+
readonly id: "5ac220c2031a6752fb806d60";
|
|
111
|
+
readonly total: 246;
|
|
112
|
+
}, {
|
|
113
|
+
readonly id: "5ac22a8c031a6752fb806d66";
|
|
114
|
+
readonly total: 210;
|
|
115
|
+
}, {
|
|
116
|
+
readonly id: "5ac1de17040ab15980c9b438";
|
|
117
|
+
readonly total: 194;
|
|
118
|
+
}, {
|
|
119
|
+
readonly id: "5ac21bf9031a6752fb806d5a";
|
|
120
|
+
readonly total: 161;
|
|
121
|
+
}, {
|
|
122
|
+
readonly id: "5ac21cc5031a6752fb806d5c";
|
|
123
|
+
readonly total: 170;
|
|
124
|
+
}, {
|
|
125
|
+
readonly id: "5ac21ae3040ab15980c9b440";
|
|
126
|
+
readonly total: 149;
|
|
127
|
+
}, {
|
|
128
|
+
readonly id: "5ac218e3040ab15980c9b43c";
|
|
129
|
+
readonly total: 221;
|
|
130
|
+
}, {
|
|
131
|
+
readonly id: "5ac21184040ab15980c9b43a";
|
|
132
|
+
readonly total: 234;
|
|
133
|
+
}];
|
|
134
|
+
export declare const TAB_LINE_MESSAGE_EMOJIS: readonly {
|
|
135
|
+
key: "5ac2213e040ab15980c9b447" | "5ac21a8c040ab15980c9b43f" | "5ac21c4e031a6752fb806d5b" | "5ac21e6c040ab15980c9b444" | "5ac1bfd5040ab15980c9b435" | "5ac22e85040ab15980c9b44f" | "5ac22775040ab15980c9b44c" | "5ac2197b040ab15980c9b43d" | "5ac21d59031a6752fb806d5d" | "5ac221ca040ab15980c9b449" | "5ac22bad031a6752fb806d67" | "5ac2211e031a6752fb806d61" | "5ac21b4f031a6752fb806d59" | "5ac21cce040ab15980c9b443" | "5ac21fda040ab15980c9b446" | "5ac22224031a6752fb806d62" | "5ac22c9e031a6752fb806d68" | "5ac222bf031a6752fb806d64" | "5ac21869040ab15980c9b43b" | "5ac2280f031a6752fb806d65" | "5ac22293031a6752fb806d63" | "5ac2173d031a6752fb806d56" | "5ac21542031a6752fb806d55" | "5ac2216f040ab15980c9b448" | "5ac21f52040ab15980c9b445" | "5ac21ef5031a6752fb806d5e" | "5ac223c6040ab15980c9b44a" | "5ac22b23040ab15980c9b44d" | "5ac22def040ab15980c9b44e" | "5ac21c46040ab15980c9b442" | "5ac22d62031a6752fb806d69" | "5ac21a13031a6752fb806d57" | "5ac21a18040ab15980c9b43e" | "5ac21ba5040ab15980c9b441" | "5ac2264e040ab15980c9b44b" | "5ac2206d031a6752fb806d5f" | "5ac220c2031a6752fb806d60" | "5ac22a8c031a6752fb806d66" | "5ac1de17040ab15980c9b438" | "5ac21bf9031a6752fb806d5a" | "5ac21cc5031a6752fb806d5c" | "5ac21ae3040ab15980c9b440" | "5ac218e3040ab15980c9b43c" | "5ac21184040ab15980c9b43a";
|
|
136
|
+
value: string;
|
|
137
|
+
}[];
|
|
138
|
+
export declare const LINE_MESSAGE_EMOJIS: Readonly<{}>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/* eslint-disable consistent-return */
|
|
2
|
+
// Utils
|
|
3
|
+
import { getLinkLineURLImage } from '@antscorp/antsomi-ui/es/components/molecules/TagifyInput';
|
|
4
|
+
export const PRODUCT_ID_EMOJIS = [
|
|
5
|
+
{
|
|
6
|
+
id: '5ac2213e040ab15980c9b447',
|
|
7
|
+
total: 182,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: '5ac21a8c040ab15980c9b43f',
|
|
11
|
+
total: 149,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: '5ac21c4e031a6752fb806d5b',
|
|
15
|
+
total: 161,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: '5ac21e6c040ab15980c9b444',
|
|
19
|
+
total: 222,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: '5ac1bfd5040ab15980c9b435',
|
|
23
|
+
total: 250,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: '5ac22e85040ab15980c9b44f',
|
|
27
|
+
total: 209,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: '5ac22775040ab15980c9b44c',
|
|
31
|
+
total: 247,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: '5ac2197b040ab15980c9b43d',
|
|
35
|
+
total: 201,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: '5ac21d59031a6752fb806d5d',
|
|
39
|
+
total: 212,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: '5ac221ca040ab15980c9b449',
|
|
43
|
+
total: 167,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: '5ac22bad031a6752fb806d67',
|
|
47
|
+
total: 214,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: '5ac2211e031a6752fb806d61',
|
|
51
|
+
total: 250,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: '5ac21b4f031a6752fb806d59',
|
|
55
|
+
total: 149,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: '5ac21cce040ab15980c9b443',
|
|
59
|
+
total: 161,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: '5ac21fda040ab15980c9b446',
|
|
63
|
+
total: 140,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: '5ac22224031a6752fb806d62',
|
|
67
|
+
total: 251,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: '5ac22c9e031a6752fb806d68',
|
|
71
|
+
total: 198,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: '5ac222bf031a6752fb806d64',
|
|
75
|
+
total: 250,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: '5ac21869040ab15980c9b43b',
|
|
79
|
+
total: 199,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: '5ac2280f031a6752fb806d65',
|
|
83
|
+
total: 250,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: '5ac22293031a6752fb806d63',
|
|
87
|
+
total: 184,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: '5ac2173d031a6752fb806d56',
|
|
91
|
+
total: 240,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: '5ac21542031a6752fb806d55',
|
|
95
|
+
total: 248,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: '5ac2216f040ab15980c9b448',
|
|
99
|
+
total: 188,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: '5ac21f52040ab15980c9b445',
|
|
103
|
+
total: 183,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: '5ac21ef5031a6752fb806d5e',
|
|
107
|
+
total: 150,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: '5ac223c6040ab15980c9b44a',
|
|
111
|
+
total: 157,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: '5ac22b23040ab15980c9b44d',
|
|
115
|
+
total: 247,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: '5ac22def040ab15980c9b44e',
|
|
119
|
+
total: 250,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: '5ac21c46040ab15980c9b442',
|
|
123
|
+
total: 221,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: '5ac22d62031a6752fb806d69',
|
|
127
|
+
total: 196,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: '5ac21a13031a6752fb806d57',
|
|
131
|
+
total: 149,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: '5ac21a18040ab15980c9b43e',
|
|
135
|
+
total: 239,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: '5ac21ba5040ab15980c9b441',
|
|
139
|
+
total: 161,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: '5ac2264e040ab15980c9b44b',
|
|
143
|
+
total: 252,
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: '5ac2206d031a6752fb806d5f',
|
|
147
|
+
total: 252,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: '5ac220c2031a6752fb806d60',
|
|
151
|
+
total: 246,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: '5ac22a8c031a6752fb806d66',
|
|
155
|
+
total: 210,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: '5ac1de17040ab15980c9b438',
|
|
159
|
+
total: 194,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: '5ac21bf9031a6752fb806d5a',
|
|
163
|
+
total: 161,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: '5ac21cc5031a6752fb806d5c',
|
|
167
|
+
total: 170,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: '5ac21ae3040ab15980c9b440',
|
|
171
|
+
total: 149,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: '5ac218e3040ab15980c9b43c',
|
|
175
|
+
total: 221,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: '5ac21184040ab15980c9b43a',
|
|
179
|
+
total: 234,
|
|
180
|
+
},
|
|
181
|
+
];
|
|
182
|
+
const generateStringArray = (length = 0) => {
|
|
183
|
+
const result = [];
|
|
184
|
+
for (let i = 1; i <= length; i += 1) {
|
|
185
|
+
// Use String.prototype.padStart to ensure leading zeros
|
|
186
|
+
const str = i.toString().padStart(3, '0');
|
|
187
|
+
result.push(str);
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
};
|
|
191
|
+
export const TAB_LINE_MESSAGE_EMOJIS = Object.freeze(PRODUCT_ID_EMOJIS.map(({ id }) => ({
|
|
192
|
+
key: id,
|
|
193
|
+
value: getLinkLineURLImage(id, '001'),
|
|
194
|
+
})));
|
|
195
|
+
const generateLineEmojis = () => {
|
|
196
|
+
const results = {};
|
|
197
|
+
try {
|
|
198
|
+
PRODUCT_ID_EMOJIS.forEach(({ id, total }) => {
|
|
199
|
+
results[id] = generateStringArray(total);
|
|
200
|
+
});
|
|
201
|
+
return results;
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
// eslint-disable-next-line no-console
|
|
205
|
+
console.log(error);
|
|
206
|
+
}
|
|
207
|
+
return results;
|
|
208
|
+
};
|
|
209
|
+
export const LINE_MESSAGE_EMOJIS = Object.freeze(generateLineEmojis());
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
// Libraries
|
|
4
|
+
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
import { useImmer } from 'use-immer';
|
|
7
|
+
// Components & Styled
|
|
8
|
+
import { Emoji, EmojiList, EmojiImage, WrapperCollection } from '../styled';
|
|
9
|
+
import { Empty, Flex, Scrollbars } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
10
|
+
import { getLinkLineURLImage, PREFIX_PATTERN_LINE_MESSAGE, } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
11
|
+
import { EmojiSmileIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
12
|
+
// Constants
|
|
13
|
+
import { LINE_MESSAGE_EMOJIS, TAB_LINE_MESSAGE_EMOJIS } from './constants';
|
|
14
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
15
|
+
const LineCollection = ({ onEmojiClick }) => {
|
|
16
|
+
// States
|
|
17
|
+
const [state, setState] = useImmer({
|
|
18
|
+
collectionActive: TAB_LINE_MESSAGE_EMOJIS[0]?.key || '',
|
|
19
|
+
});
|
|
20
|
+
// Memoizations
|
|
21
|
+
const emojiList = useMemo(() => (LINE_MESSAGE_EMOJIS ? LINE_MESSAGE_EMOJIS[state.collectionActive] : []), [state.collectionActive]);
|
|
22
|
+
const handleClickCollection = useCallback((newCollection) => {
|
|
23
|
+
setState(draft => {
|
|
24
|
+
draft.collectionActive = newCollection;
|
|
25
|
+
});
|
|
26
|
+
}, [setState]);
|
|
27
|
+
useEffect(() => () => {
|
|
28
|
+
setState(draft => {
|
|
29
|
+
draft.collectionActive = TAB_LINE_MESSAGE_EMOJIS[0]?.key || '';
|
|
30
|
+
});
|
|
31
|
+
}, [setState]);
|
|
32
|
+
const renderLineCategory = useCallback(() => {
|
|
33
|
+
const content = TAB_LINE_MESSAGE_EMOJIS.map(emoji => {
|
|
34
|
+
const { key, value } = emoji;
|
|
35
|
+
return (_jsx(Emoji, { type: "text", "$width": 40, "$height": 40, "$active": key === state.collectionActive, icon: _jsx(EmojiImage, { src: value, alt: key, style: { width: 20 } }), onClick: () => handleClickCollection(key) }, key));
|
|
36
|
+
});
|
|
37
|
+
return (_jsx(Scrollbars, { autoHeight: true, autoHeightMax: 40, children: _jsx(Flex, { wrap: "nowrap", children: content }) }));
|
|
38
|
+
}, [state.collectionActive, handleClickCollection]);
|
|
39
|
+
const renderLineEmoji = useCallback(() => {
|
|
40
|
+
if (_.isArray(emojiList) && !emojiList.length) {
|
|
41
|
+
return (_jsx(Empty, { image: _jsx(EmojiSmileIcon, { width: 50, height: 50, color: globalToken?.bw8 }), description: _jsx("span", { style: { color: globalToken?.bw8 }, children: "Emoji not found" }) }));
|
|
42
|
+
}
|
|
43
|
+
const content = emojiList.map((emojiId) => {
|
|
44
|
+
const src = getLinkLineURLImage(state.collectionActive, emojiId);
|
|
45
|
+
const code = `$((${PREFIX_PATTERN_LINE_MESSAGE}:${state.collectionActive}:${emojiId}))`;
|
|
46
|
+
return (_jsx(Emoji, { type: "text", icon: _jsx(EmojiImage, { src: src, alt: emojiId }), onClick: () => onEmojiClick(code) }, emojiId));
|
|
47
|
+
});
|
|
48
|
+
return (_jsx(Scrollbars, { autoHeight: true, autoHeightMax: 150, children: _jsx(Flex, { wrap: "wrap", children: content }) }));
|
|
49
|
+
}, [emojiList, state.collectionActive, onEmojiClick]);
|
|
50
|
+
return (_jsx(WrapperCollection, { children: _jsxs(Flex, { vertical: true, children: [renderLineCategory(), _jsx(EmojiList, { children: renderLineEmoji() })] }) }));
|
|
51
|
+
};
|
|
52
|
+
LineCollection.defaultProps = {
|
|
53
|
+
onEmojiClick: () => { },
|
|
54
|
+
};
|
|
55
|
+
export default memo(LineCollection);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
// Libraries
|
|
4
|
+
import { memo, useCallback, useEffect, useMemo } from 'react';
|
|
5
|
+
import { useImmer } from 'use-immer';
|
|
6
|
+
import _ from 'lodash';
|
|
7
|
+
// Hooks
|
|
8
|
+
import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounceV2';
|
|
9
|
+
// Components & styled
|
|
10
|
+
import { Emoji, EmojiImage, EmojiList, WrapperCollection } from '../styled';
|
|
11
|
+
import { Empty, Flex, Input, Scrollbars } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
12
|
+
import { getImageSourceViberEmoji, iconsViber } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
13
|
+
import { EmojiSmileIcon, SearchIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
14
|
+
// Constants
|
|
15
|
+
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
16
|
+
const listEmoji = Object.values(iconsViber);
|
|
17
|
+
const ViberCollection = ({ onEmojiClick }) => {
|
|
18
|
+
// States
|
|
19
|
+
const [state, setState] = useImmer({
|
|
20
|
+
txtSearch: '',
|
|
21
|
+
});
|
|
22
|
+
const txtSearchDebounce = useDebounce(state.txtSearch, 300);
|
|
23
|
+
// Memoizations
|
|
24
|
+
const listEmojiMemoized = useMemo(() => {
|
|
25
|
+
if (!txtSearchDebounce)
|
|
26
|
+
return listEmoji;
|
|
27
|
+
return listEmoji.filter(emojiFileName => {
|
|
28
|
+
const [emoji] = emojiFileName.split('.');
|
|
29
|
+
return emoji.toLowerCase().includes(txtSearchDebounce.toLowerCase());
|
|
30
|
+
});
|
|
31
|
+
}, [txtSearchDebounce]);
|
|
32
|
+
const handleChangeInput = useCallback((e) => {
|
|
33
|
+
if (e.target) {
|
|
34
|
+
setState(draft => {
|
|
35
|
+
draft.txtSearch = e.target.value.trim();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, [setState]);
|
|
39
|
+
useEffect(() => () => {
|
|
40
|
+
setState(draft => {
|
|
41
|
+
draft.txtSearch = '';
|
|
42
|
+
});
|
|
43
|
+
}, [setState]);
|
|
44
|
+
const renderViberCollection = useCallback(() => {
|
|
45
|
+
if (_.isArray(listEmojiMemoized) && !listEmojiMemoized.length) {
|
|
46
|
+
return (_jsx(Empty, { image: _jsx(EmojiSmileIcon, { width: 30, height: 30, color: globalToken?.bw8 }), description: _jsx("span", { style: { color: globalToken?.bw8 }, children: "Emoji not found" }) }));
|
|
47
|
+
}
|
|
48
|
+
const content = listEmojiMemoized.map(emojiFileName => {
|
|
49
|
+
const src = getImageSourceViberEmoji(emojiFileName);
|
|
50
|
+
const [emoji] = emojiFileName.split('.');
|
|
51
|
+
const code = `(${emoji})`;
|
|
52
|
+
return (_jsx(Emoji, { type: "text", icon: _jsx(EmojiImage, { src: src, alt: emojiFileName }), onClick: () => onEmojiClick(code) }, emojiFileName));
|
|
53
|
+
});
|
|
54
|
+
return (_jsx(Scrollbars, { autoHeight: true, autoHeightMax: 150, children: _jsx(Flex, { wrap: "wrap", children: content }) }));
|
|
55
|
+
}, [listEmojiMemoized, onEmojiClick]);
|
|
56
|
+
return (_jsx(WrapperCollection, { children: _jsxs(Flex, { vertical: true, children: [_jsx(Input, { placeholder: "Search...", suffix: _jsx(SearchIcon, { color: globalToken?.bw8 }), onChange: handleChangeInput }), _jsx(EmojiList, { children: renderViberCollection() })] }) }));
|
|
57
|
+
};
|
|
58
|
+
ViberCollection.defaultProps = {
|
|
59
|
+
onEmojiClick: () => { },
|
|
60
|
+
};
|
|
61
|
+
export default memo(ViberCollection);
|