emoji-picker-react 4.0.0-rc.33 → 4.0.0-rc.34

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 CHANGED
@@ -37,6 +37,7 @@ function App() {
37
37
  - Skin tone change
38
38
  - Different emoji sets (Google, Apple, Facebook, Twitter)
39
39
  - Native Emoji support
40
+ - Emoji Component To Render Emojis in your app
40
41
 
41
42
  # Props
42
43
 
@@ -169,6 +170,32 @@ The list of possible variables is quite extensive, but the main ones you may wan
169
170
  - `--epr-bg-color`: The background color of the picker. When changing it, you should also change `--epr-category-label-bg-color` as they are usually the same color.
170
171
  - `--epr-text-color`: The text color in the picker.
171
172
 
173
+ # Rendering Output Emojis in Your App
174
+
175
+ The picker exports an `Emoji` component. The emoji component is the same used within the picker, so it will render the same way as the emojis in the picker. You can choose to render emojis either as native, or as images.
176
+
177
+ ## Props
178
+
179
+ | Name | Type | Default | Description |
180
+ | ------------ | ------------ | ------------------ | ------------------------------------------------------------------------------------------- |
181
+ | `unified` | string | "" | The unified code of the emoji. |
182
+ | `size` | number | 32 | The size of the emoji. |
183
+ | `emojiStyle` | `EmojiStyle` | `EmojiStyle.APPLE` | The emoji style to use. Can be either `apple`, `google`, `facebook`, `twitter` or `native`. |
184
+ | `lazyLoad` | boolean | `false` | Whether to lazy load the emoji. image |
185
+
186
+ ```js
187
+ import { Emoji, EmojiStyle } from 'emoji-picker-react';
188
+
189
+ export function MyApp() {
190
+ return (
191
+ <p>
192
+ My Favorite emoji is:
193
+ <Emoji unified="1f423" size="25" />
194
+ </p>
195
+ );
196
+ }
197
+ ```
198
+
172
199
  # Troubleshooting
173
200
 
174
201
  ## Error Boundary
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { EmojiStyle } from '../../types/exposedTypes';
3
+ export declare function ExportedEmoji({ unified, size, emojiStyle, lazyLoad }: {
4
+ unified: string;
5
+ emojiStyle?: EmojiStyle;
6
+ size?: number;
7
+ lazyLoad?: boolean;
8
+ }): JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import { Categories } from "../config/categoryConfig";
1
+ import { Categories } from '../config/categoryConfig';
2
2
  import { EmojiStyle, SkinTones } from '../types/exposedTypes';
3
3
  import { DataEmoji, DataEmojis } from './DataTypes';
4
4
  export declare function emojiNames(emoji: DataEmoji): string[];
@@ -14989,7 +14989,12 @@ function emojiByUnified(unified) {
14989
14989
  return;
14990
14990
  }
14991
14991
 
14992
- return allEmojisByUnified[unified];
14992
+ if (allEmojisByUnified[unified]) {
14993
+ return allEmojisByUnified[unified];
14994
+ }
14995
+
14996
+ var withoutSkinTone = unifiedWithoutSkinTone(unified);
14997
+ return allEmojisByUnified[withoutSkinTone];
14993
14998
  }
14994
14999
  var allEmojis = /*#__PURE__*/Object.values(emojis).flat();
14995
15000
  var allEmojisByUnified = {};
@@ -17467,10 +17472,31 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
17467
17472
  return ErrorBoundary;
17468
17473
  }(React.Component);
17469
17474
 
17475
+ function ExportedEmoji(_ref) {
17476
+ var unified = _ref.unified,
17477
+ _ref$size = _ref.size,
17478
+ size = _ref$size === void 0 ? 32 : _ref$size,
17479
+ _ref$emojiStyle = _ref.emojiStyle,
17480
+ emojiStyle = _ref$emojiStyle === void 0 ? exports.EmojiStyle.APPLE : _ref$emojiStyle,
17481
+ _ref$lazyLoad = _ref.lazyLoad,
17482
+ lazyLoad = _ref$lazyLoad === void 0 ? false : _ref$lazyLoad;
17483
+
17484
+ if (!unified) {
17485
+ return null;
17486
+ }
17487
+
17488
+ return React.createElement(ViewOnlyEmoji, {
17489
+ unified: unified,
17490
+ size: size,
17491
+ emojiStyle: emojiStyle,
17492
+ lazyLoad: lazyLoad
17493
+ });
17494
+ }
17495
+
17470
17496
  function EmojiPicker$1(props) {
17471
17497
  return React.createElement(ErrorBoundary, null, React.createElement(EmojiPicker, Object.assign({}, props)));
17472
17498
  }
17473
17499
 
17474
- exports.Emoji = ViewOnlyEmoji;
17500
+ exports.Emoji = ExportedEmoji;
17475
17501
  exports.default = EmojiPicker$1;
17476
17502
  //# sourceMappingURL=emoji-picker-react.cjs.development.js.map