# chatty-thinking

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

## Key rules

- `chatty-thinking` khai báo 1 attribute, 0 property không có attribute, 0 event, 0 slot, 2 part và 1 CSS custom property.
- Import 1 module `@avada/chatty-ui/elements/thinking.js` là define `chatty-thinking`; 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

Waiting line in the reply slot until the answer takes over: a pulsing dot, or a label with an ink sweep. A new label cross-fades over the previous one. Class `ChattyThinking`.

### Attributes

| Name | Property | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `label` | `label` | `string` | `''` | Translated waiting text; empty shows the dot. |

### Properties

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

Not declared in the manifest.

### Events

Not declared in the manifest.

### Slots

Not declared in the manifest.

### Parts

| Name | Description |
| --- | --- |
| `base` | Live status region. |
| `label` | Current label. |

### CSS custom properties

| Name | Default | Description |
| --- | --- | --- |
| `--chatty-thinking-ink` | – | Dot and label colour. |

## Usage

```js
import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/thinking.js';
```

```html
<chatty-thinking style="width: 240px"></chatty-thinking>
<chatty-thinking label="Searching products…" style="width: 240px"></chatty-thinking>
```

## 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.

```html
<chatty-thinking style="width: 240px"></chatty-thinking>
<chatty-thinking label="Searching products…" style="width: 240px"></chatty-thinking>
```

## 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ố.

```html
<chatty-thinking style="width: 240px"></chatty-thinking>
<chatty-thinking label="Searching products…" style="width: 240px"></chatty-thinking>
```

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

## Keyboard

No element-specific keys.

### Source

- chatty-ui/custom-elements.json
