## class: `WyConversationList`, `wy-conversation-list`

Displays a list of conversation items, with search and create conversation button.

**Used sub components**

*   [`<wy-buttons>`](./ui/wy-button)
*   [`<wy-progress-circular>`](./ui/wy-progress-circular)
*   [`<wy-search>`](./ui/wy-search)
*   [`<wy-conversation-item>`](./wy-conversation-item)
*   [`<wy-empty>`](./wy-empty)

### Fields

| Name                   | Type                         | Default                                           | Description                                      | Inherited From |
| ---------------------- | ---------------------------- | ------------------------------------------------- | ------------------------------------------------ | -------------- |
| `conversationId`       | `number \| undefined`        |                                                   | The id of the currently selected conversation    |                |
| `aroundConversationId` | `number \| undefined`        |                                                   | The id of a conversation to load items around    |                |
| `conversationTypes`    | `AppTypeGuid[] \| undefined` | `[AppTypeGuid.ChatRoom, AppTypeGuid.PrivateChat]` | The conversation type guids to show in the list. |                |

### Methods

| Name                 | Description                                          | Parameters                        | Return                       | Inherited From    |
| -------------------- | ---------------------------------------------------- | --------------------------------- | ---------------------------- | ----------------- |
| `selectConversation` | Selects a conversation and triggers an action event. | `conversation: AppType \| null`   |                              |                   |
| `whenReady`          | Resolves when the component has rendered first time. |                                   | `Promise<WeavySubComponent>` | WeavySubComponent |
| `dispatchAction`     | Dispatch a \`wy-action\` event on the component.     | `detail: WyActionEventDetailType` | `boolean`                    | WeavySubComponent |

### Events

| Name        | Type                | Description                                                                          | Inherited From    |
| ----------- | ------------------- | ------------------------------------------------------------------------------------ | ----------------- |
| `wy-action` | `WyActionEventType` | Emitted when a conversation is selected (detail: { action: "select", app: { ... } }) |                   |
| `ready`     | `CustomEvent`       | When the component has rendered.                                                     | WeavySubComponent |

### Attributes

| Name                   | Field                | Inherited From |
| ---------------------- | -------------------- | -------------- |
| `conversationId`       | conversationId       |                |
| `aroundConversationId` | aroundConversationId |                |
| `conversationTypes`    | conversationTypes    |                |

### CSS Parts

| Name                       | Description                                       |
| -------------------------- | ------------------------------------------------- |
| `wy-conversations`         | Outer wrapper for the conversation list.          |
| `wy-conversation-list`     | Inner wrapper for the conversation list.          |
| `wy-conversations-toolbar` | Search/new/actions toolbar in the top of the list |
| `wy-pane`                  | Body for empty state.                             |
| `wy-pane-body`             | Body for list empty state.                        |
| `wy-pane-group`            | Body section for the list empty state.            |
| `wy-pager`                 | Pager element for infinite scroll.                |
| `wy-pager-bottom`          | Bottom styling for the pager element.             |

### Slots

| Name         | Description                                           |
| ------------ | ----------------------------------------------------- |
| `navigation` | Any navigation actions placed in front of the search. |
| `actions`    | Any actions placed next to the search.                |

<details><summary>Private API</summary>

### Fields

| Name                   | Privacy | Type                                                  | Default                                                              | Description                                             | Inherited From    |
| ---------------------- | ------- | ----------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------- | ----------------- |
| `searchText`           | private | `string \| undefined`                                 | `""`                                                                 | Input text to search for.                               |                   |
| `handleRefresh`        | private |                                                       |                                                                      | Refresh the conversation query                          |                   |
| `handlePresenceChange` | private |                                                       |                                                                      | Updates member data when realtime presence is received. |                   |
| `#resolveContextId`    | private | `(contextId: ContextIdType) => void \| undefined`     |                                                                      |                                                         | WeavySubComponent |
| `#whenContextId`       | private |                                                       | `new Promise<ContextIdType>((r) => { this.#resolveContextId = r; })` |                                                         | WeavySubComponent |
| `#resolveUser`         | private | `(user: UserType) => void \| undefined`               |                                                                      |                                                         | WeavySubComponent |
| `#whenUser`            | private |                                                       | `new Promise<UserType>((r) => { this.#resolveUser = r; })`           |                                                         | WeavySubComponent |
| `#resolveWeavy`        | private | `(weavy: WeavyType) => void \| undefined`             |                                                                      |                                                         | WeavySubComponent |
| `#whenWeavy`           | private |                                                       | `new Promise<WeavyType>((r) => { this.#resolveWeavy = r; })`         |                                                         | WeavySubComponent |
| `#resolveReady`        | private | `(component: WeavySubComponent) => void \| undefined` |                                                                      |                                                         | WeavySubComponent |
| `#whenReady`           | private |                                                       | `new Promise<WeavySubComponent>((r) => { this.#resolveReady = r; })` |                                                         | WeavySubComponent |

### Methods

| Name                       | Privacy | Description                                                                                                                                                                                                                          | Parameters                                       | Return | Inherited From |
| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------ | ------ | -------------- |
| `handleMark`               | private | Marks a conversation as read.                                                                                                                                                                                                        | `app: AppType, messageId: number \| null, appId` |        |                |
| `handleStar`               | private | Sets a conversation as starred.                                                                                                                                                                                                      | `appId: number, star: boolean`                   |        |                |
| `handleBlock`              | private | Blocks or unblocks the other member of a private chat.&#xA;&#xA;Built per user rather than held as a single tracked mutation, since the endpoint is keyed on the user being&#xA;blocked and each row in the list is a different one. | `userId: number, block: boolean`                 |        |                |
| `handlePin`                | private | Sets a conversation as pinned.                                                                                                                                                                                                       | `appId: number, pin: boolean`                    |        |                |
| `handleLeaveConversation`  | private | Leave a conversation (for the current user).                                                                                                                                                                                         | `appId: number`                                  |        |                |
| `handleRemoveConversation` | private | Remove a conversation.                                                                                                                                                                                                               | `appId: number`                                  |        |                |
| `handleTrashConversation`  | private | Trash a conversation.                                                                                                                                                                                                                | `appId: number`                                  |        |                |
| `renderConversations`      | private |                                                                                                                                                                                                                                      | `infiniteData: InfiniteData<AppsResultType>`     |        |                |

</details>

<hr/>

## Exports

| Kind                        | Name                   | Declaration        | Module                                 | Package |
| --------------------------- | ---------------------- | ------------------ | -------------------------------------- | ------- |
| `js`                        | `WyConversationList`   | WyConversationList | lib/components/wy-conversation-list.ts |         |
| `custom-element-definition` | `wy-conversation-list` | WyConversationList | lib/components/wy-conversation-list.ts |         |
