## class: `WyPoll`, `wy-poll`

Poll container rendering a list of poll options.

**Used sub components:**

*   [`<wy-poll-option>`](./wy-poll)

### Fields

| Name          | Type               | Default | Description                         | Inherited From |
| ------------- | ------------------ | ------- | ----------------------------------- | -------------- |
| `pollOptions` | `PollOptionType[]` | `[]`    | Poll options displayed in the list. |                |

### Events

| Name   | Type                | Description                          | Inherited From |
| ------ | ------------------- | ------------------------------------ | -------------- |
| `vote` | `PollVoteEventType` | Emitted when a poll option is voted. |                |

### CSS Parts

| Name      | Description          |
| --------- | -------------------- |
| `wy-poll` | Root poll container. |

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

### Methods

| Name           | Privacy | Description                                         | Parameters         | Return    | Inherited From |
| -------------- | ------- | --------------------------------------------------- | ------------------ | --------- | -------------- |
| `dispatchVote` | private | Dispatch a \`vote\` event for the specified option. | `optionId: number` | `boolean` |                |

</details>

<hr/>

## class: `WyPollOption`, `wy-poll-option`

Poll option item showing vote meter, label and optional voter list sheet.

**Used sub components:**

*   [`<wy-icon>`](./ui/wy-icon)
*   [`<wy-overlay>`](./ui/wy-overlay)
*   [`<wy-container>`](./ui/wy-container)
*   [`<wy-item>`](./ui/wy-item)
*   [`<wy-avatar>`](./ui/wy-avatar)

### Fields

| Name         | Type                          | Default | Description                               | Inherited From |
| ------------ | ----------------------------- | ------- | ----------------------------------------- | -------------- |
| `totalVotes` | `number`                      | `0`     | Total number of votes across all options. |                |
| `option`     | `PollOptionType \| undefined` |         | Poll option rendered by this card.        |                |

### Methods

| Name        | Description                                          | Parameters | Return                       | Inherited From    |
| ----------- | ---------------------------------------------------- | ---------- | ---------------------------- | ----------------- |
| `whenReady` | Resolves when the component has rendered first time. |            | `Promise<WeavySubComponent>` | WeavySubComponent |

### Events

| Name    | Type                | Description                        | Inherited From    |
| ------- | ------------------- | ---------------------------------- | ----------------- |
| `vote`  | `PollVoteEventType` | Emitted when this option is voted. |                   |
| `ready` | `CustomEvent`       | When the component has rendered.   | WeavySubComponent |

### CSS Parts

| Name             | Description                                                |
| ---------------- | ---------------------------------------------------------- |
| `wy-poll-option` | Root poll option container.                                |
| `wy-poll-meter`  | Visual meter showing vote ratio.                           |
| `wy-poll-image`  | Icon/indicator area.                                       |
| `wy-poll-title`  | Option label.                                              |
| `wy-poll-amount` | Percentage/amount element (clickable to open voter sheet). |

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

### Fields

| Name                | Privacy   | Type                                                  | Default                                                              | Description | Inherited From    |
| ------------------- | --------- | ----------------------------------------------------- | -------------------------------------------------------------------- | ----------- | ----------------- |
| `exportParts`       | protected |                                                       | `new ShadowPartsController(this)`                                    |             |                   |
| `#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 |

</details>

<hr/>

## Exports

| Kind                        | Name             | Declaration  | Module                    | Package |
| --------------------------- | ---------------- | ------------ | ------------------------- | ------- |
| `js`                        | `WyPoll`         | WyPoll       | lib/components/wy-poll.ts |         |
| `custom-element-definition` | `wy-poll`        | WyPoll       | lib/components/wy-poll.ts |         |
| `js`                        | `WyPollOption`   | WyPollOption | lib/components/wy-poll.ts |         |
| `custom-element-definition` | `wy-poll-option` | WyPollOption | lib/components/wy-poll.ts |         |
