react-input-emoji 4.0.9 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -52353,6 +52353,7 @@ styleInject(css_248z);
52353
52353
  // vendors
52354
52354
  /**
52355
52355
  * @typedef {object} Props
52356
+ * @property {'light' | 'dark' | 'auto'} theme
52356
52357
  * @property {function(import("../types/types").EmojiMartItem): void} onSelectEmoji
52357
52358
  * @property {boolean} disableRecent
52358
52359
  * @property {object[]} customEmojis
@@ -52364,12 +52365,14 @@ styleInject(css_248z);
52364
52365
  * @return {React.FC}
52365
52366
  */
52366
52367
 
52367
- function EmojiPicker({
52368
- onSelectEmoji,
52369
- disableRecent,
52370
- customEmojis
52371
- }) {
52372
- const excluePicker = React.useMemo(() => {
52368
+ function EmojiPicker(props) {
52369
+ const {
52370
+ theme,
52371
+ onSelectEmoji,
52372
+ disableRecent,
52373
+ customEmojis
52374
+ } = props;
52375
+ const excludePicker = React.useMemo(() => {
52373
52376
  /** @type import("emoji-mart").CategoryName[] */
52374
52377
  const exclude = [];
52375
52378
 
@@ -52380,16 +52383,18 @@ function EmojiPicker({
52380
52383
  return exclude;
52381
52384
  }, [disableRecent]);
52382
52385
  return /*#__PURE__*/React__default['default'].createElement(Picker, {
52386
+ theme: theme,
52387
+ set: "apple",
52383
52388
  showPreview: false,
52384
52389
  showSkinTones: false,
52385
- set: "apple",
52386
52390
  onSelect: onSelectEmoji,
52387
- exclude: excluePicker,
52391
+ exclude: excludePicker,
52388
52392
  custom: customEmojis
52389
52393
  });
52390
52394
  }
52391
52395
 
52392
52396
  EmojiPicker.propTypes = {
52397
+ theme: PropTypes__default['default'].oneOf(['light', 'dark', 'auto']),
52393
52398
  onSelectEmoji: PropTypes__default['default'].func,
52394
52399
  disableRecent: PropTypes__default['default'].bool,
52395
52400
  customEmojis: PropTypes__default['default'].array
@@ -52407,7 +52412,8 @@ var EmojiPicker$1 = /*#__PURE__*/React.memo(EmojiPicker);
52407
52412
 
52408
52413
  /**
52409
52414
  * @typedef {Object} Props
52410
- * @property {boolean} keepOpenend
52415
+ * @property {'light' | 'dark' | 'auto'} theme
52416
+ * @property {boolean} keepOpened
52411
52417
  * @property {boolean} disableRecent
52412
52418
  * @property {object[]=} customEmojis
52413
52419
  * @property {(fn: SanitizeFn) => void} addSanitizeFn
@@ -52418,14 +52424,16 @@ var EmojiPicker$1 = /*#__PURE__*/React.memo(EmojiPicker);
52418
52424
 
52419
52425
  /** @type {React.FC<Props>} */
52420
52426
 
52421
- const EmojiPickerWrapper = ({
52422
- keepOpenend,
52423
- disableRecent,
52424
- customEmojis,
52425
- addSanitizeFn,
52426
- addPolluteFn,
52427
- appendContent
52428
- }) => {
52427
+ const EmojiPickerWrapper = props => {
52428
+ const {
52429
+ theme,
52430
+ keepOpened,
52431
+ disableRecent,
52432
+ customEmojis,
52433
+ addSanitizeFn,
52434
+ addPolluteFn,
52435
+ appendContent
52436
+ } = props;
52429
52437
  const [showPicker, setShowPicker] = React.useState(false);
52430
52438
  React.useEffect(() => {
52431
52439
  addSanitizeFn(replaceAllTextEmojiToString);
@@ -52475,7 +52483,7 @@ const EmojiPickerWrapper = ({
52475
52483
  function handleSelectEmoji(emoji) {
52476
52484
  appendContent(getImageEmoji(emoji));
52477
52485
 
52478
- if (!keepOpenend) {
52486
+ if (!keepOpened) {
52479
52487
  setShowPicker(currentShowPicker => !currentShowPicker);
52480
52488
  }
52481
52489
  }
@@ -52488,6 +52496,7 @@ const EmojiPickerWrapper = ({
52488
52496
  }, /*#__PURE__*/React__default['default'].createElement("div", {
52489
52497
  className: "react-emoji-picker"
52490
52498
  }, /*#__PURE__*/React__default['default'].createElement(EmojiPicker$1, {
52499
+ theme: theme,
52491
52500
  onSelectEmoji: handleSelectEmoji,
52492
52501
  disableRecent: disableRecent,
52493
52502
  customEmojis: customEmojis
@@ -53063,6 +53072,7 @@ function usePollute() {
53063
53072
  * @typedef {object} Props
53064
53073
  * @property {string} value
53065
53074
  * @property {(value: string) => void} onChange
53075
+ * @property {"light" | "dark" | "auto"} theme
53066
53076
  * @property {boolean} cleanOnEnter
53067
53077
  * @property {(text: string) => void} onEnter
53068
53078
  * @property {string} placeholder
@@ -53070,7 +53080,7 @@ function usePollute() {
53070
53080
  * @property {() => void} onClick
53071
53081
  * @property {() => void} onFocus
53072
53082
  * @property {number} maxLength
53073
- * @property {boolean} keepOpenend
53083
+ * @property {boolean} keepOpened
53074
53084
  * @property {(event: KeyboardEvent) => void} onKeyDown
53075
53085
  * @property {string} inputClass
53076
53086
  * @property {boolean} disableRecent
@@ -53091,30 +53101,33 @@ function usePollute() {
53091
53101
  * @return {JSX.Element}
53092
53102
  */
53093
53103
 
53094
- function InputEmoji({
53095
- onChange,
53096
- onEnter,
53097
- onResize,
53098
- onClick,
53099
- onFocus,
53100
- onKeyDown,
53101
- cleanOnEnter,
53102
- placeholder,
53103
- maxLength,
53104
- keepOpenend,
53105
- inputClass,
53106
- disableRecent,
53107
- tabIndex,
53108
- value,
53109
- customEmojis,
53110
- searchMention,
53111
- // style
53112
- borderRadius,
53113
- borderColor,
53114
- fontSize,
53115
- fontFamily
53116
- }, ref) {
53104
+ function InputEmoji(props, ref) {
53105
+ const {
53106
+ onChange,
53107
+ onEnter,
53108
+ onResize,
53109
+ onClick,
53110
+ onFocus,
53111
+ onKeyDown,
53112
+ theme,
53113
+ cleanOnEnter,
53114
+ placeholder,
53115
+ maxLength,
53116
+ keepOpened,
53117
+ inputClass,
53118
+ disableRecent,
53119
+ tabIndex,
53120
+ value,
53121
+ customEmojis,
53122
+ searchMention,
53123
+ // style
53124
+ borderRadius,
53125
+ borderColor,
53126
+ fontSize,
53127
+ fontFamily
53128
+ } = props;
53117
53129
  /** @type {React.MutableRefObject<import('./text-input').Ref>} */
53130
+
53118
53131
  const textInputRef = React.useRef(null);
53119
53132
  const {
53120
53133
  addEventListener,
@@ -53288,7 +53301,8 @@ function InputEmoji({
53288
53301
  className: inputClass,
53289
53302
  onChange: handleTextInputChange
53290
53303
  }), /*#__PURE__*/React__default['default'].createElement(EmojiPickerWrapper, {
53291
- keepOpenend: keepOpenend,
53304
+ theme: theme,
53305
+ keepOpened: keepOpened,
53292
53306
  disableRecent: disableRecent,
53293
53307
  customEmojis: customEmojis,
53294
53308
  addSanitizeFn: addSanitizeFn,
@@ -53299,6 +53313,9 @@ function InputEmoji({
53299
53313
 
53300
53314
  const InputEmojiWithRef = /*#__PURE__*/React.forwardRef(InputEmoji);
53301
53315
  InputEmojiWithRef.defaultProps = {
53316
+ theme:
53317
+ /** @type {const} */
53318
+ "auto",
53302
53319
  height: 30,
53303
53320
  placeholder: "Type a message",
53304
53321
  borderRadius: 21,