emoji-picker-react 4.18.0 → 4.19.1

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
@@ -105,6 +105,7 @@ The following is a complete list of all props accepted by `EmojiPicker`.
105
105
  | `previewConfig` | `PreviewConfig` | `{ showPreview: true }` | Configuration for the bottom preview bar. |
106
106
  | `getEmojiUrl` | `(unified: string, style: EmojiStyle) => string` | - | Function to override the default CDN URL for emoji images. |
107
107
  | `categoryIcons` | `CategoryIcons` | `{}` | Map `Categories` enum values to custom React nodes for navigation icons. |
108
+ | `nonce` | `string` | `undefined` | Content Security Policy (CSP) nonce for the inline style tag. |
108
109
 
109
110
  ### ❤️ Reactions Picker Mode
110
111
 
@@ -141,6 +142,14 @@ When passing `customEmojis`, use this format:
141
142
 
142
143
  ```
143
144
 
145
+ ### Content Security Policy (CSP)
146
+
147
+ If your site has a CSP that blocks inline styles, you can pass a `nonce` to the `EmojiPicker` component. This nonce will be applied to the inline `<style>` tag.
148
+
149
+ ```jsx
150
+ <EmojiPicker nonce="your-nonce-value" />
151
+ ```
152
+
144
153
  ### Preview Config
145
154
 
146
155
  Control the footer preview area using `previewConfig`:
@@ -9,7 +9,9 @@ export declare const stylesheet: {
9
9
  isApplied: () => boolean;
10
10
  };
11
11
  export declare const commonStyles: Record<never, Set<string>>;
12
- export declare const PickerStyleTag: React.NamedExoticComponent<object>;
12
+ export declare const PickerStyleTag: React.NamedExoticComponent<{
13
+ nonce?: string | undefined;
14
+ }>;
13
15
  export declare const commonInteractionStyles: Record<never, Set<string>>;
14
16
  export declare function darkMode(key: string, value: Styles): {
15
17
  '.epr-dark-theme': {
@@ -41,6 +41,7 @@ export declare type PickerConfigInternal = {
41
41
  hiddenEmojis: string[];
42
42
  emojiData?: EmojiData;
43
43
  categoryIcons: CategoryIcons;
44
+ nonce?: string;
44
45
  };
45
46
  export declare type PreviewConfig = {
46
47
  defaultEmoji: string;
@@ -109,8 +109,10 @@ var commonStyles = /*#__PURE__*/stylesheet.create({
109
109
  '.': ClassNames.hidden
110
110
  }, hidden)
111
111
  });
112
- var PickerStyleTag = /*#__PURE__*/React.memo(function PickerStyleTag() {
112
+ var PickerStyleTag = /*#__PURE__*/React.memo(function PickerStyleTag(_ref) {
113
+ var nonce = _ref.nonce;
113
114
  return React.createElement("style", {
115
+ nonce: nonce,
114
116
  suppressHydrationWarning: true,
115
117
  dangerouslySetInnerHTML: {
116
118
  __html: stylesheet.getStyle()
@@ -468,7 +470,8 @@ function basePickerConfig() {
468
470
  allowExpandReactions: true,
469
471
  hiddenEmojis: [],
470
472
  emojiData: undefined,
471
- categoryIcons: {}
473
+ categoryIcons: {},
474
+ nonce: undefined
472
475
  };
473
476
  }
474
477
  var basePreviewConfig = {
@@ -25976,7 +25979,9 @@ function Header() {
25976
25979
  }
25977
25980
 
25978
25981
  function EmojiPicker(props) {
25979
- return React.createElement(ElementRefContextProvider, null, React.createElement(PickerStyleTag, null), React.createElement(PickerConfigProvider, Object.assign({}, props), React.createElement(PickerDataProvider, null, React.createElement(ContentControl, null))));
25982
+ return React.createElement(ElementRefContextProvider, null, React.createElement(PickerStyleTag, {
25983
+ nonce: props.nonce
25984
+ }), React.createElement(PickerConfigProvider, Object.assign({}, props), React.createElement(PickerDataProvider, null, React.createElement(ContentControl, null))));
25980
25985
  }
25981
25986
  function ContentControl() {
25982
25987
  var _useReactionsModeStat = useReactionsModeState(),