Skip to content

Commit 6e92116

Browse files
fix: reduce emoji-mart peer requirements, add "typesVersions"
1 parent d0601e6 commit 6e92116

File tree

6 files changed

+37
-23
lines changed

6 files changed

+37
-23
lines changed

docusaurus/docs/React/basics/getting-started.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ The [`MessageInput`](../components/message-input-components/message-input.mdx) c
176176

177177
The [`Thread`](../components/core-components/thread.mdx) component renders a list of replies tied to a single parent message in a channel's main message list. A `Thread` maintains its own state and renders its own `MessageList` and `MessageInput` components.
178178

179+
### Emojis (picker & autocomplete)
180+
181+
The SDK is equipped with features designed to facilitate seamless integration, enabling developers to effortlessly incorporate emoji picker and emoji autocomplete (built on top of [`emoji-mart`](https://github.com/missive/emoji-mart)) functionalities for a comprehensive chat experience.
182+
183+
Starting from version `11.0.0`, these features are entirely optional, requiring integrators to opt-in manually. The decision was made in conjunction with enhanced architecture, aiming to reduce the overall size of the final bundles of our integrators.
184+
185+
Make sure to read ["EmojiPicker 11.0.0"](../release-guides/emoji-picker-v11.mdx) and ["emojiSearchIndex 11.0.0"](../release-guides/emoji-search-index-v11.mdx) release guides for more information.
186+
179187
## Summary
180188

181189
In addition to the above referenced UI components, client instantiation, and user connection, you need little other code to get a fully functioning chat application up and running. See below for an example of the complete code.

docusaurus/docs/React/guides/channel-list-infinite-scroll.mdx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,19 @@ import { ChannelList, InfiniteScroll } from 'stream-chat-react';
2828
If you would like to adjust the configuration parameters like `threshold`, `reverse` (`PaginatorProps`) or `useCapture`, etc. (`InfiniteScrollProps`), you can create a wrapper component where these props can be set:
2929

3030
```tsx
31-
import {
32-
ChannelList,
33-
InfiniteScroll,
34-
InfiniteScrollProps
35-
} from 'stream-chat-react';
36-
31+
import { ChannelList, InfiniteScroll, InfiniteScrollProps } from 'stream-chat-react';
3732

3833
const Paginator = (props: InfiniteScrollProps) => <InfiniteScroll {...props} threshold={50} />;
3934

40-
...
41-
<ChannelList filters={filters} sort={sort} options={options}
42-
Paginator={Paginator}
43-
showChannelSearch
44-
/>
35+
// ...
36+
37+
<ChannelList
38+
filters={filters}
39+
sort={sort}
40+
options={options}
41+
Paginator={Paginator}
42+
showChannelSearch
43+
/>;
4544
```
4645

4746
Especially the `threshold` prop may need to be set as the default is 250px. That may be too soon to load more channels.

docusaurus/docs/React/release-guides/emoji-picker-v11.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ We made `emoji-mart` package in our SDK completely optional which means that `Em
2121

2222
### Reinstate the `EmojiPicker` component
2323

24-
To reinstate the previous behavior you'll have to add `emoji-mart` to your packages and make sure the package versions fit our peer-dependency requirements:
24+
To reinstate the previous behavior you'll have to add `emoji-mart` to your packages and make sure the packages come with versions that fit our peer-dependency requirements:
2525

2626
```bash
27-
yarn add emoji-mart@^5.5.2 @emoji-mart/data@^1.1.2 @emoji-mart/react@^1.1.1
27+
yarn add emoji-mart @emoji-mart/data @emoji-mart/react
2828
```
2929

3030
Import `EmojiPicker` component from the `stream-chat-react` package:
@@ -42,7 +42,7 @@ const WrappedChannel = ({ children }) => {
4242

4343
### Build your custom `EmojiPicker` (with example)
4444

45-
If `emoji-mart` is too heavy for your use-case and you'd like to build your own you can certainly do so, here's a simple `EmojiPicker` built using `emoji-picker-react` package:
45+
If `emoji-mart` is too heavy for your use-case and you'd like to build your own you can certainly do so, here's a very simple `EmojiPicker` example built using `emoji-picker-react` package:
4646

4747
```tsx
4848
import EmojiPicker from 'emoji-picker-react';
@@ -72,7 +72,7 @@ export const CustomEmojiPicker = () => {
7272
// and pass it down to the `Channel` component
7373
```
7474

75-
You can make the component slightly better using [`FloatingUI`](https://floating-ui.com/) by wrapping the actual picker element to make it float perfectly positioned above the button. See the source of the component <GHComponentLink text="EmojiPicker" branch="feat/emoji-picker-delete" as="code" path="/Emojis/EmojiPicker.tsx" /> which comes with the SDK for inspiration.
75+
You can make the component slightly better using [`FloatingUI`](https://floating-ui.com/) by wrapping the actual picker element to make it float perfectly positioned above the button. See the source of the <GHComponentLink text="EmojiPicker" branch="feat/emoji-picker-delete" as="code" path="/Emojis/EmojiPicker.tsx" /> component which comes with the SDK for inspiration.
7676

7777
## Old `emoji-mart` (v3.0.1)
7878

docusaurus/docs/React/release-guides/emoji-search-index-v11.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ By default, our SDK comes bundled with the `emoji-mart`'s [`emojiIndex`](https:/
1414
Add `emoji-mart` to your packages and make sure the package versions fit our peer-dependency requirements:
1515

1616
```bash
17-
yarn add emoji-mart@^5.5.2 @emoji-mart/data@^1.1.2
17+
yarn add emoji-mart @emoji-mart/data
1818
```
1919

2020
Import `SearchIndex` and `data` from `emoji-mart`, initiate these data and then and pass `SearchIndex` to our `MessageInput` component:

docusaurus/docs/React/release-guides/reactions-v11.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ When it came to developer experience regarding customization of the reaction com
1414
### Main reasons for a revamp
1515

1616
- inability to reuse default (Stream supplied reactions) with your custom ones
17-
- strong reliance on [`EmojiMart`](https://github.com/missive/emoji-mart) and inability to use completely custom reactions out of the box
17+
- strong reliance on [`emoji-mart`](https://github.com/missive/emoji-mart) and inability to use completely custom reactions out of the box
1818
- certain `additionalEmojiProps` did not work with Stream-supplied reactions
1919

2020
```tsx
@@ -38,7 +38,7 @@ export const customReactions = [
3838

3939
## New default setup and how it works
4040

41-
SDK by default comes with five pre-defined reaction types (`haha`, `like`, `love`, `sad` and `wow`) which are newly rendered by <GHComponentLink text='StreamEmoji' branch="feat/reactions" path='/Reactions/StreamEmoji.tsx'/> component which utilises sprite sheet system and renders images for each reaction to make sure it works flawlessly on every system. Default reaction options are defined in <GHComponentLink text='defaultReactionOptions' branch="feat/reactions" path='/Reactions/reactionOptions.tsx'/> and these options are reused for both [`ReactionSelector`](../components/message-components/reactions.mdx) and [`ReactionsList`](../components/message-components/reactions.mdx) (as well as [`SimpleReactionsList`](../components/message-components/reactions.mdx)). These options come by default from the ComponentContext but local component property will be prioritised if defined. This is how it works under the hood:
41+
SDK by default comes with five pre-defined reaction types (`haha`, `like`, `love`, `sad` and `wow`) which are newly rendered by <GHComponentLink text='StreamEmoji' branch="feat/reactions" path='/Reactions/StreamEmoji.tsx'/> component which utilises sprite sheet system and renders images for each reaction to make sure it works flawlessly on every system. Default reaction options are defined in <GHComponentLink text='defaultReactionOptions' branch="feat/reactions" path='/Reactions/reactionOptions.tsx'/> and these options are reused for both [`ReactionSelector`](../components/message-components/reactions.mdx#reactionselector-props) and [`ReactionsList`](../components/message-components/reactions.mdx#reactionslist-props) (as well as [`SimpleReactionsList`](../components/message-components/reactions.mdx#simplereactionslist-props)). These options come by default from the ComponentContext but local component property will be prioritised if defined. This is how it works under the hood:
4242

4343
```ts
4444
contextReactionOptions = defaultReactionOptions;
@@ -75,7 +75,7 @@ const customReactionOptions = [
7575
];
7676
```
7777

78-
And then you can pass these newly created options to [`Channel`](../components/core-components/channel) component which will be then propagated to `ReactionSelector` and `ReactionsList`:
78+
And then you can pass these newly created options to [`Channel`](../components/core-components/channel.mdx) component which will be then propagated to `ReactionSelector` and `ReactionsList`:
7979

8080
```tsx
8181
<Channel reactionOptions={customReactionOptions}>{/*...*/}</Channel>
@@ -234,7 +234,7 @@ const newReactionOptions = [
234234
];
235235
```
236236

237-
All of the extra options previously applied to `EmojiMart` emojis can now be directly applied to your custom components either manually or through your custom context. For more information see [EmojiMart integration](#emojimart-integration).
237+
All of the extra options previously applied to `EmojiMart` emojis can now be directly applied to your custom components either manually or through your custom context. For more information see [EmojiMart integration](#emoji-mart-integration).
238238

239239
### Re-enabling `angry` reaction
240240

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838
"default": "./dist/scss/*"
3939
}
4040
},
41+
"typesVersions": {
42+
"*": {
43+
"emojis": [
44+
"./dist/components/Emojis/index.d.ts"
45+
]
46+
}
47+
},
4148
"sideEffects": [
4249
"*.css"
4350
],
@@ -87,9 +94,9 @@
8794
"mml-react": "^0.4.7"
8895
},
8996
"peerDependencies": {
90-
"@emoji-mart/data": "^1.1.2",
91-
"@emoji-mart/react": "^1.1.1",
92-
"emoji-mart": "^5.5.2",
97+
"@emoji-mart/data": "^1.1.0",
98+
"@emoji-mart/react": "^1.1.0",
99+
"emoji-mart": "^5.4.0",
93100
"react": "^18.0.0 || ^17.0.0 || ^16.8.0",
94101
"react-dom": "^18.0.0 || ^17.0.0 || ^16.8.0",
95102
"stream-chat": "^8.0.0"

0 commit comments

Comments
 (0)