# chatty-block-email-verify

API chuẩn của element chatty-block-email-verify, sinh từ custom-elements.json của prototype trong guide.

## Key rules

- `chatty-block-email-verify` khai báo 1 attribute, 1 property không có attribute, 1 event, 0 slot, 2 part và 0 CSS custom property.
- Import 1 module `@avada/chatty-ui/elements/chatty-block-email-verify.js` là define `chatty-block-email-verify`; chunk chỉ import element nó dùng. Prototype chuẩn:  trong guide.
- Đổi tên attribute, event, slot, part hay CSS custom property là đổi API: diff của custom-elements.json phải có trong 1 MR.

## Overview

Opt-in order email verification with one scoped error shared by description and announcement. Class `ChattyBlockEmailVerify`.

### Attributes

| Name | Property | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `block` | `block` | `object` | `{}` | Canonical data with number, loading, mismatch and translated mismatchText. |

### Properties

Attributes also expose the properties listed in the Property column above.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `email` | `string` | `''` | Current email draft, retained after mismatch. |

### Events

| Name | Detail type | Description |
| --- | --- | --- |
| `chatty-verify` | `CustomEvent<{email: string, number: string}>` | Valid email to verify. |

### Slots

Not declared in the manifest.

### Parts

| Name | Description |
| --- | --- |
| `control` | Email input. |
| `error` | Single mismatch announcement below the field. |

### CSS custom properties

Not declared in the manifest.

## Usage

```js
import '@avada/chatty-ui/tokens/tokens.css';
import {html} from 'lit';
import '@avada/chatty-ui/elements/chatty-block-email-verify.js';
export function Standard() {
  return html`<chatty-block-email-verify style="display:block;width:100%;max-width:360px" .block=${{data:{number:'1001'}}}></chatty-block-email-verify>`;
}
```

## Live preview

Component thật dùng cùng story với trang component; dữ liệu mẫu nằm trong frame cục bộ.

Example (Standard) — Default: trạng thái mặc định và nội dung mẫu của element.

```js
import '@avada/chatty-ui/tokens/tokens.css';
import {html} from 'lit';
import '@avada/chatty-ui/elements/chatty-block-email-verify.js';
export function Standard() {
  return html`<chatty-block-email-verify style="display:block;width:100%;max-width:360px" .block=${{data:{number:'1001'}}}></chatty-block-email-verify>`;
}
```

Example (Standard) — Các variant hoặc state chính đặt cạnh nhau trong cùng ví dụ.

```js
import '@avada/chatty-ui/tokens/tokens.css';
import {html} from 'lit';
import '@avada/chatty-ui/elements/chatty-block-email-verify.js';
export function States() {
  return html`<div style="display:flex;flex-wrap:wrap;gap:20px;width:100%">
    <chatty-block-email-verify style="flex:1;min-width:220px" .email=${'you@example.com'} .block=${{data:{number:'1001',loading:true}}}></chatty-block-email-verify>
    <chatty-block-email-verify style="flex:1;min-width:220px" .email=${'you@example.com'} .block=${{data:{number:'1001',mismatch:true}}}></chatty-block-email-verify>
  </div>`;
}
```

## Anatomy

Số trong hình khớp bảng bên dưới. Phần chỉ hiện ở state khác được ghi Not shown; ví dụ không thêm phần tử giả.

Example (Standard) — Anatomy: một instance mặc định riêng, có khoảng trống quanh các phần được đánh số.

```js
import '@avada/chatty-ui/tokens/tokens.css';
import {html} from 'lit';
import '@avada/chatty-ui/elements/chatty-block-email-verify.js';
export function Standard() {
  return html`<chatty-block-email-verify style="display:block;width:100%;max-width:360px" .block=${{data:{number:'1001'}}}></chatty-block-email-verify>`;
}
```

| Part | Element | Source |
| --- | --- | --- |
| 1 | CSS part `control` | chatty-ui/custom-elements.json |
| 2 | CSS part `error` | chatty-ui/custom-elements.json |

## Keyboard

No element-specific keys.

### Source

- chatty-ui/custom-elements.json
