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/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
@@ -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
- onSelectEmoji,
52362
- disableRecent,
52363
- customEmojis
52364
- }) {
52365
- const excluePicker = useMemo(() => {
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: excluePicker,
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 {boolean} keepOpenend
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
- keepOpenend,
52416
- disableRecent,
52417
- customEmojis,
52418
- addSanitizeFn,
52419
- addPolluteFn,
52420
- appendContent
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 (!keepOpenend) {
52479
+ if (!keepOpened) {
52472
52480
  setShowPicker(currentShowPicker => !currentShowPicker);
52473
52481
  }
52474
52482
  }
@@ -52481,6 +52489,7 @@ 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
@@ -53056,6 +53065,7 @@ function usePollute() {
53056
53065
  * @typedef {object} Props
53057
53066
  * @property {string} value
53058
53067
  * @property {(value: string) => void} onChange
53068
+ * @property {"light" | "dark" | "auto"} theme
53059
53069
  * @property {boolean} cleanOnEnter
53060
53070
  * @property {(text: string) => void} onEnter
53061
53071
  * @property {string} placeholder
@@ -53063,7 +53073,7 @@ function usePollute() {
53063
53073
  * @property {() => void} onClick
53064
53074
  * @property {() => void} onFocus
53065
53075
  * @property {number} maxLength
53066
- * @property {boolean} keepOpenend
53076
+ * @property {boolean} keepOpened
53067
53077
  * @property {(event: KeyboardEvent) => void} onKeyDown
53068
53078
  * @property {string} inputClass
53069
53079
  * @property {boolean} disableRecent
@@ -53084,30 +53094,33 @@ function usePollute() {
53084
53094
  * @return {JSX.Element}
53085
53095
  */
53086
53096
 
53087
- function InputEmoji({
53088
- onChange,
53089
- onEnter,
53090
- onResize,
53091
- onClick,
53092
- onFocus,
53093
- onKeyDown,
53094
- cleanOnEnter,
53095
- placeholder,
53096
- maxLength,
53097
- keepOpenend,
53098
- inputClass,
53099
- disableRecent,
53100
- tabIndex,
53101
- value,
53102
- customEmojis,
53103
- searchMention,
53104
- // style
53105
- borderRadius,
53106
- borderColor,
53107
- fontSize,
53108
- fontFamily
53109
- }, ref) {
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;
53110
53122
  /** @type {React.MutableRefObject<import('./text-input').Ref>} */
53123
+
53111
53124
  const textInputRef = useRef(null);
53112
53125
  const {
53113
53126
  addEventListener,
@@ -53281,7 +53294,8 @@ function InputEmoji({
53281
53294
  className: inputClass,
53282
53295
  onChange: handleTextInputChange
53283
53296
  }), /*#__PURE__*/React.createElement(EmojiPickerWrapper, {
53284
- keepOpenend: keepOpenend,
53297
+ theme: theme,
53298
+ keepOpened: keepOpened,
53285
53299
  disableRecent: disableRecent,
53286
53300
  customEmojis: customEmojis,
53287
53301
  addSanitizeFn: addSanitizeFn,
@@ -53292,6 +53306,9 @@ function InputEmoji({
53292
53306
 
53293
53307
  const InputEmojiWithRef = /*#__PURE__*/forwardRef(InputEmoji);
53294
53308
  InputEmojiWithRef.defaultProps = {
53309
+ theme:
53310
+ /** @type {const} */
53311
+ "auto",
53295
53312
  height: 30,
53296
53313
  placeholder: "Type a message",
53297
53314
  borderRadius: 21,