react-input-emoji 4.0.7 → 4.1.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 +2 -1
- package/dist/index.es.js +63 -44
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +63 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -46,7 +46,7 @@ export default function Example() {
|
|
46
46
|
## Props
|
47
47
|
|
48
48
|
| Prop | Type | Default | Description |
|
49
|
-
|
49
|
+
|----------------|----------|------------------|--------------------------------------------------------------------------------------------------------------------------|
|
50
50
|
| `value` | string | "" | The input value. |
|
51
51
|
| `onChange` | function | - | This function is called when the value of the input changes. The first argument is the current value. |
|
52
52
|
| `onResize` | function | - | This function is called when the width or the height of the input changes. The first argument is the current size value. |
|
@@ -57,6 +57,7 @@ export default function Example() {
|
|
57
57
|
| `placeholder` | string | "Type a message" | Set the placeholder of the input. |
|
58
58
|
| `height` | number | 40 | The total height of the area in which the element is rendered. |
|
59
59
|
| `maxLength` | number | - | The maximum number of characters allowed in the element. |
|
60
|
+
| `theme` | string | - | Set theme for emoji popup. Available values "light", "dark", "auto" |
|
60
61
|
| `borderRadius` | number | 21 | The border radius of the input container. |
|
61
62
|
| `borderColor` | string | "#EAEAEA" | The border color of the input container. |
|
62
63
|
| `fontSize` | number | 15 | The font size of the placeholder and input container. |
|
package/dist/index.es.js
CHANGED
@@ -30,7 +30,7 @@ function styleInject(css, ref) {
|
|
30
30
|
}
|
31
31
|
}
|
32
32
|
|
33
|
-
var css_248z$1 = ".react-input-emoji--container {\n color: #4b4b4b;\n text-rendering: optimizeLegibility;\n background-color: #fff;\n border: 1px solid #fff;\n border-radius: 21px;\n margin: 5px 10px;\n box-sizing: border-box;\n flex: 1 1 auto;\n font-size: 15px;\n font-family: sans-serif;\n font-weight: 400;\n line-height: 20px;\n min-height: 20px;\n min-width: 0;\n outline: none;\n width: inherit;\n will-change: width;\n vertical-align: baseline;\n border: 1px solid #eaeaea;\n margin-right: 0;\n}\n\n.react-input-emoji--wrapper {\n display: flex;\n overflow: hidden;\n flex: 1;\n position: relative;\n padding-right: 0;\n vertical-align: baseline;\n outline: none;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n.react-input-emoji--input {\n font-weight: 400;\n max-height: 100px;\n min-height: 20px;\n outline: none;\n overflow-x: hidden;\n overflow-y: auto;\n position: relative;\n white-space: pre-wrap;\n word-wrap: break-word;\n z-index: 1;\n width: 100%;\n user-select: text;\n padding: 9px 12px 11px;\n text-align: left;\n}\n\n.react-input-emoji--input img {\n vertical-align: middle;\n width: 18px !important;\n height: 18px !important;\n display: inline !important;\n margin-left: 1px;\n margin-right: 1px;\n}\n\n.react-input-emoji--overlay {\n position: fixed;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 9;\n}\n\n.react-input-emoji--placeholder {\n color: #a0a0a0;\n pointer-events: none;\n position: absolute;\n user-select: none;\n z-index: 2;\n left: 16px;\n top: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n width: calc(100% - 22px);\n}\n\n.react-input-emoji--button {\n position: relative;\n display: block;\n text-align: center;\n padding: 0 10px;\n overflow: hidden;\n transition: color 0.1s ease-out;\n margin: 0;\n box-shadow: none;\n background: none;\n border: none;\n outline: none;\n cursor: pointer;\n flex-shrink: 0;\n}\n\n.react-input-emoji--button svg {\n fill: #858585;\n}\n\n.react-input-emoji--button__show svg {\n fill: #128b7e;\n}\n\n.react-emoji {\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n}\n\n.react-emoji-picker--container {\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.react-emoji-picker--wrapper {\n position: absolute;\n bottom: 0;\n right: 0;\n height: 357px;\n width: 338px;\n overflow: hidden;\n z-index: 10;\n}\n\n.react-emoji-picker {\n position: absolute;\n top: 0;\n left: 0;\n animation: slidein 0.1s ease-in-out;\n}\n\n.react-emoji-picker__show {\n top: 0;\n}\n\n.react-input-emoji--mention--container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 10;\n}\n\n.react-input-emoji--mention--list {\n background-color: #fafafa;\n border: 1px solid #eaeaea;\n border-radius: 4px;\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n gap: 5px;\n flex-direction: column;\n position: absolute;\n bottom: 0;\n width: 100%;\n left: 0;\n}\n\n.react-input-emoji--mention--item {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 5px 10px;\n background-color: transparent;\n width: 100%;\n margin: 0;\n border: 0;\n}\n\n.react-input-emoji--mention--item__selected {\n background-color: #eeeeee;\n}\n\n.react-input-emoji--mention--item--img {\n width: 34px;\n height: 34px;\n border-radius: 50%;\n}\n\n.react-input-emoji--mention--item--name {\n font-size: 16px;\n color: #333;\n}\n\n.react-input-emoji--mention--item--name__selected {\n color: green;\n}\n\n.react-input-emoji--mention--text {\n color: #039be5;\n}\n\n.react-input-emoji--mention--loading {\n background-color: #fafafa;\n border: 1px solid #eaeaea;\n border-radius: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 10px 0;\n}\n\n.react-input-emoji--mention--loading--spinner,\n.react-input-emoji--mention--loading--spinner::after {\n border-radius: 50%;\n width: 10em;\n height: 10em;\n}\n\n.react-input-emoji--mention--loading--spinner {\n margin: 1px auto;\n font-size: 2px;\n position: relative;\n text-indent: -9999em;\n border-top: 1.1em solid rgba(0, 0, 0, 0.1);\n border-right: 1.1em solid rgba(0, 0, 0, 0.1);\n border-bottom: 1.1em solid rgba(0, 0, 0, 0.1);\n border-left: 1.1em solid rgba(0, 0, 0, 0.4);\n transform: translateZ(0);\n animation: load8 1.1s infinite linear;\n}\n\n@keyframes load8 {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n@keyframes slidein {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n";
|
33
|
+
var css_248z$1 = ".react-input-emoji--container {\n color: #4b4b4b;\n text-rendering: optimizeLegibility;\n background-color: #fff;\n border: 1px solid #fff;\n border-radius: 21px;\n margin: 5px 10px;\n box-sizing: border-box;\n flex: 1 1 auto;\n font-size: 15px;\n font-family: sans-serif;\n font-weight: 400;\n line-height: 20px;\n min-height: 20px;\n min-width: 0;\n outline: none;\n width: inherit;\n will-change: width;\n vertical-align: baseline;\n border: 1px solid #eaeaea;\n margin-right: 0;\n}\n\n.react-input-emoji--wrapper {\n display: flex;\n overflow: hidden;\n flex: 1;\n position: relative;\n padding-right: 0;\n vertical-align: baseline;\n outline: none;\n margin: 0;\n padding: 0;\n border: 0;\n}\n\n.react-input-emoji--input {\n font-weight: 400;\n max-height: 100px;\n min-height: 20px;\n outline: none;\n overflow-x: hidden;\n overflow-y: auto;\n position: relative;\n white-space: pre-wrap;\n word-wrap: break-word;\n z-index: 1;\n width: 100%;\n user-select: text;\n padding: 9px 12px 11px;\n text-align: left;\n}\n\n.react-input-emoji--input img {\n vertical-align: middle;\n width: 18px !important;\n height: 18px !important;\n display: inline !important;\n margin-left: 1px;\n margin-right: 1px;\n}\n\n.react-input-emoji--overlay {\n position: fixed;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 9;\n}\n\n.react-input-emoji--placeholder {\n color: #a0a0a0;\n pointer-events: none;\n position: absolute;\n user-select: none;\n z-index: 2;\n left: 16px;\n top: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n width: calc(100% - 22px);\n}\n\n.react-input-emoji--button {\n position: relative;\n display: block;\n text-align: center;\n padding: 0 10px;\n overflow: hidden;\n transition: color 0.1s ease-out;\n margin: 0;\n box-shadow: none;\n background: none;\n border: none;\n outline: none;\n cursor: pointer;\n flex-shrink: 0;\n}\n\n.react-input-emoji--button svg {\n fill: #858585;\n}\n\n.react-input-emoji--button__show svg {\n fill: #128b7e;\n}\n\n.react-emoji {\n display: flex;\n align-items: center;\n position: relative;\n width: 100%;\n}\n\n.react-emoji-picker--container {\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.react-emoji-picker--wrapper {\n position: absolute;\n bottom: 0;\n right: 0;\n height: 357px;\n width: 338px;\n overflow: hidden;\n z-index: 10;\n}\n\n.react-emoji-picker {\n position: absolute;\n top: 0;\n left: 0;\n animation: slidein 0.1s ease-in-out;\n}\n\n.react-emoji-picker__show {\n top: 0;\n}\n\n.react-input-emoji--mention--container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 10;\n}\n\n.react-input-emoji--mention--list {\n background-color: #fafafa;\n border: 1px solid #eaeaea;\n border-radius: 4px;\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n gap: 5px;\n flex-direction: column;\n position: absolute;\n bottom: 0;\n width: 100%;\n left: 0;\n}\n\n.react-input-emoji--mention--item {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 5px 10px;\n background-color: transparent;\n width: 100%;\n margin: 0;\n border: 0;\n}\n\n.react-input-emoji--mention--item__selected {\n background-color: #eeeeee;\n}\n\n.react-input-emoji--mention--item--img {\n width: 34px;\n height: 34px;\n border-radius: 50%;\n}\n\n.react-input-emoji--mention--item--name {\n font-size: 16px;\n color: #333;\n}\n\n.react-input-emoji--mention--item--name__selected {\n color: green;\n}\n\n.react-input-emoji--mention--text {\n color: #039be5;\n}\n\n.react-input-emoji--mention--loading {\n background-color: #fafafa;\n border: 1px solid #eaeaea;\n border-radius: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 10px 0;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n}\n\n.react-input-emoji--mention--loading--spinner,\n.react-input-emoji--mention--loading--spinner::after {\n border-radius: 50%;\n width: 10em;\n height: 10em;\n}\n\n.react-input-emoji--mention--loading--spinner {\n margin: 1px auto;\n font-size: 2px;\n position: relative;\n text-indent: -9999em;\n border-top: 1.1em solid rgba(0, 0, 0, 0.1);\n border-right: 1.1em solid rgba(0, 0, 0, 0.1);\n border-bottom: 1.1em solid rgba(0, 0, 0, 0.1);\n border-left: 1.1em solid rgba(0, 0, 0, 0.4);\n transform: translateZ(0);\n animation: load8 1.1s infinite linear;\n}\n\n@keyframes load8 {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n@keyframes slidein {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n";
|
34
34
|
styleInject(css_248z$1);
|
35
35
|
|
36
36
|
// @ts-check
|
@@ -52346,6 +52346,7 @@ styleInject(css_248z);
|
|
52346
52346
|
// vendors
|
52347
52347
|
/**
|
52348
52348
|
* @typedef {object} Props
|
52349
|
+
* @property {'light' | 'dark' | 'auto'} theme
|
52349
52350
|
* @property {function(import("../types/types").EmojiMartItem): void} onSelectEmoji
|
52350
52351
|
* @property {boolean} disableRecent
|
52351
52352
|
* @property {object[]} customEmojis
|
@@ -52357,12 +52358,14 @@ styleInject(css_248z);
|
|
52357
52358
|
* @return {React.FC}
|
52358
52359
|
*/
|
52359
52360
|
|
52360
|
-
function EmojiPicker({
|
52361
|
-
|
52362
|
-
|
52363
|
-
|
52364
|
-
|
52365
|
-
|
52361
|
+
function EmojiPicker(props) {
|
52362
|
+
const {
|
52363
|
+
theme,
|
52364
|
+
onSelectEmoji,
|
52365
|
+
disableRecent,
|
52366
|
+
customEmojis
|
52367
|
+
} = props;
|
52368
|
+
const excludePicker = useMemo(() => {
|
52366
52369
|
/** @type import("emoji-mart").CategoryName[] */
|
52367
52370
|
const exclude = [];
|
52368
52371
|
|
@@ -52373,16 +52376,18 @@ function EmojiPicker({
|
|
52373
52376
|
return exclude;
|
52374
52377
|
}, [disableRecent]);
|
52375
52378
|
return /*#__PURE__*/React.createElement(Picker, {
|
52379
|
+
theme: theme,
|
52380
|
+
set: "apple",
|
52376
52381
|
showPreview: false,
|
52377
52382
|
showSkinTones: false,
|
52378
|
-
set: "apple",
|
52379
52383
|
onSelect: onSelectEmoji,
|
52380
|
-
exclude:
|
52384
|
+
exclude: excludePicker,
|
52381
52385
|
custom: customEmojis
|
52382
52386
|
});
|
52383
52387
|
}
|
52384
52388
|
|
52385
52389
|
EmojiPicker.propTypes = {
|
52390
|
+
theme: PropTypes.oneOf(['light', 'dark', 'auto']),
|
52386
52391
|
onSelectEmoji: PropTypes.func,
|
52387
52392
|
disableRecent: PropTypes.bool,
|
52388
52393
|
customEmojis: PropTypes.array
|
@@ -52400,7 +52405,8 @@ var EmojiPicker$1 = /*#__PURE__*/memo(EmojiPicker);
|
|
52400
52405
|
|
52401
52406
|
/**
|
52402
52407
|
* @typedef {Object} Props
|
52403
|
-
* @property {
|
52408
|
+
* @property {'light' | 'dark' | 'auto'} theme
|
52409
|
+
* @property {boolean} keepOpened
|
52404
52410
|
* @property {boolean} disableRecent
|
52405
52411
|
* @property {object[]=} customEmojis
|
52406
52412
|
* @property {(fn: SanitizeFn) => void} addSanitizeFn
|
@@ -52411,14 +52417,16 @@ var EmojiPicker$1 = /*#__PURE__*/memo(EmojiPicker);
|
|
52411
52417
|
|
52412
52418
|
/** @type {React.FC<Props>} */
|
52413
52419
|
|
52414
|
-
const EmojiPickerWrapper =
|
52415
|
-
|
52416
|
-
|
52417
|
-
|
52418
|
-
|
52419
|
-
|
52420
|
-
|
52421
|
-
|
52420
|
+
const EmojiPickerWrapper = props => {
|
52421
|
+
const {
|
52422
|
+
theme,
|
52423
|
+
keepOpened,
|
52424
|
+
disableRecent,
|
52425
|
+
customEmojis,
|
52426
|
+
addSanitizeFn,
|
52427
|
+
addPolluteFn,
|
52428
|
+
appendContent
|
52429
|
+
} = props;
|
52422
52430
|
const [showPicker, setShowPicker] = useState(false);
|
52423
52431
|
useEffect(() => {
|
52424
52432
|
addSanitizeFn(replaceAllTextEmojiToString);
|
@@ -52468,7 +52476,7 @@ const EmojiPickerWrapper = ({
|
|
52468
52476
|
function handleSelectEmoji(emoji) {
|
52469
52477
|
appendContent(getImageEmoji(emoji));
|
52470
52478
|
|
52471
|
-
if (!
|
52479
|
+
if (!keepOpened) {
|
52472
52480
|
setShowPicker(currentShowPicker => !currentShowPicker);
|
52473
52481
|
}
|
52474
52482
|
}
|
@@ -52481,10 +52489,12 @@ const EmojiPickerWrapper = ({
|
|
52481
52489
|
}, /*#__PURE__*/React.createElement("div", {
|
52482
52490
|
className: "react-emoji-picker"
|
52483
52491
|
}, /*#__PURE__*/React.createElement(EmojiPicker$1, {
|
52492
|
+
theme: theme,
|
52484
52493
|
onSelectEmoji: handleSelectEmoji,
|
52485
52494
|
disableRecent: disableRecent,
|
52486
52495
|
customEmojis: customEmojis
|
52487
52496
|
})))), /*#__PURE__*/React.createElement("button", {
|
52497
|
+
type: "button",
|
52488
52498
|
className: `react-input-emoji--button${showPicker ? " react-input-emoji--button__show" : ""}`,
|
52489
52499
|
onClick: toggleShowPicker
|
52490
52500
|
}, /*#__PURE__*/React.createElement("svg", {
|
@@ -52788,6 +52798,7 @@ const MentionUserList = ({
|
|
52788
52798
|
}, usersFiltered.map((user, index) => /*#__PURE__*/React.createElement("li", {
|
52789
52799
|
key: user.id
|
52790
52800
|
}, /*#__PURE__*/React.createElement("button", {
|
52801
|
+
type: "button",
|
52791
52802
|
onClick: handleClick(user),
|
52792
52803
|
className: `react-input-emoji--mention--item${selectedUser === index ? " react-input-emoji--mention--item__selected" : ""}`,
|
52793
52804
|
onMouseOver: () => setSelectedUser(index)
|
@@ -53054,6 +53065,7 @@ function usePollute() {
|
|
53054
53065
|
* @typedef {object} Props
|
53055
53066
|
* @property {string} value
|
53056
53067
|
* @property {(value: string) => void} onChange
|
53068
|
+
* @property {"light" | "dark" | "auto"} theme
|
53057
53069
|
* @property {boolean} cleanOnEnter
|
53058
53070
|
* @property {(text: string) => void} onEnter
|
53059
53071
|
* @property {string} placeholder
|
@@ -53061,7 +53073,7 @@ function usePollute() {
|
|
53061
53073
|
* @property {() => void} onClick
|
53062
53074
|
* @property {() => void} onFocus
|
53063
53075
|
* @property {number} maxLength
|
53064
|
-
* @property {boolean}
|
53076
|
+
* @property {boolean} keepOpened
|
53065
53077
|
* @property {(event: KeyboardEvent) => void} onKeyDown
|
53066
53078
|
* @property {string} inputClass
|
53067
53079
|
* @property {boolean} disableRecent
|
@@ -53082,30 +53094,33 @@ function usePollute() {
|
|
53082
53094
|
* @return {JSX.Element}
|
53083
53095
|
*/
|
53084
53096
|
|
53085
|
-
function InputEmoji({
|
53086
|
-
|
53087
|
-
|
53088
|
-
|
53089
|
-
|
53090
|
-
|
53091
|
-
|
53092
|
-
|
53093
|
-
|
53094
|
-
|
53095
|
-
|
53096
|
-
|
53097
|
-
|
53098
|
-
|
53099
|
-
|
53100
|
-
|
53101
|
-
|
53102
|
-
|
53103
|
-
|
53104
|
-
|
53105
|
-
|
53106
|
-
|
53107
|
-
|
53097
|
+
function InputEmoji(props, ref) {
|
53098
|
+
const {
|
53099
|
+
onChange,
|
53100
|
+
onEnter,
|
53101
|
+
onResize,
|
53102
|
+
onClick,
|
53103
|
+
onFocus,
|
53104
|
+
onKeyDown,
|
53105
|
+
theme,
|
53106
|
+
cleanOnEnter,
|
53107
|
+
placeholder,
|
53108
|
+
maxLength,
|
53109
|
+
keepOpened,
|
53110
|
+
inputClass,
|
53111
|
+
disableRecent,
|
53112
|
+
tabIndex,
|
53113
|
+
value,
|
53114
|
+
customEmojis,
|
53115
|
+
searchMention,
|
53116
|
+
// style
|
53117
|
+
borderRadius,
|
53118
|
+
borderColor,
|
53119
|
+
fontSize,
|
53120
|
+
fontFamily
|
53121
|
+
} = props;
|
53108
53122
|
/** @type {React.MutableRefObject<import('./text-input').Ref>} */
|
53123
|
+
|
53109
53124
|
const textInputRef = useRef(null);
|
53110
53125
|
const {
|
53111
53126
|
addEventListener,
|
@@ -53279,7 +53294,8 @@ function InputEmoji({
|
|
53279
53294
|
className: inputClass,
|
53280
53295
|
onChange: handleTextInputChange
|
53281
53296
|
}), /*#__PURE__*/React.createElement(EmojiPickerWrapper, {
|
53282
|
-
|
53297
|
+
theme: theme,
|
53298
|
+
keepOpened: keepOpened,
|
53283
53299
|
disableRecent: disableRecent,
|
53284
53300
|
customEmojis: customEmojis,
|
53285
53301
|
addSanitizeFn: addSanitizeFn,
|
@@ -53290,6 +53306,9 @@ function InputEmoji({
|
|
53290
53306
|
|
53291
53307
|
const InputEmojiWithRef = /*#__PURE__*/forwardRef(InputEmoji);
|
53292
53308
|
InputEmojiWithRef.defaultProps = {
|
53309
|
+
theme:
|
53310
|
+
/** @type {const} */
|
53311
|
+
"auto",
|
53293
53312
|
height: 30,
|
53294
53313
|
placeholder: "Type a message",
|
53295
53314
|
borderRadius: 21,
|