Skip to content

Commit

Permalink
feat: remove legacy style components (#2394)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: stylesheet import path changed & v1 stylesheet has been dropped, see release guide for more information
BREAKING CHANGE: theme v1 related markup and classNames have been removed
BREAKING CHANGE: `themeVersion` property has been removed from `ChatContext`
  • Loading branch information
MartinCupela committed May 27, 2024
1 parent d64adcc commit bffcf77
Show file tree
Hide file tree
Showing 427 changed files with 23,891 additions and 5,517 deletions.
5 changes: 3 additions & 2 deletions docusaurus/docs/React/basics/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ Use cases include team and social messaging, virtual events, livestream gaming,
- Text input commands (ex: Giphy and @mentions)
- Image and file uploads
- Video playback
- Audio recording
- Read state and typing indicators
- Channel and message lists

## Where to get started

If you are new to our SDK it is best to go through a of our [tutorial](https://getstream.io/chat/react-chat/tutorial/).
If you are new to our SDK it is best to go through our [tutorial](https://getstream.io/chat/react-chat/tutorial/).

After that, our [getting started page](./getting-started.mdx) is a great next step.

Expand All @@ -32,4 +33,4 @@ If you are integrating our SDK, please pay attention to our [Theming](../theming
A common pattern in the library is the use of context provider hooks. These custom hooks allow for effective value sharing between parent components and their children.
This makes customization straightforward, as you can use our exported hooks in your custom components to receive the exact values needed, while also subscribing to context changes.

The left navigation will guide you to the various documentation sections for information on everything regarding our robust component library. Check out the instructions below for adding the library to your React project.
The left navigation will guide you to the various documentation sections for information on everything regarding our robust component library. Check out the instructions for adding the library to your React project.
61 changes: 30 additions & 31 deletions docusaurus/docs/React/components/contexts/channel-state-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { channel, watchers } = useChannelStateContext();

### acceptedFiles

A list of accepted file upload types.
The value is forwarded to the context from the `Channel` component [prop `acceptedFiles`](../../components/core-components/channel.mdx#acceptedfiles).

| Type |
| -------- |
Expand Down Expand Up @@ -48,9 +48,24 @@ The configurations object for the currently active channel.
| ------ |
| object |

### channelUnreadUiState

The read state maintained for use by components representing channel unread state (for example `UnreadMessagesSeparator`, `UnreadMessagesNotification`).

| Property | Type | Description |
| --------------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **last_read** | `Date` | Date when the channel was marked read the last time. |
| **unread_messages** | `number` | The count of unread messages in a given channel. Unread count refers only to foreign (not own) unread messages. |
| **first_unread_message_id** | `string` or `undefined` | The ID of the message that was marked unread (`notification.mark_unread` event). The value is available only when a message is marked unread. Therefore, cannot be relied on to place unread messages UI. |
| **last_read_message_id** | `string` or `undefined` | The ID of the message preceding the first unread message. |

| Type |
| ---------------------- |
| `ChannelUnreadUiState` |

### dragAndDropWindow

If true, chat users will be able to drag and drop file uploads to the entire channel window.
The value is forwarded to the context from the `Channel` component [prop `dragAndDropWindow`](../../components/core-components/channel.mdx#draganddropwindow).

| Type | Default |
| ------- | ------- |
Expand All @@ -66,8 +81,7 @@ Number of milliseconds to debounce firing the URL enrichment queries when typing

### enrichURLForPreview

A global flag to toggle the URL enrichment and link previews in `MessageInput`. By default, the feature is disabled. It can be overridden on Thread and MessageList level through `additionalMessageInputProps`
or directly on `MessageInput` level through `urlEnrichmentConfig` prop.
The value is forwarded to the context from the `Channel` component [prop `enrichURLForPreview`](../../components/core-components/channel.mdx#enrichurlforpreview).

| Type | Default |
| ------- | ------- |
Expand All @@ -91,18 +105,18 @@ Custom function to identify URLs in a string for later generation of link previe

### giphyVersion

The giphy version to use when displaying giphies.
The value is forwarded to the context from the `Channel` component [prop `giphyVersion`](../../components/core-components/channel.mdx#giphyversion).

| Type |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `'original'` \| `'fixed_height'` \| `'fixed_height_still'` \| `'fixed_height_downsampled'` \| `'fixed_width'` \| `'fixed_width_still'` \| `'fixed_width_downsampled'` |
| Type | Default |
| ------ | -------------- |
| string | 'fixed_height' |

### imageAttachmentSizeHandler

A custom function to provide size configuration for image attachments
The value is forwarded to the context from the `Channel` component [prop `imageAttachmentSizeHandler`](../../components/core-components/channel.mdx#imageattachmentsizehandler).

| Type |
| ---------------------------------------------------------------- |
| Type |
| ----------------------------------------------------------------- |
| `(a: Attachment, e: HTMLElement) => ImageAttachmentConfiguration` |

### hasMore
Expand Down Expand Up @@ -145,7 +159,7 @@ Boolean for the `channel` loading more messages.
| ------- |
| boolean |

### loadingMoreNewer?
### loadingMoreNewer

Flag signalling whether newer messages are being loaded as the user scrolls down in the message list. Used internally by `VirtualizedMessageList`.

Expand All @@ -155,7 +169,7 @@ Flag signalling whether newer messages are being loaded as the user scrolls down

### maxNumberOfFiles

The maximum number of attachments allowed per `message`, defaults to the Stream Chat API maximum.
The value is forwarded to the context from the `Channel` component [prop `maxNumberOfFiles`](../../components/core-components/channel.mdx#maxnumberoffiles).

| Type | Default |
| ------ | ------- |
Expand All @@ -179,7 +193,7 @@ Array of [message objects](https://getstream.io/chat/docs/javascript/message_for

### multipleUploads

Whether to allow multiple attachment uploads on a message.
The value is forwarded to the context from the `Channel` component [prop `multipleUploads`](../../components/core-components/channel.mdx#multipleuploads).

| Type | Default |
| ------- | ------- |
Expand Down Expand Up @@ -209,21 +223,6 @@ Custom function to react to link preview dismissal. See the guide [Link Previews
| ------------------------------------ |
| `(linkPreview: LinkPreview) => void` |

### channelUnreadUiState

The read state maintained for use by components representing channel unread state (for example `UnreadMessagesSeparator`, `UnreadMessagesNotification`).

| Property | Type | Description |
|-----------------------------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **last_read** | `Date` | Date when the channel was marked read the last time. |
| **unread_messages** | `number` | The count of unread messages in a given channel. Unread count refers only to foreign (not own) unread messages. |
| **first_unread_message_id** | `string` or `undefined` | The ID of the message that was marked unread (`notification.mark_unread` event). The value is available only when a message is marked unread. Therefore, cannot be relied on to place unread messages UI. |
| **last_read_message_id** | `string` or `undefined` | The ID of the message preceding the first unread message. |

| Type |
|-----------------------|
| `ChannelUnreadUiState` |

### pinnedMessages

The messages that are pinned in the `channel`.
Expand Down Expand Up @@ -258,7 +257,7 @@ Flag signalling whether the scroll to the bottom is prevented. Used internally b

### shouldGenerateVideoThumbnail

You can turn on/off thumbnail generation for video attachments
The value is forwarded to the context from the `Channel` component [prop `shouldGenerateVideoThumbnail`](../../components/core-components/channel.mdx#shouldgeneratevideothumbnail).

| Type |
| --------- |
Expand Down Expand Up @@ -306,7 +305,7 @@ Flag signalling whether the scroll to the bottom is prevented in thread. Used in

### videoAttachmentSizeHandler

A custom function to provide size configuration for video attachments
The value is forwarded to the context from the `Channel` component [prop `videoAttachmentSizeHandler`](../../components/core-components/channel.mdx#videoattachmentsizehandler).

| Type |
| ----------------------------------------------------------------- |
Expand Down
27 changes: 8 additions & 19 deletions docusaurus/docs/React/components/contexts/chat-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { client, setActiveChannel } = useChatContext();

### client

The `StreamChat` client instance. Any methods from the `stream-chat-js` API interface can be run off this object.
The value is forwarded to the context from the `Chat` component [prop `client`](../../components/core-components/chat.mdx#client).

| Type |
| ------ |
Expand Down Expand Up @@ -49,7 +49,7 @@ The `queryInProgress` values are:
- `null` - at least one channels page has been loaded and there is no query in progress at the moment

| Type |
|----------------------|
| -------------------- |
| `ChannelsQueryState` |

### closeMobileNav
Expand All @@ -62,8 +62,7 @@ The function to close mobile navigation.

### customClasses

Object containing custom CSS classnames to override the library's default container CSS. See [CSS and Theming](../../guides/theming/css-and-theming.mdx)
for implementation assistance.
The value is forwarded to the context from the `Chat` component [prop `customClasses`](../../components/core-components/chat.mdx#customclasses)

| Type |
| ------ |
Expand Down Expand Up @@ -120,25 +119,15 @@ You can override the default behavior by pulling it from context and then utiliz

### theme

Deprecated and to be removed in a future major release. Use the `customStyles` prop to adjust CSS variables and [customize the theme](../../guides/theming/css-and-theming.mdx#css-variables) of your app.
The value is forwarded to the context from the `Chat` component [prop `theme`](../../components/core-components/chat.mdx#theme)

| Type |
| ----- |
| Theme |

### themeVersion

Stream chat theme version 2 has been introduced with the release of stream-chat-react v10.0.0. This flag is used internally by some UI components of the SDK and the integrators shouldn't need to use it. The value is extracted from a CSS variable `--str-chat__theme-version`. You can set it to values `'1'` or `'2'` in your stylesheets and import the corresponding v2 stylesheet from `stream-chat-react/dist`. Find out more about benefits that the theme version 2 brings to the integrators with [the theming guide](../../theming/introduction.mdx).

| Type | Default |
| -------------- | ------- |
| `'1'` \| `'2'` | `'1'` |
| Type |
| ------ |
| string |

### useImageFlagEmojisOnWindow

Windows 10 does not support country flag emojis out of the box. It chooses to render these emojis as characters instead.
Stream Chat can override this behavior by loading a custom web font that will render images instead (PNGs or SVGs depending
on the platform). Set this prop to true if you want to use these custom emojis for Windows users.
The value is forwarded to the context from the `Chat` component [prop `useImageFlagEmojisOnWindow`](../../components/core-components/chat.mdx#useimageflagemojisonwindow).

| Type | Default |
| ------- | ------- |
Expand Down
16 changes: 4 additions & 12 deletions docusaurus/docs/React/components/contexts/component-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ Custom UI component to display a attachment previews in `MessageInput`.
| --------- | ---------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='AttachmentPreviewList' path='/MessageInput/AttachmentPreviewList.tsx'/> |

### AutocompleteSuggestionHeader

Custom UI component to override the default suggestion header component.

| Type | Default |
| --------- | ------------------------------------------------------------------------ |
| component | <GHComponentLink text='Header' path='/AutoCompleteTextarea/Header.tsx'/> |

### AutocompleteSuggestionItem

Custom UI component to override the default suggestion Item component.
Expand Down Expand Up @@ -346,11 +338,11 @@ Custom UI component to display the header of a `Thread`.

### ThreadInput

Custom UI component to replace the `MessageInput` of a `Thread`. For the applications using [theme version 1](../../guides/theming/css-and-theming.mdx), the default is `MessageInputSmall`. Applications using [theme version 2](../../theming/introduction.mdx) will use `MessageInputFlat` by default.
Custom UI component to replace the `MessageInput` of a `Thread`. The component uses `MessageInputFlat` by default.

| Type | Default |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='MessageInputSmall (theme v1)' path='/MessageInput/MessageInputSmall.tsx'/> / <GHComponentLink text='MessageInputFlat (theme v2)' path='/MessageInput/MessageInputFlat.tsx'/> |
| Type | Default |
| --------- | ------------------------------------------------------------------------------------ |
| component | <GHComponentLink text='MessageInputFlat' path='/MessageInput/MessageInputFlat.tsx'/> |

### ThreadStart

Expand Down
34 changes: 13 additions & 21 deletions docusaurus/docs/React/components/core-components/channel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Channel
import GHComponentLink from '../../_docusaurus-components/GHComponentLink';

The `Channel` component is a React Context provider that wraps all the logic, functionality, and UI for an individual chat channel.
It provides five separate contexts to its children:
It provides four separate contexts to its children:

- [`ChannelStateContext`](../contexts/channel-state-context.mdx) - stateful data (ex: `messages` or `members`)
- [`ChannelActionContext`](../contexts/channel-action-context.mdx) - action handlers (ex: `sendMessage` or `openThread`)
Expand Down Expand Up @@ -142,14 +142,6 @@ Custom UI component to display an attachment previews in `MessageInput`.
| --------- | ---------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='AttachmentPreviewList' path='/MessageInput/AttachmentPreviewList.tsx'/> |

### AutocompleteSuggestionHeader

Custom UI component to override the default suggestion header component.

| Type | Default |
| --------- | ------------------------------------------------------------------------ |
| component | <GHComponentLink text='Header' path='/AutoCompleteTextarea/Header.tsx'/> |

### AutocompleteSuggestionItem

Custom UI component to override the default suggestion Item component.
Expand Down Expand Up @@ -439,14 +431,6 @@ export const MessageInput = (props: MessageInputProps) => {
| ------- | ------- |
| boolean | true |

### markReadOnMount

Configuration parameter to mark the active channel as read when mounted (opened). By default, the channel is marked read on mount.

| Type | Default |
| ------- | ------- |
| boolean | true |

### Input

Custom UI component handling how the message input is rendered.
Expand Down Expand Up @@ -479,6 +463,14 @@ Custom UI component to render while the `MessageList` is loading new messages.
| --------- | ------------------------------------------------------------------------------- |
| component | <GHComponentLink text='LoadingIndicator' path='/Loading/LoadingIndicator.tsx'/> |

### markReadOnMount

Configuration parameter to mark the active channel as read when mounted (opened). By default, the channel is marked read on mount.

| Type | Default |
| ------- | ------- |
| boolean | true |

### maxNumberOfFiles

The maximum number of attachments allowed per message, defaults to the Stream Chat API maximum.
Expand Down Expand Up @@ -691,11 +683,11 @@ Custom UI component to display the header of a `Thread`.

### ThreadInput

Custom UI component to replace the `MessageInput` of a `Thread`. For the applications using [theme version 1](../../guides/theming/css-and-theming.mdx), the default is `MessageInputSmall`. Applications using [theme version 2](../../theming/introduction.mdx) will use `MessageInputFlat` by default.
Custom UI component to replace the `MessageInput` of a `Thread`. The component uses `MessageInputFlat` by default.

| Type | Default |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| component | <GHComponentLink text='MessageInputSmall (theme v1)' path='/MessageInput/MessageInputSmall.tsx'/> / <GHComponentLink text='MessageInputFlat (theme v2)' path='/MessageInput/MessageInputFlat.tsx'/> |
| Type | Default |
| --------- | ------------------------------------------------------------------------------------ |
| component | <GHComponentLink text='MessageInputFlat' path='/MessageInput/MessageInputFlat.tsx'/> |

### ThreadStart

Expand Down
Loading

0 comments on commit bffcf77

Please sign in to comment.