## class: `WyConversationNew`, `wy-conversation-new`

Button and dialog for creating new conversations.

**Used sub components**

*   [`<wy-button>`](./ui/wy-button)
*   [`<wy-icon>`](./ui/wy-icon)
*   [`<wy-overlay>`](./ui/wy-overlay)
*   [`<wy-titlebar>`](./ui/wy-titlebar)
*   [`<wy-users-search>`](./wy-users-search)

### Fields

| Name      | Type                                                 | Default   | Description                                                 | Inherited From |
| --------- | ---------------------------------------------------- | --------- | ----------------------------------------------------------- | -------------- |
| `overlay` | `"modal" \| "sheet" \| "drawer" \| "full" \| "none"` | `"modal"` | Overlay appearance used for the create conversation dialog. |                |

### Methods

| Name             | Description                                                   | Parameters                        | Return                       | Inherited From    |
| ---------------- | ------------------------------------------------------------- | --------------------------------- | ---------------------------- | ----------------- |
| `whenMembers`    | Resolves when members are selected from the modal.            |                                   |                              |                   |
| `selectMembers`  | Open the new conversation dialog and return selected members. |                                   |                              |                   |
| `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    |
| -------- | ----------------------------- | ---------------------------------------------- | ----------------- |
| `create` | `CreateConversationEventType` | Emitted when a conversation should be created. |                   |
| `ready`  | `CustomEvent`                 | When the component has rendered.               | WeavySubComponent |

### Attributes

| Name      | Field   | Inherited From |
| --------- | ------- | -------------- |
| `overlay` | overlay |                |

### CSS Parts

| Name                         | Description                                     |
| ---------------------------- | ----------------------------------------------- |
| `wy-conversation-new-button` | The button for creating a new conversation.     |
| `wy-conversation-new-dialog` | The dialog overlay for creating a conversation. |

### Slots

| Name | Description                             |
| ---- | --------------------------------------- |
|      | Anything to replace the default button. |

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

### Fields

| Name                | Privacy | Type                                                  | Default                                                              | Description | Inherited From    |
| ------------------- | ------- | ----------------------------------------------------- | -------------------------------------------------------------------- | ----------- | ----------------- |
| `#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 |
| -------- | ------- | ------------------------------------------------------------------------------- | ------------------------- | ------ | -------------- |
| `submit` | private | Create a conversation by dispatching a \`create\` event and closing the dialog. | `members: MemberIdType[]` |        |                |

</details>

<hr/>

## Exports

| Kind                        | Name                  | Declaration       | Module                                 | Package |
| --------------------------- | --------------------- | ----------------- | -------------------------------------- | ------- |
| `js`                        | `WyConversationNew`   | WyConversationNew | lib/components/wy-conversation-new\.ts |         |
| `custom-element-definition` | `wy-conversation-new` | WyConversationNew | lib/components/wy-conversation-new\.ts |         |
